Esempio n. 1
0
        /// <summary>
        /// 通过模块代码查询系统代码
        /// </summary>
        /// <param name="ModelCode">模块代码</param>
        /// <returns></returns>
        public static ModelInfo GetSysCodeByModelCode(OracleConnection con, string ModelCode)
        {
            ModelInfo tmpModelInfo = new ModelInfo();
            try
            {
                var dt = FLOW_MODELDEFINE_TDAL.GetModelDefineByCode(con, ModelCode);
                //Flow_ModelDefine_TDAL Dal = new Flow_ModelDefine_TDAL();
                //var dt = Dal.GetModelDefineByCode(ModelCode);

                if (dt.Count > 0)
                {
                    tmpModelInfo.SysCode = dt[0].SYSTEMCODE;
                    tmpModelInfo.ModelName = dt[0].DESCRIPTION;
                    return tmpModelInfo;
                }
                return null;
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetSysCodeByModelCode异常信息 :" + ex.ToString());
                throw new Exception(ex.Message);
            }
            finally
            {
                tmpModelInfo = null;
            }

        }
Esempio n. 2
0
        /// <summary>
        /// 发送审批消息(调用引擎服务)
        /// </summary>
        /// <param name="submitData"></param>
        /// <param name="dataResult"></param>
        /// <param name="modelinfo"></param>
        /// <param name="CheckFlowResult"></param>
        /// <param name="Flowbill"></param>
        /// <param name="AppCompanyID">申请公司</param>
        /// <param name="MessageUserID">申请人ID</param>
        /// <param name="MessageUserName">申请人名</param>
        private void SubmitEngineService(OracleConnection con, SubmitData submitData, DataResult dataResult, ModelInfo modelinfo, CheckResult CheckFlowResult, FlowBLL2 Flowbill, string AppCompanyID, string MessageUserID, string MessageUserName, ref string ErroMessage)
        {
            bool bOK = true;
            #region 发送审批消息(调用引擎服务)
            try
            {
                if (dataResult.FlowResult == FlowResult.SUCCESS || dataResult.FlowResult == FlowResult.END)
                {
                    #region 调用引擎服务(原有调用WCF服务)
                    ////EngineWcfGlobalFunctionService.EngineWcfGlobalFunctionClient engineClient = new EngineWcfGlobalFunctionService.EngineWcfGlobalFunctionClient();//旧引擎服务

                    //FlowEngineService.EngineWcfGlobalFunctionClient FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    //string IsTask = dataResult.FlowResult == FlowResult.SUCCESS ? "1" : "0";
                    //MessageData tmpMessageData = null;
                    //StringBuilder FlowResultXml = null;
                    //#region
                    //switch (submitData.SubmitFlag)
                    //{
                    //    case SubmitFlag.New:
                    //        #region 新增
                    //        if (dataResult.IsCountersign)
                    //        {
                    //            #region
                    //            if (dataResult.FlowResult == FlowResult.SUCCESS)
                    //            {
                    //                List<string> listUserID = new List<string>();
                    //                List<string> listUserName = new List<string>();
                    //                if (dataResult.DictCounterUser != null && dataResult.DictCounterUser.Keys.Count > 0)
                    //                {
                    //                    dataResult.DictCounterUser.Values.ToList().ForEach(users =>
                    //                    {
                    //                        users.ForEach(user =>
                    //                        {
                    //                            listUserID.Add(user.UserID);
                    //                            listUserName.Add(user.UserName);
                    //                        });
                    //                    });

                    //                    MessageUserID = string.Join("|", listUserID);
                    //                    MessageUserName = string.Join("|", listUserName);
                    //                }

                    //            }
                    //            if (dataResult.DictAgentUserInfo != null && dataResult.DictAgentUserInfo.Count > 0)
                    //            {
                    //                dataResult.DictAgentUserInfo.Values.ToList().ForEach(user =>
                    //                {
                    //                    MessageUserID += "|" + user.UserID.Trim();
                    //                    MessageUserName += "|" + user.UserName.Trim();

                    //                });
                    //            }
                    //            #endregion
                    //        }
                    //        else
                    //        {
                    //            #region
                    //            if (dataResult.FlowResult == FlowResult.SUCCESS)
                    //            {
                    //                MessageUserID = dataResult.UserInfo[0].UserID.Trim();
                    //                MessageUserName = dataResult.UserInfo[0].UserName.Trim();
                    //            }
                    //            if (dataResult.AgentUserInfo != null)
                    //            {
                    //                MessageUserID += "|" + dataResult.AgentUserInfo.UserID.Trim();
                    //                MessageUserName += "|" + dataResult.AgentUserInfo.UserName.Trim();
                    //            }
                    //            #endregion
                    //        }
                    //        tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                    //            submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                    //        FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);
                    //        DateTime s = DateTime.Now;
                    //        LogHelper.WriteLog("开始新增FlowEngine.SaveFlowTriggerData");
                    //        bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //        LogHelper.WriteLog("bOK=" + bOK.ToString());
                    //        LogHelper.WriteLog("结束新增FlowEngine.SaveFlowTriggerData");
                    //        //bOK = engineClient.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //        DateTime e = DateTime.Now;
                    //        string str = DateDiff(e, s);
                    //        if (!bOK)
                    //        {
                    //            Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                    //        }

                    //        #endregion
                    //        break;
                    //    case SubmitFlag.Cancel:
                    //        #region 撤单
                    //        tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                    //            submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                    //        FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);
                    //        LogHelper.WriteLog("开始撤单FlowEngine.FlowCancel");
                    //        bool bCancel = FlowEngine.FlowCancel(FlowResultXml.ToString(), submitData.XML);
                    //        LogHelper.WriteLog("bCancel=" + bCancel.ToString());
                    //        LogHelper.WriteLog("结束撤单FlowEngine.FlowCancel");
                    //        //bool bCancel = engineClient.FlowCancel(FlowResultXml.ToString(), submitData.XML); 
                    //        if (!bCancel)
                    //        {
                    //            Tracer.Debug("FlowEngineService:DateTime:" + DateTime.Now.ToString() + "\n" + "FlowCancel:submitData.XML" + "\n\nFlowResultXml" + FlowResultXml.ToString());
                    //        }
                    //        #endregion
                    //        break;
                    //    case SubmitFlag.Approval:
                    //        LogHelper.WriteLog("开始审核");
                    //        #region 审核

                    //        if (dataResult.CurrentIsCountersign)
                    //        {
                    //            LogHelper.WriteLog("第1次:TaskMsgClose");
                    //            FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);
                    //            //engineClient.TaskMsgClose(modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);
                    //            //einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);

                    //            #region
                    //            if (submitData.ApprovalResult == ApprovalResult.NoPass)
                    //            {
                    //                #region
                    //                List<string> listMessageUserID = new List<string>();
                    //                CheckFlowResult.fd.Where(detail => detail.EDITUSERID != submitData.ApprovalUser.UserID).ToList().ForEach(item =>
                    //                {
                    //                    listMessageUserID.Add(item.EDITUSERID);
                    //                    if (!string.IsNullOrEmpty(item.AGENTUSERID))
                    //                    {
                    //                        listMessageUserID.Add(item.AGENTUSERID);
                    //                    }
                    //                });
                    //                if (listMessageUserID.Count > 0)
                    //                {
                    //                    string messageUserID = string.Join(",", listMessageUserID);
                    //                    LogHelper.WriteLog("第2次:TaskMsgClose");
                    //                    FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, messageUserID);

                    //                    //engineClient.TaskMsgClose(modelinfo.SysCode, submitData.FormID, messageUserID);
                    //                    //einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, messageUserID);
                    //                }
                    //                tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                    //              submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                    //                FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);

                    //                DateTime s2 = DateTime.Now;
                    //                bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //                //bOK = engineClient.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //                // bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML);
                    //                DateTime e2 = DateTime.Now;
                    //                string str2 = DateDiff(e2, s2);
                    //                if (!bOK)
                    //                {
                    //                    Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                    //                }
                    //                #endregion
                    //            }
                    //            else if (dataResult.IsGotoNextState)
                    //            {
                    //                #region
                    //                List<string> listMessageUserID = new List<string>();
                    //                CheckFlowResult.fd.Where(detail => detail.EDITUSERID != submitData.ApprovalUser.UserID).ToList().ForEach(item =>
                    //                {
                    //                    listMessageUserID.Add(item.EDITUSERID);
                    //                    if (!string.IsNullOrEmpty(item.AGENTUSERID))
                    //                    {
                    //                        listMessageUserID.Add(item.AGENTUSERID);
                    //                    }
                    //                });
                    //                if (listMessageUserID.Count > 0)
                    //                {

                    //                    string messageUserID = string.Join(",", listMessageUserID);
                    //                    LogHelper.WriteLog("第3次:TaskMsgClose");
                    //                    FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, messageUserID);

                    //                    //engineClient.TaskMsgClose(modelinfo.SysCode, submitData.FormID, messageUserID);
                    //                    //einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, messageUserID);
                    //                }
                    //                if (dataResult.IsCountersign)
                    //                {
                    //                    #region
                    //                    if (dataResult.FlowResult == FlowResult.SUCCESS)
                    //                    {

                    //                        List<string> listUserID = new List<string>();
                    //                        List<string> listUserName = new List<string>();
                    //                        if (dataResult.DictCounterUser != null && dataResult.DictCounterUser.Keys.Count > 0)
                    //                        {
                    //                            dataResult.DictCounterUser.Values.ToList().ForEach(users =>
                    //                            {
                    //                                users.ForEach(user =>
                    //                                {
                    //                                    listUserID.Add(user.UserID);
                    //                                    listUserName.Add(user.UserName);
                    //                                });
                    //                            });

                    //                            MessageUserID = string.Join("|", listUserID);
                    //                            MessageUserName = string.Join("|", listUserName);
                    //                        }

                    //                    }
                    //                    if (dataResult.DictAgentUserInfo != null && dataResult.DictAgentUserInfo.Count > 0)
                    //                    {
                    //                        dataResult.DictAgentUserInfo.Values.ToList().ForEach(user =>
                    //                        {
                    //                            MessageUserID += "|" + user.UserID.Trim();
                    //                            MessageUserName += "|" + user.UserName.Trim();

                    //                        });
                    //                    }
                    //                    #endregion
                    //                }
                    //                else
                    //                {
                    //                    #region
                    //                    if (dataResult.FlowResult == FlowResult.SUCCESS)
                    //                    {
                    //                        MessageUserID = dataResult.UserInfo[0].UserID.Trim();
                    //                        MessageUserName = dataResult.UserInfo[0].UserName.Trim();

                    //                    }

                    //                    if (dataResult.AgentUserInfo != null)
                    //                    {
                    //                        MessageUserID += "|" + dataResult.AgentUserInfo.UserID.Trim();
                    //                        MessageUserName += "|" + dataResult.AgentUserInfo.UserName.Trim();
                    //                    }
                    //                    #endregion
                    //                }
                    //                tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                    //                    submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                    //                FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);

                    //                DateTime s3 = DateTime.Now;
                    //                bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //                //bOK = engineClient.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //                //bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML);
                    //                DateTime e3 = DateTime.Now;
                    //                string str3 = DateDiff(e3, s3);
                    //                if (!bOK)
                    //                {
                    //                    Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                    //                }
                    //                #endregion
                    //            }
                    //            #endregion
                    //        }
                    //        else
                    //        {
                    //            #region
                    //            if (dataResult.IsCountersign)
                    //            {
                    //                #region
                    //                if (dataResult.FlowResult == FlowResult.SUCCESS)
                    //                {

                    //                    List<string> listUserID = new List<string>();
                    //                    List<string> listUserName = new List<string>();
                    //                    if (dataResult.DictCounterUser != null && dataResult.DictCounterUser.Keys.Count > 0)
                    //                    {
                    //                        dataResult.DictCounterUser.Values.ToList().ForEach(users =>
                    //                        {
                    //                            users.ForEach(user =>
                    //                            {
                    //                                listUserID.Add(user.UserID);
                    //                                listUserName.Add(user.UserName);
                    //                            });
                    //                        });

                    //                        MessageUserID = string.Join("|", listUserID);
                    //                        MessageUserName = string.Join("|", listUserName);
                    //                    }

                    //                }
                    //                if (dataResult.DictAgentUserInfo != null && dataResult.DictAgentUserInfo.Count > 0)
                    //                {
                    //                    dataResult.DictAgentUserInfo.Values.ToList().ForEach(user =>
                    //                    {
                    //                        MessageUserID += "|" + user.UserID.Trim();
                    //                        MessageUserName += "|" + user.UserName.Trim();

                    //                    });
                    //                }
                    //                #endregion
                    //            }
                    //            else
                    //            {
                    //                #region
                    //                if (dataResult.FlowResult == FlowResult.SUCCESS)
                    //                {
                    //                    MessageUserID = dataResult.UserInfo[0].UserID.Trim();
                    //                    MessageUserName = dataResult.UserInfo[0].UserName.Trim();

                    //                }

                    //                if (dataResult.AgentUserInfo != null)
                    //                {
                    //                    MessageUserID += "|" + dataResult.AgentUserInfo.UserID.Trim();
                    //                    MessageUserName += "|" + dataResult.AgentUserInfo.UserName.Trim();
                    //                }
                    //                #endregion
                    //            }
                    //            tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                    //                submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                    //            FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);

                    //            DateTime s4 = DateTime.Now;
                    //            LogHelper.WriteLog("开始FlowEngine.SaveFlowTriggerData");
                    //            bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //            LogHelper.WriteLog("bOK=" + bOK.ToString());
                    //            LogHelper.WriteLog("结束FlowEngine.SaveFlowTriggerData");
                    //            //bOK = engineClient.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    //            //bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML);
                    //            DateTime e4 = DateTime.Now;
                    //            string str4 = DateDiff(e4, s4);
                    //            if (!bOK)
                    //            {
                    //                Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                    //            }
                    //            else
                    //            {
                    //                LogHelper.WriteLog("第4次:TaskMsgClose");
                    //                FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);

                    //                //engineClient.TaskMsgClose(modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);
                    //                //einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);
                    //            }
                    //            #endregion
                    //        }
                    //        #endregion
                    //        LogHelper.WriteLog("结束审核");
                    //        break;
                    //}
                    //#endregion
                    #endregion 调用引擎服务(原有调用WCF服务)
                    #region 调用引擎服务(调用本地服DLL)
                    string IsTask = dataResult.FlowResult == FlowResult.SUCCESS ? "1" : "0";
                    MessageData tmpMessageData = null;
                    StringBuilder FlowResultXml = null;
                    #region
                    switch (submitData.SubmitFlag)
                    {
                        case SubmitFlag.New:
                            #region 新增
                            if (dataResult.IsCountersign)
                            {
                                #region
                                if (dataResult.FlowResult == FlowResult.SUCCESS)
                                {
                                    List<string> listUserID = new List<string>();
                                    List<string> listUserName = new List<string>();
                                    if (dataResult.DictCounterUser != null && dataResult.DictCounterUser.Keys.Count > 0)
                                    {
                                        dataResult.DictCounterUser.Values.ToList().ForEach(users =>
                                        {
                                            users.ForEach(user =>
                                            {
                                                listUserID.Add(user.UserID);
                                                listUserName.Add(user.UserName);
                                            });
                                        });

                                        MessageUserID = string.Join("|", listUserID);
                                        MessageUserName = string.Join("|", listUserName);
                                    }

                                }
                                if (dataResult.DictAgentUserInfo != null && dataResult.DictAgentUserInfo.Count > 0)
                                {
                                    dataResult.DictAgentUserInfo.Values.ToList().ForEach(user =>
                                    {
                                        MessageUserID += "|" + user.UserID.Trim();
                                        MessageUserName += "|" + user.UserName.Trim();

                                    });
                                }
                                #endregion
                            }
                            else
                            {
                                #region
                                if (dataResult.FlowResult == FlowResult.SUCCESS)
                                {
                                    MessageUserID = dataResult.UserInfo[0].UserID.Trim();
                                    MessageUserName = dataResult.UserInfo[0].UserName.Trim();
                                }
                                if (dataResult.AgentUserInfo != null)
                                {
                                    MessageUserID += "|" + dataResult.AgentUserInfo.UserID.Trim();
                                    MessageUserName += "|" + dataResult.AgentUserInfo.UserName.Trim();
                                }
                                #endregion
                            }
                            tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                                submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                            FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);

                            LogHelper.WriteLog("开始新增FlowEngine.SaveFlowTriggerData");
                            LogHelper.WriteLog("流程引擎的XML数据", "新增: FormID=" + submitData.FormID + ";SysCode=" + modelinfo.SysCode + " ModelName=" + modelinfo.ModelName + "\r\n FlowResultXml= \r\n" + FlowResultXml + "\r\n submitData.XML= \r\n" + submitData.XML);
                            bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML, ref ErroMessage);
                            LogHelper.WriteLog("bOK=" + bOK.ToString());
                            LogHelper.WriteLog("结束新增FlowEngine.SaveFlowTriggerData");
                            if (!bOK)
                            {
                                Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                            }

                            #endregion
                            break;
                        case SubmitFlag.Cancel:
                            #region 撤单
                            tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                                submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                            FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);
                            //bool bCancel = FlowEngine.FlowCancel(FlowResultXml.ToString(), submitData.XML);
                            LogHelper.WriteLog("流程引擎的XML数据", "撤单: FormID=" + submitData.FormID + ";SysCode=" + modelinfo.SysCode + " ModelName=" + modelinfo.ModelName + "\r\n FlowResultXml= \r\n" + FlowResultXml + "\r\n submitData.XML= \r\n" + submitData.XML);

                            bool bCancel = einginBll.FlowCancel(con, FlowResultXml.ToString(), submitData.XML, ref ErroMessage);
                            if (!bCancel)
                            {
                                Tracer.Debug("FlowEngineService:DateTime:" + DateTime.Now.ToString() + "\n" + "FlowCancel:submitData.XML" + "\n\nFlowResultXml" + FlowResultXml.ToString());
                            }
                            #endregion
                            break;
                        case SubmitFlag.Approval:
                            #region 审核
                            //FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);
                            einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, submitData.ApprovalUser.UserID);
                            if (dataResult.CurrentIsCountersign)
                            {
                                #region
                                if (submitData.ApprovalResult == ApprovalResult.NoPass)
                                {
                                    #region
                                    List<string> listMessageUserID = new List<string>();
                                    CheckFlowResult.fd.Where(detail => detail.EDITUSERID != submitData.ApprovalUser.UserID).ToList().ForEach(item =>
                                    {
                                        listMessageUserID.Add(item.EDITUSERID);
                                        if (!string.IsNullOrEmpty(item.AGENTUSERID))
                                        {
                                            listMessageUserID.Add(item.AGENTUSERID);
                                        }
                                    });
                                    if (listMessageUserID.Count > 0)
                                    {
                                        string messageUserID = string.Join(",", listMessageUserID);
                                        //FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, messageUserID);
                                        einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, messageUserID);
                                    }
                                    tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                                  submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                                    FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);
                                    //bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);                                   

                                    LogHelper.WriteLog("开始审核FlowEngine.SaveFlowTriggerData");
                                    LogHelper.WriteLog("流程引擎的XML数据", "审核: FormID=" + submitData.FormID + ";SysCode=" + modelinfo.SysCode + " ModelName=" + modelinfo.ModelName + "\r\n FlowResultXml= \r\n" + FlowResultXml + "\r\n submitData.XML= \r\n" + submitData.XML);
                                    bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML, ref ErroMessage);
                                    LogHelper.WriteLog("bOK=" + bOK.ToString());
                                    LogHelper.WriteLog("结束审核FlowEngine.SaveFlowTriggerData");
                                    if (!bOK)
                                    {
                                        Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                                    }
                                    #endregion
                                }
                                else if (dataResult.IsGotoNextState)
                                {
                                    #region
                                    List<string> listMessageUserID = new List<string>();
                                    CheckFlowResult.fd.Where(detail => detail.EDITUSERID != submitData.ApprovalUser.UserID).ToList().ForEach(item =>
                                    {
                                        listMessageUserID.Add(item.EDITUSERID);
                                        if (!string.IsNullOrEmpty(item.AGENTUSERID))
                                        {
                                            listMessageUserID.Add(item.AGENTUSERID);
                                        }
                                    });
                                    if (listMessageUserID.Count > 0)
                                    {
                                        string messageUserID = string.Join(",", listMessageUserID);
                                        // FlowEngine.TaskMsgClose(modelinfo.SysCode, submitData.FormID, messageUserID);
                                        einginBll.TaskMsgClose(con, modelinfo.SysCode, submitData.FormID, messageUserID);
                                    }
                                    if (dataResult.IsCountersign)
                                    {
                                        #region
                                        if (dataResult.FlowResult == FlowResult.SUCCESS)
                                        {

                                            List<string> listUserID = new List<string>();
                                            List<string> listUserName = new List<string>();
                                            if (dataResult.DictCounterUser != null && dataResult.DictCounterUser.Keys.Count > 0)
                                            {
                                                dataResult.DictCounterUser.Values.ToList().ForEach(users =>
                                                {
                                                    users.ForEach(user =>
                                                    {
                                                        listUserID.Add(user.UserID);
                                                        listUserName.Add(user.UserName);
                                                    });
                                                });

                                                MessageUserID = string.Join("|", listUserID);
                                                MessageUserName = string.Join("|", listUserName);
                                            }

                                        }
                                        if (dataResult.DictAgentUserInfo != null && dataResult.DictAgentUserInfo.Count > 0)
                                        {
                                            dataResult.DictAgentUserInfo.Values.ToList().ForEach(user =>
                                            {
                                                MessageUserID += "|" + user.UserID.Trim();
                                                MessageUserName += "|" + user.UserName.Trim();

                                            });
                                        }
                                        #endregion
                                    }
                                    else
                                    {
                                        #region
                                        if (dataResult.FlowResult == FlowResult.SUCCESS)
                                        {
                                            MessageUserID = dataResult.UserInfo[0].UserID.Trim();
                                            MessageUserName = dataResult.UserInfo[0].UserName.Trim();

                                        }

                                        if (dataResult.AgentUserInfo != null)
                                        {
                                            MessageUserID += "|" + dataResult.AgentUserInfo.UserID.Trim();
                                            MessageUserName += "|" + dataResult.AgentUserInfo.UserName.Trim();
                                        }
                                        #endregion
                                    }
                                    tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                                        submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                                    FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);
                                    //bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                                    DateTime s3 = DateTime.Now;
                                    bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML, ref ErroMessage);
                                    DateTime e3 = DateTime.Now;
                                    string str3 = DateDiff(e3, s3);
                                    if (!bOK)
                                    {
                                        Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                                    }
                                    #endregion
                                }
                                #endregion
                            }
                            else
                            {
                                #region
                                if (dataResult.IsCountersign)
                                {
                                    #region
                                    if (dataResult.FlowResult == FlowResult.SUCCESS)
                                    {

                                        List<string> listUserID = new List<string>();
                                        List<string> listUserName = new List<string>();
                                        if (dataResult.DictCounterUser != null && dataResult.DictCounterUser.Keys.Count > 0)
                                        {
                                            dataResult.DictCounterUser.Values.ToList().ForEach(users =>
                                            {
                                                users.ForEach(user =>
                                                {
                                                    listUserID.Add(user.UserID);
                                                    listUserName.Add(user.UserName);
                                                });
                                            });

                                            MessageUserID = string.Join("|", listUserID);
                                            MessageUserName = string.Join("|", listUserName);
                                        }

                                    }
                                    if (dataResult.DictAgentUserInfo != null && dataResult.DictAgentUserInfo.Count > 0)
                                    {
                                        dataResult.DictAgentUserInfo.Values.ToList().ForEach(user =>
                                        {
                                            MessageUserID += "|" + user.UserID.Trim();
                                            MessageUserName += "|" + user.UserName.Trim();

                                        });
                                    }
                                    #endregion
                                }
                                else
                                {
                                    #region
                                    if (dataResult.FlowResult == FlowResult.SUCCESS)
                                    {
                                        MessageUserID = dataResult.UserInfo[0].UserID.Trim();
                                        MessageUserName = dataResult.UserInfo[0].UserName.Trim();

                                    }

                                    if (dataResult.AgentUserInfo != null)
                                    {
                                        MessageUserID += "|" + dataResult.AgentUserInfo.UserID.Trim();
                                        MessageUserName += "|" + dataResult.AgentUserInfo.UserName.Trim();
                                    }
                                    #endregion
                                }
                                tmpMessageData = new MessageData("Flow", modelinfo.SysCode, AppCompanyID, submitData.ModelCode, modelinfo.ModelName,
                                    submitData.FormID, dataResult.AppState, dataResult.CheckState, IsTask, MessageUserID, MessageUserName, dataResult.KPITime);
                                FlowResultXml = Flowbill.BuildMessageData(tmpMessageData);
                                // bOK = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                                DateTime s4 = DateTime.Now;
                                bOK = einginBll.SaveFlowTriggerData(con, FlowResultXml.ToString(), submitData.XML, ref ErroMessage);
                                DateTime e4 = DateTime.Now;
                                string str4 = DateDiff(e4, s4);
                                if (!bOK)
                                {
                                    Tracer.Debug("FlowEngineService:FormID-" + submitData.FormID + "--submitDataXML:" + submitData.XML);
                                }
                                #endregion
                            }
                            #endregion
                            break;
                    }
                    #endregion
                    #endregion  调用引擎服务(调用本地服DLL)

                }
            }
            catch (Exception ex)
            {
                //Tracer.Debug("FlowEngineService: -" + "\n\nError:" + ex.InnerException + ex.Message);
                LogHelper.WriteLog(this, "SubmitEngineService", "", ex);
                throw new Exception(ErroMessage);
            }
            #endregion
        }
Esempio n. 3
0
File: FlowBLL.cs Progetto: JuRogn/OA
        public static ModelInfo GetSysCodeByModelCode(string ModelCode)
        {
            ModelInfo tmpModelInfo = new ModelInfo();
            try
            {
                var dt= FLOW_MODELDEFINE_TDAL.GetModelDefineByCode(ModelCode);
                //Flow_ModelDefine_TDAL Dal = new Flow_ModelDefine_TDAL();
                //var dt = Dal.GetModelDefineByCode(ModelCode);

                if (dt.Count > 0)
                {
                    tmpModelInfo.SysCode = dt[0].SYSTEMCODE;
                    tmpModelInfo.ModelName = dt[0].DESCRIPTION;                    
                    return tmpModelInfo;
                }
                return null;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                tmpModelInfo = null;
            }

        }