From bdeea0f54fcdb94531d404e9b720d0086d5cca96 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 13 八月 2021 10:29:31 +0800
Subject: [PATCH] 流程管理界面

---
 zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexGuanLi.cshtml          |  137 +++++++++++++++++++
 zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs |   50 +++++++
 zhengcaioa/Services/WfHistoryService.cs                              |  116 ++++++++++++++++
 zhengcaioa/Services/WfRunProcessService.cs                           |   88 ++++++++++++
 zhengcaioa/IServices/IWfHistoryService.cs                            |    2 
 5 files changed, 392 insertions(+), 1 deletions(-)

diff --git a/zhengcaioa/IServices/IWfHistoryService.cs b/zhengcaioa/IServices/IWfHistoryService.cs
index 9fa4c18..372caaa 100644
--- a/zhengcaioa/IServices/IWfHistoryService.cs
+++ b/zhengcaioa/IServices/IWfHistoryService.cs
@@ -18,5 +18,7 @@
         List<WfHistoryDTO> GetList(string RunProcessId ="" );
 
         List<WfHistoryDTO> GetListshenpi(string RunProcessId);
+
+        ResultDataEntity<WfHistoryDTO> SearchByPagingGuanLi(WfHistoryDTOSearch searchEntity);
     }
 }
diff --git a/zhengcaioa/Services/WfHistoryService.cs b/zhengcaioa/Services/WfHistoryService.cs
index c3c607a..a19cbc3 100644
--- a/zhengcaioa/Services/WfHistoryService.cs
+++ b/zhengcaioa/Services/WfHistoryService.cs
@@ -301,6 +301,120 @@
 
             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
+
+                         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 = a.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;
+        }
+
     }
 }
diff --git a/zhengcaioa/Services/WfRunProcessService.cs b/zhengcaioa/Services/WfRunProcessService.cs
index 4499b1a..8c7df35 100644
--- a/zhengcaioa/Services/WfRunProcessService.cs
+++ b/zhengcaioa/Services/WfRunProcessService.cs
@@ -202,6 +202,94 @@
                 model.RecStatus = "D";
                 model.Modifier = userid;
                 model.Modifytime = DateTime.Now;
+                switch (model.Applytiye)
+
+                {
+                    case "01":
+                        var model01 = _context.AdmAskLeaves.Find(model.DanjuId);
+                        model01.RecStatus = "D";
+                        model01.Modifier = userid;
+                        model01.Modifytime = DateTime.Now;
+                        break;
+                    case "02":
+                        var model02 = _context.AdmAskLeaveOffs.Find(model.DanjuId);
+                        model02.RecStatus = "D";
+                        model02.Modifier = userid;
+                        model02.Modifytime = DateTime.Now;
+                        break;
+                    case "03":
+                        var model03 = _context.HrSalaryAppeal.Find(model.DanjuId);
+                        model03.status = "D";
+                        break;
+                    case "04":
+                        var model04 = _context.AdmAskcosts.Find(model.DanjuId);
+                        model04.RecStatus = "D";
+                        model04.Modifier = userid;
+                        model04.Modifytime = DateTime.Now;
+                        break;
+                    case "05":
+                        var model05 = _context.AdmAskGoods.Find(model.DanjuId);
+                        model05.RecStatus = "D";
+                        model05.Modifier = userid;
+                        model05.Modifytime = DateTime.Now;
+                        break;
+                    case "06":
+                        var model06 = _context.AdmAskCars.Find(model.DanjuId);
+                        model06.RecStatus = "D";
+                        model06.Modifier = userid;
+                        model06.Modifytime = DateTime.Now;
+                        break;
+                    case "07":
+                        var model07 = _context.AdmAskMarketingCosts.Find(model.DanjuId);
+                        model07.RecStatus = "D";
+                        model07.Modifier = userid;
+                        model07.Modifytime = DateTime.Now;
+                        break;
+                    case "08":
+                        var model08 = _context.AdmAskMarketingCosts.Find(model.DanjuId);
+                        model08.RecStatus = "D";
+                        model08.Modifier = userid;
+                        model08.Modifytime = DateTime.Now;
+                        break;
+                    case "09":
+                        var model09 = _context.AdmAskMarketingCosts.Find(model.DanjuId);
+                        model09.RecStatus = "D";
+                        model09.Modifier = userid;
+                        model09.Modifytime = DateTime.Now;
+                        break;
+                    case "10":
+                        var model10 = _context.AdmAskovertimes.Find(model.DanjuId);
+                        model10.RecStatus = "D";
+                        model10.Modifier = userid;
+                        model10.Modifytime = DateTime.Now;
+                        break;
+                    case "11":
+                        var model11 = _context.AdmAskMarketingCosts.Find(model.DanjuId);
+                        model11.RecStatus = "D";
+                        model11.Modifier = userid;
+                        model11.Modifytime = DateTime.Now;
+                        break;
+                    case "12":
+                        var model12 = _context.AdmAskYouHuis.Find(model.DanjuId);
+                        model12.RecStatus = "D";
+                        model12.Modifier = userid;
+                        model12.Modifytime = DateTime.Now;
+                        break;
+                    case "13":
+                        var model13 = _context.AdmAskBaiFangs.Find(model.DanjuId);
+                        model13.RecStatus = "D";
+                        model13.Modifier = userid;
+                        model13.Modifytime = DateTime.Now;
+                        break;
+                    case "20":
+                        var model20 = _context.AdmCustomerWithdrawals.Find(model.DanjuId);
+                        model20.RecStatus = "D";
+                        model20.Modifier = userid;
+                        model20.Modifytime = DateTime.Now;
+                        break;
+                    default:
+                        break;
+                }
                 _context.SaveChanges();
             }
 
