protected void btnOK_ServerClick(object sender, System.EventArgs e) { string oldProcess = this.dOldProcess.Value.Trim(); string process = this.dProcess.Text.Trim(); string descr = this.dDescr.Text.Trim(); string type = this.dOldType.Value.Trim(); ProcessMaintainInfo processObj = new ProcessMaintainInfo(); processObj.Description = descr; processObj.Process =process; processObj.Type =type; processObj.Editor =this.HiddenUserName.Value; processObj.Cdt =DateTime.Now; processObj.Udt = DateTime.Now; try { iProcessManager.ProcessSaveAs(processObj, oldProcess); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } process = replaceSpecialChart(process); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DealHideWait();AddUpdateComplete('" + process + "');", true); }
public ProcessInfoDef() { ProcessInfo = new ProcessMaintainInfo(); ProcessStationList = new List<ProcessStationMaintainInfo>(); }
//ok protected void btnAddProcess_Click(Object sender, EventArgs e) { string strProcess = txtProcess.Text; string strOldProcess = hidProcess.Value.Trim(); try { ProcessMaintainInfo tmpProcessInfo = new ProcessMaintainInfo(); tmpProcessInfo.Type = this.cmbMaintainProcessType.InnerDropDownList.SelectedValue.Trim(); tmpProcessInfo.Process = strProcess; tmpProcessInfo.Description = txtDescription.Text; tmpProcessInfo.Editor = this.HiddenUserName.Value; if (strProcess == strOldProcess) { iProcessManager.saveProcess(strOldProcess, tmpProcessInfo); } else { iProcessManager.addProcess(tmpProcessInfo); } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } ShowProcessList(); this.updatePanel1.Update(); strProcess = replaceSpecialChart(strProcess); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "AddProcessComplete", "DealHideWait();AddProcessComplete(\"" + strProcess + "\");", true); }
public void saveProcess(string strOldProcessName, ProcessMaintainInfo processInfo) { try { Process processObj = processRepository.Find(strOldProcessName); if (processObj == null) { FisException ex; List<string> paraError = new List<string>(); ex = new FisException("DMT141", paraError); throw ex; } if (processObj.Type != processInfo.Type) { FisException ex; List<string> paraError = new List<string>(); ex = new FisException("DMT145", paraError); throw ex; } processObj = convertToObjFromMaintainInfo(processObj, processInfo); IUnitOfWork work = new UnitOfWork(); processRepository.SaveProcessDefered(work, strOldProcessName, processObj); work.Commit(); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
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 ProcessMaintainInfo getProcess(string process) { ProcessMaintainInfo tmpProcess = new ProcessMaintainInfo(); try { Process processObj = processRepository.Find(process); if (processObj == null) { return new ProcessMaintainInfo(); } tmpProcess = convertToMaintainInfoFromObj(processObj); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } return tmpProcess; }
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; }
public IList<ProcessMaintainInfo> getProcessList(string process) { IList<ProcessMaintainInfo> processList = new List<ProcessMaintainInfo>(); try { IList<Process> tmpProcessList = processRepository.getProcessList(process); foreach (Process temp in tmpProcessList) { ProcessMaintainInfo tmpProcess = new ProcessMaintainInfo(); tmpProcess = convertToMaintainInfoFromObj(temp); processList.Add(tmpProcess); } } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } return processList; }
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; }
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; }
/// <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; }
protected void btnOK_ServerClick(Object sender, EventArgs e) { string fullFileName = ""; try { string fileName = dFileUpload.FileName; string filePath = HttpContext.Current.Server.MapPath("~"); string path = filePath + "\\tmp"; MakeDirIfNotExist(path); DataTable dt = new DataTable(); if (dFileUpload.FileName.Trim() == "") { pmtMessage4 = this.GetLocalResourceObject(Pre + "_pmtMessage4").ToString(); showErrorMessage(pmtMessage4); return; } if (dFileUpload.HasFile) { try { string extName = fileName.Substring(fileName.LastIndexOf(".")); //if (extName != ".xls" && extName != ".xlsx" && extName != ".xlsm") //if (extName != ".xls") //{ // pmtMessage2 = this.GetLocalResourceObject(Pre + "_pmtMessage2").ToString(); // showErrorMessage(pmtMessage2); // return; //} Guid guid = System.Guid.NewGuid(); fullFileName = path + "\\" + guid.ToString() + extName; dFileUpload.PostedFile.SaveAs(fullFileName); dt = ExcelManager.getExcelSheetData(fullFileName); } catch (Exception ex) { pmtMessage2 = this.GetLocalResourceObject(Pre + "_pmtMessage2").ToString(); showErrorMessage(ex.Message); return; } int startRow = EXCEL_DATA_START_ROW; int endRow = dt.Rows.Count + startRow; if (endRow < startRow) { pmtMessage3 = this.GetLocalResourceObject(Pre + "_pmtMessage3").ToString(); showErrorMessage(pmtMessage3); return; } ProcessMaintainInfo processInfo = new ProcessMaintainInfo(); List<ProcessStationMaintainInfo> processStationInfo = new List<ProcessStationMaintainInfo>(); //下面中B1,B2,B3固定存上传的process信息,Editor,Cdt,Udt有可能没有,有了也不要从这取 string tmpValueNPOI; tmpValueNPOI = dt.Rows[1][1].ToString(); string processName = tmpValueNPOI; if (processName == "" || processName.Length > 10) { pmtMessage5 = this.GetLocalResourceObject(Pre + "_pmtMessage5").ToString() + " " + 1.ToString(); showErrorMessage(pmtMessage5); return; } string pcbType = Resources.ComboxFixValues.ResourceManager.GetString(Pre + "_CmbMaintainProcessTypeValue1"); string productType = Resources.ComboxFixValues.ResourceManager.GetString(Pre + "_CmbMaintainProcessTypeValue2"); //!!!目前只有2种类型的可以上传 tmpValueNPOI = dt.Rows[2][1].ToString(); string processType = tmpValueNPOI; if (processType == "" || (processType != pcbType && processType != productType)) { pmtMessage5 = this.GetLocalResourceObject(Pre + "_pmtMessage5").ToString() + " " + 2.ToString(); showErrorMessage(pmtMessage5); return; } tmpValueNPOI = dt.Rows[3][1].ToString(); string processDescr = tmpValueNPOI; if (processDescr == "" || processDescr.Length > 80) { pmtMessage5 = this.GetLocalResourceObject(Pre + "_pmtMessage5").ToString() + " " + 3.ToString(); showErrorMessage(pmtMessage5); return; } processInfo.Process = processName; processInfo.Type = processType; processInfo.Description = processDescr; processInfo.Editor = this.HiddenUserName.Value; int iRowsCountNPOI = dt.Rows.Count; int iColsCountNPOI = dt.Columns.Count; //从A1到A7搜寻Station List,这单元必有,找到后这行的下面一行就是数据标题,再下面一行是数据 int listStartRow = 0; for (int iRow = 1; iRow <= 8; iRow++) { string ValueNPOI = dt.Rows[iRow][0].ToString(); if (ValueNPOI == EXCEL_LIST_TITLE_STRING) { listStartRow = iRow; break; } } if (listStartRow == 0) { string pmtMessage6 = this.GetLocalResourceObject(Pre + "_pmtMessage6").ToString(); showErrorMessage(pmtMessage6); return; } int stationStartRow = listStartRow + 2; for (int iRow = stationStartRow; iRow < iRowsCountNPOI; iRow++) { int lineNum = iRow + EXCEL_DATA_START_ROW - 1; ProcessStationMaintainInfo item = new ProcessStationMaintainInfo(); string Value1NPOI = dt.Rows[iRow][2].ToString(); string Value2NPOI = dt.Rows[iRow][0].ToString(); string Value3NPOI = dt.Rows[iRow][1].ToString().ToUpper(); if (Value1NPOI == "" && Value2NPOI == "" && Value3NPOI == "") { continue; } //按数据库的长度 if (Value1NPOI == "" || (Value3NPOI != "FAIL" && Value3NPOI != "PASS" && Value3NPOI != "PROCESSING") || Value1NPOI.Length > 10 || Value2NPOI.Length > 10)//FAIL(0)、PASS(1)和PROCESSING { pmtMessage5 = this.GetLocalResourceObject(Pre + "_pmtMessage5").ToString() + " " + lineNum.ToString(); showErrorMessage(pmtMessage5); return; } item.Process = processName; item.Station = Value1NPOI; item.PreStation = Value2NPOI; if (Value3NPOI == "FAIL") { item.Status = 0; } else if (Value3NPOI == "PASS") { item.Status = 1; } else { item.Status = 2; } item.Editor = this.HiddenUserName.Value; item.Cdt = DateTime.Now; item.Udt = DateTime.Now; processStationInfo.Add(item); } string uploadProcess = iProcessManager.UploadProcess(processInfo, processStationInfo); this.hidIsSubmitOK.Value = "OK"; this.hidProcess.Value = uploadProcess; } else { pmtMessage2 = this.GetLocalResourceObject(Pre + "_pmtMessage2").ToString(); showErrorMessage(pmtMessage2); return; } } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } finally { TryDeleteTempFile(fullFileName); } ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "OKComplete", "OKComplete();HideWait();", true); }
/// <summary> /// 选项包括所有Process,按字符序排列 /// </summary> /// <returns></returns> public IList<ProcessMaintainInfo> GetProcessList() { IList<Process> rempList = processRepository.FindAll(); List<ProcessMaintainInfo> processMaintainInfoList = new List<ProcessMaintainInfo>(); foreach(Process process in rempList) { ProcessMaintainInfo processMaintainInfo = new ProcessMaintainInfo(); processMaintainInfo.Process = process.process; processMaintainInfo.Editor = process.Editor; processMaintainInfo.Cdt = process.Cdt; processMaintainInfo.Udt = process.Udt; processMaintainInfoList.Add(processMaintainInfo); } return processMaintainInfoList; }