Exemple #1
0
        public void AddConsultation(OracleConnection con, FLOW_CONSULTATION_T flowConsultation, SubmitData submitData)
        {

            if (strIsFlowEngine.ToLower() == "true")
            {
                try
                {
                    flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T =
                        FlowBLL2.GetFLOW_FLOWRECORDMASTER_T(con, flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID);
                    FlowEngineService.EngineWcfGlobalFunctionClient FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    FlowEngineService.CustomUserMsg[] cs = new FlowEngineService.CustomUserMsg[1];

                    FlowEngineService.CustomUserMsg cu = new FlowEngineService.CustomUserMsg();
                    cu.FormID = flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID;
                    cu.UserID = flowConsultation.REPLYUSERID;
                    cs[0] = cu;
                    ModelInfo modelinfo = FlowBLL2.GetSysCodeByModelCode(con, submitData.ModelCode);
                    MessageData tmpMessageData = new MessageData("Flow", modelinfo.SysCode,
                        flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID,
                        submitData.ModelCode, modelinfo.ModelName, submitData.FormID, flowConsultation.FLOW_FLOWRECORDDETAIL_T.STATECODE, flowConsultation.FLOW_FLOWRECORDDETAIL_T.CHECKSTATE, "", "", "", "");
                    FlowBLL2 flowBLL = new FlowBLL2();
                    StringBuilder FlowResultXml = flowBLL.BuildMessageData(tmpMessageData);
                    //FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    //log = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    if (!string.IsNullOrEmpty(flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT))
                    {
                        submitData.XML = flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT;
                    }

                    bool b = FlowEngine.FlowConsultati(cs, "", FlowResultXml.ToString(), submitData.XML);
                    if (!b)
                    {
                        Tracer.Debug("FlowEngineService-FlowConsultati:" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID
                            + "\nsubmitData:" + submitData.XML);
                    }

                    FlowBLL2 bll = new FlowBLL2();

                    bll.AddConsultation(con, flowConsultation);
                }
                catch (Exception ex)
                {
                    Tracer.Debug("AddConsultation: -" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "-" + ex.InnerException + ex.Message);
                    throw ex;
                }
            }



        }