diff --git a/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs b/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs
index d26f9b2..387c288 100644
--- a/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs
@@ -159,5 +159,55 @@
             return new JsonResult(_wfRunProcessService.SearchByPaging(search));
         }
 
+
+
+        public IActionResult IndexGuanLi()
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            List<ActionEntity> actionlist = new List<ActionEntity>();
+            ActionEntity actionEntity = new ActionEntity();
+            actionEntity.OpenType = 0;
+            actionEntity.ActionUrl = "";
+            actionEntity.ActionFun = "Search";
+            actionEntity.PageIco = "fa fa-search";
+            actionEntity.ActionName = "鏌ヨ";
+            actionlist.Add(actionEntity);
+
+
+
+
+            ViewData["ActionInfo"] = actionlist;
+
+            ViewBag.Applytiye = _wfApplytypeService.GetList().Select(x => new { code = x.Applyno, label = x.Applytiye }).ToList();
+
+
+
+            return View();
+        }
+
+        public IActionResult GetListGuanLi(WfHistoryDTOSearch search)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            //search.Creater = curentuser.Id;
+            //JsonResult jsonResult =   new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
+            return new JsonResult(_wfHistoryService.SearchByPagingGuanLi(search));
+        }
+
+
+        public IActionResult Del(string id)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            ResultEntity resultEntity = new ResultEntity();
+            resultEntity.Result = false;
+
+
+            resultEntity = _wfRunProcessService.ModifyStatus(id, curentuser.Id);
+
+
+            return new JsonResult(resultEntity);
+        }
     }
 }
