From 67a0042c5f29e4bb0e0b82f6190f2bc51480b45c Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 28 二月 2023 13:25:09 +0800
Subject: [PATCH] 工资绩效改版

---
 zhengcaioa/Services/WfHistoryService.cs |  192 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 183 insertions(+), 9 deletions(-)

diff --git a/zhengcaioa/Services/WfHistoryService.cs b/zhengcaioa/Services/WfHistoryService.cs
index 11421d4..fe2dc40 100644
--- a/zhengcaioa/Services/WfHistoryService.cs
+++ b/zhengcaioa/Services/WfHistoryService.cs
@@ -116,7 +116,7 @@
                 string[] Applytimes = searchEntity.Applytime.Split("|");
                 DateTime.TryParse(Applytimes[0], out Applytimestart);
                 DateTime.TryParse(Applytimes[1], out Applytimeend);
-                //Applytimeend = Applytimeend.AddDays(1);
+                Applytimeend = Applytimeend.AddDays(1);
             }
 
             ///WfHistories
@@ -140,7 +140,7 @@
                          from fff in fsssss.DefaultIfEmpty()
 
                          join d in _context.WfApplytypes
-                       on k.Applytiye equals d.Id
+                       on k.Applytiye equals d.Applyno
 
                          join b in _context.PltUsers
                         on k.Creater equals b.Id
@@ -159,7 +159,7 @@
                                && (string.IsNullOrWhiteSpace(searchEntity.RunProcessId) || a.RunProcessId == searchEntity.RunProcessId.Trim())
 
                                 && (string.IsNullOrWhiteSpace(searchEntity.Applyno) || k.Applyno == searchEntity.Applyno.Trim())
-
+                                 && (string.IsNullOrWhiteSpace(searchEntity.Creater) || a.DeelUserId == searchEntity.Creater.Trim())
 
                          select new WfHistoryDTO
                          {
@@ -191,20 +191,20 @@
                              NeeddeelTypeName = fff.Comments,
                              Contentyijian = a.Content,
                              Sort = a.Sort,
-
+                             Deelurl = a.Deelurl,
                              Creater = a.Creater,
                              Createtime = a.Createtime,
-
+                             Step = a.Step,
                              RecStatus = a.RecStatus,
                              Modifier = a.Modifier,
                              Modifytime = a.Modifytime,
 
                          }
-                ).OrderBy(x => x.Sort).ThenByDescending(x=>x.Resivetime).ToList();
+                ).OrderByDescending(x=>x.Applyno).ThenBy(x => x.Sort).ThenByDescending(x=>x.Resivetime).ToList();
 
 
 
-            if (searchEntity.totalrows == 0)
+            //if (searchEntity.totalrows == 0)
                 searchEntity.totalrows = query.Count();
             var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
             data.LoadData(searchEntity, lianlist);
@@ -235,14 +235,188 @@
         /// 鑾峰彇鎵�鏈夋湁鏁堟祦绋嬬被鍨�
         /// </summary>
         /// <returns></returns>
-        public List<WfHistoryDTO> GetList()
+        public List<WfHistoryDTO> GetList(string RunProcessId = "")
         {
 
 
-            var listRole = _context.WfHistories.Where(r => r.RecStatus == "A").ToList();
+            var listRole = _context.WfHistories.Where(r => r.RecStatus == "A").OrderBy(x=>x.Sort).ToList();
+            if (!string.IsNullOrEmpty(RunProcessId))
+            {
+                listRole = listRole.Where(x => x.RunProcessId == RunProcessId).ToList();
+            }
 
             var list = _mapper.Map<List<WfHistoryDTO>>(listRole);
             return list;
         }
