Exemplo n.º 1
0
        /// <summary>
        /// 拒绝
        /// </summary>
        private void OrderRefuse()
        {
            int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id

            EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"];

            string comparedata = " reviewerid=" + login.Id + " AND jobflowid=" + jobflowid.ToString();

            if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0)
            {
                //该工作流被收回或删除导致审批提交失败
                Response.Redirect("../Job/AuditError.aspx?error=0");
            }
            else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04")
            {
                //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过
                Response.Redirect("../Job/AuditError.aspx?error=1");
            }

            else
            {
                string    ruletxt = ""; //审核的分类
                string    strsql  = " jobflowid=" + jobflowid.ToString();
                DataTable tbl     = EtNet_BLL.To_OrderInfoManager.getList("", strsql);
                if (tbl.Rows.Count == 1)
                {
                    int ruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString());
                    EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid);
                    ruletxt = rule.sort;

                    //修改当前审核人的记录
                    EtNet_Models.AuditJobFlow auditmodel = null;
                    string    auditstr     = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + login.Id;
                    DataTable audittbl     = EtNet_BLL.AuditJobFlowManager.GetList(auditstr);   // 查找到当前审核人员的记录
                    int       num          = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号
                    string    mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();       //当前审核人是不是最终审核人

                    auditmodel              = new EtNet_Models.AuditJobFlow();
                    auditmodel.auditoperat  = "拒绝";
                    auditmodel.audittime    = DateTime.Now;
                    auditmodel.id           = int.Parse(audittbl.Rows[0]["id"].ToString());
                    auditmodel.jobflowid    = int.Parse(audittbl.Rows[0]["jobflowid"].ToString());
                    auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();
                    auditmodel.nowreviewer  = "P"; //能查找到工作流记录,但不能进行审核操作
                    auditmodel.numbers      = int.Parse(audittbl.Rows[0]["numbers"].ToString());
                    auditmodel.operatstatus = "已审批";
                    auditmodel.reviewerid   = int.Parse(audittbl.Rows[0]["reviewerid"].ToString());
                    auditmodel.opiniontxt   = Server.UrlDecode(this.iptcomment.Value.Trim());
                    EtNet_BLL.AuditJobFlowManager.Update(auditmodel);

                    EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow();
                    jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid);

                    //依据不同的审核类型进行操作
                    switch (ruletxt)
                    {
                    case "单审":
                    case "会审":
                        jobflowmodel.endtime     = DateTime.Now;
                        jobflowmodel.auditstatus = "03";     //工作流的审核状态为“被拒绝”
                        EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                        break;

                    case "选审":
                        string    st     = " jobflowid=" + jobflowid.ToString();
                        DataTable tbla   = EtNet_BLL.AuditJobFlowManager.GetList(st);
                        bool      refuse = true;

                        for (int j = 0; j < tbla.Rows.Count; j++)
                        {
                            if (tbla.Rows[j]["auditoperat"].ToString() != "拒绝")
                            {
                                refuse = false;     //还有其他审核人员未审
                                break;
                            }
                        }
                        if (refuse)
                        {
                            jobflowmodel.endtime     = DateTime.Now;
                            jobflowmodel.auditstatus = "03";     // 工作流的审核状态为被拒绝
                            EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                        }
                        else
                        {
                            jobflowmodel.auditstatus = "02";     // 工作流的审核状态为进行中
                            EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                        }
                        break;
                    }


                    string strad = "编号为" + jobflowmodel.cname + "的订单,【" + login.Cname + "】审批被拒绝!";
                    SendInfo(strad, jobflowmodel.id);

                    SendNextAudit(jobflowmodel.id);

                    //修改客户的审核意见与启用状态
                    //int cusid = int.Parse(tbl.Rows[0]["id"].ToString());
                    EtNet_Models.AuditJobFlow cus = EtNet_BLL.AuditJobFlowManager.GetModelByJFID(jobflowid);
                    cus.opiniontxt = cus.opiniontxt + login.Cname + "的审批意见:" + Server.UrlDecode(this.iptcomment.Value.Trim()) + "|";
                    //if (jobflowmodel.auditstatus == "04")
                    //{
                    //    cus.Used = 1;
                    //}
                    EtNet_BLL.AuditJobFlowManager.Update(cus);
                    if (HttpContext.Current.Request.QueryString["pageindex"] != null)
                    {
                        int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]);
                        Response.Redirect("../Job/AuditJobFlow.aspx?page=" + page + "");
                    }
                    else
                    {
                        Response.Redirect("../Job/AuditJobFlow.aspx");
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///  创建审批序列
        /// </summary>
        ///<param name="ruleid">审核规则id值</param>
        /// <param name="id">工作流的id号</param>
        private void CreateApproval(int ruleid, int id)
        {
            EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid);
            string stafflist = rule.idgourp;
            string auditsort = rule.sort;

            string[] staff = null;
            int      len   = 0; //审批人员的个数

            EtNet_Models.AuditJobFlow model = null;
            if (stafflist.IndexOf(",") == -1)
            {
                staff    = new string[1];
                staff[0] = stafflist;
                len      = 1;
            }
            else
            {
                staff = stafflist.Split(',');
                len   = staff.Length;
            }

            switch (auditsort)
            {
            case "单审":
                for (int i = 0; i < staff.Length; i++)
                {
                    model              = new EtNet_Models.AuditJobFlow();
                    model.auditoperat  = "未操作";
                    model.operatstatus = "未审批";
                    model.audittime    = new DateTime(1900, 1, 1);
                    if (i == 0)
                    {
                        model.nowreviewer = "T";    //第一个审核的人员
                    }
                    else
                    {
                        model.nowreviewer = "F";
                    }

                    if ((i + 1) == len)
                    {
                        model.mainreviewer = "T";    //最终审核的人员
                    }
                    else
                    {
                        model.mainreviewer = "F";
                    }
                    model.numbers    = i + 1;
                    model.jobflowid  = id;
                    model.reviewerid = int.Parse(staff[i]);
                    model.opiniontxt = "";
                    EtNet_BLL.AuditJobFlowManager.Add(model);
                }
                break;

            case "选审":
            case "会审":
                for (int i = 0; i < staff.Length; i++)
                {
                    model              = new EtNet_Models.AuditJobFlow();
                    model.audittime    = new DateTime(1900, 1, 1);
                    model.nowreviewer  = "T";
                    model.mainreviewer = "T";
                    model.numbers      = 1;
                    model.jobflowid    = id;
                    model.auditoperat  = "未操作";
                    model.operatstatus = "未审批";
                    model.opiniontxt   = "";
                    model.reviewerid   = int.Parse(staff[i]);
                    EtNet_BLL.AuditJobFlowManager.Add(model);
                }
                break;
            }
        }
