示例#1
0
        public static void UpdatePaymentApplication(PaymentApplicationInfo info)
        {
            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@FormID", System.Data.SqlDbType.NVarChar, 100),
                new SqlParameter("@IsOverContract", System.Data.SqlDbType.Int),
                new SqlParameter("@ErpFormId", System.Data.SqlDbType.NVarChar, 100),
                new SqlParameter("@ErpFormType", System.Data.SqlDbType.NVarChar, 100),
                new SqlParameter("@StartDeptId", System.Data.SqlDbType.NVarChar, 100),
                new SqlParameter("@PaymentApplicationEngineer", System.Data.SqlDbType.Int),
                new SqlParameter("@ApproveResult", System.Data.SqlDbType.VarChar, 100),
                new SqlParameter("@LeadersSelected", System.Data.SqlDbType.NVarChar, 2000),
                new SqlParameter("@Amount", System.Data.SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = info.FormId;
            parameters[1].Value = info.IsOverContract;
            parameters[2].Value = info.ErpFormId;
            parameters[3].Value = info.ErpFormType;
            parameters[4].Value = info.StartDeptId;
            parameters[5].Value = info.IsCheckedChairman;
            parameters[6].Value = info.ApproveResult;
            parameters[7].Value = info.LeadersSelected;
            parameters[8].Value = info.Amount;

            DataTable dataTable = DBHelper.ExecutedProcedure("Biz.ERP_UpdatePaymentApplication", parameters);
        }
示例#2
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        int    wfInstanceId = 0; //process instance id
        string id           = ViewState["FormID"].ToString();

        if (!BeforeSubmit())
        {
            return;
        }
        PaymentApplicationInfo dataInfo = SaveFormData();

        //Countersign1.SaveData(true);//会签数据保存

        if (dataInfo != null)
        {
            UploadAttachments1.SaveAttachment(FormId);
            // Countersign1.SaveAndSubmit();//会签数据保存

            #region 工作流参数
            NameValueCollection dataFields = SetWFParams();
            if (dataFields == null)
            {
                return;
            }
            #endregion



            WorkflowHelper.CurrentUser = "******" + _BPMContext.CurrentUser.LoginId;
            AppDict appInfo = new Pkurg.BPM.Services.AppDictService().GetByAppId("10105");
            if (appInfo == null)
            {
                Alert("提交失败");
                return;
            }
            WorkflowHelper.StartProcess(appInfo.WorkFlowName, FormId, dataFields, ref wfInstanceId);
            if (wfInstanceId > 0)
            {
                if (SaveWorkFlowInstance("1", DateTime.Now, wfInstanceId.ToString()))
                {
                    SaveWorkItem();
                    //发布时释放代码
                    if (!AfterWorkflowStart(wfInstanceId))
                    {
                        return;
                    }
                    ScriptManager.RegisterClientScriptBlock(this, typeof(string), "1", "alert('提交成功');window.opener.location.href=window.opener.location.href;", true);
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", " window.opener=null;window.open('', '_self', '');window.close();", true);

                    return;
                }
            }
        }

        Alert("提交失败");

        //WorkflowHelper.ApproveProcess
        //insert data to business object
    }
