public void ReplyConsultation( SMT.Workflow.Common.Model.FLOW_CONSULTATION_T flowConsultation, SubmitData submitData)
        {
            if (strIsFlowEngine.ToLower() == "true")
            {
                try
                {

                    #region 记录日志
                    SMT.Workflow.Common.Model.FLOW_CONSULTATION_T entity = flowConsultation;
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("FLOW_CONSULTATION_T entity= new FLOW_CONSULTATION_T();");//
                    sb.AppendLine("entity.CONSULTATIONID = \"" + entity.CONSULTATIONID + "\";");//
                    sb.AppendLine("entity.FLOWRECORDDETAILID = \"" + (entity.FLOW_FLOWRECORDDETAIL_T == null ? "" : entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID) + "\";");
                    sb.AppendLine("entity.CONSULTATIONUSERID = \"" + entity.CONSULTATIONUSERID + "\";");
                    sb.AppendLine("entity.CONSULTATIONUSERNAME = \"" + entity.CONSULTATIONUSERNAME + "\";");
                    sb.AppendLine("entity.CONSULTATIONCONTENT =\"" + entity.CONSULTATIONCONTENT + "\";");
                    sb.AppendLine("entity.CONSULTATIONDATE = \"" + entity.CONSULTATIONDATE + "\";");
                    sb.AppendLine("entity.REPLYUSERID = \"" + entity.REPLYUSERID + "\";");
                    sb.AppendLine("entity.REPLYUSERNAME = \"" + entity.REPLYUSERNAME + "\";");
                    sb.AppendLine("entity.REPLYCONTENT = \"" + entity.REPLYCONTENT + "\";");
                    sb.AppendLine("entity.REPLYDATE = \"" + entity.REPLYDATE + "\";");
                    sb.AppendLine("entity.FLAG = \"" + entity.FLAG + "\";");//0未回复,1回复
                    sb.AppendLine("FLOW_FLOWRECORDDETAIL_T model=new FLOW_FLOWRECORDDETAIL_T();");
                    sb.AppendLine("  model.FLOWRECORDDETAILID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID + "\";");
                    //sb.AppendLine("  model.FLOWRECORDMASTERID=\""+entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDMASTERID+"\";");
                    sb.AppendLine("  model.STATECODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.STATECODE + "\";");
                    sb.AppendLine("  model.PARENTSTATEID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.PARENTSTATEID + "\";");
                    sb.AppendLine("  model.CONTENT=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CONTENT + "\";");
                    sb.AppendLine("  model.CHECKSTATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CHECKSTATE + "\";//同意:1,不同意:0 ,未处理:2,会签同意7,会签不同意8");
                    sb.AppendLine("  model.FLAG=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLAG + "\";//已审批:1,未审批:0");
                    sb.AppendLine("  model.CREATEUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEUSERID + "\";");
                    sb.AppendLine("  model.CREATEUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEUSERNAME + "\";");
                    sb.AppendLine("  model.CREATECOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATECOMPANYID + "\";");
                    sb.AppendLine("  model.CREATEDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEDEPARTMENTID + "\";");
                    sb.AppendLine("  model.CREATEPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEPOSTID + "\";");
                    sb.AppendLine("  model.CREATEDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEDATE + "\";");
                    sb.AppendLine("  model.EDITUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITUSERID + "\";");
                    sb.AppendLine("  model.EDITUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITUSERNAME + "\";");
                    sb.AppendLine("  model.EDITCOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITCOMPANYID + "\";");
                    sb.AppendLine("  model.EDITDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITDEPARTMENTID + "\";");
                    sb.AppendLine("  model.EDITPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITPOSTID + "\";");
                    sb.AppendLine("  model.EDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITDATE + "\";");
                    sb.AppendLine("  model.AGENTUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTUSERID + "\";");
                    sb.AppendLine("  model.AGENTERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTERNAME + "\";");
                    sb.AppendLine("  model.AGENTEDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTEDITDATE + "\";");
                    sb.AppendLine("  entity.FLOW_FLOWRECORDDETAIL_T = model;");

                    sb.AppendLine("FLOW_FLOWRECORDMASTER_T eentity=new FLOW_FLOWRECORDMASTER_T();");
                    sb.AppendLine("  eentity.FLOWRECORDMASTERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID + "\";");
                    sb.AppendLine("  eentity.INSTANCEID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.INSTANCEID + "\";");
                    sb.AppendLine("  eentity.FLOWSELECTTYPE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWSELECTTYPE + "\";//0:固定流程,1:自选流程");
                    sb.AppendLine("  eentity.MODELCODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.MODELCODE + "\";");
                    sb.AppendLine("  eentity.FLOWCODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWCODE + "\";");
                    sb.AppendLine("  eentity.FORMID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "\";");
                    sb.AppendLine("  eentity.FLOWTYPE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWTYPE + "\";//0:审批流程,1:任务流程");
                    sb.AppendLine("  eentity.CHECKSTATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CHECKSTATE + "\";//1:审批中,2:审批通过,3审批不通过,5撤销(为与字典保持一致)");
                    sb.AppendLine("  eentity.CREATEUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEUSERID + "\";");
                    sb.AppendLine("  eentity.CREATEUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME + "\";");
                    sb.AppendLine("  eentity.CREATECOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID + "\";");
                    sb.AppendLine("  eentity.CREATEDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID + "\";");
                    sb.AppendLine("  eentity.CREATEPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID + "\";");
                    sb.AppendLine("  eentity.CREATEDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEDATE + "\";");
                    sb.AppendLine("  eentity.EDITUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITUSERID + "\";");
                    sb.AppendLine("  eentity.EDITUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME + "\";");
                    sb.AppendLine("  eentity.EDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITDATE + "\";");
                    sb.AppendLine("  eentity.ACTIVEROLE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.ACTIVEROLE + "\";");
                    sb.AppendLine("  eentity.BUSINESSOBJECT=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT + "\";");
                    sb.AppendLine("  eentity.KPITIMEXML=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.KPITIMEXML + "\";");
                    sb.AppendLine("  entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T = eentity;");
                    Tracer.Debug("流程引擎的XML数据 SubimtFlow入口处 回复咨询信息: FormID=" + submitData.FormID + ";ModelCode=" + submitData.ModelCode + " \r\n FLOW_CONSULTATION_T 实体:\r\n" + sb.ToString());
                    LogSubmitData(submitData);
                    #endregion

                    //FlowEngineService.EngineWcfGlobalFunctionClient FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    EnginFlowBLL FlowEngine = new EnginFlowBLL();
                    //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 = FlowBLL.GetSysCodeByModelCode( submitData.ModelCode);
                    // FlowEngine.FlowConsultatiClose(modelinfo.SysCode, flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID, flowConsultation.REPLYUSERID);
                    FlowEngine.FlowConsultatiClose( modelinfo.SysCode, flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID, flowConsultation.REPLYUSERID);

                    FlowBLL bll = new FlowBLL();
                    bll.ReplyConsultation( flowConsultation);
                }
                catch (Exception ex)
                {
                    Tracer.Debug("回复咨询出错,异常信息: FORMID=" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "异常信息:\r\n" + ex.InnerException + ex.Message);
                    throw ex;
                }
            }
        }
        public void AddConsultation( SMT.Workflow.Common.Model.FLOW_CONSULTATION_T flowConsultation, SubmitData submitData)
        {
            if (strIsFlowEngine.ToLower() == "true")
            {
                try
                {
                    #region 记录日志
                    SMT.Workflow.Common.Model.FLOW_CONSULTATION_T entity = flowConsultation;
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("FLOW_CONSULTATION_T entity= new FLOW_CONSULTATION_T();");//
                    sb.AppendLine("entity.CONSULTATIONID = \"" + entity.CONSULTATIONID + "\";");//
                    sb.AppendLine("entity.FLOWRECORDDETAILID = \"" + (entity.FLOW_FLOWRECORDDETAIL_T == null ? "" : entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID) + "\";");
                    sb.AppendLine("entity.CONSULTATIONUSERID = \"" + entity.CONSULTATIONUSERID + "\";");
                    sb.AppendLine("entity.CONSULTATIONUSERNAME = \"" + entity.CONSULTATIONUSERNAME + "\";");
                    sb.AppendLine("entity.CONSULTATIONCONTENT =\"" + entity.CONSULTATIONCONTENT + "\";");
                    sb.AppendLine("entity.CONSULTATIONDATE = \"" + entity.CONSULTATIONDATE + "\";");
                    sb.AppendLine("entity.REPLYUSERID = \"" + entity.REPLYUSERID + "\";");
                    sb.AppendLine("entity.REPLYUSERNAME = \"" + entity.REPLYUSERNAME + "\";");
                    sb.AppendLine("entity.REPLYCONTENT = \"" + entity.REPLYCONTENT + "\";");
                    sb.AppendLine("entity.REPLYDATE = \"" + entity.REPLYDATE + "\";");
                    sb.AppendLine("entity.FLAG = \"" + entity.FLAG + "\";");//0未回复,1回复

                    sb.AppendLine("FLOW_FLOWRECORDDETAIL_T model=new FLOW_FLOWRECORDDETAIL_T();");
                    sb.AppendLine("  model.FLOWRECORDDETAILID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID + "\";");
                    //sb.AppendLine("  model.FLOWRECORDMASTERID=\""+entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDMASTERID+"\";");
                    sb.AppendLine("  model.STATECODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.STATECODE + "\";");
                    sb.AppendLine("  model.PARENTSTATEID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.PARENTSTATEID + "\";");
                    sb.AppendLine("  model.CONTENT=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CONTENT + "\";");
                    sb.AppendLine("  model.CHECKSTATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CHECKSTATE + "\";//同意:1,不同意:0 ,未处理:2,会签同意7,会签不同意8");
                    sb.AppendLine("  model.FLAG=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLAG + "\";//已审批:1,未审批:0");
                    sb.AppendLine("  model.CREATEUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEUSERID + "\";");
                    sb.AppendLine("  model.CREATEUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEUSERNAME + "\";");
                    sb.AppendLine("  model.CREATECOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATECOMPANYID + "\";");
                    sb.AppendLine("  model.CREATEDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEDEPARTMENTID + "\";");
                    sb.AppendLine("  model.CREATEPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEPOSTID + "\";");
                    sb.AppendLine("  model.CREATEDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEDATE + "\";");
                    sb.AppendLine("  model.EDITUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITUSERID + "\";");
                    sb.AppendLine("  model.EDITUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITUSERNAME + "\";");
                    sb.AppendLine("  model.EDITCOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITCOMPANYID + "\";");
                    sb.AppendLine("  model.EDITDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITDEPARTMENTID + "\";");
                    sb.AppendLine("  model.EDITPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITPOSTID + "\";");
                    sb.AppendLine("  model.EDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITDATE + "\";");
                    sb.AppendLine("  model.AGENTUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTUSERID + "\";");
                    sb.AppendLine("  model.AGENTERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTERNAME + "\";");
                    sb.AppendLine("  model.AGENTEDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTEDITDATE + "\";");
                    sb.AppendLine("  entity.FLOW_FLOWRECORDDETAIL_T = model;");

                    sb.AppendLine("FLOW_FLOWRECORDMASTER_T eentity=new FLOW_FLOWRECORDMASTER_T();");
                    sb.AppendLine("  eentity.FLOWRECORDMASTERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID + "\";");
                    sb.AppendLine("  eentity.INSTANCEID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.INSTANCEID + "\";");
                    sb.AppendLine("  eentity.FLOWSELECTTYPE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWSELECTTYPE + "\";//0:固定流程,1:自选流程");
                    sb.AppendLine("  eentity.MODELCODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.MODELCODE + "\";");
                    sb.AppendLine("  eentity.FLOWCODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWCODE + "\";");
                    sb.AppendLine("  eentity.FORMID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "\";");
                    sb.AppendLine("  eentity.FLOWTYPE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWTYPE + "\";//0:审批流程,1:任务流程");
                    sb.AppendLine("  eentity.CHECKSTATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CHECKSTATE + "\";//1:审批中,2:审批通过,3审批不通过,5撤销(为与字典保持一致)");
                    sb.AppendLine("  eentity.CREATEUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEUSERID + "\";");
                    sb.AppendLine("  eentity.CREATEUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME + "\";");
                    sb.AppendLine("  eentity.CREATECOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID + "\";");
                    sb.AppendLine("  eentity.CREATEDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID + "\";");
                    sb.AppendLine("  eentity.CREATEPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID + "\";");
                    sb.AppendLine("  eentity.CREATEDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEDATE + "\";");
                    sb.AppendLine("  eentity.EDITUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITUSERID + "\";");
                    sb.AppendLine("  eentity.EDITUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME + "\";");
                    sb.AppendLine("  eentity.EDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITDATE + "\";");
                    sb.AppendLine("  eentity.ACTIVEROLE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.ACTIVEROLE + "\";");
                    sb.AppendLine("  eentity.BUSINESSOBJECT=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT + "\";");
                    sb.AppendLine("  eentity.KPITIMEXML=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.KPITIMEXML + "\";");
                    sb.AppendLine("  entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T = eentity;");

                    Tracer.Debug("流程引擎的XML数据"+ "SubimtFlow入口处 进行咨询: FormID=" + submitData.FormID + ";ModelCode=" + submitData.ModelCode + " \r\n FLOW_CONSULTATION_T 实体:\r\n" + sb.ToString());
                    LogSubmitData(submitData);
                    #endregion

                    flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T =
                        FlowBLL.GetFLOW_FLOWRECORDMASTER_T( 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;

                    List<CustomUserMsg> UserAndForm = new List<CustomUserMsg>();
                    CustomUserMsg cu = new CustomUserMsg();
                    cu.FormID = flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID;
                    cu.UserID = flowConsultation.REPLYUSERID;
                    UserAndForm.Add(cu);

                    ModelInfo modelinfo = FlowBLL.GetSysCodeByModelCode( 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, "", "", "", "");
                    FlowBLL flowBLL = new FlowBLL();
                    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);
                    EnginFlowBLL efbll = new EnginFlowBLL();

                    bool b = efbll.FlowConsultati( UserAndForm, "", FlowResultXml.ToString(), submitData.XML);
                    if (!b)
                    {
                        Tracer.Debug("发送咨询失败:FormID" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID
                            + "\n\r submitData.XML:" + submitData.XML);
                    }

                    FlowBLL bll = new FlowBLL();

                    bll.AddConsultation( flowConsultation);
                }
                catch (Exception ex)
                {
                    Tracer.Debug("发送咨询出错: FORMID=" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "异常信息:\r\n" + ex.InnerException + ex.Message);
                    throw ex;
                }
                finally
                {
                }
            }
        }
        protected void btngetMyrecord_Click(object sender, EventArgs e)
        {
            //SMT.SaaS.BLLCommonServices.PersonalRecordWS.PersonalRecordServiceClient client = new SMT.SaaS.BLLCommonServices.PersonalRecordWS.PersonalRecordServiceClient();

            //string BeginDate = string.Empty, EndDate = string.Empty;
            //string strCreateUserID = string.Empty, strfilterString = string.Empty, strSortKey = string.Empty;
            //int pageCount = 0;
            //strCreateUserID = "55922953-53b1-4bb8-b15d-0c05d0e215d2";
            ////strCreateUserID = "5347a18b-5c9c-4e40-a1c4-ce30389224ed";  
            //strSortKey = " CREATEDATE DESC ";
            //strfilterString = "";//SQL       
            //SMT.SaaS.BLLCommonServices.PersonalRecordWS.T_PF_PERSONALRECORD[] myrecords =
            //client.GetPersonalRecord(0, strSortKey, "2", strfilterString, strCreateUserID, BeginDate, EndDate, ref pageCount);
            try
            {
                string EntityType = "T_VM_USEVEHICLEAPPLY", EntityKey = "UVAPPLYID"
                    , EntityId = "43f8623b-a7a2-4bb9-9277-f5ded09ea8cb"
                    , strXmlParams = "";
                int CheckState = 1;

                VMServicesClient vmClient = new VMServicesClient();
                Tracer.Debug("EntityType:" + EntityType + " EntityKey:" + EntityKey + "\r\n" + " EntityId:" + EntityId + " CheckState:" + CheckState + " URL:" + vmClient.Endpoint.Address + " strXmlParams:" + strXmlParams);

                //int i = vmClient.UpdateCheckState(EntityType, EntityKey, EntityId, CheckState, strXmlParams);
                string msg = string.Empty;


                EnginFlowBLL bll = new EnginFlowBLL();
                SMT.FlowWFService.SubmitData subdata = new FlowWFService.SubmitData();
                subdata.ApprovalUser = new FlowWFService.UserInfo();
                bll.UpdateAuditStatus(subdata, "VM", EntityType, EntityKey, EntityId, "1", ref msg);




                //Utility.UpdateFormCheckState("VM", EntityType, EntityKey, EntityId, BLLCommonServices.CheckStates.Approving, ref msg, strXmlParams);
                Tracer.Debug("" + msg);

                Tracer.Debug("EnginFlowBLL更新业务系统成功!");
                txtMessage.Text +="更新成功!"+ msg;


            }
            catch (Exception ex)
            {
                Tracer.Debug(ex.ToString());
                txtMessage.Text += ex.ToString();
                //throw ex;
            }

        }