Exemplo n.º 3
0
        private void OrderPass()
        {
            int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id

            EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"];

            string comparedata = " reviewerid=" + login.Id + " AND jobflowid=" + jobflowid.ToString();

            if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0)
            {
                //该工作流被收回或删除导致审批提交失败
                Response.Redirect("../Job/AuditError.aspx?error=0");
            }
            else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04")
            {
                //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过
                Response.Redirect("../Job/AuditError.aspx?error=1");
            }
            else
            {
                string ruletxt = ""; //审核的分类
                string strsql  = " jobflowID=" + jobflowid.ToString();

                DataTable tbl = EtNet_BLL.To_OrderInfoManager.getList("", strsql);//获取视图数据
                if (tbl.Rows.Count == 1)
                {
                    int ruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString());
                    EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid);
                    ruletxt = rule.sort;

                    //修改当前审核人的记录
                    EtNet_Models.AuditJobFlow auditmodel = null;
                    string    auditstr     = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + login.Id;
                    DataTable audittbl     = EtNet_BLL.AuditJobFlowManager.GetList(auditstr);   // 查找到当前审核人员的记录
                    int       num          = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号
                    string    mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();       //当前审核人是不是最终审核人

                    auditmodel              = new EtNet_Models.AuditJobFlow();
                    auditmodel.auditoperat  = "通过";
                    auditmodel.audittime    = DateTime.Now;
                    auditmodel.id           = int.Parse(audittbl.Rows[0]["id"].ToString());
                    auditmodel.jobflowid    = int.Parse(audittbl.Rows[0]["jobflowid"].ToString());
                    auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString();
                    auditmodel.nowreviewer  = "P"; //能查找到工作流记录,但不能进行审核操作
                    auditmodel.numbers      = int.Parse(audittbl.Rows[0]["numbers"].ToString());
                    auditmodel.operatstatus = "已审批";
                    auditmodel.reviewerid   = int.Parse(audittbl.Rows[0]["reviewerid"].ToString());
                    if (this.iptcomment.Value != "")
                    {
                        auditmodel.opiniontxt = Server.UrlDecode(this.iptcomment.Value.Trim());
                    }
                    else
                    {
                        auditmodel.opiniontxt = "   ";
                    }

                    EtNet_BLL.AuditJobFlowManager.Update(auditmodel);

                    EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow();
                    jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid);

                    //依据不同的审核类型进行操作
                    switch (ruletxt)
                    {
                    case "单审":
                        if (mainreviewer != "T")
                        {
                            auditmodel = new EtNet_Models.AuditJobFlow();     //设置下一个审核人的数据记录
                            string    nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString();
                            DataTable nextaudittbl = EtNet_BLL.AuditJobFlowManager.GetList(nextauditstr);
                            auditmodel.auditoperat  = nextaudittbl.Rows[0]["auditoperat"].ToString();
                            auditmodel.audittime    = DateTime.Parse(nextaudittbl.Rows[0]["audittime"].ToString());
                            auditmodel.id           = int.Parse(nextaudittbl.Rows[0]["id"].ToString());
                            auditmodel.jobflowid    = int.Parse(nextaudittbl.Rows[0]["jobflowid"].ToString());
                            auditmodel.mainreviewer = nextaudittbl.Rows[0]["mainreviewer"].ToString();
                            auditmodel.nowreviewer  = "T";    //设置其为审核人员
                            auditmodel.numbers      = int.Parse(nextaudittbl.Rows[0]["numbers"].ToString());
                            auditmodel.operatstatus = nextaudittbl.Rows[0]["operatstatus"].ToString();
                            auditmodel.reviewerid   = int.Parse(nextaudittbl.Rows[0]["reviewerid"].ToString());
                            auditmodel.opiniontxt   = nextaudittbl.Rows[0]["opiniontxt"].ToString();
                            EtNet_BLL.AuditJobFlowManager.Update(auditmodel);

                            jobflowmodel.auditstatus = "02";     //工作流的审核状态为“进行中”
                            EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                        }
                        else
                        {
                            jobflowmodel.endtime     = DateTime.Now;
                            jobflowmodel.auditstatus = "04";     //工作流的审核状态为“已通过”
                            EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                            EtNet_BLL.To_OrderInfoManager.updateOrdersjGross(jobflowid.ToString(), this.lblsjml.Text);
                        }
                        break;

                    case "选审":

                        jobflowmodel.endtime     = DateTime.Now;
                        jobflowmodel.auditstatus = "04";     //工作流的审核状态为“已通过”
                        EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                        EtNet_BLL.To_OrderInfoManager.updateOrdersjGross(jobflowid.ToString(), this.lblsjml.Text);
                        //审核通过后,删除其他审核人员的审核流数据
                        AuditJobFlowManager.UpdateOther(" reviewerid != " + login.Id + " and jobflowid=" + jobflowid.ToString());
                        break;

                    case "会审":
                        bool      pass        = true;
                        string    straudit    = " jobflowid=" + jobflowid.ToString();
                        DataTable auditjobtbl = EtNet_BLL.AuditJobFlowManager.GetList(straudit);
                        for (int i = 0; i < auditjobtbl.Rows.Count; i++)
                        {
                            if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过")
                            {
                                pass = false;     //说明还有其他审核人员未开始审核
                                break;
                            }
                        }

                        if (pass)
                        {
                            jobflowmodel.endtime     = DateTime.Now;
                            jobflowmodel.auditstatus = "04";     //工作流的状审核状态为“已通过”
                            EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                            EtNet_BLL.To_OrderInfoManager.updateOrdersjGross(jobflowid.ToString(), this.lblsjml.Text);
                        }
                        else
                        {
                            jobflowmodel.auditstatus = "02";     //工作流的状审核状态为“进行中”
                            EtNet_BLL.JobFlowManager.Update(jobflowmodel);
                        }
                        break;
                    }



                    string strad = "编号为" + jobflowmodel.cname + "的订单,【" + login.Cname + "】通过审批!";
                    SendInfo(strad, jobflowmodel.id);

                    SendNextAudit(jobflowmodel.id);

                    //修改客户的审核意见与启用状态
                    //int cusid = int.Parse(tbl.Rows[0]["id"].ToString());
                    EtNet_Models.AuditJobFlow cus = EtNet_BLL.AuditJobFlowManager.GetModelByJFID(jobflowid);
                    cus.opiniontxt = cus.opiniontxt + login.Cname + "的审批意见:" + Server.UrlDecode(this.iptcomment.Value.Trim()) + "|";
                    //if (jobflowmodel.auditstatus == "04")
                    //{
                    //    cus.Used = 1;
                    //}
                    EtNet_BLL.AuditJobFlowManager.Update(cus);
                    if (HttpContext.Current.Request.QueryString["pageindex"] != null)
                    {
                        int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]);
                        Response.Redirect("../Job/AuditJobFlow.aspx?page=" + page + "");
                    }
                    else
                    {
                        Response.Redirect("../Job/AuditJobFlow.aspx");
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false);
                }
            }
        }