using Mesnac.Action.ChemicalWeighing.Product.PptPlan.entity; using Mesnac.Codd.Session; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Mesnac.Action.ChemicalWeighing.Product.PptPlan { public class GhPlanHelper { #region 获取当班正在执行及未执行的计划列表 /// /// 获取当班正在执行及未执行的计划列表 /// /// 计划日期 /// 班次 /// 限定返回结果的行数 /// 返回符合条件的计划列表 public static List GetPlanEntityListByNum(int limit) { List lst = new List(); DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); if (dbHelper == null) { throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError); } //DateTime planDate = PlanHelper.PlanLog.LastDate; //int shiftID = PlanHelper.PlanLog.LastShiftID; //string msg = String.Empty; //string strPlanDate = String.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now); //bool result = ProductHelper.PlanDateVerify(out planDate, out shiftID, strPlanDate, shiftID, out msg); dbHelper.CommandType = CommandType.Text; string strSql = "SELECT top {0} * FROM Base_PlanInfo WHERE plan_State = 0 ORDER BY plan_order asc"; strSql = String.Format(strSql, limit); dbHelper.CommandText = strSql; DataTable table = dbHelper.ToDataTable(); if (table != null && table.Rows.Count > 0) { Base_PlanInfo entity = new Base_PlanInfo(); foreach (DataRow dr in table.Rows) { //entity = ConvertDataRowToPptPlan(dr); entity.uid = Mesnac.Basic.DataProcessor.RowValue(dr, "uid", String.Empty); entity.plan_Id = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_Id", String.Empty); entity.recipe_Id = Mesnac.Basic.DataProcessor.RowValue(dr, "recipe_Id", String.Empty); entity.recipe_Name = Mesnac.Basic.DataProcessor.RowValue(dr, "recipe_Name", String.Empty); entity.plan_Team = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_Team", String.Empty); entity.plan_Amount = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_Amount", 0); entity.real_Amount = Mesnac.Basic.DataProcessor.RowValue(dr, "real_Amount", 0); entity.run_Type = Mesnac.Basic.DataProcessor.RowValue(dr, "run_Type", 0); entity.plan_State = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_State", 0); entity.plan_beginTime = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_beginTime", String.Empty); entity.plan_endTime = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_endTime", String.Empty); entity.create_By = Mesnac.Basic.DataProcessor.RowValue(dr, "create_By", String.Empty); entity.create_Time = Mesnac.Basic.DataProcessor.RowValue(dr, "create_Time", new DateTime()); entity.update_By = Mesnac.Basic.DataProcessor.RowValue(dr, "update_By", String.Empty); entity.update_Time = Mesnac.Basic.DataProcessor.RowValue(dr, "update_Time", new DateTime()); entity.plan_order = Mesnac.Basic.DataProcessor.RowValue(dr, "plan_order", 0); entity.grid_Amount = Mesnac.Basic.DataProcessor.RowValue(dr, "grid_Amount", 0); entity.line_Amount = Mesnac.Basic.DataProcessor.RowValue(dr, "line_Amount", 0); entity.car_Amount = Mesnac.Basic.DataProcessor.RowValue(dr, "car_Amount", 0); lst.Add(entity); } } return lst; } #endregion } }