Exemple #2
0
        public DataResult SubimtFlow(SubmitData submitData)
        {
            #region
            //submitData = new SubmitData();
            //StringBuilder sb2 = new StringBuilder();
            //sb2.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            //sb2.AppendLine("<System>");
            //sb2.AppendLine("  <Name>OA</Name>");
            //sb2.AppendLine("  <Version>1.0</Version>");
            //sb2.AppendLine("  <System>");
            //sb2.AppendLine("    <Function Description=\"事项审批\" Address=\"SmtOAPersonOffice.svc\" FuncName=\"CallApplicationService\" Binding=\"customBinding\" SplitChar=\"Г\">");
            //sb2.AppendLine("      <ParaStr>");
            //sb2.AppendLine("        <Para TableName=\"T_OA_APPROVALINFO\" Name=\"APPROVALID\" Description=\"报批件ID\" Value=\"\"></Para>");
            //sb2.AppendLine("      </ParaStr>");
            //sb2.AppendLine("    </Function>");
            //sb2.AppendLine("  </System>");
            //sb2.AppendLine("  <MsgOpen>");
            //sb2.AppendLine("    <AssemblyName>SMT.SaaS.OA.UI</AssemblyName>");
            //sb2.AppendLine("    <PublicClass>SMT.SaaS.OA.UI.Utility</PublicClass>");
            //sb2.AppendLine("    <ProcessName>CreateFormFromEngine</ProcessName>");
            //sb2.AppendLine("    <PageParameter>SMT.SaaS.OA.UI.UserControls.ApprovalForm_aud</PageParameter>");
            //sb2.AppendLine("    <ApplicationOrder>{APPROVALID}</ApplicationOrder>");
            //sb2.AppendLine("    <FormTypes>Audit</FormTypes>");
            //sb2.AppendLine("  </MsgOpen>");
            //sb2.AppendLine("  <Object Name=\"T_OA_APPROVALINFO\" Description=\"事项审批\" Key=\"APPROVALID\" id=\"ea454559-3810-4fa2-8500-b20c480dd4bd\">");
            //sb2.AppendLine("    <Attribute Name=\"CURRENTEMPLOYEENAME\" LableResourceID=\"CURRENTEMPLOYEENAME\" Description=\"提交者\" DataType=\"string\" DataValue=\"\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"APPROVALID\" LableResourceID=\"APPROVALID\" Description=\"报批件ID\" DataType=\"string\" DataValue=\"ea454559-3810-4fa2-8500-b20c480dd4bd\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"APPROVALCODE\" LableResourceID=\"CODINGMATTERS\" Description=\"事项编码\" DataType=\"string\" DataValue=\"BPJ201205050001\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"APPROVALTITLE\" LableResourceID=\"TITLEMATTERS\" Description=\"事项标题\" DataType=\"string\" DataValue=\"旧流程数据到新流程数据过度测试\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"TEL\" LableResourceID=\"TEL\" Description=\"电话\" DataType=\"string\" DataValue=\"88997744\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"ISCHARGE\" LableResourceID=\"ISCHARGE\" Description=\"是否有费用\" DataType=\"string\" DataValue=\"1\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CHARGEMONEY\" LableResourceID=\"Fees\" Description=\"费用\" DataType=\"decimal\" DataValue=\"500\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CHECKSTATE\" LableResourceID=\"CHECKSTATE\" Description=\"审批状态\" DataType=\"string\" DataValue=\"0\" DataText=\"审核中\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"OWNERID\" LableResourceID=\"OWNERID\" Description=\"所属员工\" DataType=\"string\" DataValue=\"1bc4b78a-d178-4499-b948-16e18a9d73d3\" DataText=\"人事001-人事经理-人力资源部-模拟测试公司\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"OWNERNAME\" LableResourceID=\"OWNERNAME\" Description=\"当事人\" DataType=\"string\" DataValue=\"人事001\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"OWNERCOMPANYID\" LableResourceID=\"OWNERCOMPANYID\" Description=\"所属公司\" DataType=\"string\" DataValue=\"491d6eac-3bae-47ca-8998-89d39fc6faea\" DataText=\"模拟测试公司\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"OWNERDEPARTMENTID\" LableResourceID=\"OWNERDEPARTMENTID\" Description=\"所属部门\" DataType=\"string\" DataValue=\"4b146209-9442-489a-b19d-b70bd6a720d6\" DataText=\"人力资源部\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"OWNERPOSTID\" LableResourceID=\"OWNERPOSTID\" Description=\"所属岗位\" DataType=\"string\" DataValue=\"6d438cb1-92a8-4a07-a2ab-49926c68d1cd\" DataText=\"人事经理\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CREATEUSERID\" LableResourceID=\"CREATEUSERID\" Description=\"创建人\" DataType=\"string\" DataValue=\"1bc4b78a-d178-4499-b948-16e18a9d73d3\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CREATEUSERNAME\" LableResourceID=\"CREATEUSERNAME\" Description=\"创建人\" DataType=\"string\" DataValue=\"人事001\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CREATECOMPANYID\" LableResourceID=\"CREATECOMPANYID\" Description=\"创建公司\" DataType=\"string\" DataValue=\"491d6eac-3bae-47ca-8998-89d39fc6faea\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CREATEDEPARTMENTID\" LableResourceID=\"CREATEDEPARTMENTID\" Description=\"创建人部门\" DataType=\"string\" DataValue=\"4b146209-9442-489a-b19d-b70bd6a720d6\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CREATEPOSTID\" LableResourceID=\"CREATEPOSTID\" Description=\"创建人岗位\" DataType=\"string\" DataValue=\"6d438cb1-92a8-4a07-a2ab-49926c68d1cd\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CREATEDATE\" LableResourceID=\"CREATEDATE\" Description=\"创建日期\" DataType=\"DateTime\" DataValue=\"2012/5/5 15:42:27\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"UPDATEUSERID\" LableResourceID=\"UPDATEUSERID\" Description=\"修改人\" DataType=\"string\" DataValue=\"\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"UPDATEUSERNAME\" LableResourceID=\"UPDATEUSERNAME\" Description=\"修改人名\" DataType=\"string\" DataValue=\"\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"UPDATEDATE\" LableResourceID=\"UPDATEDATE\" Description=\"修改时间\" DataType=\"DateTime\" DataValue=\"\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"CONTENT\" LableResourceID=\"CONTENT\" Description=\"内容\" DataType=\"RTF\" DataValue=\"ea454559-3810-4fa2-8500-b20c480dd4bd\" DataText=\"ea454559-3810-4fa2-8500-b20c480dd4bd\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"AttachMent\" LableResourceID=\"AttachMent\" Description=\"附件\" DataType=\"attachmentlist\" DataValue=\"ea454559-3810-4fa2-8500-b20c480dd4bd\" DataText=\"ea454559-3810-4fa2-8500-b20c480dd4bd\" />");
            //sb2.AppendLine("    <Attribute Name=\"POSTLEVEL\" LableResourceID=\"POSTLEVEL\" Description=\"岗位级别\" DataType=\"string\" DataValue=\"15\" DataText=\"15\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"TYPEAPPROVAL\" LableResourceID=\"TYPEAPPROVAL\" Description=\"事项类型\" DataType=\"string\" DataValue=\"5\" DataText=\"公司制度修改\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"TYPEAPPROVALONE\" LableResourceID=\"TYPEAPPROVALONE\" Description=\"上级事项审批类型\" DataType=\"string\" DataValue=\"0\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"TYPEAPPROVALTWO\" LableResourceID=\"TYPEAPPROVALTWO\" Description=\"上上级事项审批类型\" DataType=\"string\" DataValue=\"\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("    <Attribute Name=\"TYPEAPPROVALTHREE\" LableResourceID=\"TYPEAPPROVALTHREE\" Description=\"上上上级事项审批类型\" DataType=\"string\" DataValue=\"\" DataText=\"\"></Attribute>");
            //sb2.AppendLine("  </Object>");
            //sb2.AppendLine("</System>");

            //submitData.FlowSelectType = FlowSelectType.FixedFlow;
            //submitData.FormID = "ea454559-3810-4fa2-8500-b20c480dd4bd";
            //submitData.ModelCode = "T_OA_APPROVALINFO";
            //submitData.ApprovalUser = new UserInfo();
            //submitData.ApprovalUser.CompanyID = "491d6eac-3bae-47ca-8998-89d39fc6faea";
            //submitData.ApprovalUser.DepartmentID = "4b146209-9442-489a-b19d-b70bd6a720d6";
            //submitData.ApprovalUser.PostID = "6d438cb1-92a8-4a07-a2ab-49926c68d1cd";
            //submitData.ApprovalUser.UserID = "1bc4b78a-d178-4499-b948-16e18a9d73d3";
            //submitData.ApprovalUser.UserName = "******";
            //submitData.NextStateCode = "";
            //submitData.NextApprovalUser = new UserInfo();
            //submitData.NextApprovalUser.CompanyID = "";
            //submitData.NextApprovalUser.DepartmentID = "";
            //submitData.NextApprovalUser.PostID = "";
            //submitData.NextApprovalUser.UserID = "";
            //submitData.NextApprovalUser.UserName = "";
            //submitData.SubmitFlag = SubmitFlag.New;
            //submitData.XML = sb2.ToString();
            //submitData.FlowType = FlowType.Approval;
            //submitData.ApprovalResult = ApprovalResult.Pass;
            //submitData.ApprovalContent = "提交";
            #endregion
            //调试外网 st = new 调试外网();
            //return st.SubimtFlow(submitData);
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("submitData.FlowSelectType =\"" + submitData.FlowSelectType + "\";");
            sb.AppendLine("submitData.FormID = \"" + submitData.FormID + "\";");
            sb.AppendLine("submitData.ModelCode = \"" + submitData.ModelCode + "\";");
            sb.AppendLine("submitData.ApprovalUser.CompanyID = \"" + submitData.ApprovalUser.CompanyID + "\";");
            sb.AppendLine("submitData.ApprovalUser.DepartmentID = \"" + submitData.ApprovalUser.DepartmentID + "\";");
            sb.AppendLine("submitData.ApprovalUser.PostID = \"" + submitData.ApprovalUser.PostID + "\";");
            sb.AppendLine("submitData.ApprovalUser.UserID = \"" + submitData.ApprovalUser.UserID + "\";");
            sb.AppendLine("submitData.ApprovalUser.UserName = \"" + submitData.ApprovalUser.UserName + "\";");
            sb.AppendLine("submitData.NextStateCode = \"" + (submitData.NextStateCode != null ? submitData.NextStateCode : "空") + "\";");
            sb.AppendLine("submitData.NextApprovalUser = \"" + submitData.NextApprovalUser + "\";");
            sb.AppendLine("submitData.NextApprovalUser.CompanyID = \"" + (submitData.NextApprovalUser != null ? submitData.NextApprovalUser.CompanyID : "空") + "\";");
            sb.AppendLine("submitData.NextApprovalUser.DepartmentID = \"" + (submitData.NextApprovalUser != null ? submitData.NextApprovalUser.DepartmentID : "空") + "\";");
            sb.AppendLine("submitData.NextApprovalUser.PostID = \"" + (submitData.NextApprovalUser != null ? submitData.NextApprovalUser.PostID : "空") + "\";");
            sb.AppendLine("submitData.NextApprovalUser.UserID = \"" + (submitData.NextApprovalUser != null ? submitData.NextApprovalUser.UserID : "空") + "\";");
            sb.AppendLine("submitData.NextApprovalUser.UserName = \"" + (submitData.NextApprovalUser != null ? submitData.NextApprovalUser.UserName : "******") + "\";");
            sb.AppendLine("submitData.SubmitFlag = \"" + submitData.SubmitFlag + "\";");
            // sb.AppendLine("submitData.XML = \"" + submitData.XML + "\";");
            sb.AppendLine("submitData.FlowType = \"" + submitData.FlowType.ToString() + "\";");
            sb.AppendLine("submitData.ApprovalResult = \"" + submitData.ApprovalResult.ToString() + "\";");
            sb.AppendLine("submitData.ApprovalContent = \"" + submitData.ApprovalContent + "\";");
            LogHelper.WriteLog("提交审核的信息:\r\n" + sb.ToString() + "\r\n");
            LogHelper.WriteLog("流程引擎的XML数据", "SubimtFlow入口处:" + submitData.ApprovalContent + " FormID=" + submitData.FormID + ";ModelCode=" + submitData.ModelCode + " \r\n submitData.XML:\r\n" + submitData.XML);
            LogHelper.WriteLog("***********************************************开始" + DateTime.Now.ToString() + "***********************************************");
            string msg = "";

            // MsOracle.BeginTransaction(con);

            DateTime dtStart = DateTime.Now;
            DateTime dtEngineStart = DateTime.Now;
            DateTime dtEnd = DateTime.Now;
            DateTime dtCheckData = DateTime.Now;
            //using (TransactionScope ts = new TransactionScope())
            //设置2分钟超时时间
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(DateTime.Now.AddMinutes(2).Ticks)))
            {
                OracleConnection con = ADOHelper.GetOracleConnection();
                #region 事务处理

                //System.Threading.Thread.Sleep(60000);
                DataResult dataResult = new DataResult();
                FlowBLL2 Flowbill = new FlowBLL2();
                string AppCompanyID = "";  //申请公司
                string MessageUserID = ""; //申请人ID
                string MessageUserName = ""; //申请人名
                dataResult.FlowResult = FlowResult.SUCCESS;
                try
                {
                    #region 检查流程数据是否规范
                    if (!FlowBLL2.CheckFlowData(submitData, ref dataResult))
                    {
                        dataResult.FlowResult = FlowResult.FAIL;
                        {
                            //ts.Complete();
                            return dataResult;
                        }
                    }
                    #endregion
                    submitData.ApprovalResult = submitData.SubmitFlag == SubmitFlag.New ? ApprovalResult.Pass : submitData.ApprovalResult;
                    submitData.FlowSelectType = submitData.FlowSelectType == null ? FlowSelectType.FixedFlow : submitData.FlowSelectType;
                    #region
                    #region 检查是否已提交流程(对数据库操作)
                    msg += "检查是否已提交流程" + DateTime.Now.ToString() + "\r\n";
                    LogHelper.WriteLog("检查是否已提交流程FormID = " + submitData.FormID);
                    OracleConnection ocon = ADOHelper.GetOracleConnection();
                    CheckResult CheckFlowResult = Flowbill.CheckFlow2(ocon, submitData, dataResult);//对数据库操作                    
                    msg += "检查是否已提交流程完成" + DateTime.Now.ToString() + "\r\n";
                    LogHelper.WriteLog("检查是否已提交流程完成FormID =" + submitData.FormID);
                    dtCheckData = DateTime.Now;
                    dataResult = CheckFlowResult.APPDataResult;
                    if (CheckFlowResult.Flag == 0)//已审批:1,未审批:0
                    {
                        //ts.Complete();
                        //return dataResult;
                    }
                    if (ocon.State == ConnectionState.Open)
                    {
                        ocon.Close();
                    }

                    #endregion
                    dataResult.AppState = submitData.NextStateCode;
                    //提交新流程
                    if (submitData.SubmitFlag == SubmitFlag.New)
                    {
                        #region 新增
                        AppCompanyID = submitData.ApprovalUser.CompanyID;
                        if (submitData.FlowSelectType == FlowSelectType.FreeFlow)
                            //自选流程
                            dataResult = Flowbill.AddFreeFlow(con, submitData, dataResult);//对数据库操作
                        else
                        {
                            //固定流程
                            msg += "固定流程" + DateTime.Now.ToString() + "\r\n";
                            LogHelper.WriteLog("固定流程.Flowbill.AddFlow2");
                            dataResult = Flowbill.AddFlow2(con, submitData, dataResult, ref msg);//对数据库操作
                            msg += "固定流程完成" + DateTime.Now.ToString() + "\r\n";
                        }
                        #endregion

                    }
                    else if (submitData.SubmitFlag == SubmitFlag.Cancel)
                    {
                        #region 撤单
                        if (!string.IsNullOrEmpty(CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT))
                        {
                            submitData.XML = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT;
                        }
                        submitData.ApprovalContent = "";
                        dataResult = Flowbill.CancelFlow(submitData, dataResult, CheckFlowResult.fd);
                        dataResult.SubmitFlag = submitData.SubmitFlag;
                        #endregion
                    }

                    //审批流程
                    else
                    {
                        msg += "审核" + DateTime.Now.ToString() + "\r\n";
                        #region  审核
                        if (!string.IsNullOrEmpty(CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT))
                        {
                            submitData.XML = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT;
                        }
                        //引擎消息数据
                        AppCompanyID = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID;
                        MessageUserID = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.CREATEUSERID;
                        MessageUserName = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME;
                        submitData.ApprovalUser.CompanyID = CheckFlowResult.fd[0].EDITCOMPANYID;
                        submitData.ApprovalUser.DepartmentID = CheckFlowResult.fd[0].EDITDEPARTMENTID;
                        submitData.ApprovalUser.PostID = CheckFlowResult.fd[0].EDITPOSTID;
                        submitData.FlowSelectType = (FlowSelectType)Convert.ToInt32(CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.FLOWSELECTTYPE);
                        if (submitData.FlowSelectType == FlowSelectType.FreeFlow)
                            dataResult = Flowbill.ApprovalFreeFlow(con, submitData, dataResult, CheckFlowResult.fd);//对数据库操作、对服务操作
                        else
                            dataResult = Flowbill.ApprovalFlow2(con, submitData, dataResult, CheckFlowResult.fd, ref msg);
                        #endregion
                        msg += "审核完成" + DateTime.Now.ToString() + "\r\n";
                    }

                    #endregion
                    ModelInfo modelinfo = FlowBLL2.GetSysCodeByModelCode(con, submitData.ModelCode);//对数据库操作
                    if (dataResult.FlowResult == FlowResult.MULTIUSER)
                    {//如果检出有多个审核人时,返回界面让用户选择一个人进行审核
                        string users = "检出有多个审核人\r\n";
                        foreach (var u in dataResult.UserInfo)
                        {
                            users += "CompanyID      =" + u.CompanyID + "\r\n";
                            users += "DepartmentID   = " + u.DepartmentID + "\r\n";
                            users += "PostID         = " + u.PostID + "\r\n";
                            users += "serID          = " + u.UserID + "\r\n";
                            users += "UserName       = "******"\r\n";
                            users += "------------------------------------\r\n";
                        }
                        LogHelper.WriteLog(users + "检出有多个审核人,返回界面让用户选择一个人进行审核 FormID =" + submitData.FormID);
                        return dataResult;
                    }
                    //return dataResult;//测试检查流程用的,不能提交事务
                    LogHelper.WriteLog("模块名称:submitData.ModelCode=" + submitData.ModelCode + ";modelinfo.ModelName=" + modelinfo.ModelName);
                    //ts.Complete(); //提交事务                           
                    if (string.IsNullOrEmpty(strIsFlowEngine) || strIsFlowEngine.ToLower() == "true")
                    {
                        msg += "发送审批消息(调用引擎服务)" + DateTime.Now.ToString() + "\r\n";
                        #region 发送审批消息(调用引擎服务)
                        LogHelper.WriteLog("开始(调用引擎服务):SubmitEngineService");
                        SubmitEngineService(con, submitData, dataResult, modelinfo, CheckFlowResult, Flowbill, AppCompanyID, MessageUserID, MessageUserName, ref msg);
                        LogHelper.WriteLog("结束(调用引擎服务):SubmitEngineService");
                        #endregion
                        msg += "发送审批消息(调用引擎服务)完成" + DateTime.Now.ToString() + "\r\n";
                    }
                    dtEnd = DateTime.Now;
                    dataResult.SubmitFlag = submitData.SubmitFlag;
                    msg += "开始时间" + dtStart.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "\r\n";
                    msg += "结束时间" + dtEnd.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "\r\n";
                    msg += "完成时间" + DateDiff(dtEnd, dtStart);
                    ts.Complete();//提交事务
                    MsOracle.Close(con);//关闭数据库  
                    LogHelper.WriteLog("执行流程成功:FormID=" + submitData.FormID);
                    //LogHelper.WriteLog(msg);
                    return dataResult;
                }
                catch (Exception ex)
                {
                    ts.Dispose();
                    if (con.State == System.Data.ConnectionState.Open)
                    {
                        con.Close();
                        con.Dispose();
                    }
                    dataResult.RunTime += "---FlowEnd:" + DateTime.Now.ToString();
                    dataResult.FlowResult = FlowResult.FAIL;
                    // Flowbill              = null;
                    dataResult.Err = ex.Message;
                    // Tracer.Debug("FlowService: -" + submitData.FormID + "--submitDataXML:" + submitData.XML + "-" + ex.InnerException + ex.Message);
                    LogHelper.WriteLog("执行流程失败:FormID=" + submitData.FormID + " 异常信息:" + ex.Message);
                    return dataResult;
                }
                finally
                {
                    if (Flowbill.workflowRuntime != null && Flowbill.workflowRuntime.IsStarted)
                    {
                        Flowbill.workflowRuntime.Dispose();
                    }
                    if (con.State == System.Data.ConnectionState.Open)
                    {
                        con.Close();
                        con.Dispose();
                    }
                    dataResult = null;
                    // Tracer.Debug("-------Trace--FormID:" + submitData.FormID + "DateTime: Start:" + dtStart.ToString()  + "  EngineStart:" + dtEngineStart.ToString() + "  End:" + dtEnd.ToString() + "\n");

                }
                #endregion
            }

        }