示例#3
0
    /// <summary>
    /// 保存表单
    /// </summary>
    /// <returns></returns>
    private PaymentApplicationInfo SaveFormData()
    {
        bool isEdit = false;
        PaymentApplicationInfo info = null;

        try
        {
            info = PaymentApplication.GetPaymentApplicationInfo(FormId);
            if (info == null)
            {
                info             = new PaymentApplicationInfo();
                info.FormId      = FormId;
                info.ErpFormId   = HttpContext.Current.Request["erpFormId"];
                info.ErpFormType = HttpContext.Current.Request["erpFormType"];
                //info.StartDeptId = HttpContext.Current.Request["startDeptId"];
                info.StartDeptId       = ddlDepartName.SelectedItem.Value;
                info.IsOverContract    = cblisoverCotract.Checked ? 1 : 0;
                info.IsCheckedChairman = cbChairman.Checked ? 1 : 0;
                info.Amount            = HttpContext.Current.Request["amount"];
            }
            else
            {
                isEdit                 = true;
                info.FormId            = FormId;
                info.IsOverContract    = cblisoverCotract.Checked ? 1 : 0;
                info.StartDeptId       = ddlDepartName.SelectedItem.Value;
                info.IsCheckedChairman = cbChairman.Checked ? 1 : 0;
                info.ApproveResult     = "";
                //info.ErpFormId = HttpContext.Current.Request["erpFormId"];
                //info.ErpFormType = HttpContext.Current.Request["erpFormType"];
                //info.StartDeptId = HttpContext.Current.Request["startDeptId"];
            }
            StringBuilder cbDatas = new StringBuilder();
            foreach (ListItem item in cbRelatonUsers.Items)
            {
                if (item.Selected)
                {
                    cbDatas.AppendFormat("{0},", item.Value);
                }
            }
            info.LeadersSelected = cbDatas.ToString().Trim(',');

            if (!isEdit)
            {
                PaymentApplication.InsertPaymentApplication(info);
            }
            else
            {
                PaymentApplication.UpdatePaymentApplication(info);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return(info);
    }
示例#4
0
        public static PaymentApplicationInfo GetPaymentApplicationInfoByWfId(string wfId)
        {
            PaymentApplicationInfo info = null;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@FormID", System.Data.SqlDbType.NVarChar, 100),
            };
            parameters[0].Value = wfId;
            DataTable dataTable = DBHelper.ExecutedProcedure("Biz.ERP_GetErpApplyOfForm_ByWfId", parameters);

            ///给实体赋值
            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                info = new PaymentApplicationInfo();
                if (dataTable.Rows[0]["FormId"] != null && dataTable.Rows[0]["FormId"].ToString() != "")
                {
                    info.FormId = dataTable.Rows[0]["FormId"].ToString();
                }
                if (dataTable.Rows[0]["IsOverContract"] != null && dataTable.Rows[0]["IsOverContract"].ToString() != "")
                {
                    info.IsOverContract = int.Parse(dataTable.Rows[0]["IsOverContract"].ToString());
                }
                if (dataTable.Rows[0]["ErpFormId"] != null && dataTable.Rows[0]["ErpFormId"].ToString() != "")
                {
                    info.ErpFormId = dataTable.Rows[0]["ErpFormId"].ToString();
                }
                if (dataTable.Rows[0]["ErpFormType"] != null && dataTable.Rows[0]["ErpFormType"].ToString() != "")
                {
                    info.ErpFormType = dataTable.Rows[0]["ErpFormType"].ToString();
                }
                if (dataTable.Rows[0]["StartDeptId"] != null && dataTable.Rows[0]["StartDeptId"].ToString() != "")
                {
                    info.StartDeptId = dataTable.Rows[0]["StartDeptId"].ToString();
                }
                if (dataTable.Rows[0]["PaymentApplicationEngineer"] != null && dataTable.Rows[0]["PaymentApplicationEngineer"].ToString() != "")
                {
                    info.IsCheckedChairman = int.Parse(dataTable.Rows[0]["PaymentApplicationEngineer"].ToString());
                }
                if (dataTable.Rows[0]["ApproveResult"] != null && dataTable.Rows[0]["ApproveResult"].ToString() != "")
                {
                    info.ApproveResult = dataTable.Rows[0]["ApproveResult"].ToString();
                }
                if (dataTable.Rows[0]["CreateTime"] != null && dataTable.Rows[0]["CreateTime"].ToString() != "")
                {
                    info.CreateTime = DateTime.Parse(dataTable.Rows[0]["CreateTime"].ToString());
                }
                if (dataTable.Rows[0]["LeadersSelected"] != null && dataTable.Rows[0]["LeadersSelected"].ToString() != "")
                {
                    info.LeadersSelected = dataTable.Rows[0]["LeadersSelected"].ToString();
                }
                if (dataTable.Rows[0]["Amount"] != null && dataTable.Rows[0]["Amount"].ToString() != "")
                {
                    info.Amount = dataTable.Rows[0]["Amount"].ToString();
                }
            }
            return(info);
        }
