/// <summary> /// 按指定顺序编号获取对应的工艺子流程数据 /// </summary> /// <param name="strProcessId"></param> /// <param name="iOrderIndex"></param> /// <returns></returns> public TeExProcess GetTeExProcess(string strProcessId, int iOrderIndex) { try { DataModels.HnfactoryautodbDB dataContext = new DataModels.HnfactoryautodbDB(); //获取数据 DataModels.PExprocess data = dataContext.PExprocesses.SingleOrDefault(c => c.ProcessId == strProcessId & c.ProcessOrderId == iOrderIndex); if (data != null) { TeExProcess item = new TeExProcess(data); //提取对应的子集合 string strExProcessId = item.ExProcessId; ExProcessStepCollection steps = GetExProcessSteps(strExProcessId); foreach (ExProcessStep step in steps) { ExProcessStepParsCollection pars = GetExProcessStepPars(step.StepId); step.StepPars = pars; } item.Steps = steps; return(item); } else { return(null); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取工业子流程所有信息 /// </summary> /// <param name="strExProcessId">工业子流程编号</param> /// <returns></returns> public TeExProcess GetTeExProcess(string strExProcessId) { try { TeExProcess item = new TeExProcess(); string strSQL = "select *from p_exprocess where ExProcessId=?ExProcessId"; List <MySqlParameter> sqlParameters = new List <MySqlParameter> { new MySqlParameter("?ExProcessId", strExProcessId) }; DataSet dataSet = MySqlHelper.GetDataSet(CommandType.Text, strSQL, sqlParameters.ToArray()); if (dataSet.Tables.Count > 0) { DataTable table = dataSet.Tables[0]; if (table.Rows.Count > 0) { Dictionary <string, Type> dEnum = new Dictionary <string, Type>(); dEnum.Add("ParType", typeof(SysHelper.Enums.DeviceParameterType)); TeExProcessCollection infos = new TeExProcessCollection(); CreateDataList <TeExProcess>(infos, strSQL, sqlParameters, item, dEnum); //item = EntityHelper.GetEntityListByDT<TeExProcess>(table.Rows[0], null); item = infos[0]; #region 提前相关的步骤集合 ExProcessStepCollection steps = GetExProcessSteps(strExProcessId); foreach (ExProcessStep step in steps) { ExProcessStepParsCollection pars = GetExProcessStepPars(step.StepId); step.StepPars = pars; } item.Steps = steps; #endregion } } return(item); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取子流程的步骤顺序集合 /// </summary> /// <param name="strExProcessId"></param> /// <returns></returns> public ExProcessStepCollection GetExProcessSteps(string strExProcessId) { try { ExProcessStepCollection items = new ExProcessStepCollection(); using (DataModels.HnfactoryautodbDB dataContext = new DataModels.HnfactoryautodbDB()) { var datas = (from c in dataContext.VExprocesssteps where c.ExProcessId == strExProcessId orderby c.OrderIndex select c ).ToList(); foreach (DataModels.VExprocessstep data in datas) { ExProcessStep item = new ExProcessStep(data); items.Add(item); } } return(items); //ProcessStepCollection infos = new ProcessStepCollection(); //string strSQL = "select *from p_exprocessstep where ExProcessId=?ExProcessId order by orderindex"; //List<MySqlParameter> sqlParameters = new List<MySqlParameter> //{ // new MySqlParameter("?ExProcessId", strExProcessId) //}; //ProcessStep info = new ProcessStep(); //Dictionary<string, Type> dEnum = new Dictionary<string, Type>(); //dEnum.Add("ActionType", typeof(SysHelper.Enums.DeviceActionType)); //dEnum.Add("FinishParType", typeof(SysHelper.Enums.DeviceParameterType)); ////获取主数据 //CreateDataList<ProcessStep>(infos, strSQL, sqlParameters, info, dEnum); //return infos; } catch (Exception ex) { throw ex; } }
public TeExProcess() { Steps = new ExProcessStepCollection(); ParType = SysHelper.Enums.DeviceParameterType.None; }