From 57556b16aafbafebc7f9fc86745ac2ea83e7616d Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 01 七月 2021 14:26:35 +0800 Subject: [PATCH] 流程 请假 销假 待办 已办 我得申请 --- zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs | 254 ++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 184 insertions(+), 70 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs index bab1b0c..62691b1 100644 --- a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs @@ -22,15 +22,22 @@ private readonly ISysAttachmentService _sysAttachmentService; private readonly IAdmAttendanceRuleService _attendanceRuleService; private readonly ILiaotianService _liaotianService; + private readonly IWfRunProcessService _wfRunProcessService; + private readonly IWfHistoryService _wfHistoryService; + private readonly IWfNeeddeelService _wfNeeddeelService; [CheckLogin] public SigninController(ILogger<SigninController> logger, IAdmSigninService signinService, ISysAttachmentService sysAttachmentService - , IAdmAttendanceRuleService attendanceRuleService, ILiaotianService liaotianService) + , IAdmAttendanceRuleService attendanceRuleService, ILiaotianService liaotianService, IWfRunProcessService wfRunProcessService + , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService) { _logger = logger; _signinService = signinService; _sysAttachmentService = sysAttachmentService; _attendanceRuleService = attendanceRuleService; _liaotianService = liaotianService; + _wfRunProcessService = wfRunProcessService; + _wfHistoryService = wfHistoryService; + _wfNeeddeelService = wfNeeddeelService; } #region 鑰冨嫟绛惧埌鎵撳崱 @@ -272,6 +279,51 @@ ViewData["Lavetype"] = _liaotianService.GetSYScode("ADM_AskLeave", "Lavetype"); + string shifoubiaoji = "A"; + string sifoudangqian = "A"; + string dangqianbuzhou = "鎻愪氦"; + var lishiyijian = new List<WfHistoryDTO>(); + //娴佺▼鐩稿叧 + if (!string.IsNullOrEmpty(id)) + { + var wfRunProcessDTO = _wfRunProcessService.GetList(id,"01").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + shifoubiaoji = "D"; + sifoudangqian = "D"; + } + else + { + dangqianbuzhou = wfRunProcessDTO.Step; + //鏌ヨ鍘嗗彶鎰忚 + lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id); + if(wfRunProcessDTO.Step != "鎻愪氦") + { + shifoubiaoji = "D"; + } + + //鏌ヨ寰呭姙 + var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x=>x.DeelUserId == curentuser.Id).ToList(); + if(chaxundaiban!=null && chaxundaiban.Count > 0) + { + sifoudangqian = "A"; + } + else + { + sifoudangqian = "D"; + } + + } + + + + + } + + ViewBag.shifoubiaoji = shifoubiaoji; + ViewBag.sifoudangqian = sifoudangqian; + ViewBag.lishiyijian = lishiyijian; + ViewBag.dangqianbuzhou = dangqianbuzhou; return View(); } @@ -283,61 +335,72 @@ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; admAsk.RecStatus = "A"; - //鏈寕瀹℃壒娴侊紝鎻愪氦鐩存帴閫氳繃 - admAsk.ShenpiStatus = "A"; - if (String.IsNullOrEmpty(admAsk.Id)) - { - admAsk.Creater = curentuser.Id; - admAsk.Createtime = DateTime.Now; - } - else - { - admAsk.Modifier = curentuser.Id; - admAsk.Modifytime = DateTime.Now; - } ResultEntity resultEntity = new ResultEntity(); resultEntity.Result = false; + + if (String.IsNullOrEmpty(admAsk.Id)) + { + admAsk.Creater = curentuser.Id; + admAsk.Createtime = DateTime.Now; + } + else + { + admAsk.Modifier = curentuser.Id; + admAsk.Modifytime = DateTime.Now; + } + + using (TransactionScope scope = new TransactionScope()) { - resultEntity = _signinService.SaveAskLeave(admAsk); - if (resultEntity.Result == false) + if (admAsk.Step == "鎻愪氦") { - return JsonConvert.SerializeObject(resultEntity); - } - - string[] Filepaths = admAsk.Filepath; - - if (Filepaths != null && Filepaths.Length > 0) - { - for (int i = 0; i < Filepaths.Length; i++) + resultEntity = _signinService.SaveAskLeave(admAsk); + if (resultEntity.Result == false) { - if (string.IsNullOrEmpty(admAsk.attachmentid[i])) - { - SysAttachmentDTO sysAttachmentDTO = new SysAttachmentDTO(); - //sysAttachmentDTO.Id = - sysAttachmentDTO.AttObj = "AskLeave"; - sysAttachmentDTO.AttObjid = admAsk.Id; - sysAttachmentDTO.Filefullname = admAsk.Filefullname[i]; - sysAttachmentDTO.Filepath = admAsk.Filepath[i]; - sysAttachmentDTO.Creater = curentuser.Id; - sysAttachmentDTO.Modifier = curentuser.Id; - sysAttachmentDTO.Createtime = DateTime.Now; - sysAttachmentDTO.Modifytime = sysAttachmentDTO.Createtime; - - resultEntity = _sysAttachmentService.save(sysAttachmentDTO); - if (resultEntity.Result == false) - { - return JsonConvert.SerializeObject(resultEntity); - } - } - + return JsonConvert.SerializeObject(resultEntity); } + string[] Filepaths = admAsk.Filepath; + if (Filepaths != null && Filepaths.Length > 0) + { + for (int i = 0; i < Filepaths.Length; i++) + { + if (string.IsNullOrEmpty(admAsk.attachmentid[i])) + { + SysAttachmentDTO sysAttachmentDTO = new SysAttachmentDTO(); + //sysAttachmentDTO.Id = + sysAttachmentDTO.AttObj = "AskLeave"; + sysAttachmentDTO.AttObjid = admAsk.Id; + sysAttachmentDTO.Filefullname = admAsk.Filefullname[i]; + sysAttachmentDTO.Filepath = admAsk.Filepath[i]; + sysAttachmentDTO.Creater = curentuser.Id; + sysAttachmentDTO.Modifier = curentuser.Id; + sysAttachmentDTO.Createtime = DateTime.Now; + sysAttachmentDTO.Modifytime = sysAttachmentDTO.Createtime; + + resultEntity = _sysAttachmentService.save(sysAttachmentDTO); + if (resultEntity.Result == false) + { + return JsonConvert.SerializeObject(resultEntity); + } + } + + } + + + } } + + + //鍙戣捣娴佺▼鐩稿叧 + + resultEntity = _wfRunProcessService.WfAskLeave(admAsk.Id, admAsk.Step, admAsk.Tongguojujue, curentuser.Id, admAsk.Content, admAsk.Tittle, "v1"); + scope.Complete(); + } - + return JsonConvert.SerializeObject(resultEntity); @@ -785,6 +848,53 @@ ViewData["Lavetype"] = _liaotianService.GetSYScode("ADM_AskLeaveOff", "Lavetype"); ViewData.Model = askLeaveOffDTO; + + string shifoubiaoji = "A"; + string sifoudangqian = "A"; + string dangqianbuzhou = "鎻愪氦"; + var lishiyijian = new List<WfHistoryDTO>(); + //娴佺▼鐩稿叧 + if (!string.IsNullOrEmpty(id)) + { + var wfRunProcessDTO = _wfRunProcessService.GetList(id, "02").FirstOrDefault(); + if (wfRunProcessDTO == null) + { + shifoubiaoji = "D"; + sifoudangqian = "D"; + } + else + { + dangqianbuzhou = wfRunProcessDTO.Step; + //鏌ヨ鍘嗗彶鎰忚 + lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id); + if (wfRunProcessDTO.Step != "鎻愪氦") + { + shifoubiaoji = "D"; + } + + //鏌ヨ寰呭姙 + var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList(); + if (chaxundaiban != null && chaxundaiban.Count > 0) + { + sifoudangqian = "A"; + } + else + { + sifoudangqian = "D"; + } + + } + + + + + } + + ViewBag.shifoubiaoji = shifoubiaoji; + ViewBag.sifoudangqian = sifoudangqian; + ViewBag.lishiyijian = lishiyijian; + ViewBag.dangqianbuzhou = dangqianbuzhou; + return View(); } @@ -806,41 +916,45 @@ resultEntity.Result = false; using (TransactionScope scope = new TransactionScope()) { - resultEntity = _signinService.SaveAskLeaveOff(leaveOff); - if(resultEntity.Result == false) + if (leaveOff.Step == "鎻愪氦") { - return JsonConvert.SerializeObject(resultEntity); - } - string[] Filepaths = leaveOff.Filepath; - - if (Filepaths != null && Filepaths.Length > 0) - { - for (int i = 0; i < Filepaths.Length; i++) + resultEntity = _signinService.SaveAskLeaveOff(leaveOff); + if (resultEntity.Result == false) { - if (string.IsNullOrEmpty(leaveOff.attachmentid[i])) - { - SysAttachmentDTO sysAttachmentDTO = new SysAttachmentDTO(); - //sysAttachmentDTO.Id = - sysAttachmentDTO.AttObj = "AskLeaveOff"; - sysAttachmentDTO.AttObjid = leaveOff.Id; - sysAttachmentDTO.Filefullname = leaveOff.Filefullname[i]; - sysAttachmentDTO.Filepath = leaveOff.Filepath[i]; - sysAttachmentDTO.Creater = curentuser.Id; - sysAttachmentDTO.Modifier = curentuser.Id; - sysAttachmentDTO.Createtime = DateTime.Now; - sysAttachmentDTO.Modifytime = sysAttachmentDTO.Createtime; + return JsonConvert.SerializeObject(resultEntity); + } + string[] Filepaths = leaveOff.Filepath; - resultEntity = _sysAttachmentService.save(sysAttachmentDTO); - if (resultEntity.Result == false) + if (Filepaths != null && Filepaths.Length > 0) + { + for (int i = 0; i < Filepaths.Length; i++) + { + if (string.IsNullOrEmpty(leaveOff.attachmentid[i])) { - return JsonConvert.SerializeObject(resultEntity); + SysAttachmentDTO sysAttachmentDTO = new SysAttachmentDTO(); + //sysAttachmentDTO.Id = + sysAttachmentDTO.AttObj = "AskLeaveOff"; + sysAttachmentDTO.AttObjid = leaveOff.Id; + sysAttachmentDTO.Filefullname = leaveOff.Filefullname[i]; + sysAttachmentDTO.Filepath = leaveOff.Filepath[i]; + sysAttachmentDTO.Creater = curentuser.Id; + sysAttachmentDTO.Modifier = curentuser.Id; + sysAttachmentDTO.Createtime = DateTime.Now; + sysAttachmentDTO.Modifytime = sysAttachmentDTO.Createtime; + + resultEntity = _sysAttachmentService.save(sysAttachmentDTO); + if (resultEntity.Result == false) + { + return JsonConvert.SerializeObject(resultEntity); + } } + } + } - - } + resultEntity = _wfRunProcessService.WfAskLeaveOff(leaveOff.Id, leaveOff.Step, leaveOff.Tongguojujue, curentuser.Id, leaveOff.Content, leaveOff.Tittle, "v1"); scope.Complete(); } -- Gitblit v1.9.1