Exemple #3
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
        }
Exemple #4
0
        /// <summary>
        /// 通过机构ID和模块代码查询对应流程代码
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        //public List<FLOW_MODELFLOWRELATION_T> GetFlowByModel(FLOW_MODELFLOWRELATION_T entity)
        //{
        //    return FlowBLL2.GetFlowByModel(entity);
        //}

        public string GetFlowDefine(OracleConnection con, SubmitData ApprovalData)
        {

            FlowBLL2 Flow = new FlowBLL2();
            return Flow.GetFlowDefine(con, ApprovalData);
        }
Exemple #5
0
 /// <summary>
 /// 根据流程ID获取流程的所有分支
 /// </summary>
 /// <param name="FlowID"></param>
 /// <returns></returns>
 public List<string> GetFlowBranch(string FlowID)
 {
     FlowBLL2 Flow = new FlowBLL2();
     return Flow.GetFlowBranch(FlowID);
 }
Exemple #6
0
        public string UpdateFlow(OracleConnection con, FLOW_FLOWRECORDDETAIL_T entity)
        {

            FlowBLL2 bll = new FlowBLL2();
            bll.UpdateFlowRecord(con, entity, "", "");

            return "";
        }
Exemple #7
0
        public void ReplyConsultation(OracleConnection con, FLOW_CONSULTATION_T flowConsultation, SubmitData submitData)
        {
            if (strIsFlowEngine.ToLower() == "true")
            {
                try
                {


                    FlowEngineService.EngineWcfGlobalFunctionClient FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    //Byte[] Bo = System.Text.UTF8Encoding.UTF8.GetBytes(submitData.XML);
                    //XElement xemeBoObject = XElement.Load(System.Xml.XmlReader.Create(new MemoryStream(Bo)));
                    //string strSystemCode = (from item in xemeBoObject.Descendants("Name") select item).FirstOrDefault().Value;


                    ModelInfo modelinfo = FlowBLL2.GetSysCodeByModelCode(con, submitData.ModelCode);
                    FlowEngine.FlowConsultatiClose(modelinfo.SysCode, flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID, flowConsultation.REPLYUSERID);

                    FlowBLL2 bll = new FlowBLL2();
                    bll.ReplyConsultation(con, flowConsultation);
                }
                catch (Exception ex)
                {
                    Tracer.Debug("ReplyConsultation: -" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "-" + ex.InnerException + ex.Message);
                    throw ex;
                }
            }

        }
