/// <summary> /// 发送消息 /// </summary> private void SendInformation(int jobflowid, int ruleid) { EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); string[] list = rule.idgourp.Split(','); EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jobflowid); EtNet_Models.Information informodel = null; if (model != null) { informodel = new EtNet_Models.Information(); informodel.sortid = 9; informodel.associationid = jobflowid; informodel.contents = "编号为" + model.cname + "的客户需要您审批!"; informodel.createtime = DateTime.Now; informodel.sendtime = DateTime.Now; informodel.founderid = ((EtNet_Models.LoginInfo)Session["login"]).Id; if (EtNet_BLL.InformationManager.Add(informodel)) { int maxid = EtNet_BLL.InformationManager.GetMaxId(); EtNet_Models.InformationNotice infnotic = null; int len = (rule.sort == "单审") ? 1 : list.Length; for (int j = 0; j < len; j++) { infnotic = new EtNet_Models.InformationNotice(); infnotic.informationid = maxid; infnotic.recipientid = int.Parse(list[j].ToString()); infnotic.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(infnotic); } } } }
/// <summary> /// 客户送审 /// </summary> /// <param name="id">客户的id值</param> private void AuditCustomer(int id) { string strsql = " id=" + id; string strfields = " jobflowcode,savestatus,ruleid "; DataTable tbl = EtNet_BLL.ViewBLL.ViewCustomerManager.getList(strfields, strsql); if (tbl.Rows.Count != 1) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('送审失败')</script>"); } else { if (tbl.Rows[0]["savestatus"].ToString() == "草稿") { int jfid = int.Parse(tbl.Rows[0]["jobflowcode"].ToString()); EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jfid); model.createtime = DateTime.Now; //默认是当前时间 model.endtime = DateTime.Now; model.savestatus = "已提交"; EtNet_BLL.JobFlowManager.Update(model); CreateApproval(model.ruleid, model.id); SendInformation(model.id, model.ruleid); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('送审成功')</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script>alert('无需送审')</script>"); } } }
/// <summary> /// 回收 /// </summary> /// <param name="jfid"></param> private void Refresh(int jfid) { EtNet_Models.JobFlow refreshmodel = EtNet_BLL.JobFlowManager.GetModel(jfid); if (refreshmodel != null && (refreshmodel.auditstatus == "01" || refreshmodel.auditstatus == "03")) { string strfresh = " jobflowid = " + jfid; EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核人员的数据,请假单回到草稿状态 refreshmodel.savestatus = "草稿"; refreshmodel.auditstatus = "01"; refreshmodel.txt = ""; string sqlpolicy = " isVerify =" + jfid.ToString(); DataTable tblpolicy = EtNet_BLL.To_PolicyManager.GetList(1, sqlpolicy, "id"); EtNet_Models.To_Policy policy = EtNet_BLL.To_PolicyManager.getTo_PolicyById(int.Parse(tblpolicy.Rows[0]["id"].ToString())); policy.Txt = ""; EtNet_BLL.To_PolicyManager.updateTo_Policy(policy); if (EtNet_BLL.JobFlowManager.Update(refreshmodel)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回')</script>", false); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "retwo", "<script>alert('回收失败,原因可能审核人员在审核或审核已通过!')</script>", false); } }
/// <summary> /// 发送消息 /// </summary> /// <param name="straud">审核单据编号及意见</param> /// <param name="jobflowid">工作流id值</param> public void SendInfo(string straud, int jobflowid) { EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jobflowid); if (model != null) { int infoid = CreateInfo(straud); CreateInfoNotice(infoid, model.founderid); } }
/// <summary> /// 回收客户审批资料 /// </summary> /// <param name="jfid">客户的id值</param> private void RefreshCus(int id) { string login = ((EtNet_Models.LoginInfo)Session["login"]).Id.ToString(); string strsql = " id=" + id; string strfields = " madefrom,jobflowcode,auditstatus "; DataTable tbl = EtNet_BLL.ViewBLL.ViewCustomerManager.getList(strfields, strsql); if (tbl.Rows.Count == 0) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "share", "<script>alert('该客户已删除')</script>"); } else { string str = "<script>alert('成功收回客户!')</script>"; if (tbl.Rows[0]["jobflowcode"].ToString() == "") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "share", "<script>alert('客户资料缺失导致无法回收')</script>"); } else if (tbl.Rows[0]["auditstatus"].ToString() == "02" || tbl.Rows[0]["auditstatus"].ToString() == "04") { str = "<script>alert('回收失败,只有状态是未开始与被拒绝的客户才能回收')</script>"; } else if (tbl.Rows[0]["madefrom"].ToString() != login) { str = "<script>alert('回收失败,无此权限')</script>"; } else { int jfid = int.Parse(tbl.Rows[0]["jobflowcode"].ToString()); string strfresh = " jobflowid = " + jfid.ToString(); EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核人员的数据 EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jfid); model.savestatus = "草稿"; model.auditstatus = "01"; EtNet_BLL.JobFlowManager.Update(model); EtNet_Models.Customer cus = EtNet_BLL.CustomerManager.getCustomerById(id); cus.Txt = ""; EtNet_BLL.CustomerManager.updateCustomer(cus); } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "refresh", str, false); } }
/// <summary> /// 发送审批消息给下一个审批人员 /// </summary> public void SendNextAudit(int jfid) { EtNet_Models.LoginInfo login = ((EtNet_Models.LoginInfo)Session["login"]); EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(jfid); if (jfmodel != null) { EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(jfmodel.ruleid); string[] list = rule.idgourp.Split(','); if (rule.sort != "单审" || list.Length == 1) { return; } if (list[list.Length - 1] == login.Id.ToString()) { return; } int recipientid = 0; for (int i = 0; i < list.Length; i++) { if (list[i] == login.Id.ToString() && i != list.Length - 1) { recipientid = int.Parse(list[i + 1]); } } EtNet_Models.Information model = new EtNet_Models.Information(); model.sortid = 10; model.associationid = jfid; model.createtime = DateTime.Now; model.sendtime = DateTime.Now; model.founderid = jfmodel.founderid; model.contents = "名称为" + jfmodel.cname + "的单据需要您审批!";; EtNet_BLL.InformationManager.Add(model); int maxid = EtNet_BLL.InformationManager.GetMaxId(jfmodel.founderid.ToString()); EtNet_Models.InformationNotice infnotic = new EtNet_Models.InformationNotice(); infnotic.informationid = maxid; infnotic.recipientid = recipientid; infnotic.remind = "是"; EtNet_BLL.InformationNoticeManager.Add(infnotic); } }
/// <summary> /// 回收 /// </summary> /// <param name="jfid"></param> private void Refresh(int jfid) { LoginInfo login = Session["login"] as LoginInfo; EtNet_Models.JobFlow refreshmodel = EtNet_BLL.JobFlowManager.GetModel(jfid); if (login.Id.ToString() == "1") //如果是管理员,那么审核通过后也能够回收 { if (refreshmodel != null) { string strfresh = " jobflowid = " + jfid; EtNet_BLL.AuditJobFlowManager.Delete(strfresh); refreshmodel.savestatus = "草稿"; refreshmodel.auditstatus = "01"; refreshmodel.txt = ""; if (EtNet_BLL.JobFlowManager.Update(refreshmodel)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回')</script>", false); } } } else { if (refreshmodel != null && (refreshmodel.auditstatus == "01" || refreshmodel.auditstatus == "03")) { string strfresh = " jobflowid = " + jfid; EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核人员的数据,申请单回到草稿状态 refreshmodel.savestatus = "草稿"; refreshmodel.auditstatus = "01"; refreshmodel.txt = ""; if (EtNet_BLL.JobFlowManager.Update(refreshmodel)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回')</script>", false); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "retwo", "<script>alert('回收失败,原因可能审核人员在审核或审核已通过!')</script>", false); } } }
/// <summary> /// 回收 /// </summary> /// <param name="jfid"></param> private void Recover(int jobflowID) { EtNet_Models.JobFlow refreshmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowID); if (refreshmodel != null && (refreshmodel.auditstatus == "01" || refreshmodel.auditstatus == "03")) { string strfresh = " jobflowid = " + jobflowID; EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核人员的数据,请假单回到草稿状态 refreshmodel.savestatus = "草稿"; refreshmodel.auditstatus = "01"; refreshmodel.txt = ""; if (EtNet_BLL.JobFlowManager.Update(refreshmodel)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回')</script>", false); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "retwo", "<script>alert('回收失败,原因可能审核人员在审核或审核已通过!')</script>", false); } }
/// <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); } } }
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); } } }