From 6e2b929cf381e2320ba6e7dec56c0371124d2b51 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期六, 27 八月 2022 15:03:00 +0800
Subject: [PATCH] 提交

---
 zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs |  110 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 98 insertions(+), 12 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs
index 1fce48e..bac4408 100644
--- a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs
@@ -25,10 +25,12 @@
         private readonly IWfRunProcessService _wfRunProcessService;
         private readonly IWfHistoryService _wfHistoryService;
         private readonly IWfNeeddeelService _wfNeeddeelService;
+        private readonly IPltPageService _pltPageService;
         [CheckLogin]
         public SigninController(ILogger<SigninController> logger, IAdmSigninService signinService, ISysAttachmentService sysAttachmentService
             , IAdmAttendanceRuleService attendanceRuleService, ILiaotianService liaotianService, IWfRunProcessService wfRunProcessService
-            , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService)
+            , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
+             , IPltPageService pltPageService)
         {
             _logger = logger;
             _signinService = signinService;
@@ -38,6 +40,7 @@
             _wfRunProcessService = wfRunProcessService;
             _wfHistoryService = wfHistoryService;
             _wfNeeddeelService = wfNeeddeelService;
+            _pltPageService = pltPageService;
         }
 
         #region 鑰冨嫟绛惧埌鎵撳崱