示例#5
0
    /// <summary>
    /// 加载表单
    /// </summary>
    private void InitFormData()
    {
        try
        {
            PaymentApplicationInfo formDataInfo = PaymentApplication.GetPaymentApplicationInfo(FormId);
            if (formDataInfo.IsOverContract == 1)
            {
                cblisoverCotract.Checked = true;
            }
            else
            {
                cblisoverCotract.Checked = false;
            }

            ListItem item = ddlDepartName.Items.FindByValue(formDataInfo.StartDeptId);
            if (item != null)
            {
                ddlDepartName.SelectedIndex = ddlDepartName.Items.IndexOf(item);
            }
            cbChairman.Checked = formDataInfo.IsCheckedChairman == 1;

            StartDeptId = formDataInfo.StartDeptId;

            ListItem departItem = ddlDepartName.Items.FindByValue(formDataInfo.StartDeptId);
            if (departItem == null)
            {
                ExceptionHander.GoToErrorPage();
                return;
            }
            departItem.Selected = true;


            //Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(formDataInfo.StartDeptId);
            //tbDepartName.Text = deptInfo.DepartName;
            Countersign1.CounterSignDeptId = formDataInfo.StartDeptId;

            LoadRelationPerson();

            if (!string.IsNullOrEmpty(formDataInfo.LeadersSelected))
            {
                string[] cbDatas = formDataInfo.LeadersSelected.Split(',');
                foreach (var cbItem in cbDatas)
                {
                    ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem);
                    listItem.Selected = true;
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
示例#6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static PaymentApplicationInfo DataRowToModel(DataTable dataTable)
        {
            PaymentApplicationInfo info = new PaymentApplicationInfo();

            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                if (dataTable.Rows[0]["FormId"] != null && dataTable.Rows[0]["FormId"].ToString() != "")
                {
                    info.FormId = dataTable.Rows[0]["FormId"].ToString();
                }
                if (dataTable.Rows[0]["IsOverContract"] != null && dataTable.Rows[0]["IsOverContract"].ToString() != "")
                {
                    info.IsOverContract = int.Parse(dataTable.Rows[0]["IsOverContract"].ToString());
                }
                if (dataTable.Rows[0]["ErpFormId"] != null && dataTable.Rows[0]["ErpFormId"].ToString() != "")
                {
                    info.ErpFormId = dataTable.Rows[0]["ErpFormId"].ToString();
                }
                if (dataTable.Rows[0]["ErpFormType"] != null && dataTable.Rows[0]["ErpFormType"].ToString() != "")
                {
                    info.ErpFormType = dataTable.Rows[0]["ErpFormType"].ToString();
                }
                if (dataTable.Rows[0]["StartDeptId"] != null && dataTable.Rows[0]["StartDeptId"].ToString() != "")
                {
                    info.StartDeptId = dataTable.Rows[0]["StartDeptId"].ToString();
                }
                if (dataTable.Rows[0]["PaymentApplicationEngineer"] != null && dataTable.Rows[0]["PaymentApplicationEngineer"].ToString() != "")
                {
                    info.IsCheckedChairman = int.Parse(dataTable.Rows[0]["PaymentApplicationEngineer"].ToString());
                }
                if (dataTable.Rows[0]["ApproveResult"] != null && dataTable.Rows[0]["ApproveResult"].ToString() != "")
                {
                    info.ApproveResult = dataTable.Rows[0]["ApproveResult"].ToString();
                }
                if (dataTable.Rows[0]["CreateTime"] != null && dataTable.Rows[0]["CreateTime"].ToString() != "")
                {
                    info.CreateTime = DateTime.Parse(dataTable.Rows[0]["CreateTime"].ToString());
                }
                if (dataTable.Rows[0]["LeadersSelected"] != null && dataTable.Rows[0]["LeadersSelected"].ToString() != "")
                {
                    info.LeadersSelected = dataTable.Rows[0]["LeadersSelected"].ToString();
                }
                if (dataTable.Rows[0]["Amount"] != null && dataTable.Rows[0]["Amount"].ToString() != "")
                {
                    info.Amount = dataTable.Rows[0]["Amount"].ToString();
                }
            }
            return(info);
        }
示例#7
0
    private bool AfterWorkflowStart(int wfInstanceId)
    {
        PaymentApplicationInfo info       = PaymentApplication.GetPaymentApplicationInfo(FormId);
        ERP_CallbackResultType resultType = new ERP_PaymentApplication_Service().NotifyStartAdvance(info.ErpFormId, true);

        if (resultType != ERP_CallbackResultType.调用成功)
        {
            //删除流程实例
            new WF_WorkFlowInstance().DeleteWorkFlowInstance(_BPMContext.ProcID);

            //撤销已发起的流程
            WorkflowManage.StopWorkflow(wfInstanceId);

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ajax", "alert('" + ConstString.RepeatAlertTip + "'); window.opener=null;window.open('', '_self', '');window.close();", true);
            return(false);
        }
        return(true);
    }
示例#8
0
    protected void Save_Click(object sender, EventArgs e)
    {
        PaymentApplicationInfo dataInfo = SaveFormData();

        if (dataInfo != null)
        {
            UploadAttachments1.SaveAttachment(FormId);

            if (SaveWorkFlowInstance("0", null, ""))
            {
                Alert("保存完成");
            }
        }
        else
        {
            Alert("保存失败");
        }
    }
示例#9
0
        /// <summary>
        /// 通过formid1得到instanceid
        /// </summary>
        /// <param name="formid3"></param>
        /// <returns></returns>
        public static string GetPaymentApplicationInstanceIdByFormId(string formid3)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@formid3", SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = formid3;
            PaymentApplicationInfo model = new PaymentApplicationInfo();
            DataTable dt = DBHelper.ExecutedProcedure("Biz.ERP_GetPaymentApplicationInstanceIdByFormId", parameters);

            if (dt != null && dt.Rows.Count > 0)
            {
                return(dt.Rows[0][0].ToString());
            }
            else
            {
                return(null);
            }
        }
    //private void InintData()
    //{
    //    string methodName = "InintData";
    //    Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.IN);
    //    try
    //    {
    //        InitFormData();
    //        if (instructionOfPkurg != null)
    //        {
    //            tbDepartName.Text = instructionOfPkurg.DeptName;
    //            WorkFlowInstance workFlowInstance = wf_WorkFlowInstance.GetWorkFlowInstanceByFormId(instructionOfPkurg.FormId);
    //            AddSign1.ProcId = workFlowInstance.InstanceId;
    //            #region 审批意见框
    //            ApproveOpinionUCDeptleader.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCRealateDept.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCLeader.InstanceId = workFlowInstance.InstanceId;
    //            ApproveOpinionUCCEO.InstanceId = workFlowInstance.InstanceId;

    //            if (ApproveOpinionUCDeptleader.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCDeptleader.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCRealateDept.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCRealateDept.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCLeader.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCLeader.CurrentNode = true;
    //            }

    //            if (ApproveOpinionUCCEO.CurrentNodeName == nodeName.Value)
    //            {
    //                ApproveOpinionUCCEO.CurrentNode = true;
    //            }
    //            #endregion

    //            //查询已经添加的附件
    //            //UploadFilesUC1.BindAttachmentListByCode(ViewState["FormID"].ToString());
    //            UploadAttachments1.ProcId = workFlowInstance.InstanceId;
    //        }

    //    }
    //    catch (Exception ex)
    //    {

    //        Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
    //        throw ex;
    //    }
    //    Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
    //}

    /// <summary>
    /// 加载表单
    /// </summary>
    private void InitFormData()
    {
        try
        {
            PaymentApplicationInfo formDataInfo = PaymentApplication.GetPaymentApplicationInfo(FormId);
            if (formDataInfo.IsOverContract == 1)
            {
                cblisoverCotract.Checked = true;
            }
            else
            {
                cblisoverCotract.Checked = false;
            }
            Department deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(formDataInfo.StartDeptId);
            tbDepartName.Text  = deptInfo.Remark;
            cbChairman.Checked = formDataInfo.IsCheckedChairman == 1;

            if (formDataInfo.StartDeptId.Contains("S972"))
            {
                lbPresident.Text = "总经理意见:";
            }
            else
            {
                lbPresident.Text = "总裁意见:";
            }
            //LoadRelationPerson(formDataInfo.StartDeptId);
            //cbRelatonUsers.Visible = cbPayer.Checked;
            //if (!string.IsNullOrEmpty(formDataInfo.LeadersSelected))
            //{
            //    string[] cbDatas = formDataInfo.LeadersSelected.Split(',');
            //    foreach (var cbItem in cbDatas)
            //    {
            //        ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem);
            //        listItem.Selected = true;
            //    }
            //}
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
示例#11
0
    public static string GetErpUrl()
    {
        string erpFormId   = HttpContext.Current.Request["erpFormId"];
        string erpFormType = HttpContext.Current.Request["erpFormType"];
        string startDeptId = HttpContext.Current.Request["startDeptId"];
        string id          = HttpContext.Current.Request["Id"];

        if (string.IsNullOrEmpty(id))
        {//新建页面
            if (string.IsNullOrEmpty(erpFormId) ||
                string.IsNullOrEmpty(erpFormType)
                )
            {
                //参数错误
                ExceptionHander.GoToErrorPage();
                return(null);
            }
        }
        else
        {
            PaymentApplicationInfo info = PaymentApplication.GetPaymentApplicationInfoByInstanceId(id);
            if (info == null)
            {
                ExceptionHander.GoToErrorPage();
                return(null);
            }
            erpFormId   = info.ErpFormId;
            erpFormType = info.ErpFormType;
        }

        Dictionary <string, string> pageNames = IFrameHelper.GetUrlDatas();

        if (!pageNames.Keys.Contains(erpFormType))
        {
            ExceptionHander.GoToErrorPage();
            return(null);
        }
        string pageName = pageNames[erpFormType];

        return(string.Format("{0}{1}", pageName, erpFormId));
    }
示例#12
0
    private void InintData()
    {
        string methodName = "InintData";

        try
        {
            WorkFlowInstance       Instance = wf_WorkFlowInstance.GetWorkFlowInstanceById(ViewState["InstanceID"].ToString());
            PaymentApplicationInfo item     = PaymentApplication.GetPaymentApplicationInfoByInstanceId(ViewState["InstanceID"].ToString());
            if (item != null)
            {
                PaymentApplicationInfo info     = PaymentApplication.GetPaymentApplicationInfo(Instance.FormId);
                Department             deptInfo = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(info.StartDeptId);
                ddlDepartName.Text = deptInfo.Remark;

                cblisoverCotract.Checked = info.IsOverContract == 1;
                cbChairman.Checked       = info.IsCheckedChairman == 1;

                if (info.StartDeptId.Contains("S972"))
                {
                    lbPresident.Text = "总经理意见:";
                }
                else
                {
                    lbPresident.Text = "总裁意见:";
                }
                //LoadRelationPerson(info.StartDeptId);
                //cbRelatonUsers.Visible = cbPayer.Checked;
                //cbRelatonUsers.Enabled = false;
                //if (!string.IsNullOrEmpty(info.LeadersSelected))
                //{
                //    string[] cbDatas = info.LeadersSelected.Split(',');
                //    foreach (var cbItem in cbDatas)
                //    {
                //        ListItem listItem = cbRelatonUsers.Items.FindByValue(cbItem);
                //        listItem.Selected = true;
                //    }
                //}
            }

            FlowRelated1.ProcId       = ViewState["InstanceID"].ToString();
            Countersign1.ProcId       = ViewState["InstanceID"].ToString();
            UploadAttachments1.ProcId = ViewState["InstanceID"].ToString();

            ApproveOpinionUCDeptleader.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUCRealateDept.InstanceId = ViewState["InstanceID"].ToString();
            ApproveOpinionUCLeader.InstanceId      = ViewState["InstanceID"].ToString();
            Option_4.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC1.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUC2.InstanceId  = ViewState["InstanceID"].ToString();
            ApproveOpinionUC22.InstanceId = ViewState["InstanceID"].ToString();
            ApproveOpinionUC3.InstanceId  = ViewState["InstanceID"].ToString();
            Option_0.InstanceId           = ViewState["InstanceID"].ToString();
            ApproveOpinionUC4.InstanceId  = ViewState["InstanceID"].ToString();
            Option_10.InstanceId          = ViewState["InstanceID"].ToString();
            Option_11.InstanceId          = ViewState["InstanceID"].ToString();
            Option_12.InstanceId          = ViewState["InstanceID"].ToString();
            Option_13.InstanceId          = ViewState["InstanceID"].ToString();
        }
        catch (Exception ex)
        {
            Logger.Write(this.GetType(), EnumLogLevel.Fatal, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.Exception + ":" + string.Format("Exception={0}", ex));
            throw ex;
        }
        Logger.Write(this.GetType(), EnumLogLevel.Info, className + ":" + methodName + ":" + Pkurg.PWorldBPM.Common.Log.MessageType.OUT);
    }
示例#13
0
    /// <summary>
    /// 设置流程参数
    /// </summary>
    /// <returns></returns>
    private NameValueCollection SetWFParams()
    {
        //存储过程的四个参数

        string startDeptId = ddlDepartName.SelectedItem.Value;
        //部门【条件1】
        string startDeptName = ddlDepartName.SelectedItem.Text;
        //定义合同类型的取值
        // string erpFormType = HttpContext.Current.Request["erpFormType"];
        //根据formTitle中的第七位取两位得到合同类型【条件2】
        string type = PaymentApplication_Common.GetErpFormTitle(this).Substring(5, 2);
        //得到金额amount,需要先判断改单子是打开拟稿的还是新打开的,根据ID来判断是哪一类【条件3】
        string amounts = null;

        //用info和_BPMContext.ProcID是否为空来判断是打开的拟稿还是新打开的有什么区别

        //如果为null或者为空时,则为新打开的页面,新打开页面的amount值
        if (_BPMContext.ProcID == null || _BPMContext.ProcID == "")
        {
            amounts = HttpContext.Current.Request["amount"];
        }
        //如果不为null,则为打开的拟稿
        else
        {
            PaymentApplicationInfo info = PaymentApplication.GetPaymentApplicationInfo(FormId);
            amounts = info.Amount;
        }
        //是否在计划内【条件4】
        string isInPlan = cblIsInPan.SelectedItem.Value;



        NameValueCollection dataFields = new NameValueCollection();
        Department          deptInfo   = new Pkurg.PWorld.Services.DepartmentService().GetByDepartCode(startDeptId);
        string CompanyCode             = BPMHelp.GetCompanyCodeByDeptID(StartDeptId);

        StringBuilder firstFieldBuilder = new StringBuilder();

        foreach (ListItem item in cbRelatonUsers.Items)
        {
            if (item.Selected)
            {
                firstFieldBuilder.AppendFormat("K2:Founder\\{0},", item.Value);
            }
        }
        string firstField = firstFieldBuilder.ToString().Trim(',');

        dataFields.Add("RelatedPersonnel", !string.IsNullOrEmpty(firstField) ? firstField : "noapprovers");

        bool flag = true;//标记datafields内的变量是否均赋值

        //验证部分步骤的审批人是否尚未配置
        if (string.IsNullOrEmpty(GetRoleUsers(deptInfo.DepartCode, "部门负责人")))
        {
            flag = false;
            Alert(Page, "发起部门负责人尚未配置!");
        }
        List <string> countersigns = Countersign1.Result.Split(',').ToList();

        foreach (var item in countersigns)
        {
            if (!string.IsNullOrEmpty(item))
            {
                if (string.IsNullOrEmpty(GetRoleUsers(item, "部门负责人")))
                {
                    flag = false;
                    Alert(Page, item + "会签部门负责人尚未配置!");
                }
            }
        }
        string financialManagementDepartmentCode = BPMHelp.GetDeptIDByOtherIDAndName(deptInfo.DepartCode, "财务管理部");

        if (string.IsNullOrEmpty(financialManagementDepartmentCode))
        {
            flag = false;
            Alert(Page, "财务管理部尚未设置!");
        }
        else
        {
            string financialManagementDepartmentInfoManager = GetRoleUsers(financialManagementDepartmentCode, "部门负责人");
            if (string.IsNullOrEmpty(financialManagementDepartmentInfoManager))
            {
                flag = false;
                Alert(Page, "财务管理部门负责人尚未配置!");
            }
            //else
            //{
            //    if (string.IsNullOrEmpty(GetRoleUsers(financialManagementDepartmentInfo.DepartCode, "主管副总裁")))
            //    {
            //        flag = false;
            //        Alert(Page, "财务管理部门主管副总裁尚未配置!");
            //    }
            //}
        }
        if (string.IsNullOrEmpty(GetRoleUsers(CompanyCode, "总裁")))
        {
            flag = false;
            Alert(Page, "公司总裁尚未配置!");
        }
        if (string.IsNullOrEmpty(GetRoleUsers(PKURGICode, "总裁")))
        {
            flag = false;
            Alert(Page, "集团总裁尚未配置!");
        }
        StringBuilder leaders      = new StringBuilder();
        StringBuilder Viceleaders  = new StringBuilder();
        StringBuilder deptsofGroup = new StringBuilder();

        StringBuilder leaderofgroup      = new StringBuilder();
        StringBuilder AssistantPresident = new StringBuilder();
        StringBuilder VicePresident      = new StringBuilder();

        countersigns.Add(startDeptId);
        foreach (var item in countersigns)
        {
            string leadersTmp = GetRoleUsers(item, "主管助理总裁");
            if (!leaders.ToString().Contains(leadersTmp))
            {
                leaders.AppendFormat("{0},", leadersTmp);
            }
            string ViceleadersTmp = GetRoleUsers(item, "主管副总裁");
            if (!Viceleaders.ToString().Contains(ViceleadersTmp))
            {
                Viceleaders.AppendFormat("{0},", ViceleadersTmp);
            }
            string deptsofGroupTmp = GetRoleDepts(item, "集团主管部门");
            if (!deptsofGroup.ToString().Contains(deptsofGroupTmp))
            {
                deptsofGroup.AppendFormat("{0},", deptsofGroupTmp);
            }
        }

        //集团审批人员
        if (cblisoverCotract.Checked)
        {
            foreach (var item in deptsofGroup.ToString().Trim(',').Split(','))
            {
                string leaderofgroupTmp = GetRoleUsers(item, "部门负责人");
                if (!leaderofgroup.ToString().Contains(leaderofgroupTmp))
                {
                    leaderofgroup.AppendFormat("{0},", leaderofgroupTmp);
                }
                string AssistantPresidentTmp = GetRoleUsers(item, "主管助理总裁");
                if (!AssistantPresident.ToString().Contains(AssistantPresidentTmp))
                {
                    AssistantPresident.AppendFormat("{0},", AssistantPresidentTmp);
                }
                string VicePresidentTmp = GetRoleUsers(item, "主管副总裁");
                if (!VicePresident.ToString().Contains(VicePresidentTmp))
                {
                    VicePresident.AppendFormat("{0},", VicePresidentTmp);
                }
            }
            dataFields.Add("CEOGroup", FilterDataField2(GetRoleUsers(PKURGICode, "总裁")));
            dataFields.Add("VicePresident", FilterDataField2(VicePresident));
            dataFields.Add("AssistantPresident", FilterDataField2(AssistantPresident));
            dataFields.Add("leadersofgroup", FilterDataField2(leaderofgroup));
        }

        if (cbChairman.Checked)
        {
            dataFields.Add("chairman", FilterDataField2(GetRoleUsers(CompanyCode, "董事长")));
        }
        else
        {
            dataFields.Add("chairman", "noapprovers");
        }
        string CQCompanyCode = "S374";
        string CPDeptCode    = "S366-S976-S219";
        string JSDeptCode    = "S366-S976-S782";
        string SCKFDeptCode  = "S366-S976-S860";

        //如果是重庆公司或者是北京北大资源物业公司,则进行判断
        if (StartDeptId.Contains(CQCompanyCode) || StartDeptId.Contains(CPDeptCode) || StartDeptId.Contains(JSDeptCode) || StartDeptId.Contains(SCKFDeptCode))
        {
            //判断“分管副总裁”“分管财务副总裁”“总裁”需要审批还是不需要审批
            int grade = ERP_PaymentApplication_Grade.GetERP_PaymentApplication_GradeInfo(type, startDeptName, isInPlan, amounts);
            //如果grade为别的值,则抛出异常
            if (grade == -1)
            {
                //throw new InvalidDataException("输入的参数不正确!");
                grade = 111;
            }

            //分管财务副总裁审批
            dataFields.Add("financialManagementViceleaders", (grade - (grade / 100 * 100)) / 10 == 1 ? this.FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "主管副总裁")) : "noapprovers");
            //分管副总裁审批【因为总是会审批,所以不需要进行grade的判断】
            if ((grade / 100) == 1)
            {
                dataFields.Add("Viceleaders", this.FilterDataField2(Viceleaders));
                dataFields.Add("leaders", this.FilterDataField2(leaders));
            }
            //总裁审批
            dataFields.Add("CEO", (grade - (grade / 100 * 100) - ((grade - grade / 100 * 100) / 10 * 10)) == 1 ? this.FilterDataField2(GetRoleUsers(CompanyCode, "总裁")) : "noapprovers");
        }
        else
        {
            //分管财务副总裁审批
            dataFields.Add("financialManagementViceleaders", FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "主管副总裁")));
            //分管副总裁审批
            dataFields.Add("Viceleaders", this.FilterDataField2(Viceleaders));
            dataFields.Add("leaders", this.FilterDataField2(leaders));
            //总裁审批
            dataFields.Add("CEO", FilterDataField2(GetRoleUsers(CompanyCode, "总裁")));
        }

        dataFields.Add("StandingViceCEO", FilterDataField2(GetRoleUsers(CompanyCode, "常务副总裁")));


        dataFields.Add("financialManagement", FilterDataField2(GetRoleUsers(financialManagementDepartmentCode, "部门负责人")));
        dataFields.Add("CounterSignUsers", Countersign1.GetCounterSignUsers());
        dataFields.Add("DeptManager", GetRoleUsers(deptInfo.DepartCode, "部门负责人"));
        dataFields.Add("IsOverContract", cblisoverCotract.Checked ? "1" : "0");
        dataFields.Add("IsPass", "1");

        if (!flag)
        {
            dataFields = null;
        }
        return(dataFields);
    }