/// <summary> /// 发消息给审核用户 /// </summary> /// <param name="ruleID">审核规则ID</param> /// <param name="num">业务编号</param> private void SendMessage(int ruleID, string num) { ApprovalRule rule = ApprovalRuleManager.GetModel(ruleID); if (rule.idgourp.Trim() != string.Empty) { EtNet_Models.Information messageEntity = new EtNet_Models.Information(); messageEntity.associationid = 0;//此处不需要,默认给一个值 messageEntity.contents = string.Format("编号为{0}的保单需要您审批!", num); messageEntity.createtime = DateTime.Now; messageEntity.founderid = (Session["login"] as LoginInfo).Id; messageEntity.sendtime = DateTime.Now; messageEntity.sortid = 10;//消息分类:保单审核 if (messageBLL.Add(messageEntity)) { IEnumerable <string> userList = rule.idgourp.Split(',').Where(x => x != string.Empty); int messageID = messageBLL.GetMaxId(); EtNet_Models.InformationNotice messageNoticeEntity = new InformationNotice(); messageNoticeEntity.informationid = messageID; foreach (string user in userList) { messageNoticeEntity.recipientid = int.Parse(user); messageNoticeEntity.remind = "是";//默认未阅读; InformationNoticeManager.Add(messageNoticeEntity); } } } }
/// <summary> /// 发消息给审核用户 /// </summary> private void SendMessage(string serialNumber) { ApprovalRule rule = ApprovalRuleManager.GetModel(int.Parse(ddlApproval.SelectedValue)); if (rule.idgourp.Trim() != string.Empty) { EtNet_Models.Information messageEntity = new EtNet_Models.Information(); messageEntity.associationid = 0;//此处不需要,默认给一个值 messageEntity.contents = string.Format("编号为{0}的单据需要您审批!", serialNumber); messageEntity.createtime = DateTime.Now; messageEntity.founderid = (Session["login"] as LoginInfo).Id; messageEntity.sendtime = DateTime.Now; messageEntity.sortid = 1;//消息分类:个人消息 if (InformationManager.Add(messageEntity)) { IEnumerable <string> userList = rule.idgourp.Split(',').Where(x => x != string.Empty); int messageID = InformationManager.GetMaxId(); EtNet_Models.InformationNotice messageNoticeEntity = new InformationNotice(); messageNoticeEntity.informationid = messageID; int len = rule.sort == "单审" ? 1 : userList.Count(); if (rule.sort == "单审") { messageNoticeEntity.recipientid = int.Parse(userList.ElementAt(0)); messageNoticeEntity.remind = "是";//默认未阅读; InformationNoticeManager.Add(messageNoticeEntity); } else { foreach (string user in userList) { messageNoticeEntity.recipientid = int.Parse(user); messageNoticeEntity.remind = "是";//默认未阅读; InformationNoticeManager.Add(messageNoticeEntity); } } } } }
/// <summary> /// 发消息给审核用户 /// </summary> private void SendMessage(string serialNum, int ruleid) { ApprovalRule rule = ApprovalRuleManager.GetModel(ruleid); if (rule.idgourp.Trim() != string.Empty) { EtNet_Models.Information messageEntity = new EtNet_Models.Information(); messageEntity.associationid = 0; //此处不需要,默认给一个值 消息分类关联的id值,邮件的id值,文档的id值 messageEntity.contents = string.Format("编号为{0}的定单需要您审批!", serialNum); //消息提示信息 messageEntity.createtime = DateTime.Now; //创建时间 messageEntity.founderid = (Session["login"] as LoginInfo).Id; //创建人id messageEntity.sendtime = DateTime.Now; //发送时间 messageEntity.sortid = 10; //消息分类:保单审核 if (messageBLL.Add(messageEntity)) { IEnumerable <string> userList = rule.idgourp.Split(',').Where(x => x != string.Empty); int messageID = messageBLL.GetMaxId(); EtNet_Models.InformationNotice messageNoticeEntity = new InformationNotice(); messageNoticeEntity.informationid = messageID; int len = rule.sort == "单审" ? 1 : userList.Count(); if (rule.sort == "单审") { messageNoticeEntity.recipientid = int.Parse(userList.ElementAt(0)); messageNoticeEntity.remind = "是";//默认未阅读; InformationNoticeManager.Add(messageNoticeEntity); } else { foreach (string user in userList) { messageNoticeEntity.recipientid = int.Parse(user); messageNoticeEntity.remind = "是";//默认未阅读; InformationNoticeManager.Add(messageNoticeEntity); } } } } }
/// <summary> /// 加载审核流程图 /// </summary> private void LoadAuditImg(int ruleid) { ApprovalRule model = ApprovalRuleManager.GetModel(ruleid); if (model != null) { string filePath = Server.MapPath(model.rolepic); if (File.Exists(filePath)) { auditpic.InnerHtml = File.ReadAllText(filePath); } else { auditpic.InnerHtml = "流程图不存在,或已被删除"; } } }
/// <summary> /// 加载审核流程图 /// </summary> private void LoadAuditImg(int ruleid) { ApprovalRule model = ApprovalRuleManager.GetModel(ruleid); if (model != null) { string strpath = Server.MapPath(model.rolepic); if (File.Exists(strpath)) { this.auditpic.InnerHtml = File.ReadAllText(strpath); } else { this.auditpic.InnerText = "找不到指定的审批流程图"; } } }
//通过审核 protected void imgbtnpass_Click(object sender, ImageClickEventArgs e) { 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 (AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../Job/AuditJobFlow.aspx"); } else if (JobFlowManager.GetModel(jobflowid).auditstatus == "03" || JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../Job/AuditJobFlow.aspx"); } else { JobFlow jobflow = JobFlowManager.GetModel(jobflowid); ApprovalRule rule = ApprovalRuleManager.GetModel(jobflow.ruleid); string ruletxt = rule.sort; //审核的分类 //修改当前审核人的记录 AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((LoginInfo)Session["login"]).Id; DataTable audittbl = AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new 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.treatxt.Value.Trim()); AuditJobFlowManager.Update(auditmodel); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": if (mainreviewer != "T") { auditmodel = new AuditJobFlow(); //设置下一个审核人的数据记录 string nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString(); DataTable nextaudittbl = 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(); AuditJobFlowManager.Update(auditmodel); jobflow.auditstatus = "02"; //工作流的审核状态为“进行中” JobFlowManager.Update(jobflow); } else { jobflow.endtime = DateTime.Now; jobflow.auditstatus = "04"; //工作流的审核状态为“已通过” JobFlowManager.Update(jobflow); } break; case "选审": jobflow.endtime = DateTime.Now; jobflow.auditstatus = "04"; //工作流的审核状态为“已通过” JobFlowManager.Update(jobflow); break; case "会审": bool pass = true; string strsql = " jobflowid=" + jobflowid.ToString(); DataTable auditjobtbl = AuditJobFlowManager.GetList(strsql); for (int i = 0; i < auditjobtbl.Rows.Count; i++) { if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过") { pass = false; //说明还有其他审核人员未开始审核 break; } } if (pass) { jobflow.endtime = DateTime.Now; jobflow.auditstatus = "04"; //工作流的状审核状态为“已通过” JobFlowManager.Update(jobflow); } else { jobflow.auditstatus = "02"; //工作流的状审核状态为“进行中” JobFlowManager.Update(jobflow); } break; } string sqlpolicy = " isVerify =" + jobflowid.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())); if (policy.Txt == "") { policy.Txt = login.Cname + "的审批意见:" + Server.UrlDecode(this.treatxt.Value.Trim()); } else { policy.Txt = policy.Txt + "|" + login.Cname + "的审批意见:" + Server.UrlDecode(this.treatxt.Value.Trim()); } EtNet_BLL.To_PolicyManager.updateTo_Policy(policy); SendMessage("【" + login.Cname + "】通过审批"); SendNextAudit(jobflowid); Response.Redirect("../Job/AuditJobFlow.aspx"); } }