@@ -296,8 +299,8 @@
                 else
                 {
                     dangqianbuzhou = wfRunProcessDTO.Step;
-                    //鏌ヨ鍘嗗彶鎰忚
-                     lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
+                    //鏌ヨ瀹℃壒杩涘害
+                    lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
                     if(wfRunProcessDTO.Step != "鎻愪氦")
                     {
                         shifoubiaoji = "D";
@@ -338,8 +341,37 @@
             admAsk.RecStatus = "A";
             ResultEntity resultEntity = new ResultEntity();
             resultEntity.Result = false;
-           
-                if (String.IsNullOrEmpty(admAsk.Id))
+
+            if(admAsk.Step == "鎻愪氦")
+            {
+                //璇峰亣鏃堕棿涓嶈兘閲嶅彔
+              var qingjia  =   _signinService.GetAskLeaveChongdie(curentuser.Id, admAsk.StratTime.Value, admAsk.EndTime.Value);
+                if (qingjia.Count > 0)
+                {
+                    resultEntity.Result = false;
+                    resultEntity.Message = "璇ユ椂闂存宸茬粡鏈夎鍋囷紒";
+                    return JsonConvert.SerializeObject(resultEntity);
+                }
+
+            //璇峰亣瓒呰繃涓夊ぉ锛屽繀椤绘彁鍓嶄笁澶╀互涓婅鍋囷紒
+                if (admAsk.LaveDay.Value >= 3 && admAsk.StratTime.Value.Date < DateTime.Now.Date.AddDays(3))
+                {
+                    resultEntity.Result = false;
+                    resultEntity.Message = "璇峰亣瓒呰繃涓夊ぉ锛屽繀椤绘彁鍓嶄笁澶╀互涓婅鍋囷紒";
+                    return JsonConvert.SerializeObject(resultEntity);
+                }
+
+                //璇峰亣瓒呰繃涓冨ぉ锛屽繀椤绘彁鍓嶄竷澶╀互涓婅鍋囷紒
+                if (admAsk.LaveDay.Value >= 7 && admAsk.StratTime.Value.Date < DateTime.Now.Date.AddDays(7))
+                {
+                    resultEntity.Result = false;
+                    resultEntity.Message = "璇峰亣瓒呰繃涓冨ぉ锛屽繀椤绘彁鍓嶄竷澶╀互涓婅鍋囷紒";
+                    return JsonConvert.SerializeObject(resultEntity);
+                }
+            }
+            
+
+            if (String.IsNullOrEmpty(admAsk.Id))
                 {
                     admAsk.Creater = curentuser.Id;
                     admAsk.Createtime = DateTime.Now;
@@ -440,6 +472,8 @@
             var jiejiari = admAttendanceRulesDtlDTOs.Where(x=>x.Name== "jiejiari").ToList();
 
             var tiaoxiuri = admAttendanceRulesDtlDTOs.Where(x => x.Name == "tiaoxiuri").ToList();
+
+            var jiabanri = admAttendanceRulesDtlDTOs.Where(x => x.Name == "jiabanri").ToList();
 
             //姣忓ぉ鐨勮�冨嫟鏃堕棿鐐�
             string[] WorkingStart = admAttendanceRuleDTO.WorkingStart.Split('.');
@@ -551,7 +585,8 @@
                     {
 
                         //鏄惁璋冧紤鏃�  璋冧紤鏃ラ渶瑕佷笂鐝�
-                        if (tiaoxiuri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date))
+                        if (tiaoxiuri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date)
+                            || jiabanri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date))
                         {
                             if (StratTime <= StratTimeWorkingStart)
                             {
@@ -647,7 +682,8 @@
                     {
 
                         //鏄惁璋冧紤鏃�  璋冧紤鏃ラ渶瑕佷笂鐝�
-                        if (tiaoxiuri.Exists(x => x.ValueStart <= EndTime.Date && x.ValueEnd >= EndTime.Date))
+                        if (tiaoxiuri.Exists(x => x.ValueStart <= EndTime.Date && x.ValueEnd >= EndTime.Date)
+                            || jiabanri.Exists(x => x.ValueStart <= EndTime.Date && x.ValueEnd >= EndTime.Date))
                         {
                             if (EndTime >= EndTimeOffworkEnd)
                             {
@@ -709,7 +745,8 @@
                     {
 
                         //鏄惁璋冧紤鏃�  璋冧紤鏃ラ渶瑕佷笂鐝�
-                        if (tiaoxiuri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date))
+                        if (tiaoxiuri.Exists(x => x.ValueStart <= dateTimenow.Date && x.ValueEnd >= dateTimenow.Date)
+                            || jiabanri.Exists(x => x.ValueStart <= dateTimenow.Date && x.ValueEnd >= dateTimenow.Date))
                         {
                             LavehTime += shangbanshijian;
                         }
@@ -738,7 +775,8 @@
                     else
                     {
                         //鏄惁璋冧紤鏃�  璋冧紤鏃ラ渶瑕佷笂鐝�
-                        if (tiaoxiuri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date))
+                        if (tiaoxiuri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date)
+                            || jiabanri.Exists(x => x.ValueStart <= StratTime.Date && x.ValueEnd >= StratTime.Date))
                         {
                             LavehTime -= shangbanshijian;
                         }
@@ -866,7 +904,7 @@
                 else
                 {
                     dangqianbuzhou = wfRunProcessDTO.Step;
-                    //鏌ヨ鍘嗗彶鎰忚
+                    //鏌ヨ瀹℃壒杩涘害
                     lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
                     if (wfRunProcessDTO.Step != "鎻愪氦")
                     {
@@ -904,8 +942,8 @@
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             ViewData["curentuser"] = curentuser;
             leaveOff.RecStatus = "A";
-            //鏈寕瀹℃壒娴侊紝鎻愪氦鐩存帴閫氳繃
-            leaveOff.ShenpiStatus = "A";
+            ////鏈寕瀹℃壒娴侊紝鎻愪氦鐩存帴閫氳繃
+            //leaveOff.ShenpiStatus = "A";
             if (String.IsNullOrEmpty(leaveOff.Id))
             {
                 leaveOff.Creater = curentuser.Id;
@@ -915,6 +953,27 @@
             leaveOff.Modifytime = DateTime.Now;
             ResultEntity resultEntity = new ResultEntity();
             resultEntity.Result = false;
+
+            if (leaveOff.Step == "鎻愪氦")
+            {
+                //璇峰亣鏃堕棿涓嶈兘閲嶅彔
+                var qingjia = _signinService.GetAskLeaveOffChongdie(curentuser.Id, leaveOff.StratTime.Value, leaveOff.EndTime.Value);
+                if (qingjia.Count > 0)
+                {
+                    resultEntity.Result = false;
+                    resultEntity.Message = "璇ユ椂闂存宸茬粡鏈夐攢鍋囷紒";
+                    return JsonConvert.SerializeObject(resultEntity);
+                }
+
+                //閿�鍋囧繀椤讳笁澶╀互鍐�
+                if (leaveOff.StratTime.Value.Date < DateTime.Now.Date.AddDays(-3))
+                {
+                    resultEntity.Result = false;
+                    resultEntity.Message = "璇峰湪72灏忔椂鍐呰繘琛岄攢鍋囧鐞嗭紝瓒呰繃72灏忔椂鏃犳硶鎻愪氦";
+                    return JsonConvert.SerializeObject(resultEntity);
+                }
+            }
+
             using (TransactionScope scope = new TransactionScope())
             {
                 if (leaveOff.Step == "鎻愪氦")
@@ -974,6 +1033,12 @@
         #region 鑰冨嫟瑙勫垯
         public IActionResult AttendanceRule()
         {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/Signin/AttendanceRule/");
+            var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList();
+            ViewData["ActionInfo2"] = pageEntities2;
+
             AdmAttendanceRuleDTO admAttendanceRuleDTO =  _attendanceRuleService.Get("");
             admAttendanceRuleDTO.admAttendanceRulesDtlDTOs = _attendanceRuleService.GetDtlList("");
 
@@ -1060,6 +1125,27 @@
 
                        
                 }
+
+                for (int i = 0; i < dto.jiaban_s.Length; i++)
+                {
+                    if (!String.IsNullOrEmpty(dto.jiaban_s[i]) && !String.IsNullOrEmpty(dto.jiaban_e[i]))
+                    {
+                        AdmAttendanceRulesDtlDTO admAttendanceRulesDtlDTO = new AdmAttendanceRulesDtlDTO();
+                        admAttendanceRulesDtlDTO.Pid = dto.Id;
+                        admAttendanceRulesDtlDTO.ValueStart = DateTime.Parse(dto.jiaban_s[i]);
+                        admAttendanceRulesDtlDTO.ValueEnd = DateTime.Parse(dto.jiaban_e[i]);
+                        admAttendanceRulesDtlDTO.Name = "jiabanri";
+                        admAttendanceRulesDtlDTO.RecStatus = "A";
+                        admAttendanceRulesDtlDTO.Creater = curentuser.Id;
+                        admAttendanceRulesDtlDTO.Createtime = DateTime.Now;
+                        admAttendanceRulesDtlDTO.Modifier = admAttendanceRulesDtlDTO.Creater;
+                        admAttendanceRulesDtlDTO.Modifytime = admAttendanceRulesDtlDTO.Createtime;
+                        resultEntity = _attendanceRuleService.saveDtl(admAttendanceRulesDtlDTO);
+                    }
+
+
+                }
+
                 scope.Complete();
             }
                

--
Gitblit v1.9.1