/// <summary> /// 进行申请时调用,申请时同时往状态表插入申请状态 /// </summary> /// <param name="apply"></param> /// <returns></returns> public int ApplyCommit(Apply apply, string nextRecheckUserId) { // 申请信息 SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ApplyId", apply.Id.ToString()), new SqlParameter("@ApplyReason", apply.ApplyReason == null?"":apply.ApplyReason), new SqlParameter("@ApplyTypeId", apply.ApplyTypeId == null?"":apply.ApplyTypeId), new SqlParameter("@ProjectId", apply.ProjectId), new SqlParameter("@ApplyUserId", apply.ApplyUserId == null?"":apply.ApplyUserId) }; Type t = typeof(int); int applyId = db.Database.SqlQuery(t, "EXEC up_Apply_Apply_S @ApplyId,@ApplyReason,@ApplyTypeId,@ProjectId,@ApplyUserId", para).Cast <int>().First(); // 申请状态信息 ApplyRecheckStatus status = new ApplyRecheckStatus(); if (apply.ApplyReason == null) { apply.ApplyReason = ""; } status.ApplyId = applyId; status.RecheckUserId = apply.ApplyUserId; status.RecheckStatusCode = "申请"; status.RecheckReason = apply.ApplyReason; status.InDateTime = DateTime.Now; ApplyRecheckStatusUpdate(status, nextRecheckUserId); return(applyId); }
public ActionResult ApplyCommit(string recheckUserId, Apply apply, string projectId, string applyIdexists, string seqNO, string attachArray) { ApplyService applayService = new ApplyService(); apply.InDateTime = DateTime.Now; apply.ApplyUserId = UserInfo.UserId; apply.ApplyTypeId = ApplyType.立项.ToString(); apply.ProjectId = Convert.ToInt32(projectId); int applyId = 0; if (Convert.ToInt32(applyIdexists) == 0) { applyId = applayService.ApplyCommit(apply, recheckUserId); } else { ApplyRecheckStatus status = new ApplyRecheckStatus(); status.ApplyId = Convert.ToInt32(applyIdexists); status.RecheckUserId = ((Mst_UserInfo)Session["LoginUser"]).UserId; status.RecheckStatusCode = "申请"; status.RecheckReason = apply.ApplyReason == null ? "" : apply.ApplyReason; status.SeqNO = Convert.ToInt32(seqNO); status.InDateTime = DateTime.Now; applayService.ApplyRecheckStatusUpdate(status, recheckUserId); applyId = Convert.ToInt32(applyIdexists); } MyApplyDto applyInfo = applayService.ApplySearchById(applyId.ToString()).FirstOrDefault(); ApplyEmailSend(applyInfo, recheckUserId); //保存附件 List <string> attachList = JsonConvert.DeserializeObject <List <string> >(attachArray); int fileSeqNO = 1; attachList.ForEach((string attach) => { db.ApplyFile.Add(new ApplyFile() { ApplyId = applyId, FileName = attach, InDateTime = DateTime.Now, InUserId = UserInfo.UserId, SeqNO = fileSeqNO++ }); }); db.SaveChanges(); return(Json(applyId, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 在审核的过程中,当进行批准或者拒绝的时候调用 /// 若是批准nextRecheckUserId为选择的下一个批准人 /// 若是拒绝nextRecheckUserId 为上一个批准人,或者申请人 /// 若是终止,或者是最后一个审核人时 nextRecheckUserId="" /// </summary> /// <param name="status"></param> public void ApplyRecheckStatusUpdate(ApplyRecheckStatus status, string nextRecheckUserId) { if (nextRecheckUserId == null) { nextRecheckUserId = ""; } if (status.RecheckReason == null) { status.RecheckReason = ""; } SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ApplyId", status.ApplyId), new SqlParameter("@SeqNO", status.SeqNO), new SqlParameter("@RecheckUserId", status.RecheckUserId), new SqlParameter("@RecheckStatusCode", status.RecheckStatusCode), new SqlParameter("@RecheckReason", status.RecheckReason), new SqlParameter("@NextRecheckUserId", nextRecheckUserId) }; db.Database.ExecuteSqlCommand("EXEC up_Apply_Apply_RecheckStatus_S @ApplyId,@SeqNO,@RecheckUserId,@RecheckStatusCode,@RecheckReason,@NextRecheckUserId", para); }
public ActionResult RecheckCommit(ApplyRecheckStatus applyStatus, string nextRecheckUserId) { ApplyService applayService = new ApplyService(); // 查询当前提交审核的申请,审核人的审核信息 RecheckStatusDtlDto recheckStatus = applayService.RecheckDtlSearch(applyStatus.ApplyId.ToString()).Where(x => x.SeqNO == applyStatus.SeqNO.ToString()).FirstOrDefault(); // 只有当审核人还没有审核的时候执行下面的操作,如果审核人已经审核过的话,不需要再执行 //正常情况下不会出现这样的数据,为了解决特定网络情况下导致的重复数据,所以添加了这个判断 if (string.IsNullOrEmpty(recheckStatus.RecheckStatusCode)) { MyApplyDto applyInfo = applayService.ApplySearchById(applyStatus.ApplyId.ToString()).FirstOrDefault(); if (applyStatus.RecheckStatusCode == "拒绝") { nextRecheckUserId = applayService.PreRecheckUserSearch(applyStatus.ApplyId.ToString(), UserInfo.UserId); } applyStatus.RecheckUserId = UserInfo.UserId; applyStatus.InDateTime = DateTime.Now; if (nextRecheckUserId == null) { nextRecheckUserId = ""; } applayService.ApplyRecheckStatusUpdate(applyStatus, nextRecheckUserId); if (applyStatus.RecheckStatusCode == "拒绝") { ApplyEmailSend(applyInfo, nextRecheckUserId, "拒绝"); } else { ApplyEmailSend(applyInfo, nextRecheckUserId, ""); } // 状态更新后再查询一遍,如果是完成的话则发送邮件给申请人,邮件通知已经审核完成 MyApplyDto afterUpdate = applayService.ApplySearchById(applyStatus.ApplyId.ToString()).FirstOrDefault(); if (afterUpdate.ApplyStatusCode == "完成") { ApplyEmailSend(applyInfo, nextRecheckUserId, "完成"); } } return(Json("")); }
public ActionResult RecheckListCommit(string applyStatusList, string recheckReason, string nextRecheckUserId) { ApplyService applayService = new ApplyService(); string[] applyList = new string[] { }; if (applyStatusList.Length > 0) { applyList = applyStatusList.Split(';'); } foreach (string item in applyList) { // 查询当前提交审核的申请,审核人的审核信息 RecheckStatusDtlDto recheckStatus = applayService.RecheckDtlSearch(item.Split(',')[0].ToString()).Where(x => x.SeqNO == item.Split(',')[1].ToString()).FirstOrDefault(); // 只有当审核人还没有审核的时候执行下面的操作,如果审核人已经审核过的话,不需要再执行 //正常情况下不会出现这样的数据,为了解决特定网络情况下导致的重复数据,所以添加了这个判断 if (string.IsNullOrEmpty(recheckStatus.RecheckStatusCode)) { ApplyRecheckStatus applyStatus = new ApplyRecheckStatus(); applyStatus.RecheckUserId = UserInfo.UserId; applyStatus.InDateTime = DateTime.Now; applyStatus.ApplyId = Convert.ToInt32(item.Split(',')[0]); applyStatus.SeqNO = Convert.ToInt32(item.Split(',')[1]); applyStatus.RecheckStatusCode = "同意"; applyStatus.RecheckReason = recheckReason; applayService.ApplyRecheckStatusUpdate(applyStatus, nextRecheckUserId); MyApplyDto applyInfo = applayService.ApplySearchById(applyStatus.ApplyId.ToString()).FirstOrDefault(); ApplyEmailSend(applyInfo, nextRecheckUserId, ""); // 状态更新后再查询一遍,如果是完成的话则发送邮件给申请人,邮件通知已经审核完成 MyApplyDto afterUpdate = applayService.ApplySearchById(applyStatus.ApplyId.ToString()).FirstOrDefault(); if (afterUpdate.ApplyStatusCode == "完成") { ApplyEmailSend(applyInfo, nextRecheckUserId, "完成"); } } } return(Json("")); }
public ActionResult ApplyCommit(string recheckUserId, Apply apply, string projectId, string groupId, string applyIdexists, string seqNO, string attachArray) { ApplyService applayService = new ApplyService(); apply.InDateTime = DateTime.Now; apply.ApplyUserId = UserInfo.UserId; apply.ApplyTypeId = ApplyType.结算单.ToString(); apply.ProjectId = Convert.ToInt32(groupId);// 结算单申请时ProjectId 保存为groupId int applyId = 0; if (Convert.ToInt32(applyIdexists) == 0) { applyId = applayService.ApplyCommit(apply, recheckUserId); } else { applyId = Convert.ToInt32(applyIdexists); ApplyRecheckStatus status = new ApplyRecheckStatus(); status.ApplyId = Convert.ToInt32(applyIdexists); status.RecheckUserId = ((Mst_UserInfo)Session["LoginUser"]).UserId; status.RecheckStatusCode = "申请"; status.RecheckReason = apply.ApplyReason == null ? "" : apply.ApplyReason; status.SeqNO = Convert.ToInt32(seqNO); status.InDateTime = DateTime.Now; applayService.ApplyRecheckStatusUpdate(status, recheckUserId); } applayService.ApplyDtlDelete(new ApplyDtl { ApplyId = applyId, ApplyTypeId = "结算单" }); List <SettlementGroupDtlDto> list = service.SettlementMstSearchByGroupId(projectId, groupId.ToString()).Where(x => x.SelectedChk == true).ToList(); foreach (SettlementGroupDtlDto item in list) { ApplyDtl applyDtl = new ApplyDtl() { ApplyId = applyId, ApplyContentId = Convert.ToInt32(item.SettlementId), ApplyTypeId = ApplyType.结算单.ToString(), InDateTime = DateTime.Now, InUserId = UserInfo.UserId }; // applayService.ApplyDtlSave(applyDtl); applyService.ApplyDtlSave_Settlement(applyDtl); } MyApplyDto applyInfo = applayService.ApplySearchById(applyId.ToString()).FirstOrDefault(); ApplyEmailSend(applyInfo, recheckUserId); //保存附件 List <string> attachList = JsonConvert.DeserializeObject <List <string> >(attachArray); int fileSeqNO = 1; attachList.ForEach((string attach) => { db.ApplyFile.Add(new ApplyFile() { ApplyId = applyId, FileName = attach, InDateTime = DateTime.Now, InUserId = UserInfo.UserId, SeqNO = fileSeqNO++ }); }); db.SaveChanges(); return(Json(applyId, JsonRequestBehavior.AllowGet)); }