public override void SPM_SendError(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, SPMRoutingVariable RoutingVariable, EFFormFields FormFields, IInterfaceHandleResult HandleResult) { string strExceptionFrom = HandleResult.ExceptionFrom; string strErrorMessage = HandleResult.CustomMessage; base.SPM_SendError(SubmitMethod, SPMTaskVars, Variables, RoutingVariable, FormFields, HandleResult); }
public override void SPMStepActivity(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, EFFormFields FormFields, string NewStepName, ref IInterfaceHandleResult HandleResult) { base.SPMStepActivity(SubmitMethod, SPMTaskVars, Variables, FormFields, NewStepName, ref HandleResult); }
public override void SPMStepComplete(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, EFFormFields FormFields, string CompletedStepName, ref IInterfaceHandleResult HandleResult) { base.SPMStepComplete(SubmitMethod, SPMTaskVars, Variables, FormFields, CompletedStepName, ref HandleResult); }
private void SPMAfterSend_DBIO(SPMTaskVariables SPMTaskVars, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult, SPMRoutingVariable RoutingVariable) { try { string stepName = (string)SPMTaskVars.ReadDatum("STEPNAME"); int caseID = int.Parse((string)(SPMTaskVars.ReadDatum("CASEID"))); NPIMgmt oMgmt = new NPIMgmt(oUIControls.lblSite.Text, oUIControls.lblBu.Text); NPI_Standard oStandard = oMgmt.InitialLeaveMgmt(); Dictionary <string, object> result = new Dictionary <string, object>(); Model_PRELAUNCH_MAIN oModel = new Model_PRELAUNCH_MAIN(); string Handler = oPara.LoginId; switch (RoutingVariable.Key) { case SPMRoutingVariableKey.spm_Recall: //修改本单据数据状态为Abort oModel._CaseId = caseID; oModel._Status = "Abort"; result = oStandard.RecordOperation_PrelaunchMain(oModel, Status_Operation.UPDATE); if (!(bool)result["Result"]) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = (string)result["ErrMsg"]; } break; case SPMRoutingVariableKey.spm_Jump: //1.标示当前关卡已核准(如为最后一关,则变更状态为Finished) string ApproverRemark = string.Empty; string ApproverResult = string.Empty; for (int i = 0; i < oUIControls.rgResult.Items.Count; i++) { if (oUIControls.rgResult.Items[i].Checked == true) { ApproverResult = oUIControls.rgResult.Items[i].BoxLabel.Trim(); } } result = oStandard.UpdateDOAHandlerStatus(caseID, stepName, Handler, ApproverResult, oUIControls.txtReslutOpinion.Text.Trim()); if (!(bool)result["Result"]) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = (string)result["ErrMsg"]; } break; } } catch (Exception e) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = e.Message; } }
//Abort public override void SPMRecallProcess(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult) { base.SPMRecallProcess(SubmitMethod, SPMTaskVars, Variables, FormFields, ref HandleResult); }
// Code for 'before send' public override void SPMBeforeSend(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, SPMRoutingVariable RoutingVariable, ref EFFormFields FormFields, ref IInterfaceHandleResult HandleResult) { if (RoutingVariable != null) { switch (RoutingVariable.Key) { case SPMRoutingVariableKey.spm_Return: string value = RoutingVariable.Data; break; } } base.SPMBeforeSend(SubmitMethod, SPMTaskVars, Variables, RoutingVariable, ref FormFields, ref HandleResult); }
// Code for 'after send' public override void SPMAfterSend(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, SPMRoutingVariable RoutingVariable, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult) { string caseid = System.Web.HttpUtility.UrlDecode(Variables[SPMVariableKey.CaseId]); if (RoutingVariable != null) { string sRoutingData = string.Empty; switch (RoutingVariable.Key) { case SPMRoutingVariableKey.spm_Return: sRoutingData = RoutingVariable.Data; break; case SPMRoutingVariableKey.spm_Jump: sRoutingData = RoutingVariable.Data; break; } } //// Business logic if (SubmitMethod != SPMSubmitMethod.CreateNewCase) { SPMAfterSend_DBIO(SPMTaskVars, FormFields, ref HandleResult, RoutingVariable); } else { ////////1.待签核关卡及签核人写DB NPIMgmt oNPIMgmt = new NPIMgmt(oUIControls.lblSite.Text, oUIControls.lblBu.Text); NPI_Standard oStandard = oNPIMgmt.InitialLeaveMgmt(); Dictionary <string, object> result = oStandard.RecordDOAHandler(caseid, oUIControls.txtFormNo.Text, oUIControls.lblBu.Text, oUIControls.cmbPlant.SelectedItem.Text, oUIControls.cmbPhase.SelectedItem.Text); if (!(bool)result["Result"]) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = (string)result["ErrMsg"]; } else { StringBuilder sbLayout = new StringBuilder(); if (oUIControls.cmbLayout.SelectedItems.Count > 0) { foreach (SelectedListItem li in oUIControls.cmbLayout.SelectedItems) { sbLayout.AppendFormat("{0},", li.Text); } } Model_NPI_APP_MAIN_HIS oModel_Main = new Model_NPI_APP_MAIN_HIS(); oModel_Main._DOC_NO = oUIControls.txtFormNo.Text.Trim(); oModel_Main._BU = oUIControls.lblBu.Text; oModel_Main._BUILDING = oUIControls.cmbPlant.SelectedItem.Text; oModel_Main._APPLY_DATE = oUIControls.txtDate.Text; oModel_Main._APPLY_USERID = oPara.LoginId.Trim(); oModel_Main._MODEL_NAME = oUIControls.txtModel.Text; oModel_Main._CUSTOMER = oUIControls.txtCustomer.Text; oModel_Main._PRODUCT_TYPE = oUIControls.cbProductType.SelectedItem.Text; oModel_Main._LAYOUT = sbLayout.ToString().TrimEnd(','); oModel_Main._PHASE = oUIControls.cmbPhase.SelectedItem.Text; oModel_Main._NEXTSTAGE_DATE = oUIControls.txtNextStage_BeginDate.SelectedDate.ToString("yyyy/MM/dd"); oModel_Main._NPI_PM = oUIControls.txtPM.Text; oModel_Main._SALES_OWNER = oUIControls.txtSales.Text; oModel_Main._RD_ENGINEER = oUIControls.txtRD.Text; oModel_Main._REMARK = oUIControls.txtNotes.Text; oModel_Main._CASEID = oPara.CaseId.ToString(); oModel_Main._UPDATE_USERID = oPara.LoginId; oModel_Main._STATUS = "Pending"; oModel_Main._PMLOC = oUIControls.cmbPM.SelectedItem.Text.Trim(); oModel_Main._PMEXT = oUIControls.txtPMExt.Text.Trim(); oModel_Main._RDLOC = oUIControls.cmbRD.SelectedItem.Text.Trim(); oModel_Main._RDEXT = oUIControls.txtRDExt.Text.Trim(); oModel_Main._SALESLOC = oUIControls.cmbSales.SelectedItem.Text.Trim(); oModel_Main._SALESEXT = oUIControls.txtSalesExt.Text.Trim(); result = oStandard.RecordOperation_NPIMain(oModel_Main, Status_Operation.ADD); //result = "true"; if (!(bool)result["Result"]) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = (string)result["ErrMsg"]; } } } base.SPMAfterSend(SubmitMethod, SPMTaskVars, Variables, RoutingVariable, FormFields, ref HandleResult); }
// Fill SPM's EFFormFieldData public override void PrepareEFFormFields(SPMSubmitMethod SubmitMethod, SPMProcessMethod ProcessMethod, SPMTaskVariables TaskVars, ref EFFormFields FormFields, ref IInterfaceHandleResult HandleResult, object oContainer, IUIShadow UIShadow, ref string ApplicantInfo) { NPIGating_HISUIShadow lUIControls = (NPIGating_HISUIShadow)UIShadow; FormFields.SetOrAdd("txtFormNo".ToUpper(), lUIControls.txtFormNo.Text); FormFields.SetOrAdd("txtSite".ToUpper(), lUIControls.lblSite.Text); FormFields.SetOrAdd("txtBu".ToUpper(), lUIControls.lblBu.Text); FormFields.SetOrAdd("txtBuilding".ToUpper(), lUIControls.cmbPlant.SelectedItem.Text); base.PrepareEFFormFields(SubmitMethod, ProcessMethod, TaskVars, ref FormFields, ref HandleResult, oContainer, UIShadow, ref ApplicantInfo); }
// Fill SPM Variable public override void PrepareSPMVariables(SPMSubmitMethod SubmitMethod, SPMProcessMethod ProcessMethod, SPMTaskVariables SPMTaskVars, ref SPMVariables Variables, ref SPMRoutingVariable RoutingVariable, ref string strSPMUid, string strMemo, string strNotesForNextApprover, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult, ref string SuccessMessage) { bool isError = false; string stepName = string.Empty; string errorMsg = string.Empty; string FormNo = FormFields["txtFormNo".ToUpper()]; string Applicant = oPara.LoginId; Variables.Add(SPMVariableKey.Subject, "[NPIReport_Application] [" + FormNo + "] By [" + Applicant + "]"); string Approver = string.Empty; NPIMgmt oMgmt = new NPIMgmt(oUIControls.lblSite.Text, oUIControls.lblBu.Text); //NPIMgmt oMgmt = new NPIMgmt("CZ1","HIS"); NPI_Standard oStandard = oMgmt.InitialLeaveMgmt(); if (SubmitMethod == SPMSubmitMethod.CreateNewCase) { DataTable dtDOAHandler = oModel_NPI_DOA_HandlerInfo._HANDLER; if (dtDOAHandler.Rows.Count > 0) { DataRow dr = dtDOAHandler.Rows[0]; string step_name = dr["STEP_NAME"].ToString(); string handler = dr["HANDLER"].ToString(); RoutingVariable = new SPMRoutingVariable(SPMRoutingVariableKey.spm_NextHandler, step_name + "(" + handler + ")"); } else { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "無法獲取下一關簽核人信息,請聯絡系統管理員!"; } } if (SubmitMethod == SPMSubmitMethod.HandleCase_Approve) { Dictionary <string, object> result = new Dictionary <string, object>(); stepName = (string)SPMTaskVars.ReadDatum("STEPNAME"); int caseID = int.Parse((string)(SPMTaskVars.ReadDatum("CASEID"))); ////获取待签核关卡及签核人资讯 result = oStandard.GetNextStepAndHandler_NPI(caseID, FormNo, stepName, oUIControls.cmbPlant.SelectedItem.Text, oUIControls.cmbPhase.SelectedItem.Text); if (!(bool)result["Result"])//无法找到签核关卡资讯,显示ERROR { HandleResult.IsSuccess = false; HandleResult.CustomMessage = (string)result["ErrMsg"]; } else { try { RoutingVariable = new SPMRoutingVariable(SPMRoutingVariableKey.spm_Jump, (string)result["SPMRoutingVariable"]); } catch (Exception ex) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "DOA Error:" + ex.Message; } if (RoutingVariable == null) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "Error: get RoutingVariable fail"; } } } base.PrepareSPMVariables(SubmitMethod, ProcessMethod, SPMTaskVars, ref Variables, ref RoutingVariable, ref strSPMUid, strMemo, strNotesForNextApprover, FormFields, ref HandleResult, ref SuccessMessage); }
private void SPMAfterSend_DBIO(SPMTaskVariables SPMTaskVars, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult, SPMRoutingVariable RoutingVariable, SPMVariables Variables) { try { string stepName = (string)SPMTaskVars.ReadDatum("STEPNAME"); int caseID = int.Parse((string)(SPMTaskVars.ReadDatum("CASEID"))); switch (RoutingVariable.Key) { //if Reject,Post Back To SAP case SPMRoutingVariableKey.spm_Return: try { PostBackToSAP(SPMTaskVars, FormFields, Variables, "R"); oStandard.UpdateFormStatus(caseID, "Reject"); } catch (Exception ex) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = ex.Message; } break; case SPMRoutingVariableKey.spm_Jump: string curDOA = FormFields["txtDOA".ToUpper()].Replace("<1;", "<").Replace(">1;", ">"); string curStep = SPMAppLine.GetCurrentStep(curDOA); //最後一關結束 將結果拋到DB中 並更新STATUS欄位為 Approve if (curStep == "*") { try { // IF APPROVE ,POST BACK TO SAP and Update Form Status Approve PostBackToSAP(SPMTaskVars, FormFields, Variables, "A"); oStandard.UpdateFormStatus(caseID, "Approve"); } catch (Exception ex) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = ex.Message; } } break; } } catch (Exception e) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = e.Message; } }
// Validate contols before submit public override bool EFFormFieldsValidation(SPMSubmitMethod SubmitMethod, SPMProcessMethod ProcessMethod, SPMTaskVariables SPMTaskVars, ref IInterfaceHandleResult HandleResult, object oContainer, IUIShadow UIShadow) { NPIGating_HISUIShadow lUIControls = (NPIGating_HISUIShadow)UIShadow; string ErrMsg = string.Empty; if (SubmitMethod == SPMSubmitMethod.CreateNewCase) { #region [ check list] //ErrMsg = BeginFormFieldsValidation(UIShadow); if (ErrMsg.Length > 0) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = ErrMsg; return(false); } ////依DOA获取待签关卡及签核人资讯 if (HandleResult.IsSuccess) { NPIMgmt oMgmt = new NPIMgmt(lUIControls.lblSite.Text, lUIControls.lblBu.Text); NPI_Standard oStandard = oMgmt.InitialLeaveMgmt(); Model_NPI_DOA_Parameter oModel_NPI_DOA_Parameter = new Model_NPI_DOA_Parameter(); //oModel_NPI_DOA_Parameter._BU = "HIS"; oModel_NPI_DOA_Parameter._BU = lUIControls.lblBu.Text; oModel_NPI_DOA_Parameter._BUILDING = lUIControls.cmbPlant.SelectedItem.Text; oModel_NPI_DOA_Parameter._CASE_ID = oPara.CaseId; oModel_NPI_DOA_Parameter._FORM_NO = lUIControls.txtFormNo.Text; oModel_NPI_DOA_Parameter._PHASE = lUIControls.cmbPhase.SelectedItem.Text; oModel_NPI_DOA_HandlerInfo = oStandard.GenerateStepAndHandler(oModel_NPI_DOA_Parameter); if (!oModel_NPI_DOA_HandlerInfo._RESULT) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = oModel_NPI_DOA_HandlerInfo._ERROR_MSG; } } #endregion } else { string stepName = (string)(SPMTaskVars.ReadDatum("STEPNAME")); if (SubmitMethod != SPMSubmitMethod.CreateNewCase) { HandleResult.IsSuccess = true; } if (stepName == "Begin" || stepName == "開始") { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "退簽單據不可重複送簽!"; } else { if (!(lUIControls.rdResultY.Checked || lUIControls.rdResultN.Checked || lUIControls.rdReulutCondition.Checked)) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "請勾选签核結果!"; } } } return(base.EFFormFieldsValidation(SubmitMethod, ProcessMethod, SPMTaskVars, ref HandleResult, oContainer, UIShadow)); }
// Code for 'after send' public override void SPMAfterSend(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, SPMRoutingVariable RoutingVariable, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult) { if (SubmitMethod != SPMSubmitMethod.CreateNewCase) { SPMAfterSend_DBIO(SPMTaskVars, FormFields, ref HandleResult, RoutingVariable, Variables); } else { GDS_Helper oStandard = new GDS_Helper(); string CASEID = System.Web.HttpUtility.UrlDecode(Variables[SPMVariableKey.CaseId]); //CASEID string Werks = oUIControls.txtWERKS.Text; string DocNo = oUIControls.txtDocNo.Text; //主單號 string RDocNo = oUIControls.txtRDocNo.Text; //Link 單號 string CostCenter = oUIControls.txtCostCenter.Text; //成本中心 string Department = oUIControls.txtDepartment.Text; //部門 string Application = oUIControls.txtApplication.Text; //申請人 string ZEILE = oUIControls.txtZEILE.Text; //ITEM string Material = oUIControls.txtMaterial.Text; //料號 string ReturnQuantity = oUIControls.txtReturnQuantity.Text; //退料數量 string Reason = oUIControls.txtReason.Text; //退料原因 string Remark = oUIControls.txtRemark.Text; //備註 string Return = oUIControls.txtReturn.Text; //條件FLAG Flag為Y才符合條件 string IADocNo = oUIControls.txtIADocNo.Text; //關聯IA單 string I6DocNo = oUIControls.txtI6DocNo.Text; //關聯I6單 string Amount = oUIControls.txtAmount.Text; //金額 string Settingxml = oUIControls.txtDOA.Text; //Setting try { //Insert Submit之後數據到DB中 oStandard.Insert_Begin(Werks, DocNo, RDocNo, CostCenter, Department, Application, ZEILE, Material, ReturnQuantity, Return, Reason, Remark, IADocNo, I6DocNo, "In Process", double.Parse(Amount), Settingxml, int.Parse(CASEID)); //將Submit後的狀態 W(In Process)回傳給SAP Begin關卡直接回傳 oStandard.PostBackToSAP(int.Parse(CASEID)); } catch (Exception ex) { //有異常 刪除已經Insert的資料 oStandard.DeleteFormNo(int.Parse(CASEID)); HandleResult.IsSuccess = false; HandleResult.CustomMessage = ex.Message; } } base.SPMAfterSend(SubmitMethod, SPMTaskVars, Variables, RoutingVariable, FormFields, ref HandleResult); }
// Code for 'before send' public override void SPMBeforeSend(SPMSubmitMethod SubmitMethod, SPMTaskVariables SPMTaskVars, SPMVariables Variables, SPMRoutingVariable RoutingVariable, ref EFFormFields FormFields, ref IInterfaceHandleResult HandleResult) { base.SPMBeforeSend(SubmitMethod, SPMTaskVars, Variables, RoutingVariable, ref FormFields, ref HandleResult); }
// Fill SPM Variable public override void PrepareSPMVariables(SPMSubmitMethod SubmitMethod, SPMProcessMethod ProcessMethod, SPMTaskVariables SPMTaskVars, ref SPMVariables Variables, ref SPMRoutingVariable RoutingVariable, ref string strSPMUid, string strMemo, string strNotesForNextApprover, EFFormFields FormFields, ref IInterfaceHandleResult HandleResult, ref string SuccessMessage) { if (SubmitMethod == SPMSubmitMethod.CreateNewCase) { GDS_Helper oStandard = new GDS_Helper(); StringBuilder ErrMsg = new StringBuilder(); //string stepName = (string)(SPMTaskVars.ReadDatum("STEPNAME")); string curDOA = oUIControls.txtDOA.Text; string plant = oUIControls.txtWERKS.Text; string apType = oUIControls.txtAPTYP.Text; DOA spmDOA = new DOA(); string sApplicant = oUIControls.txtApplication.Text.Trim(); //獲取 表頭及表身DATA string formDetail = oUIControls.txtDetail.Text.Trim().Replace("<1;", "<").Replace(">1;", ">"); string formHead = oUIControls.txtHead.Text.Trim().Replace("<1;", "<").Replace(">1;", ">"); DataTable dtHead = LiteOn.GDS.Utility.Tools.BuildHeadTable(); System.IO.StringReader reader = new System.IO.StringReader(formHead); dtHead.ReadXml(reader); System.IO.StringReader reader2 = new System.IO.StringReader(formDetail); DataTable dtDetail = LiteOn.GDS.Utility.Tools.BuildDetailTable(); dtDetail.ReadXml(reader2); try { //抓取第一關簽核人 DOAHandler = spmDOA.GetStepHandler(sApplicant, curDOA, dtHead, dtDetail, true); Variables.Add(SPMVariableKey.Subject, "[部門領料_應退未退---測試] [" + FormFields["txtDocNo".ToUpper()] + "]"); RoutingVariable = new SPMRoutingVariable(SPMRoutingVariableKey.spm_Jump, "DOA(" + DOAHandler._sHandler + ")"); } catch (Exception ex) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = ex.Message; } } else { try { if (DOAHandler._sEndFlag == "N") { //簽核人防呆檢查 if (DOAHandler._sHandler.Length == 0) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "Operation fail(server or network is busy now), pls refresh this page and try again"; } else { RoutingVariable = new SPMRoutingVariable(SPMRoutingVariableKey.spm_Jump, "DOA(" + DOAHandler._sHandler + ")"); // 20121105 Add QX NA if (DOAHandler._cc.Length > 0) { Variables.Add(SPMVariableKey.NextCC, DOAHandler._cc); } // 20121105 End QX NA } } else { RoutingVariable = new SPMRoutingVariable(SPMRoutingVariableKey.spm_Jump, "End"); } // DBIO.RecordTraceLog("D", "OK", DOAHandler); } catch (Exception) { DBIO.RecordTraceLog("D", "NG", DOAHandler); throw; } } base.PrepareSPMVariables(SubmitMethod, ProcessMethod, SPMTaskVars, ref Variables, ref RoutingVariable, ref strSPMUid, strMemo, strNotesForNextApprover, FormFields, ref HandleResult, ref SuccessMessage); }
// Fill SPM's EFFormFieldData public override void PrepareEFFormFields(SPMSubmitMethod SubmitMethod, SPMProcessMethod ProcessMethod, SPMTaskVariables TaskVars, ref EFFormFields FormFields, ref IInterfaceHandleResult HandleResult, object oContainer, IUIShadow UIShadow, ref string ApplicantInfo) { GDSExceptionHandlingUIShadow lUIControls = (GDSExceptionHandlingUIShadow)UIShadow; //基本資料 FormFields.SetOrAdd("txtLogonID".ToUpper(), lUIControls.txtLogonID.Text); FormFields.SetOrAdd("txtName".ToUpper(), lUIControls.txtName.Text); FormFields.SetOrAdd("txtPlant".ToUpper(), lUIControls.txtPlant.Text); FormFields.SetOrAdd("txtDept".ToUpper(), lUIControls.txtDept.Text); FormFields.SetOrAdd("txtEMail".ToUpper(), lUIControls.txtEMail.Text); FormFields.SetOrAdd("txtExtNO".ToUpper(), lUIControls.txtExtNO.Text); FormFields.SetOrAdd("txtRDocNo".ToUpper(), lUIControls.txtRDocNo.Text); FormFields.SetOrAdd("txtDocNo".ToUpper(), lUIControls.txtDocNo.Text); FormFields.SetOrAdd("txtCostCenter".ToUpper(), lUIControls.txtCostCenter.Text); FormFields.SetOrAdd("txtDepartment".ToUpper(), lUIControls.txtDepartment.Text); FormFields.SetOrAdd("txtApplication".ToUpper(), lUIControls.txtApplication.Text); FormFields.SetOrAdd("txtMaterial".ToUpper(), lUIControls.txtMaterial.Text); FormFields.SetOrAdd("txtReturnQuantity".ToUpper(), lUIControls.txtReturnQuantity.Text); FormFields.SetOrAdd("txtReason".ToUpper(), lUIControls.txtReason.Text); FormFields.SetOrAdd("txtRemark".ToUpper(), lUIControls.txtRemark.Text); FormFields.SetOrAdd("txtReturn".ToUpper(), lUIControls.txtReturn.Text); FormFields.SetOrAdd("txtIADocNo".ToUpper(), lUIControls.txtIADocNo.Text); FormFields.SetOrAdd("txtI6DocNo".ToUpper(), lUIControls.txtI6DocNo.Text); FormFields.SetOrAdd("txtZEILE".ToUpper(), lUIControls.txtZEILE.Text); FormFields.SetOrAdd("txtAmount".ToUpper(), lUIControls.txtAmount.Text); //SOURCE DATA FormFields.SetOrAdd("txtHead".ToUpper(), lUIControls.txtHead.Text); FormFields.SetOrAdd("txtDetail".ToUpper(), lUIControls.txtDetail.Text); FormFields.SetOrAdd("txtDOA".ToUpper(), lUIControls.txtDOA.Text); FormFields.SetOrAdd("txtWERKS".ToUpper(), lUIControls.txtWERKS.Text); FormFields.SetOrAdd("txtAPTYP".ToUpper(), lUIControls.txtAPTYP.Text); base.PrepareEFFormFields(SubmitMethod, ProcessMethod, TaskVars, ref FormFields, ref HandleResult, oContainer, UIShadow, ref ApplicantInfo); }
// Validate contols before submit public override bool EFFormFieldsValidation(SPMSubmitMethod SubmitMethod, SPMProcessMethod ProcessMethod, SPMTaskVariables SPMTaskVars, ref IInterfaceHandleResult HandleResult, object oContainer, IUIShadow UIShadow) { GDSExceptionHandlingUIShadow lUIControls = (GDSExceptionHandlingUIShadow)UIShadow; GDS_Helper oStandard = new GDS_Helper(); StringBuilder ErrMsg = new StringBuilder(); string stepName = (string)(SPMTaskVars.ReadDatum("STEPNAME")); string curDOA = lUIControls.txtDOA.Text; string plant = lUIControls.txtWERKS.Text; string apType = lUIControls.txtAPTYP.Text; DOA spmDOA = new DOA(); string sApplicant = lUIControls.txtApplication.Text.Trim(); //獲取 表頭及表身DATA string formDetail = lUIControls.txtDetail.Text.Trim().Replace("<1;", "<").Replace(">1;", ">"); string formHead = lUIControls.txtHead.Text.Trim().Replace("<1;", "<").Replace(">1;", ">"); DataTable dtHead = LiteOn.GDS.Utility.Tools.BuildHeadTable(); System.IO.StringReader reader = new System.IO.StringReader(formHead); dtHead.ReadXml(reader); System.IO.StringReader reader2 = new System.IO.StringReader(formDetail); DataTable dtDetail = LiteOn.GDS.Utility.Tools.BuildDetailTable(); dtDetail.ReadXml(reader2); if (SubmitMethod == SPMSubmitMethod.CreateNewCase) { #region 欄位的非空驗證 #endregion #region Check單據是否已經過帳 string I1DocNo = oUIControls.txtRDocNo.Text; string IADocNo = oUIControls.txtIADocNo.Text; string I6DocNo = oUIControls.txtI6DocNo.Text; string WERKS = oUIControls.txtWERKS.Text; //Check此I1單(領料單)和關聯的IA,I6單(退料單)是否都已經過賬 (Call SAP BAPI Z_BAPI_GDS_SEND MBLNR不為空則表示已經過賬) if (!oStandard.CheckFormNoIsPass(I1DocNo, IADocNo, I6DocNo, WERKS)) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "I1(領料單)或者IA,I6(退料單)存在未過賬的單子!"; } #endregion } else { //only approve action check controls if (SubmitMethod == SPMSubmitMethod.HandleCase_Approve) { int caseId = int.Parse((string)(SPMTaskVars.ReadDatum("CASEID"))); string curStepId = SPMAppLine.GetCurrentStep(curDOA); //調用FUNCTION作FormFieldsValidation string errMsg = DOA.FieldsValidationByStepId(plant, apType, curStepId, caseId); if (errMsg.Length > 0) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = errMsg; } else { try { //CALL FUNCTION獲取下關簽核人 DOAHandler = spmDOA.GetStepHandler(sApplicant, curDOA, dtHead, dtDetail, false); oStandard.UpdateSettingxml(oUIControls.txtDocNo.Text, DOAHandler._sDOA.ToString()); } catch (Exception ex) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = ex.Message; } } if (ErrMsg.ToString().Length > 0) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = ErrMsg.ToString(); } //簽核人防呆檢查 if (DOAHandler._sEndFlag == "N" && DOAHandler._sHandler.Length == 0) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "Can't find next step handler, pls contact sys administrator"; } string sCurLogonID = (string)(SPMTaskVars.ReadDatum("SYS_LOGONID")); string sCurRoleCode = SPMAppLine.GetCurrentApprover(curDOA).Replace("{", "").Replace("}", ""); //簽核人重復簽核防呆 if (DOAHandler._sEndFlag == "N" && DOAHandler._sRoleCode == sCurRoleCode && DOAHandler._sHandler.ToUpper() == sCurLogonID.ToUpper()) { HandleResult.IsSuccess = false; HandleResult.CustomMessage = "Server or network is busy now, pls try again"; } } } return(base.EFFormFieldsValidation(SubmitMethod, ProcessMethod, SPMTaskVars, ref HandleResult, oContainer, UIShadow)); }