diff --git a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexGuanLi.cshtml b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexGuanLi.cshtml
new file mode 100644
index 0000000..7275661
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexGuanLi.cshtml
@@ -0,0 +1,137 @@
+锘緻{
+    ViewBag.Title = "WorkFlowTask";
+    Layout = "~/Views/Shared/_Layout_Search.cshtml";
+}
+
+<link href="~/css/jquery-confirm.css" rel="stylesheet">
+<script src="~/js/jquery-confirm.js" type="text/javascript"></script>
+
+@section headerStyle{
+    <script type="text/javascript">
+        var Applytiye = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Applytiye))';
+
+
+
+        loseherght = 60;
+        dataCol = [
+            { label: 'id', name: 'Id', labtype: 'txt', hidden: true },
+            { label: '鐢宠鏃堕棿', name: 'ApplytimeName', labtype: 'txt', hidden: false, width: 100 },
+            {
+                label: '鐢宠鍗曞彿', name: 'Applyno', labtype: 'txt', hidden: false, width: 100
+            },
+
+            { label: '閮ㄩ棬', name: 'DeptName', labtype: 'txt', hidden: false, width: 100 },
+            { label: '鐢宠浜�', name: 'CreaterName', labtype: 'txt', hidden: false, width: 100 },
+            { label: '璇风ず鍚嶇О', name: 'Content', labtype: 'txt', hidden: false, width: 100 },
+            { label: '姝ラ', name: 'Step', labtype: 'txt', hidden: false, width: 100 },
+            { label: '鎵瑰鐘舵��', name: 'ShenpiStatusName', labtype: 'txt', hidden: false, width: 100 },
+            {
+                label: '鏌ョ湅', name: 'Remark', labtype: 'txt', hidden: false, width: 100,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"OpenWindow('鏌ョ湅','100%','100%', '" + rowObject.Deelurl + "')\"  >鏌ョ湅</a> ";
+                }
+            },
+
+            {
+                label: '鍒犻櫎', name: 'Remark111', labtype: 'txt', hidden: false, width: 100,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"shanchu('" + rowObject.Id + "')\"  >鍒犻櫎</a> ";
+                }
+            },
+
+        ];
+        dataUrl = "/WorkFlowTask/GetListGuanLi";
+        searchCol = [
+
+
+
+
+
+            { label: '鐢宠鏃堕棿', name: 'Applytime', labtype: 'datearea', hidden: false },
+            { label: '鐢宠鍗曞彿', name: 'Applyno', labtype: 'txt', hidden: false },
+            { label: '鐢宠浜�', name: 'ApplyUserName', labtype: 'txt', hidden: false },
+            { label: '鐢宠娴佺▼', name: 'Applytiye', labtype: 'combox', hidden: false, data: JSON.parse(Applytiye)/*, cwidth: '5%', cccwidth: '8%' */},
+
+        ];
+
+
+
+
+
+        var _afterSave = function (result) {
+            if (result) {
+                toastr.success("淇濆瓨鎴愬姛");
+            } else {
+                toastr.error("淇濆瓨澶辫触");
+            }
+        }
+
+        var _afterDel = function (result) {
+            if (result) {
+                toastr.success("鍒犻櫎鎴愬姛");
+            } else {
+                /**/
+                toastr.error("鍒犻櫎鎴愬姛");
+        /**/
+    }
+}
+    </script>
+}
+
+@section footerScripts{
+    <script type="text/javascript">
+
+
+
+        var shanchu = function (Id) {
+
+            $.confirm({
+                title: '鍒犻櫎娴佺▼鎿嶄綔纭',
+                content: '姝ゆ搷浣滃皢鍒犻櫎褰撳墠娴佺▼锛岀‘璁よ缁х画鍚�?',
+                type: 'green',
+                icon: 'glyphicon glyphicon-question-sign',
+                buttons: {
+                    ok: {
+                        text: '纭',
+                        btnClass: 'btn-primary',
+                        action: function () {
+                            $.ajax({
+                                type: "POST",
+                                url: "/WorkFlowTask/Del?id=" + Id,
+                                dataType: "json",
+                                global: false,
+                                success: function (data) {
+
+                                    if (data.Result) {
+                                        jQuery('#jqGrid').jqGrid().trigger('reloadGrid');
+
+                                        toastr.success("鍒犻櫎鎴愬姛");
+                                    }
+                                    else {
+                                        toastr.error(data.Message);  
+                                    }
+                                },
+                                error: function () {
+                                    toastr.error("鍒犻櫎澶辫触");
+                                }
+                            });
+                        }
+                    },
+                    cancel: {
+                        text: '鍙栨秷',
+                        btnClass: 'btn-primary'
+                    }
+                }
+            });
+
+
+
+            //window._reloadPageData();
+
+        }
+
+
+
+
+    </script>
+}

--
Gitblit v1.9.1