public override ERP_CallbackResultType NotifyStartAdvance(string erpFormCode, bool isSubmit) { Logger.logger.DebugFormat("NotifyStartAdvance_erpFormCode:{0},{1}", erpFormCode, isSubmit); try { ERP_CallbackResultInfo erpback = InvokeService_ERP.InvokeServiceAdvance(new CallbackInfo() { FormCode = erpFormCode, FormType = GetErpFormType().ToString(), Status = "处理中", ArrayParam = isSubmit ? new List <string>() : new List <string>() { "CHECK_STATUS" } // }); Logger.logger.DebugFormat("erpback:{0}", erpback.Log); return(erpback.ResultType); } catch (Exception ex) { Logger.logger.DebugFormat("NO:ex:{0}\r\n{1}", ex.Message, ex.StackTrace); return(ERP_CallbackResultType.ERP服务器异常); } }
public virtual ERP_CallbackResultType NotifyStopByERPCode(string erpFormCode) { Logger.logger.DebugFormat("NotifyStopByERPCode_erpFormCode:{0}", erpFormCode); try { ERP_CallbackResultInfo erpback = InvokeService_ERP.InvokeServiceAdvance(new CallbackInfo() { FormCode = erpFormCode, FormType = FormType.ToString(), Status = "", ArrayParam = new List <string>() { "FORCE" } }); Logger.logger.DebugFormat("erpback:{0}", erpback.Log); return(erpback.ResultType); } catch (Exception ex) { Logger.logger.DebugFormat("NO:ex:{0}\r\n{1}", ex.Message, ex.StackTrace); return(ERP_CallbackResultType.ERP服务器异常); } }
public ERP_CallbackResultType VerifyERPWFStatus(string erpFormCode) { Logger.logger.DebugFormat("验证工作流状态:erpFormCode:{0}", erpFormCode); try { ERP_CallbackResultInfo erpback = InvokeService_ERP.InvokeServiceAdvance(new CallbackInfo() { FormCode = erpFormCode, FormType = "PO", Status = "", ArrayParam = new List <string>() { "CHECK_WF" } // }); Logger.logger.DebugFormat("erpback:{0}", erpback.Log); return(erpback.ResultType); } catch (Exception ex) { Logger.logger.DebugFormat("NO:ex:{0}\r\n{1}", ex.Message, ex.StackTrace); return(ERP_CallbackResultType.ERP服务器异常); } }
/// <summary> /// 可以继续覆盖重写 /// </summary> /// <param name="k2_workflowId"></param> /// <param name="dataFields"></param> /// <returns></returns> public override Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo DoServiceEvent(int k2_workflowId, SerializableDictionary <string, string> dataFields) { Logger.logger.DebugFormat("Params:{0},{1}", k2_workflowId, dataFields.Keys.Count); foreach (KeyValuePair <string, string> item in dataFields) { Logger.logger.DebugFormat("df:{0}-{1}", item.Key, item.Value); } Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo info = new Pkurg.PWorldBPM.FinallyDisposeServices.ExecuteResultInfo(); try { string erpFormCode = GetErpFormIdByWorkflowId(k2_workflowId, dataFields); string[] toErpString = CallbackStatus.Split(','); string resultString = dataFields["IsPass"] == "1" ? toErpString[0] : toErpString[1]; Logger.logger.DebugFormat("Proc:{0},{1}", erpFormCode, resultString); if (BeforeNotify(k2_workflowId, dataFields)) { ERP_CallbackResultInfo resultInfo = InvokeService_ERP.InvokeServiceAdvance(new CallbackInfo() { FormCode = erpFormCode, FormType = GetErpFormType().ToString(), Status = resultString }); AfterNotify(k2_workflowId, dataFields, resultInfo); if (resultInfo.ResultType == ERP_CallbackResultType.调用成功) { info.IsSuccess = true; } else { info.IsSuccess = false; info.ExecException = "接口调用成功,erp接口返回失败:" + resultInfo.resultXml; } } else { info.IsSuccess = false; } } catch (Exception ex) { info.ExecException = ex.StackTrace; info.IsSuccess = false; } Logger.logger.DebugFormat("Result:{0}", info.IsSuccess); Logger.logger.DebugFormat("Result-e:{0}", info.ExecException); if (!IsDebug) { DoSendEmail(k2_workflowId); } return(info); }
/// <summary> /// 流程结束准备通知后处理 /// </summary> /// <param name="k2_workflowId"></param> /// <param name="dataFields"></param> /// <param name="resultInfo"></param> /// <returns></returns> protected virtual bool AfterNotify(int k2_workflowId, SerializableDictionary <string, string> dataFields, ERP_CallbackResultInfo resultInfo) { return(true); }
protected override bool AfterNotify(int k2_workflowId, SerializableDictionary <string, string> dataFields, ERP_CallbackResultInfo resultInfo) { var inst = DBContext.GetSysContext().WF_WorkFlowInstance.FirstOrDefault(x => x.WFInstanceId == k2_workflowId.ToString()); var contractfinalaccountinfo = DBContext.GetBizContext().ERP_ContractFinalAccount.FirstOrDefault(x => x.FormID == inst.FormID); if (contractfinalaccountinfo.ERPApproveLev != null && contractfinalaccountinfo.ERPApproveLev == 2) { //发送邮件 MailService mailService = new MailService(); string emailTitle = "【备案邮件】" + "由" + inst.CreateDeptName + inst.CreateByUserName + "于" + contractfinalaccountinfo.CreateTime + "发起的" + "【合同结算】" + inst.FormTitle + "流程已审批结束!"; string ID = url + "/Workflow/ViewPage/V_ERP_ContractFinalAccount.aspx?id=" + inst.InstanceID; string emailFinallyBodyFormat = @"您好! <br/> " + emailTitle + @" <br/> 若要查看审批意见点击此处: <a href='" + ID + @"'>查看</a> <br/> 谢谢 <br/> "; bool eResult = mailService.SendEmailCustom("*****@*****.**", emailTitle, emailFinallyBodyFormat); //bool eResult = mailService.SendEmailCustom("*****@*****.**", emailTitle, emailFinallyBodyFormat); } return(true); }