Exemple #8
0
 /// <summary>
 /// 获取用户有哪些未处理的单据
 /// </summary>
 /// <param name="UserID"></param>
 /// <returns></returns>
 public List<FLOW_FLOWRECORDMASTER_T> GetFlowDataByUserID(OracleConnection con, string UserID)
 {
     try
     {
         FlowBLL2 Flow = new FlowBLL2();
         return Flow.GetFlowDataByUserID(con, UserID);
     }
     catch (Exception ex)
     {
         Tracer.Debug("GetFlowDataByUserID:" + UserID + " Ex:" + ex.Message);
         throw ex;
     }
 }
Exemple #9
0
 /// <summary>
 /// 检测用户是否有未处理的单据
 /// </summary>
 /// <param name="UserID"></param>
 /// <returns></returns>
 public string IsExistFlowDataByUserID(string UserID, string PostID)
 {
     OracleConnection con = ADOHelper.GetOracleConnection();
     try
     {
         FlowBLL2 Flow = new FlowBLL2();
         return Flow.IsExistFlowDataByUserID(con, UserID, PostID);
     }
     catch (Exception ex)
     {
         Tracer.Debug("IsExistFlowDataByUserID:" + UserID + " Ex:" + ex.Message);
         throw ex;
     }
 }
Exemple #10
0
        public DataResult SubimtFlow(SubmitData submitData)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("SubmitData.FlowSelectType =\"" + submitData.FlowSelectType + "\";");
            sb.AppendLine("SubmitData.FormID = \"" + submitData.FormID + "\";");
            sb.AppendLine("SubmitData.ModelCode = \"" + submitData.ModelCode + "\";");
            sb.AppendLine("SubmitData.ApprovalUser = \"" + submitData.ApprovalUser + "\";");
            sb.AppendLine("SubmitData.ApprovalUser.CompanyID = \"" + submitData.ApprovalUser.CompanyID + "\";");
            sb.AppendLine("SubmitData.ApprovalUser.DepartmentID = \"" + submitData.ApprovalUser.DepartmentID + "\";");
            sb.AppendLine("SubmitData.ApprovalUser.PostID = \"" + submitData.ApprovalUser.PostID + "\";");
            sb.AppendLine("SubmitData.ApprovalUser.UserID = \"" + submitData.ApprovalUser.UserID + "\";");
            sb.AppendLine("SubmitData.ApprovalUser.UserName = \"" + submitData.ApprovalUser.UserName + "\";");
            sb.AppendLine("SubmitData.NextStateCode = \"\";");
            sb.AppendLine("SubmitData.NextApprovalUser = \"" + submitData.NextApprovalUser + "\";");
            sb.AppendLine("SubmitData.NextApprovalUser.CompanyID = \"\";");
            sb.AppendLine("SubmitData.NextApprovalUser.DepartmentID = \"\";");
            sb.AppendLine("SubmitData.NextApprovalUser.PostID = \"\";");
            sb.AppendLine("SubmitData.NextApprovalUser.UserID = \"\";");
            sb.AppendLine("SubmitData.NextApprovalUser.UserName = \"\";");
            sb.AppendLine("SubmitData.SubmitFlag = \"" + submitData.SubmitFlag + "\";");
            //sb.AppendLine("SubmitData.XML = \"" + submitData.XML + "\";");
            sb.AppendLine("SubmitData.FlowType = \"" + submitData.FlowType + "\";");
            sb.AppendLine("SubmitData.ApprovalResult = \"" + submitData.ApprovalResult + "\";");
            sb.AppendLine("SubmitData.ApprovalContent = \"" + submitData .ApprovalContent+ "\";");


            LogHelper.WriteLog("***********************************************开始" + DateTime.Now.ToString() + "***********************************************\r\n");
            LogHelper.WriteLog("提交审核的信息:\r\n" + sb.ToString() + "\r\n");
            string msg = "";
           
           // MsOracle.BeginTransaction(con);
           
            DateTime dtStart       = DateTime.Now;
            DateTime dtEngineStart = DateTime.Now;
            DateTime dtEnd         = DateTime.Now;
            DateTime dtCheckData   = DateTime.Now;
            //using (TransactionScope ts = new TransactionScope())
            //设置2分钟超时时间
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(DateTime.Now.AddMinutes(2).Ticks)))
            {
                OracleConnection con = ADOHelper.GetOracleConnection();
                #region 事务处理
             
                //System.Threading.Thread.Sleep(60000);
                DataResult dataResult  = new DataResult();
                FlowBLL2 Flowbill      = new FlowBLL2();                
                string AppCompanyID    = "";  //申请公司
                string MessageUserID   = ""; //申请人ID
                string MessageUserName = ""; //申请人名
                dataResult.FlowResult = FlowResult.SUCCESS;
                try
                {
                    #region 检查流程数据是否规范
                    if (!FlowBLL2.CheckFlowData(submitData, ref dataResult))
                    {
                        dataResult.FlowResult = FlowResult.FAIL;
                        {
                          //ts.Complete();
                            return dataResult;
                        }
                    }
                   
                    #endregion 
                    submitData.ApprovalResult = submitData.SubmitFlag == SubmitFlag.New ? ApprovalResult.Pass : submitData.ApprovalResult;
                    submitData.FlowSelectType = submitData.FlowSelectType == null ? FlowSelectType.FixedFlow : submitData.FlowSelectType;                    
                    #region 
                    #region 检查是否已提交流程(对数据库操作)
                    msg += "检查是否已提交流程"+DateTime.Now.ToString()+"\r\n";
                    LogHelper.WriteLog("检查是否已提交流程FormID = " + submitData.FormID);

                    OracleConnection ocon = ADOHelper.GetOracleConnection();
                    CheckResult CheckFlowResult = Flowbill.CheckFlow2(ocon, submitData, dataResult);//对数据库操作                    
                    msg += "检查是否已提交流程完成" + DateTime.Now.ToString() + "\r\n";
                    LogHelper.WriteLog("检查是否已提交流程完成FormID =" + submitData.FormID);
                    dtCheckData = DateTime.Now;
                    dataResult = CheckFlowResult.APPDataResult;
                    if (CheckFlowResult.Flag == 0)//已审批:1,未审批:0
                    {
                        //ts.Complete();
                        //return dataResult;
                    }
                    if (ocon.State == ConnectionState.Open)
                    {
                        ocon.Close();
                    }
                    #endregion 
                    dataResult.AppState = submitData.NextStateCode;
                  
                    //提交新流程
                    if (submitData.SubmitFlag == SubmitFlag.New)
                    {
                        LogHelper.WriteLog("新增(开始) FormID =" + submitData.FormID);
                        #region 新增
                        AppCompanyID = submitData.ApprovalUser.CompanyID;
                        if (submitData.FlowSelectType == FlowSelectType.FreeFlow)
                        {
                            //自选流程
                            LogHelper.WriteLog("自选流程.Flowbill.AddFlow2 FormID =" + submitData.FormID);
                            dataResult = Flowbill.AddFreeFlow(con, submitData, dataResult);//对数据库操作
                        }
                        else
                        {
                            //固定流程
                            msg += "固定流程" + DateTime.Now.ToString() + "\r\n";
                            LogHelper.WriteLog("固定流程.Flowbill.AddFlow2 FormID =" + submitData.FormID);
                            dataResult = Flowbill.AddFlow2(con, submitData, dataResult, ref msg);//对数据库操作
                            msg += "固定流程完成" + DateTime.Now.ToString() + "\r\n";
                        }
                        #endregion 
                        LogHelper.WriteLog("新增(结束) FormID =" + submitData.FormID);

                    }
                    else if (submitData.SubmitFlag == SubmitFlag.Cancel)
                    {
                        #region 撤单
                        LogHelper.WriteLog("撤单(开始) FormID =" + submitData.FormID);
                        if (!string.IsNullOrEmpty(CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT))
                        {
                            submitData.XML = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT;
                        }
                        submitData.ApprovalContent = "";
                        dataResult                 = Flowbill.CancelFlow(submitData, dataResult, CheckFlowResult.fd);
                        dataResult.SubmitFlag      = submitData.SubmitFlag;
                        LogHelper.WriteLog("撤单(结束) FormID =" + submitData.FormID);
                        #endregion 
                    }
                    
                    //审批流程
                    else
                    {
                        msg += "审核" + DateTime.Now.ToString() + "\r\n";
                        LogHelper.WriteLog("审核(开始) FormID =" + submitData.FormID);
                        #region  审核
                        if (!string.IsNullOrEmpty(CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT))
                        {
                            submitData.XML = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT;
                        }                        
                        //引擎消息数据
                        AppCompanyID                         = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID;
                        MessageUserID                        = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.CREATEUSERID;
                        MessageUserName                      = CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME;                        
                        submitData.ApprovalUser.CompanyID    = CheckFlowResult.fd[0].EDITCOMPANYID;
                        submitData.ApprovalUser.DepartmentID = CheckFlowResult.fd[0].EDITDEPARTMENTID;
                        submitData.ApprovalUser.PostID       = CheckFlowResult.fd[0].EDITPOSTID;
                        submitData.FlowSelectType            = (FlowSelectType)Convert.ToInt32(CheckFlowResult.fd[0].FLOW_FLOWRECORDMASTER_T.FLOWSELECTTYPE);
                        if (submitData.FlowSelectType == FlowSelectType.FreeFlow)
                            dataResult = Flowbill.ApprovalFreeFlow(con, submitData, dataResult, CheckFlowResult.fd);//对数据库操作、对服务操作
                        else
                            dataResult = Flowbill.ApprovalFlow2(con, submitData, dataResult, CheckFlowResult.fd, ref msg);
                        #endregion 
                        LogHelper.WriteLog("审核(结束) FormID =" + submitData.FormID);
                        msg += "审核完成" + DateTime.Now.ToString() + "\r\n";
                    }
                    
                    #endregion                  
                    ModelInfo modelinfo = FlowBLL2.GetSysCodeByModelCode(con, submitData.ModelCode);
                    #region 记录审核人日志信息
                    string loginfo = "===================================FormID=" + submitData.FormID + "============================================\r\n";
                   
                    if (dataResult.IsCountersign.ToString().ToLower() == "true")
                    {
                        loginfo += "是否会签=" + dataResult.IsCountersign.ToString() + "\r\n";
                        loginfo += "是否会签完成" + dataResult.IsCountersignComplete.ToString() + "\r\n";
                    }
                    loginfo += "模块关联流程ID=" + dataResult.ModelFlowRelationID + "\r\n";
                    loginfo += "子模块代码=" + dataResult.SubModelCode + "\r\n";
                    if (dataResult.AgentUserInfo != null)
                    {
                       
                        loginfo = "\r\n 代理审核人 \r\n";
                        loginfo += "代理公司ID=" + dataResult.AgentUserInfo.CompanyID + "\r\n";
                        loginfo += "代理部门ID=" + dataResult.AgentUserInfo.DepartmentID + "\r\n";
                        loginfo += "代理岗位ID" + dataResult.AgentUserInfo.PostID + "\r\n";
                        loginfo += "代理用户ID=" + dataResult.AgentUserInfo.UserID + "\r\n";
                        loginfo += "代理用户名称=" + dataResult.AgentUserInfo.UserName + "\r\n";
                    }                    
                    if (dataResult.UserInfo.Count > 0)
                    {
                        if (dataResult.FlowResult == FlowResult.MULTIUSER)
                        {//如果检出有多个审核人时,返回界面让用户选择一个人进行审核
                            loginfo = "\r\n 检出有多个审核人 \r\n";
                        }
                        loginfo += "dataResult.UserInfo 审核人员信息\r\n";
                        foreach (var u in dataResult.UserInfo)
                        {
                            loginfo += "公司ID=" + u.CompanyID + "\r\n";
                            loginfo += "部门ID= " + u.DepartmentID + "\r\n";
                            loginfo += "岗位ID= " + u.PostID + "\r\n";
                            loginfo += "用户ID= " + u.UserID + "\r\n";
                            loginfo += "用户名= " + u.UserName + "\r\n";
                            loginfo += "------------------------------------\r\n";
                        }
                    }     
                    loginfo += "模块代码 ModelCode=" + submitData.ModelCode + "\r\n";
                    loginfo += "模块名称 ModelName=" + modelinfo.ModelName + "\r\n";
                    loginfo += "下一审批人 公司ID=" + submitData.NextApprovalUser.CompanyID + "\r\n";
                    loginfo += "下一审批人 部门ID=" + submitData.NextApprovalUser.DepartmentID + "\r\n";
                    loginfo += "下一审批人 岗位ID=" + submitData.NextApprovalUser.PostID + "\r\n";
                    loginfo += "下一审批人 用户ID=" + submitData.NextApprovalUser.UserID + "\r\n";
                    loginfo += "下一审批人 用户名=" + submitData.NextApprovalUser.UserName + "\r\n";
                    loginfo += "下一审批状态 NextStateCode=" + submitData.NextStateCode + "\r\n";
                    loginfo += "使用流程类型 submitData.FlowSelectType=" + submitData.FlowSelectType + "\r\n";
                    loginfo += "业务数据 submitData.XML(AppXML)=" + submitData.XML + "\r\n";
                    loginfo += "================================================================================\r\n";           
                    LogHelper.WriteLog(loginfo);

                    #endregion
                    //return dataResult;//测试检查流程用的,不能提交事务
                    //ts.Complete(); //提交事务                           
                    if (string.IsNullOrEmpty(strIsFlowEngine) || strIsFlowEngine.ToLower() == "true")
                    {
                        msg += "发送审批消息(调用引擎服务)" + DateTime.Now.ToString() + "\r\n";
                        #region 发送审批消息(调用引擎服务)
                        LogHelper.WriteLog("开始(调用引擎服务):SubmitEngineService FormID =" + submitData.FormID);
                        SubmitEngineService(con, submitData,  dataResult,  modelinfo,  CheckFlowResult,  Flowbill,  AppCompanyID,  MessageUserID,  MessageUserName,ref msg);
                        LogHelper.WriteLog("结束(调用引擎服务):SubmitEngineService FormID =" + submitData.FormID);
                        #endregion     
                        msg += "发送审批消息(调用引擎服务)完成" + DateTime.Now.ToString() + "\r\n";
                    }
                    dtEnd = DateTime.Now;
                    dataResult.SubmitFlag = submitData.SubmitFlag;
                    msg += "开始时间" + dtStart.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "\r\n";
                    msg += "结束时间" + dtEnd.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "\r\n";
                    msg += "完成时间" + DateDiff(dtEnd, dtStart);
                    ts.Complete();//提交事务
                    MsOracle.Close(con);//关闭数据库  
                    LogHelper.WriteLog("执行流程成功:FormID=" + submitData.FormID);
                    //LogHelper.WriteLog(msg);
                    return dataResult;
                }
                catch (Exception ex)
                {                    
                    ts.Dispose();
                    if (con.State == System.Data.ConnectionState.Open)
                    {
                        con.Close();
                        con.Dispose();
                    }
                    dataResult.RunTime += "---FlowEnd:" + DateTime.Now.ToString();
                    dataResult.FlowResult = FlowResult.FAIL;                  
                    dataResult.Err        = ex.Message;
                    //Tracer.Debug("FlowService: -" + submitData.FormID + "--submitDataXML:" + submitData.XML + "-" + ex.InnerException + ex.Message);
                    LogHelper.WriteLog("执行流程失败:FormID=" + submitData.FormID+" 异常信息:"+ ex.ToString());
                    return dataResult;
                }
                finally
                {
                    if (Flowbill.workflowRuntime != null && Flowbill.workflowRuntime.IsStarted)
                    {
                        Flowbill.workflowRuntime.Dispose();
                    }
                   // LogHelper.WriteLog(msg);
                    if (con.State == System.Data.ConnectionState.Open)
                    {
                        con.Close();
                        con.Dispose();
                    }     
                    dataResult = null;                   
                    //Tracer.Debug("-------Trace--FormID:" + submitData.FormID + "DateTime: Start:" + dtStart.ToString()  + "  EngineStart:" + dtEngineStart.ToString() + "  End:" + dtEnd.ToString() + "\n");
                    
                }
                #endregion
            }
               
        }