+        /// <summary>
+        /// 鏌ヨ鍘嗗彶瀹℃壒鎰忚
+        /// </summary>
+        /// <returns></returns>
+        public List<WfHistoryDTO> GetListshenpi(string RunProcessId)
+        {
+
+
+            var listRole = (from a in _context.WfHistories.Where(x => x.RecStatus == "A" && x.NeeddeelType =="1" && x.ChuliStatus != "0" && x.RunProcessId == RunProcessId)
+
+                            join b in _context.PltUsers
+                            on a.DeelUserId  equals b.Id
+
+
+                            select new WfHistoryDTO
+                            {
+                                RunProcessId = a.RunProcessId,
+                                SendUserId = a.SendUserId,
+                                DeelUserId = a.DeelUserId,
+                                Sendtime = a.Sendtime,
+                                Resivetime = a.Resivetime,
+                                Step = a.Step,
+                                ChuliStatus = a.ChuliStatus,
+                                Deelurl = a.Deelurl,
+                                NeeddeelType = a.NeeddeelType,
+                                Sort = a.Sort,
+                                Content = a.Content,
+
+
+                                RecStatus = a.RecStatus,
+                                Creater = a.Creater,
+                                Createtime = a.Createtime,
+                                Modifier = a.Modifier,
+                                Modifytime = a.Modifytime,
+                                ChuliStatusName = a.Step == "鎻愪氦"? "鎻愪氦" : a.ChuliStatus == "2" ? "鍚屾剰" : "鎷掔粷",
+                                DeelUserIdName = b.UserName,
+                                ModifytimeName = a.Modifytime.ToString("yyyy-MM-dd HH:mm:ss"),
+                            }
+                             ).OrderBy(x => x.Modifytime).ToList();
+
+
+
+            //    _context.WfHistories.Where(r => r.RecStatus == "A").OrderBy(x => x.Sort).ToList();
+            //if (!string.IsNullOrEmpty(RunProcessId))
+            //{
+            //    listRole = listRole.Where(x => x.RunProcessId == RunProcessId).ToList();
+            //}
+
+
+
+
+            return listRole;
+        }
+
+
+        public ResultDataEntity<WfHistoryDTO> SearchByPagingGuanLi(WfHistoryDTOSearch searchEntity)
+        {
+
+
+
+            ResultDataEntity<WfHistoryDTO> data = new ResultDataEntity<WfHistoryDTO>();
+            List<WfHistoryDTO> list = new List<WfHistoryDTO>();
+
+
+
+
+            var listCode = (from a in _context.SysCodeDtls
+                            join b in _context.SysCodes
+                            on a.CodeId equals b.Id
+                            where a.RecStatus == "A"
+                                          && b.RecStatus == "A"
+                            select new CodeDataEntity()
+                            {
+                                CodeId = b.Id,
+                                CodeTable = b.CodeTable,
+                                CodeField = b.CodeField,
+                                CodeSn = a.CodeSn,
+                                Comments = a.Comments,
+                                Contents = a.Contents,
+                                RecStatus = a.RecStatus,
+                                Sort = a.Sort
+                            }
+                      );
+            DateTime Applytimestart = DateTime.Now;
+            DateTime Applytimeend = DateTime.Now;
+            if (!string.IsNullOrWhiteSpace(searchEntity.Applytime))
+            {
+                string[] Applytimes = searchEntity.Applytime.Split("|");
+                DateTime.TryParse(Applytimes[0], out Applytimestart);
+                DateTime.TryParse(Applytimes[1], out Applytimeend);
+                Applytimeend = Applytimeend.AddDays(1);
+            }
+
+            ///WfHistories
+            var query = (from k in _context.WfRunProcesses
+
+
+
+
+
+                         join a in _context.WfHistories
+                      on k.Id equals a.RunProcessId
+                        into asssss
+                         from aaa in asssss.DefaultIfEmpty()
+
+                         join e in listCode.Where(x => x.CodeTable == "wf_run_process" && x.CodeField == "shenpi_status")
+                        on k.ShenpiStatus equals e.CodeSn
+                        into esssss
+                         from eee in esssss.DefaultIfEmpty()
+
+                    //     join f in listCode.Where(x => x.CodeTable == "wf_needdeel" && x.CodeField == "needdeel_type")
+                    //on a.NeeddeelType equals f.CodeSn
+                    //into fsssss
+                    //     from fff in fsssss.DefaultIfEmpty()
+
+                         join d in _context.WfApplytypes
+                       on k.Applytiye equals d.Applyno
+
+                         join b in _context.PltUsers
+                        on k.Creater equals b.Id
+
+
+                         join c in _context.HrDepts
+                        on b.DeptId equals c.Id
+
+
+                         where k.RecStatus == "A"
+                          && (string.IsNullOrWhiteSpace(searchEntity.Applytime) || (k.Applytime >= Applytimestart && k.Applytime <= Applytimeend))
+                          && (string.IsNullOrWhiteSpace(searchEntity.DeptId) || b.DeptId == searchEntity.DeptId.Trim())
+                           && (string.IsNullOrWhiteSpace(searchEntity.ApplyUserName) || b.UserName.Contains(searchEntity.ApplyUserName.Trim()))
+                            && (string.IsNullOrWhiteSpace(searchEntity.Applytiye) || k.Applytiye == searchEntity.Applytiye.Trim())
+                             && (string.IsNullOrWhiteSpace(searchEntity.ShenpiStatus) || k.ShenpiStatus == searchEntity.ShenpiStatus.Trim())
+                               && (string.IsNullOrWhiteSpace(searchEntity.RunProcessId) || k.Id == searchEntity.RunProcessId.Trim())
+
+                                && (string.IsNullOrWhiteSpace(searchEntity.Applyno) || k.Applyno == searchEntity.Applyno.Trim())
+                                 && (string.IsNullOrWhiteSpace(searchEntity.Creater) || k.Creater == searchEntity.Creater.Trim())
+
+                         select new WfHistoryDTO
+                         {
+                             Id = k.Id,
+                              
+
+                             ApplytimeName = k.Applytime.Value.ToString("yyyy-MM-dd"),
+                             Applyno = k.Applyno,
+                             CreaterName = b.UserName,
+                             DeptName = c.DeptName,
+                             Applytiye = d.Applytiye,
+                             Content = k.Content,
+                             ShenpiStatusName = eee.Comments,
+                              
+                             Deelurl = aaa.Deelurl,
+                             Creater = k.Creater,
+                             Createtime = k.Createtime,
+                             Step = k.Step,
+                             RecStatus = k.RecStatus,
+                             Modifier = k.Modifier,
+                             Modifytime = k.Modifytime,
+
+                         }
+                ).Distinct().ToList().OrderByDescending(x => x.Applyno);
+
+
+
+            //if (searchEntity.totalrows == 0)
+            searchEntity.totalrows = query.Count();
+            var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
+            data.LoadData(searchEntity, lianlist);
+            return data;
+        }
+
     }
 }

--
Gitblit v1.9.1