public void addProcess(ProcessMaintainInfo processInfo) { FisException ex; List<string> paraError = new List<string>(); try { //检查是否已存在相同的Process if (processRepository.CheckExistedProcess(processInfo.Process) > 0) { ex = new FisException("DMT037", paraError); throw ex; } else { Process processObj = new Process(); processObj = convertToObjFromMaintainInfo(processObj, processInfo); IUnitOfWork work = new UnitOfWork(); processRepository.Add(processObj, work); work.Commit(); } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
public string ProcessSaveAs(ProcessMaintainInfo processInfo, string oldProcess) { string processName = processInfo.Process; string result = processName; try { Process processObjOld = processRepository.Find(oldProcess); if (processObjOld == null) { //Copy的process源已经不存在 FisException ex; List<string> paraError = new List<string>(); ex = new FisException("DMT141", paraError); throw ex; } processInfo.Cdt = DateTime.Now; processInfo.Udt = DateTime.Now; //检查是否已存在相同的Process if (processRepository.CheckExistedProcess(processInfo.Process) > 0) { FisException ex; List<string> paraError = new List<string>(); ex = new FisException("DMT037", paraError); throw ex; } Process processObj = new Process(); processObj = convertToObjFromMaintainInfo(processObj, processInfo); List<ProcessStation> tmpProcessStationList = (List<ProcessStation>)processRepository.GetProcessStationList(oldProcess); List<ProcessStation> processStationList = new List<ProcessStation>(); for (int i = 0; i < tmpProcessStationList.Count; i++) { //!!!拷贝station时状态也拷贝,是吧? ProcessStation item = new ProcessStation(); item.Cdt = DateTime.Now; item.Udt = DateTime.Now; item.Editor = processInfo.Editor; item.PreStation = tmpProcessStationList[i].PreStation; item.ProcessID = processName; item.StationID = tmpProcessStationList[i].StationID; item.Status = tmpProcessStationList[i].Status; processStationList.Add(item); } IUnitOfWork work = new UnitOfWork(); processRepository.Add(processObj, work); processRepository.AddProcessStationsDefered(work, processStationList); work.Commit(); } catch (Exception) { throw; } return result; }
private Process convertToObjFromMaintainInfo(Process obj, ProcessMaintainInfo temp) { obj.Type = temp.Type; obj.process = temp.Process; obj.Descr = temp.Description; obj.Udt = temp.Udt; obj.Cdt = temp.Cdt; obj.Editor = temp.Editor; return obj; }
private ProcessMaintainInfo convertToMaintainInfoFromObj(Process temp) { ProcessMaintainInfo process = new ProcessMaintainInfo(); process.Type = temp.Type; process.Process = temp.process; process.Description = temp.Descr; process.Editor = temp.Editor; process.Cdt = temp.Cdt; process.Udt = temp.Udt; return process; }
/// <summary> /// 上传一个excel中的内容, 以添加的形式添加process和processStation /// </summary> /// <returns></returns> public string UploadProcess(ProcessMaintainInfo processInfo, List<ProcessStationMaintainInfo> processStationList) { string processName = processInfo.Process; FisException ex; List<string> paraError = new List<string>(); try { //检查是否已存在相同的Process if (processRepository.CheckExistedProcess(processInfo.Process) > 0) { ex = new FisException("DMT037", paraError); throw ex; } Process processObj = new Process(); processObj = convertToObjFromMaintainInfo(processObj, processInfo); List<ProcessStation> stationList = new List<ProcessStation>(); for (int i = 0; i < processStationList.Count; i++) { ProcessStation item = new ProcessStation(); item.PreStation = processStationList[i].PreStation; item.Status = processStationList[i].Status; item.StationID = processStationList[i].Station; item.Editor = processStationList[i].Editor; item.Cdt = processStationList[i].Cdt; item.Udt = processStationList[i].Udt; item.ProcessID = processName; stationList.Add(item); } IUnitOfWork work = new UnitOfWork(); processRepository.Add(processObj, work); processRepository.AddProcessStationsDefered(work, stationList); work.Commit(); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } return processName; }