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/Services/WfNeeddeelService.cs                                  |   38 
 zhengcaioa/zhengcaioa/Views/IntentionVisit/Index.cshtml                   |   13 
 zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml                        |  182 +++-
 zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml                |   79 +
 zhengcaioa/zhengcaioa/Startup.cs                                          |    5 
 zhengcaioa/DTO/WfRunProcessDTO.cs                                         |    6 
 zhengcaioa/Model/zhengcaioaContext.cs                                     |   16 
 zhengcaioa/DTO/IntentionVisitDTO.cs                                       |    5 
 zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml                     |   80 +
 zhengcaioa/Model/WfRunProcess.cs                                          |    1 
 zhengcaioa/zhengcaioa/Views/Signin/AskLeaveOff.cshtml                     |  171 +++
 zhengcaioa/zhengcaioa/Views/Shared/_Layout.cshtml                         |   23 
 zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexMyApply.cshtml              |   81 +
 zhengcaioa/zhengcaioa/Views/WfApplytype/Index.cshtml                      |    2 
 zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs      |  163 +++
 zhengcaioa/zhengcaioa/Views/IntentionCustomer/IndexYiXiang.cshtml         |   93 ++
 zhengcaioa/Services/WfHistoryService.cs                                   |   72 +
 zhengcaioa/Services/WfRunProcessService.cs                                | 1096 ++++++++++++++++++++++++
 zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs       |  254 ++++-
 zhengcaioa/IServices/IWfRunProcessService.cs                              |    6 
 表修改.sql                                                                   |   39 
 zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs                           |    3 
 zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs    |   48 
 zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml                    |    2 
 zhengcaioa/IServices/IWfNeeddeelService.cs                                |    4 
 zhengcaioa/Services/IntentionVisitService.cs                              |    2 
 zhengcaioa/DTO/AdmSignInDTO.cs                                            |    9 
 zhengcaioa/DTO/WfNeeddeelDTO.cs                                           |    4 
 zhengcaioa/DTO/IntentionCustomerDTO.cs                                    |   14 
 zhengcaioa/Services/IntentionCustomerService.cs                           |   44 
 zhengcaioa/IServices/IWfHistoryService.cs                                 |    4 
 zhengcaioa/Model/IntentionCustomer.cs                                     |    4 
 zhengcaioa/DTO/WfHistoryDTO.cs                                            |    5 
 zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml                |   11 
 zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs |   51 
 35 files changed, 2,414 insertions(+), 216 deletions(-)

diff --git a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs
index 83fd413..72234ee 100644
--- a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs
+++ b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs
@@ -164,6 +164,9 @@
             CreateMap<WfRunProcess, WfRunProcessDTO>();
             CreateMap<WfRunProcessDTO, WfRunProcess>();
 
+            CreateMap<WfHistoryDTO, WfNeeddeelDTO>();
+            CreateMap<WfNeeddeelDTO, WfHistoryDTO>();
+
             CreateMap<SysAttachment, SysAttachmentDTO>();
             CreateMap<SysAttachmentDTO, SysAttachment>();
 
diff --git a/zhengcaioa/DTO/AdmSignInDTO.cs b/zhengcaioa/DTO/AdmSignInDTO.cs
index 58e08ad..de96018 100644
--- a/zhengcaioa/DTO/AdmSignInDTO.cs
+++ b/zhengcaioa/DTO/AdmSignInDTO.cs
@@ -80,6 +80,11 @@
 
         public string CreaterName { get; set; }
         public string Tittle { get; set; }
+
+        public string Content { get; set; }
+
+        public string Tongguojujue { get; set; }
+        public string Step { get; set; }
     }
 
 
@@ -111,6 +116,10 @@
 
         public string CreaterName { get; set; }
         public string Tittle { get; set; }
+        public string Content { get; set; }
+
+        public string Tongguojujue { get; set; }
+        public string Step { get; set; }
 
     }
 
diff --git a/zhengcaioa/DTO/IntentionCustomerDTO.cs b/zhengcaioa/DTO/IntentionCustomerDTO.cs
index 6a6ee36..5bb9155 100644
--- a/zhengcaioa/DTO/IntentionCustomerDTO.cs
+++ b/zhengcaioa/DTO/IntentionCustomerDTO.cs
@@ -50,6 +50,13 @@
         public string CityName { get; set; }
         public string AreaIdName { get; set; }
         public string YwjlName { get; set; }
+        public DateTime? Yixiangtime { get; set; }
+        public string YixiangtimeName { get; set; }
+        public string Yixiang { get; set; }
+        public string Dianxiaozhuanyuan { get; set; }
+        public string DianxiaozhuanyuanName { get; set; }
+        public DateTime? Zuijinzhuizongtime { get; set; }
+        public string ZuijinzhuizongtimeName { get; set; }
     }
 
     public class IntentionCustomerDTOSearch : SearchEntity
@@ -67,5 +74,12 @@
 
         public string Creater { get; set; }
 
+
+        public string Yixiangtime { get; set; }
+        public string Dianxiaozhuanyuan { get; set; }
+        public string Yixiang { get; set; }
+
+        public string YwjlYx { get; set; }
+
     }
 }
diff --git a/zhengcaioa/DTO/IntentionVisitDTO.cs b/zhengcaioa/DTO/IntentionVisitDTO.cs
index c4ce153..f912688 100644
--- a/zhengcaioa/DTO/IntentionVisitDTO.cs
+++ b/zhengcaioa/DTO/IntentionVisitDTO.cs
@@ -32,6 +32,9 @@
         public string ShengName { get; set; }
 
         public string Name { get; set; }
+
+        public string IsYwjl { get; set; }
+        
     }
 
     public class IntentionVisitDTOSearch : SearchEntity
@@ -47,5 +50,7 @@
 
         public string Vistime { get; set; }
 
+        public string  Viscustomer { get; set; }
+
     }
 }
diff --git a/zhengcaioa/DTO/WfHistoryDTO.cs b/zhengcaioa/DTO/WfHistoryDTO.cs
index 0a6b87e..978ac0d 100644
--- a/zhengcaioa/DTO/WfHistoryDTO.cs
+++ b/zhengcaioa/DTO/WfHistoryDTO.cs
@@ -31,6 +31,9 @@
         public DateTime Modifytime { get; set; }
         public string Contentyijian { get; set; }
         public int? Sort { get; set; }
+        public string ChuliStatusName { get; set; }
+        public string DeelUserIdName { get; set; }
+        public string ModifytimeName { get; set; }
     }
 
     public class WfHistoryDTOSearch : SearchEntity
@@ -45,5 +48,7 @@
 
         public string ShenpiStatus { get; set; }
 
+        public string Creater { get; set; }
+
     }
 }
diff --git a/zhengcaioa/DTO/WfNeeddeelDTO.cs b/zhengcaioa/DTO/WfNeeddeelDTO.cs
index 71749b0..40688fe 100644
--- a/zhengcaioa/DTO/WfNeeddeelDTO.cs
+++ b/zhengcaioa/DTO/WfNeeddeelDTO.cs
@@ -40,10 +40,10 @@
         public string Applytime { get; set; }
         public string DeptId { get; set; }
         public string ApplyUserName { get; set; }
-
         public string Applytiye { get; set; }
-
         public string ShenpiStatus { get; set; }
 
+        public string Creater { get; set; }
+
     }
 }
diff --git a/zhengcaioa/DTO/WfRunProcessDTO.cs b/zhengcaioa/DTO/WfRunProcessDTO.cs
index b78df18..b2663cd 100644
--- a/zhengcaioa/DTO/WfRunProcessDTO.cs
+++ b/zhengcaioa/DTO/WfRunProcessDTO.cs
@@ -22,6 +22,7 @@
         public DateTime Createtime { get; set; }
         public string Modifier { get; set; }
         public DateTime Modifytime { get; set; }
+        public string Deelurl { get; set; }
     }
 
     public class WfRunProcessDTOSearch : SearchEntity
@@ -34,5 +35,10 @@
 
         public string Applyno { get; set; }
 
+
+        public string Creater { get; set; }
+
+
+
     }
 }
diff --git a/zhengcaioa/IServices/IWfHistoryService.cs b/zhengcaioa/IServices/IWfHistoryService.cs
index 79261e9..9fa4c18 100644
--- a/zhengcaioa/IServices/IWfHistoryService.cs
+++ b/zhengcaioa/IServices/IWfHistoryService.cs
@@ -15,6 +15,8 @@
 
         ResultEntity ModifyStatus(string id, string userid);
 
-        List<WfHistoryDTO> GetList();
+        List<WfHistoryDTO> GetList(string RunProcessId ="" );
+
+        List<WfHistoryDTO> GetListshenpi(string RunProcessId);
     }
 }
diff --git a/zhengcaioa/IServices/IWfNeeddeelService.cs b/zhengcaioa/IServices/IWfNeeddeelService.cs
index de1d126..e3bf76c 100644
--- a/zhengcaioa/IServices/IWfNeeddeelService.cs
+++ b/zhengcaioa/IServices/IWfNeeddeelService.cs
@@ -15,6 +15,8 @@
 
         ResultEntity ModifyStatus(string id, string userid);
 
-        List<WfNeeddeelDTO> GetList();
+        List<WfNeeddeelDTO> GetList(string RunProcessId = "", string step = "");
+
+        List<WfNeeddeelDTO> GetListTracking(string RunProcessId = "", string step = "");
     }
 }
diff --git a/zhengcaioa/IServices/IWfRunProcessService.cs b/zhengcaioa/IServices/IWfRunProcessService.cs
index cfdd085..3dd12ea 100644
--- a/zhengcaioa/IServices/IWfRunProcessService.cs
+++ b/zhengcaioa/IServices/IWfRunProcessService.cs
@@ -15,6 +15,10 @@
 
         ResultEntity ModifyStatus(string id, string userid);
 
-        List<WfRunProcessDTO> GetList();
+        List<WfRunProcessDTO> GetList(string DanjuId = "", string Applytiye = "");
+
+        ResultEntity WfAskLeave(string DanjuId, string step, string tongguojujue , string Userid, string Content, string title, string version);
+
+        ResultEntity WfAskLeaveOff(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version);
     }
 }
diff --git a/zhengcaioa/Model/IntentionCustomer.cs b/zhengcaioa/Model/IntentionCustomer.cs
index 2757a15..5cc27b7 100644
--- a/zhengcaioa/Model/IntentionCustomer.cs
+++ b/zhengcaioa/Model/IntentionCustomer.cs
@@ -41,5 +41,9 @@
         public DateTime Createtime { get; set; }
         public string Modifier { get; set; }
         public DateTime Modifytime { get; set; }
+        public DateTime? Yixiangtime { get; set; }
+        public string Yixiang { get; set; }
+        public string Dianxiaozhuanyuan { get; set; }
+        public DateTime? Zuijinzhuizongtime { get; set; }
     }
 }
diff --git a/zhengcaioa/Model/WfRunProcess.cs b/zhengcaioa/Model/WfRunProcess.cs
index 0f36a50..f462841 100644
--- a/zhengcaioa/Model/WfRunProcess.cs
+++ b/zhengcaioa/Model/WfRunProcess.cs
@@ -21,5 +21,6 @@
         public DateTime Createtime { get; set; }
         public string Modifier { get; set; }
         public DateTime Modifytime { get; set; }
+        public string Deelurl { get; set; }
     }
 }
diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs
index 1dab811..41132d1 100644
--- a/zhengcaioa/Model/zhengcaioaContext.cs
+++ b/zhengcaioa/Model/zhengcaioaContext.cs
@@ -2904,6 +2904,10 @@
                     .HasColumnName("createtime")
                     .HasDefaultValueSql("(getdate())");
 
+                entity.Property(e => e.Dianxiaozhuanyuan)
+                    .HasMaxLength(50)
+                    .HasColumnName("dianxiaozhuanyuan");
+
                 entity.Property(e => e.Email)
                     .HasMaxLength(500)
                     .HasColumnName("email")
@@ -3021,6 +3025,10 @@
                     .HasColumnName("url")
                     .HasComment("缃戝潃");
 
+                entity.Property(e => e.Yixiang).HasMaxLength(50);
+
+                entity.Property(e => e.Yixiangtime).HasColumnType("datetime");
+
                 entity.Property(e => e.YwName)
                     .HasMaxLength(500)
                     .HasColumnName("yw_name")
@@ -3040,6 +3048,10 @@
                     .HasMaxLength(50)
                     .HasColumnName("ywjl")
                     .HasComment("涓氬姟缁忕悊");
+
+                entity.Property(e => e.Zuijinzhuizongtime)
+                    .HasColumnType("datetime")
+                    .HasColumnName("zuijinzhuizongtime");
             });
 
             modelBuilder.Entity<IntentionOrder>(entity =>
@@ -4863,6 +4875,10 @@
                     .HasColumnName("danjuId")
                     .HasComment("鍗曟嵁Id");
 
+                entity.Property(e => e.Deelurl)
+                    .HasMaxLength(500)
+                    .HasColumnName("deelurl");
+
                 entity.Property(e => e.Modifier)
                     .IsRequired()
                     .HasMaxLength(50)
diff --git a/zhengcaioa/Services/IntentionCustomerService.cs b/zhengcaioa/Services/IntentionCustomerService.cs
index d935679..73e8090 100644
--- a/zhengcaioa/Services/IntentionCustomerService.cs
+++ b/zhengcaioa/Services/IntentionCustomerService.cs
@@ -90,7 +90,12 @@
                 updateproject.Modifier = intentionCustomer.Modifier;
                 updateproject.Modifytime = intentionCustomer.Modifytime;
 
-            }
+                    updateproject.Yixiangtime = intentionCustomer.Yixiangtime;
+                    updateproject.Yixiang = intentionCustomer.Yixiang;
+                    updateproject.Dianxiaozhuanyuan = intentionCustomer.Dianxiaozhuanyuan;
+                    updateproject.Zuijinzhuizongtime = intentionCustomer.Zuijinzhuizongtime;
+
+                }
 
             _context.SaveChanges();
             resultEntity.ReturnID = intentionCustomer.Id;
@@ -175,10 +180,18 @@
                 DateTime.TryParse(Createtimes[1], out Createtimeend);
                 Createtimeend = Createtimeend.AddDays(1);
             }
-          
+            DateTime Yixiangtimestart = DateTime.Now;
+            DateTime Yixiangtimeend = DateTime.Now;
+            if (!string.IsNullOrWhiteSpace(searchEntity.Yixiangtime))
+            {
+                string[] Yixiangtimes = searchEntity.Yixiangtime.Split("|");
+                DateTime.TryParse(Yixiangtimes[0], out Yixiangtimestart);
+                DateTime.TryParse(Yixiangtimes[1], out Yixiangtimeend);
+               // Yixiangtimeend = Yixiangtimeend.AddDays(1);
+            }
 
-                var query = (from a in _context.IntentionCustomers
-                     join b in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khly")
+            var query = (from a in _context.IntentionCustomers
+                     join b in listCode.Where(x => x.CodeTable == "IntentionCustomer" && x.CodeField == "khly")
                      on a.Khly equals b.CodeSn
                      join c in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl")
                      on a.Hyfl equals c.CodeSn
@@ -188,7 +201,13 @@
                      on a.Ywjl equals e.Id
                      into esss
                      from abi in esss.DefaultIfEmpty()
-                     join f in _context.Areas on a.Sheng equals f.CodeId
+
+                             join f in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" )
+                            on a.Dianxiaozhuanyuan equals f.Id
+                            into fsss
+                             from fff in fsss.DefaultIfEmpty()
+
+                             join f in _context.Areas on a.Sheng equals f.CodeId
                      join g in _context.Areas on a.City equals g.CodeId
                      join h in _context.Areas on a.AreaId equals h.CodeId
 
@@ -204,7 +223,11 @@
                             && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || a.AreaId == searchEntity.AreaId.Trim())
                                && (string.IsNullOrWhiteSpace(searchEntity.Creater) || a.Creater == searchEntity.Creater.Trim())
 
-                             select new IntentionCustomerDTO
+                                 && (string.IsNullOrWhiteSpace(searchEntity.Dianxiaozhuanyuan) || a.Dianxiaozhuanyuan == searchEntity.Dianxiaozhuanyuan.Trim())
+                                
+                                    && (string.IsNullOrWhiteSpace(searchEntity.Yixiangtime) || (a.Yixiangtime >= Yixiangtimestart && a.Yixiangtime <= Yixiangtimeend))
+                                      && (string.IsNullOrWhiteSpace(searchEntity.Yixiang) || ( a.Yixiang == searchEntity.Yixiang.Trim() && (a.Ywjl == null || a.Ywjl == searchEntity.YwjlYx) ))
+                         select new IntentionCustomerDTO
                      {
                          Id = a.Id,
                          Sheng = a.Sheng,
@@ -249,7 +272,14 @@
                          Modifier = a.Modifier,
                          Modifytime = a.Modifytime,
                          CreatetimeName = a.Createtime.ToString("yyyy-MM-dd"),
-                     }
+                                 Yixiangtime = a.Yixiangtime,
+                                 YixiangtimeName = a.Yixiangtime.HasValue? a.Yixiangtime.Value.ToString("yyyy-MM-dd"):"",
+                                 Yixiang = a.Yixiang,
+                                 Dianxiaozhuanyuan = a.Dianxiaozhuanyuan,
+                                 DianxiaozhuanyuanName = fff.UserName,
+                                 Zuijinzhuizongtime = a.Zuijinzhuizongtime,
+                                 ZuijinzhuizongtimeName = a.Zuijinzhuizongtime.HasValue ? a.Zuijinzhuizongtime.Value.ToString("yyyy-MM-dd") : "",
+                             }
                     ).OrderByDescending(x => x.Modifytime).ToList();
 
 
diff --git a/zhengcaioa/Services/IntentionVisitService.cs b/zhengcaioa/Services/IntentionVisitService.cs
index f893879..afa8354 100644
--- a/zhengcaioa/Services/IntentionVisitService.cs
+++ b/zhengcaioa/Services/IntentionVisitService.cs
@@ -161,7 +161,7 @@
                               && (string.IsNullOrWhiteSpace(searchEntity.Sheng) || zz.Sheng == searchEntity.Sheng.Trim())
                                && (string.IsNullOrWhiteSpace(searchEntity.City) || zz.City == searchEntity.City.Trim())
                                 && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || zz.AreaId == searchEntity.AreaId.Trim())
-
+                                && (string.IsNullOrWhiteSpace(searchEntity.Viscustomer) || a.Viscustomer == searchEntity.Viscustomer.Trim())
                          select new IntentionVisitDTO
                          {
                              Id = a.Id,
diff --git a/zhengcaioa/Services/WfHistoryService.cs b/zhengcaioa/Services/WfHistoryService.cs
index 11421d4..41f1668 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,10 +191,10 @@
                              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,
@@ -235,14 +235,72 @@
         /// 鑾峰彇鎵�鏈夋湁鏁堟祦绋嬬被鍨�
         /// </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;
+        }
+        
     }
 }
diff --git a/zhengcaioa/Services/WfNeeddeelService.cs b/zhengcaioa/Services/WfNeeddeelService.cs
index 7b01ff3..ee0563f 100644
--- a/zhengcaioa/Services/WfNeeddeelService.cs
+++ b/zhengcaioa/Services/WfNeeddeelService.cs
@@ -2,6 +2,7 @@
 using DTO;
 using DTO.Models;
 using IServices;
+using Microsoft.EntityFrameworkCore;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -117,7 +118,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);
             }
 
             ///WfNeeddeels
@@ -141,7 +142,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
@@ -160,7 +161,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 WfNeeddeelDTO
                          {
@@ -192,10 +193,10 @@
                              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,
@@ -236,12 +237,37 @@
         /// 鑾峰彇鎵�鏈夋湁鏁堟祦绋嬬被鍨�
         /// </summary>
         /// <returns></returns>
-        public List<WfNeeddeelDTO> GetList()
+        public List<WfNeeddeelDTO> GetList(string RunProcessId = "", string step = "")
+        {
+
+
+            var listRole = _context.WfNeeddeels.AsNoTracking().Where(r => r.RecStatus == "A").ToList();
+
+            if (!string.IsNullOrEmpty(RunProcessId) && !string.IsNullOrEmpty(step))
+            {
+                listRole = listRole.Where(x => x.RunProcessId == RunProcessId && x.Step == step).ToList();
+            }
+
+            var list = _mapper.Map<List<WfNeeddeelDTO>>(listRole);
+            return list;
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夋湁鏁堟祦绋嬬被鍨�
+        /// </summary>
+        /// <returns></returns>
+        public List<WfNeeddeelDTO> GetListTracking(string RunProcessId = "", string step = "")
         {
 
 
             var listRole = _context.WfNeeddeels.Where(r => r.RecStatus == "A").ToList();
 
+            if (!string.IsNullOrEmpty(RunProcessId) && !string.IsNullOrEmpty(step))
+            {
+                listRole = listRole.Where(x => x.RunProcessId == RunProcessId && x.Step == step).ToList();
+            }
+
             var list = _mapper.Map<List<WfNeeddeelDTO>>(listRole);
             return list;
         }
diff --git a/zhengcaioa/Services/WfRunProcessService.cs b/zhengcaioa/Services/WfRunProcessService.cs
index 6113573..d35295e 100644
--- a/zhengcaioa/Services/WfRunProcessService.cs
+++ b/zhengcaioa/Services/WfRunProcessService.cs
@@ -2,6 +2,7 @@
 using DTO;
 using DTO.Models;
 using IServices;
+using Microsoft.EntityFrameworkCore;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -15,10 +16,12 @@
     {
         private readonly zhengcaioaContext _context;
         private readonly IMapper _mapper;
-        public WfRunProcessService(zhengcaioaContext context, IMapper mapper)
+        private readonly IWfNeeddeelService _wfNeeddeelService; 
+        public WfRunProcessService(zhengcaioaContext context, IMapper mapper, IWfNeeddeelService wfNeeddeelService)
         {
             _context = context;
             _mapper = mapper;
+            _wfNeeddeelService = wfNeeddeelService;
         }
         public ResultEntity save(WfRunProcessDTO dto)
         {
@@ -29,6 +32,17 @@
                 if (String.IsNullOrEmpty(model.Id))
                 {
                     model.Id = Guid.NewGuid().ToString();
+                    dto.Id = model.Id;
+                    var datestreing = DateTime.Now.ToString("yyyyMMdd");
+                    var Applyno = _context.WfRunProcesses.Where(x => x.Applyno.Contains(datestreing)).Max(x => x.Applyno);
+                    if (string.IsNullOrEmpty(Applyno))
+                    {
+                        model.Applyno = datestreing + 1.ToString().PadLeft(4, '0');
+                    }
+                    else
+                    {
+                        model.Applyno = datestreing + (int.Parse(Applyno.Substring(Applyno.Length - 4)) + 1).ToString().PadLeft(4, '0');
+                    }
                     _context.WfRunProcesses.Add(model);
                 }
                 else
@@ -42,7 +56,7 @@
                     updateWfRunProcess.Step = model.Step;
                     updateWfRunProcess.ShenpiStatus = model.ShenpiStatus;
                     updateWfRunProcess.Version = model.Version;
-
+                    updateWfRunProcess.Deelurl = model.Deelurl; 
 
                     updateWfRunProcess.RecStatus = model.RecStatus;
                     // updateWfRunProcess.Creater = WfRunProcess.Creater;
@@ -112,25 +126,21 @@
                 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);
             }
 
             ///WfRunProcesses
             var query = (from a in _context.WfRunProcesses
 
 
-
-
-
-                       
-
+                     
                          join e in listCode.Where(x => x.CodeTable == "wf_run_process" && x.CodeField == "shenpi_status")
                         on a.ShenpiStatus equals e.CodeSn
                         into esssss
                          from eee in esssss.DefaultIfEmpty()
 
                          join d in _context.WfApplytypes
-                       on a.Applytiye equals d.Id
+                       on a.Applytiye equals d.Applyno
 
                          join b in _context.PltUsers
                         on a.Creater equals b.Id
@@ -146,7 +156,7 @@
                              && (string.IsNullOrWhiteSpace(searchEntity.ShenpiStatus) || a.ShenpiStatus == searchEntity.ShenpiStatus.Trim())
 
                                 && (string.IsNullOrWhiteSpace(searchEntity.Applyno) || a.Applyno == searchEntity.Applyno.Trim())
-
+                                && (string.IsNullOrWhiteSpace(searchEntity.Creater) || a.Creater == searchEntity.Creater.Trim())
 
                          select new WfRunProcessDTO
                          {
@@ -159,10 +169,11 @@
                              Content = a.Content,
                              ShenpiStatusName = eee.Comments,
                              ShenpiStatus = a.ShenpiStatus,
+                             Step = a.Step,
 
                              Version = a.Version,
                              Createtime = a.Createtime,
-
+                             Deelurl = a.Deelurl,
                              RecStatus = a.RecStatus,
                              Modifier = a.Modifier,
                              Modifytime = a.Modifytime,
@@ -203,14 +214,1075 @@
         /// 鑾峰彇鎵�鏈夋湁鏁堟祦绋嬬被鍨�
         /// </summary>
         /// <returns></returns>
-        public List<WfRunProcessDTO> GetList()
+        public List<WfRunProcessDTO> GetList(string DanjuId = "",string Applytiye = "")
         {
 
 
             var listRole = _context.WfRunProcesses.Where(r => r.RecStatus == "A").ToList();
+            if(!string.IsNullOrEmpty(DanjuId) && !string.IsNullOrEmpty(Applytiye))
+            {
+                listRole = listRole.Where(x=>x.DanjuId == DanjuId && x.Applytiye == Applytiye).ToList();
+            }
 
             var list = _mapper.Map<List<WfRunProcessDTO>>(listRole);
             return list;
         }
+
+
+        public ResultEntity WfAskLeave(string DanjuId, string step, string tongguojujue, string Userid,string Content, string title, string version)
+        {
+
+            ResultEntity result = new ResultEntity();
+            result.Result = true;
+
+
+            WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "01").FirstOrDefault();
+            if (wfRunProcessDTO != null)
+            {
+                version = wfRunProcessDTO.Version;
+            }
+
+
+            if (version == "v1")
+            {
+                if (step == "鎻愪氦")
+                {
+                    //鏇存柊娴佺▼瀹炰緥
+                    // WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "01").FirstOrDefault();
+                    if (wfRunProcessDTO == null)
+                    {
+                        //鎻掑叆娴佺▼瀹炰緥
+                        wfRunProcessDTO = new WfRunProcessDTO();
+                        //wfRunProcessDTO.Applyno = 
+                        wfRunProcessDTO.Applytime = DateTime.Now;
+                        wfRunProcessDTO.Applytiye = "01";
+                        wfRunProcessDTO.DanjuId = DanjuId;
+                        wfRunProcessDTO.Content = title;
+                        wfRunProcessDTO.Step = "浜轰簨瀹℃壒";
+                        wfRunProcessDTO.ShenpiStatus = "D";
+                        wfRunProcessDTO.Version = version;
+                        wfRunProcessDTO.RecStatus = "A";
+                        wfRunProcessDTO.Creater = Userid;
+                        wfRunProcessDTO.Createtime = DateTime.Now;
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        wfRunProcessDTO.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+                        //鏌ヨ澶勭悊浜�
+                        var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "浜轰簨").FirstOrDefault();
+                        if (hrPositions == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒拌亴浣�";
+                            return result;
+                        }
+                        var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A")
+                                        join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId
+                                        select a
+                                        ).ToList();
+
+                        if (pltUsers == null || pltUsers.Count == 0)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板鐞嗕汉";
+                            return result;
+                        }
+                        foreach (var pltUser in pltUsers)
+                        {
+                            //鎻掑叆寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = pltUser.Id;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "浜轰簨瀹℃壒";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 1;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        }
+
+                        //鎻掑叆鏂扮殑宸插姙
+                        WfHistory wfHistoryDTO1 = new WfHistory();
+                        wfHistoryDTO1.Id = Guid.NewGuid().ToString();
+                        wfHistoryDTO1.RunProcessId = wfRunProcessDTO.Id;
+                        wfHistoryDTO1.SendUserId = Userid;
+                        wfHistoryDTO1.DeelUserId = wfRunProcessDTO.Creater;
+                        wfHistoryDTO1.Sendtime = DateTime.Now;
+                        wfHistoryDTO1.Resivetime = DateTime.Now;
+                        wfHistoryDTO1.Step = "鎻愪氦";
+                        wfHistoryDTO1.NeeddeelType = "1";
+                        wfHistoryDTO1.ChuliStatus = "2";
+                        wfHistoryDTO1.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                        wfHistoryDTO1.Content = "";
+                        wfHistoryDTO1.Sort = 1;
+                        wfHistoryDTO1.RecStatus = "A";
+                        wfHistoryDTO1.Creater = Userid;
+                        wfHistoryDTO1.Createtime = DateTime.Now;
+                        wfHistoryDTO1.Modifier = Userid;
+                        wfHistoryDTO1.Modifytime = wfHistoryDTO1.Createtime;
+                        _context.WfHistories.Add(wfHistoryDTO1);
+                        _context.SaveChanges();
+                    }
+                    else
+                    {
+                        wfRunProcessDTO.Step = "浜轰簨瀹℃壒";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎻愪氦");
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "2";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+                        //鏌ヨ澶勭悊浜�
+                        var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "浜轰簨").FirstOrDefault();
+                        if (hrPositions == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒拌亴浣�";
+                            return result;
+                        }
+                        var pltUsers = (from   a in  _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A") 
+                                        join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId
+                                        select a
+                                        ).ToList();
+                       
+                        if (pltUsers == null || pltUsers.Count == 0)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板鐞嗕汉";
+                            return result;
+                        }
+
+                        foreach (var pltUser in pltUsers)
+                        {
+                            //鎻掑叆鏂扮殑寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = pltUser.Id;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "浜轰簨瀹℃壒";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 2;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        }
+                    }
+
+
+                 
+
+                }
+                if (step == "浜轰簨瀹℃壒")
+                {
+                    //鏇存柊娴佺▼瀹炰緥
+                    //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "01").FirstOrDefault();
+                    if (wfRunProcessDTO == null)
+                    {
+                        result.Result = false;
+                        result.Message = "鏈壘鍒版祦绋嬪疄渚�";
+                        return result;
+                    }
+                    if (wfRunProcessDTO.Step != "浜轰簨瀹℃壒")
+                    {
+                        result.Result = false;
+                        result.Message = "褰撳墠姝ラ宸茬粡澶勭悊";
+                        return result;
+                    }
+
+                    if (tongguojujue == "A")
+                    {
+                        wfRunProcessDTO.Step = "鎬荤粡鐞嗗鎵�";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "浜轰簨瀹℃壒");
+                        
+
+
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "2";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        
+
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+                        //鏌ヨ澶勭悊浜�
+                        var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "鎬荤粡鐞�").FirstOrDefault();
+                        if (hrPositions == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒拌亴浣�";
+                            return result;
+                        }
+                        var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A")
+                                        join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId
+                                        select a
+                                        ).ToList();
+
+                        if (pltUsers == null || pltUsers.Count == 0)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板鐞嗕汉";
+                            return result;
+                        }
+
+                        foreach (var pltUser in pltUsers)
+                        {
+                            //鎻掑叆鏂扮殑寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = pltUser.Id;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "鎬荤粡鐞嗗鎵�";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 3;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        wfRunProcessDTO.Step = "鎻愪氦";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "浜轰簨瀹℃壒");
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "1";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+                       
+                            //鎻掑叆鏂扮殑寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "鎻愪氦";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 1;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        
+                    }
+                  
+                   
+
+
+                       
+                }
+
+                if (step == "鎬荤粡鐞嗗鎵�")
+                {
+                    //鏇存柊娴佺▼瀹炰緥
+                    //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "01").FirstOrDefault();
+                    if (wfRunProcessDTO == null)
+                    {
+                        result.Result = false;
+                        result.Message = "鏈壘鍒版祦绋嬪疄渚�";
+                        return result;
+                    }
+                    if (wfRunProcessDTO.Step != "鎬荤粡鐞嗗鎵�")
+                    {
+                        result.Result = false;
+                        result.Message = "褰撳墠姝ラ宸茬粡澶勭悊";
+                        return result;
+                    }
+                    if (tongguojujue == "A")
+                    {
+
+                        wfRunProcessDTO.Step = "瀹岀粨";
+                        wfRunProcessDTO.ShenpiStatus = "A";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+                        //鏇存柊鍗曟嵁
+                        var askLeave = _context.AdmAskLeaves.Find(DanjuId);
+                        if (wfRunProcessDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板崟鎹�";
+                            return result;
+                        }
+                        askLeave.ShenpiStatus = "A";
+                        _context.SaveChanges();
+
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎬荤粡鐞嗗鎵�");
+
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "2";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            // _wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+                    }
+                    else
+                    {
+                        wfRunProcessDTO.Step = "鎻愪氦";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎬荤粡鐞嗗鎵�");
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "1";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+
+                        //鎻掑叆鏂扮殑寰呭姙
+                        WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                        wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                        wfNeeddeelDTO.SendUserId = Userid;
+                        wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater;
+                        wfNeeddeelDTO.Sendtime = DateTime.Now;
+                        wfNeeddeelDTO.Resivetime = DateTime.Now;
+                        wfNeeddeelDTO.Step = "鎻愪氦";
+                        wfNeeddeelDTO.NeeddeelType = "1";
+                        wfNeeddeelDTO.ChuliStatus = "0";
+                        wfNeeddeelDTO.Deelurl = "/Signin/AskLeave?id=" + DanjuId;
+                        wfNeeddeelDTO.Content = "";
+                        wfNeeddeelDTO.Sort = 1;
+                        wfNeeddeelDTO.RecStatus = "A";
+                        wfNeeddeelDTO.Creater = Userid;
+                        wfNeeddeelDTO.Createtime = DateTime.Now;
+                        wfNeeddeelDTO.Modifier = Userid;
+                        wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                        result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                    }
+
+
+
+                }
+
+
+            }
+
+            
+
+            return result;
+        }
+
+        public ResultEntity WfAskLeaveOff(string DanjuId, string step, string tongguojujue, string Userid, string Content, string title, string version)
+        {
+
+            ResultEntity result = new ResultEntity();
+            result.Result = true;
+
+
+            WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "02").FirstOrDefault();
+            if (wfRunProcessDTO != null)
+            {
+                version = wfRunProcessDTO.Version;
+            }
+
+
+            if (version == "v1")
+            {
+                if (step == "鎻愪氦")
+                {
+                    //鏇存柊娴佺▼瀹炰緥
+                    // WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "02").FirstOrDefault();
+                    if (wfRunProcessDTO == null)
+                    {
+                        //鎻掑叆娴佺▼瀹炰緥
+                        wfRunProcessDTO = new WfRunProcessDTO();
+                        //wfRunProcessDTO.Applyno = 
+                        wfRunProcessDTO.Applytime = DateTime.Now;
+                        wfRunProcessDTO.Applytiye = "02";
+                        wfRunProcessDTO.DanjuId = DanjuId;
+                        wfRunProcessDTO.Content = title;
+                        wfRunProcessDTO.Step = "浜轰簨瀹℃壒";
+                        wfRunProcessDTO.ShenpiStatus = "D";
+                        wfRunProcessDTO.Version = version;
+                        wfRunProcessDTO.RecStatus = "A";
+                        wfRunProcessDTO.Creater = Userid;
+                        wfRunProcessDTO.Createtime = DateTime.Now;
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        wfRunProcessDTO.Deelurl = "/Signin/AskLeaveOff?id=" + DanjuId;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+                        //鏌ヨ澶勭悊浜�
+                        var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "浜轰簨").FirstOrDefault();
+                        if (hrPositions == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒拌亴浣�";
+                            return result;
+                        }
+                        var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A")
+                                        join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId
+                                        select a
+                                        ).ToList();
+
+                        if (pltUsers == null || pltUsers.Count == 0)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板鐞嗕汉";
+                            return result;
+                        }
+                        foreach (var pltUser in pltUsers)
+                        {
+                            //鎻掑叆寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = pltUser.Id;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "浜轰簨瀹℃壒";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeaveOff?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 1;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        }
+
+                        //鎻掑叆鏂扮殑宸插姙
+                        WfHistory wfHistoryDTO1 = new WfHistory();
+                        wfHistoryDTO1.Id = Guid.NewGuid().ToString();
+                        wfHistoryDTO1.RunProcessId = wfRunProcessDTO.Id;
+                        wfHistoryDTO1.SendUserId = Userid;
+                        wfHistoryDTO1.DeelUserId = wfRunProcessDTO.Creater;
+                        wfHistoryDTO1.Sendtime = DateTime.Now;
+                        wfHistoryDTO1.Resivetime = DateTime.Now;
+                        wfHistoryDTO1.Step = "鎻愪氦";
+                        wfHistoryDTO1.NeeddeelType = "1";
+                        wfHistoryDTO1.ChuliStatus = "2";
+                        wfHistoryDTO1.Deelurl = "/Signin/AskLeaveOff?id=" + DanjuId;
+                        wfHistoryDTO1.Content = "";
+                        wfHistoryDTO1.Sort = 1;
+                        wfHistoryDTO1.RecStatus = "A";
+                        wfHistoryDTO1.Creater = Userid;
+                        wfHistoryDTO1.Createtime = DateTime.Now;
+                        wfHistoryDTO1.Modifier = Userid;
+                        wfHistoryDTO1.Modifytime = wfHistoryDTO1.Createtime;
+                        _context.WfHistories.Add(wfHistoryDTO1);
+                        _context.SaveChanges();
+                    }
+                    else
+                    {
+                        wfRunProcessDTO.Step = "浜轰簨瀹℃壒";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎻愪氦");
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "2";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+                        //鏌ヨ澶勭悊浜�
+                        var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "浜轰簨").FirstOrDefault();
+                        if (hrPositions == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒拌亴浣�";
+                            return result;
+                        }
+                        var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A")
+                                        join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId
+                                        select a
+                                        ).ToList();
+
+                        if (pltUsers == null || pltUsers.Count == 0)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板鐞嗕汉";
+                            return result;
+                        }
+
+                        foreach (var pltUser in pltUsers)
+                        {
+                            //鎻掑叆鏂扮殑寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = pltUser.Id;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "浜轰簨瀹℃壒";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeaveOff?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 2;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        }
+                    }
+
+
+
+
+                }
+                if (step == "浜轰簨瀹℃壒")
+                {
+                    //鏇存柊娴佺▼瀹炰緥
+                    //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "02").FirstOrDefault();
+                    if (wfRunProcessDTO == null)
+                    {
+                        result.Result = false;
+                        result.Message = "鏈壘鍒版祦绋嬪疄渚�";
+                        return result;
+                    }
+                    if (wfRunProcessDTO.Step != "浜轰簨瀹℃壒")
+                    {
+                        result.Result = false;
+                        result.Message = "褰撳墠姝ラ宸茬粡澶勭悊";
+                        return result;
+                    }
+
+                    if (tongguojujue == "A")
+                    {
+                        wfRunProcessDTO.Step = "鎬荤粡鐞嗗鎵�";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "浜轰簨瀹℃壒");
+
+
+
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "2";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+
+
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+                        //鏌ヨ澶勭悊浜�
+                        var hrPositions = _context.PltRoles.Where(x => x.RecStatus == "A" && x.RoleName == "鎬荤粡鐞�").FirstOrDefault();
+                        if (hrPositions == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒拌亴浣�";
+                            return result;
+                        }
+                        var pltUsers = (from a in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A")
+                                        join b in _context.PltUserRoles.Where(x => x.RecStatus == "A" && x.RoleId == hrPositions.Id) on a.Id equals b.UserId
+                                        select a
+                                        ).ToList();
+
+                        if (pltUsers == null || pltUsers.Count == 0)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板鐞嗕汉";
+                            return result;
+                        }
+
+                        foreach (var pltUser in pltUsers)
+                        {
+                            //鎻掑叆鏂扮殑寰呭姙
+                            WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                            wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                            wfNeeddeelDTO.SendUserId = Userid;
+                            wfNeeddeelDTO.DeelUserId = pltUser.Id;
+                            wfNeeddeelDTO.Sendtime = DateTime.Now;
+                            wfNeeddeelDTO.Resivetime = DateTime.Now;
+                            wfNeeddeelDTO.Step = "鎬荤粡鐞嗗鎵�";
+                            wfNeeddeelDTO.NeeddeelType = "1";
+                            wfNeeddeelDTO.ChuliStatus = "0";
+                            wfNeeddeelDTO.Deelurl = "/Signin/AskLeaveOff?id=" + DanjuId;
+                            wfNeeddeelDTO.Content = "";
+                            wfNeeddeelDTO.Sort = 3;
+                            wfNeeddeelDTO.RecStatus = "A";
+                            wfNeeddeelDTO.Creater = Userid;
+                            wfNeeddeelDTO.Createtime = DateTime.Now;
+                            wfNeeddeelDTO.Modifier = Userid;
+                            wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                            result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                            if (result.Result == false)
+                            {
+                                return result;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        wfRunProcessDTO.Step = "鎻愪氦";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "浜轰簨瀹℃壒");
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "1";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+
+                        //鎻掑叆鏂扮殑寰呭姙
+                        WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                        wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                        wfNeeddeelDTO.SendUserId = Userid;
+                        wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater;
+                        wfNeeddeelDTO.Sendtime = DateTime.Now;
+                        wfNeeddeelDTO.Resivetime = DateTime.Now;
+                        wfNeeddeelDTO.Step = "鎻愪氦";
+                        wfNeeddeelDTO.NeeddeelType = "1";
+                        wfNeeddeelDTO.ChuliStatus = "0";
+                        wfNeeddeelDTO.Deelurl = "/Signin/AskLeaveOff?id=" + DanjuId;
+                        wfNeeddeelDTO.Content = "";
+                        wfNeeddeelDTO.Sort = 1;
+                        wfNeeddeelDTO.RecStatus = "A";
+                        wfNeeddeelDTO.Creater = Userid;
+                        wfNeeddeelDTO.Createtime = DateTime.Now;
+                        wfNeeddeelDTO.Modifier = Userid;
+                        wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                        result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                    }
+
+
+
+
+
+                }
+
+                if (step == "鎬荤粡鐞嗗鎵�")
+                {
+                    //鏇存柊娴佺▼瀹炰緥
+                    //WfRunProcessDTO wfRunProcessDTO = this.GetList(DanjuId, "02").FirstOrDefault();
+                    if (wfRunProcessDTO == null)
+                    {
+                        result.Result = false;
+                        result.Message = "鏈壘鍒版祦绋嬪疄渚�";
+                        return result;
+                    }
+                    if (wfRunProcessDTO.Step != "鎬荤粡鐞嗗鎵�")
+                    {
+                        result.Result = false;
+                        result.Message = "褰撳墠姝ラ宸茬粡澶勭悊";
+                        return result;
+                    }
+                    if (tongguojujue == "A")
+                    {
+
+                        wfRunProcessDTO.Step = "瀹岀粨";
+                        wfRunProcessDTO.ShenpiStatus = "A";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+                        //鏇存柊鍗曟嵁
+                        var askLeaveOff = _context.AdmAskLeaveOffs.Find(DanjuId);
+                        if (wfRunProcessDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒板崟鎹�";
+                            return result;
+                        }
+                        askLeaveOff.ShenpiStatus = "A";
+                        _context.SaveChanges();
+
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎬荤粡鐞嗗鎵�");
+
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "2";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            // _wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+                    }
+                    else
+                    {
+                        wfRunProcessDTO.Step = "鎻愪氦";
+                        wfRunProcessDTO.Modifier = Userid;
+                        wfRunProcessDTO.Modifytime = DateTime.Now;
+                        result = this.save(wfRunProcessDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                        //鏇存柊寰呭姙
+                        List<WfNeeddeelDTO> wfNeeddeelDTOs = _wfNeeddeelService.GetList(wfRunProcessDTO.Id, "鎬荤粡鐞嗗鎵�");
+                        var wfHistoryDTOs = _mapper.Map<List<WfHistoryDTO>>(wfNeeddeelDTOs);
+
+                        var wfHistoryDTO = wfHistoryDTOs.Where(x => x.DeelUserId == Userid).FirstOrDefault();
+                        if (wfHistoryDTO == null)
+                        {
+                            result.Result = false;
+                            result.Message = "鏈壘鍒颁唬鍔�";
+                            return result;
+                        }
+                        wfHistoryDTO.Content = Content;
+                        wfHistoryDTO.ChuliStatus = "1";
+                        wfHistoryDTO.Modifier = Userid;
+                        wfHistoryDTO.Modifytime = DateTime.Now;
+                        var wfHistories = _mapper.Map<List<WfHistory>>(wfHistoryDTOs);
+                        foreach (var wfHistory in wfHistories)
+                        {
+                            _context.WfHistories.Add(wfHistory);
+                        }
+                        var wfNeeddeels = _mapper.Map<List<WfNeeddeel>>(wfNeeddeelDTOs);
+                        foreach (var wfNeeddeel in wfNeeddeels)
+                        {
+                            //_wfNeeddeelService.ModifyStatus(wfNeeddeel.Id, Userid);
+                            _context.WfNeeddeels.Remove(wfNeeddeel);
+                        }
+                        _context.SaveChanges();
+
+
+                        //鎻掑叆鏂扮殑寰呭姙
+                        WfNeeddeelDTO wfNeeddeelDTO = new WfNeeddeelDTO();
+                        wfNeeddeelDTO.RunProcessId = wfRunProcessDTO.Id;
+                        wfNeeddeelDTO.SendUserId = Userid;
+                        wfNeeddeelDTO.DeelUserId = wfRunProcessDTO.Creater;
+                        wfNeeddeelDTO.Sendtime = DateTime.Now;
+                        wfNeeddeelDTO.Resivetime = DateTime.Now;
+                        wfNeeddeelDTO.Step = "鎻愪氦";
+                        wfNeeddeelDTO.NeeddeelType = "1";
+                        wfNeeddeelDTO.ChuliStatus = "0";
+                        wfNeeddeelDTO.Deelurl = "/Signin/askLeaveOff?id=" + DanjuId;
+                        wfNeeddeelDTO.Content = "";
+                        wfNeeddeelDTO.Sort = 1;
+                        wfNeeddeelDTO.RecStatus = "A";
+                        wfNeeddeelDTO.Creater = Userid;
+                        wfNeeddeelDTO.Createtime = DateTime.Now;
+                        wfNeeddeelDTO.Modifier = Userid;
+                        wfNeeddeelDTO.Modifytime = wfNeeddeelDTO.Createtime;
+                        result = _wfNeeddeelService.save(wfNeeddeelDTO);
+                        if (result.Result == false)
+                        {
+                            return result;
+                        }
+
+                    }
+
+
+
+                }
+
+
+            }
+
+
+
+            return result;
+        }
     }
 }
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();
             }
diff --git a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs
index bab207c..95b6936 100644
--- a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs
@@ -114,7 +114,7 @@
 
 
             ViewBag.khlx = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
-            ViewBag.khly = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            ViewBag.khly = _liaotianService.GetSYScode("IntentionCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
             ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
 
             ViewBag.users = _userService.GetList().Where(x => x.IsYwjl == "A").Select(x => new { code = x.Id, label = x.UserName }).ToList();
@@ -133,6 +133,41 @@
         {
             //JsonResult jsonResult =   new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
             return new JsonResult(_intentionCustomerService.SearchByPaging(search));
+        }
+
+
+        public IActionResult IndexYiXiang()
+        {
+            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.khly = _liaotianService.GetSYScode("IntentionCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+
+            ViewBag.ywjl = _userService.GetList().Where(x => x.IsYwjl == "A").Select(x => new { code = x.Id, label = x.UserName }).ToList();
+
+            ViewBag.Dianxiaozhuanyuan = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList();
+
+
+            ViewBag.ywjlId = curentuser.Id;
+
+            //ViewBag.khlx = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+
+            //ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            //ViewBag.ShengDropDown = _projectService.Getsheng().Select(x => new { code = x.CodeId, label = x.Name }).ToList();
+            return View();
+
         }
 
         public IActionResult Edit(string id = null,string namecus = null)
@@ -163,7 +198,7 @@
             var users = _userService.GetList().Where(x => x.IsYwjl == "A").ToList(); ;
 
             ViewData["khlx"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx");
-            ViewData["khly"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly");
+            ViewData["khly"] = _liaotianService.GetSYScode("IntentionCustomer", "khly");
             ViewData["hyfl"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl");
 
             ViewData["users"] = users;
@@ -196,7 +231,7 @@
             var users = _userService.GetList().Where(x => x.IsYwjl == "A").ToList(); ;
 
             ViewData["khlx"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx");
-            ViewData["khly"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly");
+            ViewData["khly"] = _liaotianService.GetSYScode("IntentionCustomer", "khly");
             ViewData["hyfl"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl");
 
             ViewData["users"] = users;
@@ -282,11 +317,11 @@
                     for (int i = 0; i < result.Count; i++)
                     {
 
-                        resultEntity = _intentionCustomerService.ModifyStatus(result[i].Id, curentuser.Id);
-                        if (!resultEntity.Result)
-                        {
-                            return new JsonResult(resultEntity);
-                        }
+                        //resultEntity = _intentionCustomerService.ModifyStatus(result[i].Id, curentuser.Id);
+                        //if (!resultEntity.Result)
+                        //{
+                        //    return new JsonResult(resultEntity);
+                        //}
 
                         var dto = _mapper.Map<CooperatecustomCustomerDTO>(result[i]);
                         dto.Id = "";
diff --git a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs
index 007b957..12a155f 100644
--- a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs
@@ -18,6 +18,7 @@
 using CommonToolsCore;
 using static CommonToolsCore.SendMailHelper;
 using System.Net.Mail;
+using System.Transactions;
 
 namespace zhengcaioa.Controllers.Customer
 {
@@ -46,7 +47,7 @@
         }
 
 
-        public IActionResult Index()
+        public IActionResult Index(string Viscustomer = "", string IsYwjl = "")
         {
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             ViewData["curentuser"] = curentuser;
@@ -74,13 +75,13 @@
 
 
             ViewBag.khlx = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
-            ViewBag.khly = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            ViewBag.khly = _liaotianService.GetSYScode("IntentionCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
             ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
 
             ViewBag.users = _userService.GetList().Where(x => x.IsYwjl == "A").Select(x => new { code = x.Id, label = x.UserName }).ToList();
 
-
-
+            ViewBag.Viscustomer = Viscustomer;
+            ViewBag.IsYwjl = IsYwjl;
 
             ViewBag.ShengDropDown = _projectService.Getsheng().Select(x => new { code = x.CodeId, label = x.Name }).ToList();
             return View();
@@ -93,7 +94,7 @@
             return new JsonResult(_intentionVisitService.SearchByPaging(search));
         }
 
-        public IActionResult Edit(string id = null)
+        public IActionResult Edit(string id = null,string Viscustomer = null,string IsYwjl = "")
         {
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             ViewData["curentuser"] = curentuser;
@@ -107,6 +108,10 @@
             else
             {
                 dto.Vistime = DateTime.Now;
+                if (!string.IsNullOrWhiteSpace(Viscustomer))
+                {
+                    dto.Viscustomer = Viscustomer;
+                }
             }
 
 
@@ -121,7 +126,7 @@
             ViewData["jy"] = _liaotianService.GetSYScode("CooperVisit", "jy");
 
 
-
+            ViewBag.IsYwjl = IsYwjl;
 
             ViewData.Model = dto;
             return View();
@@ -147,8 +152,37 @@
             }
             data.Modifier = curentuser.Id;
             data.Modifytime = DateTime.Now;
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                resultEntity = _intentionVisitService.save(data);
 
-            ResultEntity resultEntity = _intentionVisitService.save(data);
+               
+               
+                if (!string.IsNullOrEmpty(data.IsYwjl))
+                {
+                    IntentionCustomerDTO intentionCustomerDTO = _intentionCustomerService.Get(data.Viscustomer);
+                    intentionCustomerDTO.Zuijinzhuizongtime = data.Vistime;
+                    if (string.IsNullOrEmpty(intentionCustomerDTO.Ywjl))
+                    {
+                        intentionCustomerDTO.Ywjl = curentuser.Id;
+                    }
+                    resultEntity = _intentionCustomerService.save(intentionCustomerDTO);
+                }
+                else if (data.Jy == "05")
+                {
+                    IntentionCustomerDTO intentionCustomerDTO = _intentionCustomerService.Get(data.Viscustomer);
+                    intentionCustomerDTO.Yixiang = data.Jy;
+                    intentionCustomerDTO.Yixiangtime = data.Vistime;
+                    intentionCustomerDTO.Dianxiaozhuanyuan = curentuser.Id;
+                    resultEntity = _intentionCustomerService.save(intentionCustomerDTO);
+
+                }
+               
+
+                scope.Complete();
+            }
+                
 
             return new JsonResult(resultEntity);
         }
diff --git a/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs b/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs
new file mode 100644
index 0000000..d26f9b2
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Controllers/WorkFlow/WorkFlowTaskController.cs
@@ -0,0 +1,163 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using AutoMapper;
+using AngleSharp.Html.Parser;
+using DTO;
+using IServices;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Bot.Builder.Integration.AspNet.Core;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using System.Net.Http;
+using System.Threading.Tasks;
+using zhengcaioa.Models;
+using zhengcaioa.IService;
+using System.Net.Mail;
+using static CommonToolsCore.SendMailHelper;
+using CommonToolsCore;
+
+namespace zhengcaioa.Controllers.WorkFlow
+{
+    [CheckLogin]
+    public class WorkFlowTaskController : Controller
+    {
+        private readonly ILogger<WorkFlowTaskController> _logger;
+       
+        private readonly IWfRunProcessService _wfRunProcessService;
+        private readonly IWfHistoryService _wfHistoryService;
+        private readonly IWfNeeddeelService _wfNeeddeelService;
+        private readonly IWfApplytypeService _wfApplytypeService;
+        private readonly ILiaotianService _liaotianService;
+        [CheckLogin]
+        public WorkFlowTaskController(ILogger<WorkFlowTaskController> logger, IWfRunProcessService wfRunProcessService
+            , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService, IWfApplytypeService wfApplytypeService
+            , ILiaotianService liaotianService)
+        {
+            _logger = logger;
+           
+            _wfRunProcessService = wfRunProcessService;
+            _wfHistoryService = wfHistoryService;
+            _wfNeeddeelService = wfNeeddeelService;
+            _wfApplytypeService = wfApplytypeService;
+            _liaotianService = liaotianService;
+        }
+        public IActionResult Index()
+        {
+            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 GetList(WfNeeddeelDTOSearch 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(_wfNeeddeelService.SearchByPaging(search));
+        }
+
+
+        public int CountRemindRecord()
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            WfNeeddeelDTOSearch search = new WfNeeddeelDTOSearch();
+            search.page = 1;
+            search.rows = 10;
+            search.Creater = curentuser.Id;
+            ResultDataEntity<WfNeeddeelDTO> resultDataEntity =  _wfNeeddeelService.SearchByPaging(search);
+            return search.totalrows;
+        }
+
+
+
+        public IActionResult IndexYiBan()
+        {
+            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 GetListYiBan(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.SearchByPaging(search));
+        }
+
+
+
+        public IActionResult IndexMyApply()
+        {
+            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();
+            ViewBag.ShenpiStatus = _liaotianService.GetSYScode("wf_run_process", "shenpi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            return View();
+        }
+
+        public IActionResult GetListMyApply(WfRunProcessDTOSearch 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(_wfRunProcessService.SearchByPaging(search));
+        }
+
+    }
+}
diff --git a/zhengcaioa/zhengcaioa/Startup.cs b/zhengcaioa/zhengcaioa/Startup.cs
index 1ca0ad8..85a2881 100644
--- a/zhengcaioa/zhengcaioa/Startup.cs
+++ b/zhengcaioa/zhengcaioa/Startup.cs
@@ -132,7 +132,10 @@
 
             services.AddScoped(typeof(ILZhuanjiahuidumService), typeof(LZhuanjiahuidumService));
 
-            services.AddScoped(typeof(IWfApplytypeService), typeof(WfApplytypeService)); 
+            services.AddScoped(typeof(IWfApplytypeService), typeof(WfApplytypeService));
+            services.AddScoped(typeof(IWfRunProcessService), typeof(WfRunProcessService));
+            services.AddScoped(typeof(IWfNeeddeelService), typeof(WfNeeddeelService));
+            services.AddScoped(typeof(IWfHistoryService), typeof(WfHistorieservice));
 
             //定时执行
             services.AddHostedService<TimedBackgroundService>();
diff --git a/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml b/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml
index afde1b3..35f748e 100644
--- a/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/IntentionCustomer/Index.cshtml
@@ -21,12 +21,19 @@
                     return "<a onclick=\"OpenWindow('" + cellvalue.replace(/'/g, '') + "','98%','100%', '/IntentionCustomer/Edit?id=" + rowObject.Id + "')\"  >" + cellvalue + "</a>";
                 }
             },
-
+           
+            { label: '鑱旂郴鐢佃瘽', name: 'Tel', labtype: 'txt', hidden: false, width: 100 },
             { label: '鎵�灞炲尯鍩�', name: 'ShengName', labtype: 'txt', hidden: false, width: 100  },
             { label: '瀹㈡埛鏉ユ簮', name: 'KhlyName', labtype: 'txt', hidden: false, width: 100  },
             { label: '琛屼笟鍒嗙被', name: 'HyflName', labtype: 'txt', hidden: false, width: 100 },
             { label: '瀹㈡埛绫诲瀷', name: 'KhlxName', labtype: 'txt', hidden: false, width: 100},
-            { label: '涓氬姟缁忕悊', name: 'YwjlName', labtype: 'txt', hidden: false, width: 100},
+            { label: '涓氬姟缁忕悊', name: 'YwjlName', labtype: 'txt', hidden: false, width: 100 },
+            {
+                label: '瀹㈡埛璁块棶', name: 'Name111', labtype: 'txt', hidden: false, width: 100,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"OpenWindow('鏂板鎰忓悜瀹㈡埛鎷滆','98%','100%', '/IntentionVisit/Edit?id=&Viscustomer=" + rowObject.Id + "')\"  >瀹㈡埛璁块棶</a>";
+                }
+            },
 
         ];
         dataUrl = "/IntentionCustomer/GetList";
diff --git a/zhengcaioa/zhengcaioa/Views/IntentionCustomer/IndexYiXiang.cshtml b/zhengcaioa/zhengcaioa/Views/IntentionCustomer/IndexYiXiang.cshtml
new file mode 100644
index 0000000..3f84bd5
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Views/IntentionCustomer/IndexYiXiang.cshtml
@@ -0,0 +1,93 @@
+锘緻{
+    ViewBag.Title = "IntentionCustomer";
+    Layout = "~/Views/Shared/_Layout_Search.cshtml";
+    string ywjlId = ViewBag.ywjlId as string;
+}
+@section headerStyle{
+    <script type="text/javascript">
+        var ywjls = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.ywjl))';
+         var khlys = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.khly))';
+         var Dianxiaozhuanyuans = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Dianxiaozhuanyuan))';
+        
+
+        
+        loseherght = 60;
+        //gridConfig = { multiselect: true, selectcol: "Id" };
+        dataCol = [
+            { label: 'id', name: 'Id', labtype: 'txt', hidden: true },
+            { label: '鎰忓悜鏃堕棿', name: 'YixiangtimeName', labtype: 'txt', hidden: false, width: 100 },
+            { label: '鎰忓悜鏉ユ簮', name: 'KhlyName', labtype: 'txt', hidden: false, width: 100 },
+            { label: '鐢甸攢涓撳憳', name: 'DianxiaozhuanyuanName', labtype: 'txt', hidden: false, width: 100 },
+            {
+                label: '瀹㈡埛鍗曚綅', name: 'Name', labtype: 'txt', hidden: false, width: 400,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"OpenWindow('" + cellvalue.replace(/'/g, '') + "','98%','100%', '/IntentionCustomer/Edit?id=" + rowObject.Id + "')\"  >" + cellvalue + "</a>";
+                }
+            },
+            { label: '鎵垮姙浜�', name: 'YwjlName', labtype: 'txt', hidden: false, width: 100 },
+
+            { label: '鏈�杩戣窡韪椂闂�', name: 'ZuijinzhuizongtimeName', labtype: 'txt', hidden: false, width: 100 },
+           
+           
+            {
+                label: '璺熻釜璁板綍', name: 'Name111', labtype: 'txt', hidden: false, width: 100,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"OpenWindow('璺熻釜璁板綍','98%','100%', '/IntentionVisit/Index?IsYwjl=true&Viscustomer=" + rowObject.Id + "')\"  >璺熻釜璁板綍</a>";
+                }
+            },
+
+        ];
+        dataUrl = "/IntentionCustomer/GetList?Yixiang=05&YwjlYx=@ywjlId";
+        searchCol = [
+            { label: '鎰忓悜鏃堕棿', name: 'Yixiangtime', labtype: 'datearea', hidden: false },
+            { label: '鎰忓悜鏉ユ簮', name: 'Khly', labtype: 'combox', hidden: false, data: JSON.parse(khlys)/*, cwidth: '5%', cccwidth: '8%'*/ },
+            { label: '鐢甸攢涓撳憳', name: 'Dianxiaozhuanyuan', labtype: 'combox', hidden: false, data: JSON.parse(Dianxiaozhuanyuans)/*, cwidth: '5%', cccwidth: '8%' */},
+            { label: '瀹㈡埛鍗曚綅', name: 'Name', labtype: 'txt', hidden: false },
+            { label: '鎵垮姙浜�', name: 'Ywjl', labtype: 'combox', hidden: false, data: JSON.parse(ywjls) },
+             
+
+
+
+        ];
+
+
+
+
+
+
+
+
+
+
+
+
+
+        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">
+
+        
+
+
+
+    </script>
+}
diff --git a/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml
index 710ac95..dc79de5 100644
--- a/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml
@@ -10,6 +10,7 @@
     List<SysCodeDtl> zw = ViewData["zw"] as List<SysCodeDtl>; //鑱屽姟
     List<SysCodeDtl> yx = ViewData["yx"] as List<SysCodeDtl>; //鎴愪氦鎰忓悜
     List<SysCodeDtl> jy = ViewData["jy"] as List<SysCodeDtl>; //璺熻釜寤鸿
+    string IsYwjl = ViewBag.IsYwjl as string;
 
 
 }
@@ -133,6 +134,7 @@
 
                                         </select>
                                         <input type="hidden" id="Id" name="Id" value="@Model.Id" />
+                                        <input type="hidden" id="IsYwjl" name="IsYwjl" value="@IsYwjl" />
                                     </div>
                                 </div>
 
diff --git a/zhengcaioa/zhengcaioa/Views/IntentionVisit/Index.cshtml b/zhengcaioa/zhengcaioa/Views/IntentionVisit/Index.cshtml
index f094a68..06bed25 100644
--- a/zhengcaioa/zhengcaioa/Views/IntentionVisit/Index.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/IntentionVisit/Index.cshtml
@@ -1,6 +1,9 @@
 锘緻{
     ViewBag.Title = "IntentionVisit";
     Layout = "~/Views/Shared/_Layout_Search.cshtml";
+    string Viscustomer = ViewBag.Viscustomer as string;
+    string IsYwjl = ViewBag.IsYwjl as string;
+    
 }
 @section headerStyle{
     <script type="text/javascript">
@@ -13,11 +16,11 @@
         gridConfig = { multiselect: true, selectcol: "Id" };
         dataCol = [
             { label: 'id', name: 'Id', labtype: 'txt', hidden: true },
-           
+
             {
                 label: '鎷滆鏃堕棿', name: 'VistimeName', labtype: 'txt', hidden: false, width: 100,
                 formatter: function (cellvalue, options, rowObject) {
-                    return "<a onclick=\"OpenWindow('" + cellvalue.replace(/'/g, '') + "','98%','100%', '/IntentionVisit/Edit?id=" + rowObject.Id + "')\"  >" + cellvalue + "</a>";
+                    return "<a onclick=\"OpenWindow('" + cellvalue.replace(/'/g, '') + "','98%','100%', '/IntentionVisit/Edit?id=" + rowObject.Id + "&Viscustomer=@Viscustomer&IsYwjl=@IsYwjl')\"  >" + cellvalue + "</a>";
                 }
             },
 
@@ -32,7 +35,7 @@
             { label: '璺熻釜寤鸿', name: 'JyName', labtype: 'txt', hidden: false, width: 100 },
 
         ];
-        dataUrl = "/IntentionVisit/GetList";
+        dataUrl = "/IntentionVisit/GetList?Viscustomer=@Viscustomer";
         searchCol = [
             { label: '瀹㈡埛鏉ユ簮', name: 'Khly', labtype: 'combox', hidden: false, data: JSON.parse(khlys), cwidth: '5%', cccwidth: '8%' },
             { label: '琛屼笟鍒嗙被', name: 'Hyfl', labtype: 'combox', hidden: false, data: JSON.parse(hyfls), cwidth: '5%', cccwidth: '15%' },
@@ -49,11 +52,11 @@
 
         ];
         var _pageAdd = function () {
-            OpenWindow("鏂板鎰忓悜瀹㈡埛鎷滆", "98%", "90%", "/IntentionVisit/Edit/");
+            OpenWindow("鏂板鎰忓悜瀹㈡埛鎷滆", "98%", "90%", "/IntentionVisit/Edit?Viscustomer=@Viscustomer&IsYwjl=@IsYwjl");
         }
 
 
-       
+
 
         var _afterSave = function (result) {
             if (result) {
diff --git a/zhengcaioa/zhengcaioa/Views/Shared/_Layout.cshtml b/zhengcaioa/zhengcaioa/Views/Shared/_Layout.cshtml
index eb8e61e..ceaa890 100644
--- a/zhengcaioa/zhengcaioa/Views/Shared/_Layout.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/Shared/_Layout.cshtml
@@ -161,6 +161,29 @@
                 }
             });
 
+
+            $.ajax({
+                type: "POST",
+                url: "/WorkFlowTask/CountRemindRecord",
+                dataType: "json",
+                global: false,
+                async: false,
+                //data: $('form').serializeArray(),
+                success: function (data) {
+                    // console.log(data);
+                    $("#wfmsgcount").text(data);
+                    if (parseInt(data) > 0) {
+                        $("#showmsgcounts").attr("style", 'font-size:18px; color:#0d9c63;');
+                    }
+                    else {
+                        $("#showmsgcounts").attr("style", 'font-size: larger;');
+                    }
+                },
+                error: function () {
+                    parent.layer.msg('澶辫触', { icon: 5 });
+                }
+            });
+
         };
 
         timerId();
diff --git a/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml b/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml
index fca84e4..b22b742 100644
--- a/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/Signin/AskLeave.cshtml
@@ -3,6 +3,7 @@
 @using zhengcaioa.Models;
 @{
     Layout = null;
+
     ResultDataEntity<SysAttachmentDTO> attachment = ViewBag.attachment as ResultDataEntity<SysAttachmentDTO>; //闂绫诲瀷
     List<SysAttachmentDTO> attachmentsssss = attachment.DataList;
 
@@ -10,8 +11,14 @@
     {
         attachmentsssss = new List<SysAttachmentDTO>();
     }
-
     List<SysCodeDtl> Lavetype = ViewData["Lavetype"] as List<SysCodeDtl>; //鎷滆鏂瑰紡
+
+    //娴佺▼鐩稿叧
+    string shifoubiaoji = ViewBag.shifoubiaoji as string;
+    string sifoudangqian = ViewBag.sifoudangqian as string;
+    string dangqianbuzhou = ViewBag.dangqianbuzhou as string; 
+
+    List<WfHistoryDTO> lishiyijian = ViewData["lishiyijian"] as List<WfHistoryDTO>; //鍘嗗彶鎰忚
 }
 <!DOCTYPE html>
 <html>
@@ -78,21 +85,21 @@
             <tbody>
                 <tr>
                     <td class="title">鍗曟嵁鍚嶇О</td>
-                    <td>
-                        <input type="text" class="form-control" value="@Model.Tittle" name="Tittle" id="Tittle" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly"> 
+                    <td colspan="4">
+                        <input type="text" class="form-control" value="@Model.Tittle" name="Tittle" id="Tittle" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">
                     </td>
 
                 </tr>
                 <tr>
                     <td class="title">鐢宠浜�</td>
-                    <td>
+                    <td colspan="4">
                         <input type="text" class="form-control" value="@Model.CreaterName" name="CreaterName" id="CreaterName" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">
                     </td>
 
                 </tr>
                 <tr>
                     <td class="title">璇峰亣鏃堕棿</td>
-                    <td>
+                    <td colspan="4">
                         <input type="text" class="layui-input  layer-date  ldate form-control" value="@Model.StratTimeName" name="StratTime" id="StratTime" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">-  <input type="text" class="layui-input  layer-date ldate form-control" value="@Model.EndTimeName" name="EndTime" id="EndTime" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">
                     </td>
 
@@ -100,7 +107,7 @@
 
                 <tr>
                     <td class="title">璇峰亣绫诲瀷</td>
-                    <td>
+                    <td colspan="4">
                         <select class="leaveType form-control data" name="Lavetype" id="Lavetype" style="margin-right: 4px;">
                             <option value="" hassubinfo="true">璇烽�夋嫨</option>
                             @foreach (var item in Lavetype)
@@ -136,38 +143,78 @@
                 </tr>
                 <tr>
                     <td class="title">璇峰亣鏃堕暱</td>
-                    <td>
+                    <td colspan="4">
                         <input class="layui-input data" style="width:100px !important;float: left;" type="number" value="@Model.LaveDay" name="LaveDay" id="LaveDay" min="0" step="1" readonly="readonly">澶�
                         <input class="layui-input data" style="width:100px !important;" type="number" value="@Model.LavehHour" name="LavehHour" id="LavehHour" min="0" step="1" readonly="readonly">灏忔椂
                     </td>
                 </tr>
                 <tr>
                     <td class="title">澶�&nbsp;&nbsp;娉�</td>
-                    <td>
+                    <td colspan="4">
                         <textarea class="form-control data" name="Remark" style="width:374px; vertical-align: top;height:100px" maxlength="500">@Model.Remark</textarea>
                     </td>
                 </tr>
                 <tr>
                     <td class="title">涓婁紶闄勪欢</td>
-                    <td>
+                    <td colspan="4">
                         <input type="file" name="file" id="fileUp" multiple>
                     </td>
                 </tr>
-                <tr>
-                    <td colspan="10" style="text-align: center">
-                        <a class="btn btn-success" href="javascript:void(0)" onclick="Save();" style="margin-left:4px; border-radius:4px;">
-                            <span class="bold">鎻愪氦</span>
-                        </a>
+                <tr id="shenpiyijian">
+                    <td class="title">瀹℃壒鎰忚</td>
+                    <td colspan="4">
+                        <textarea class="form-control data" id="Content" name="Content" style="width:374px; vertical-align: top;height:100px" maxlength="500"></textarea>
                     </td>
                 </tr>
+                <tr>
+                    <td class="title">鍘嗗彶鎰忚</td>
+                    <td colspan="4">
+                    </td>
+                </tr>
+                <tr>
+                    <td colspan="10">  <table>
+    @foreach (var wfHistory in lishiyijian)
+    {
+                                           <tr>
+                                               <td style="border:1px solid #ccc;width:150px;">@wfHistory.Step</td>
+                                               <td style="border:1px solid #ccc;width:50px;">@wfHistory.ChuliStatusName</td>
+                                               <td style="border:1px solid #ccc;width:150px;">@wfHistory.ModifytimeName</td>
+                                               <td style="border:1px solid #ccc;width:300px;">@wfHistory.Content</td>
+                                               <td style="border:1px solid #ccc;width:100px;">@wfHistory.DeelUserIdName</td>
+                                           </tr>
+    }
+</table></td>
+                   
+                   
+                    </tr>
 
-            </tbody>
+                    <tr>
+                        <td colspan="10" style="text-align: center">
+                            <a class="btn btn-success" id="tijiao" href="javascript:void(0)" onclick="Save('');" style="margin-left:4px; border-radius:4px;">
+                                <span class="bold">鎻愪氦</span>
+                            </a>
+
+                            <a class="btn btn-success" id="tongyi" href="javascript:void(0)" onclick="Save('A');" style="margin-left:4px; border-radius:4px;">
+                                <span class="bold">鍚屾剰</span>
+                            </a>
+
+                            <a class="btn btn-success" id="jujue" href="javascript:void(0)" onclick="Save('D');" style="margin-left:4px; border-radius:4px;">
+                                <span class="bold">鎷掔粷</span>
+                            </a>
+
+                            <input type="hidden" id="Id" name="Id" value="@Model.Id" />
+                            <input type="hidden" id="Tongguojujue" name="Tongguojujue" value="" />
+                            <input type="hidden" id="Step" name="Step" value="@dangqianbuzhou" />
+                        </td>
+                    </tr>
+
+                </tbody>
         </table>
         <div id='file-list-display' style="width: 100%;text-align: left; background-color:white">
             @{ for (int i = 0; i < attachmentsssss.Count; i++)
                 {
                     <div>
-                        <a download href='@attachmentsssss[i].Filepath'>@attachmentsssss[i].Filefullname  </a> &nbsp;  <a href='javascript: void (0);' onclick='js_method(this,"@attachmentsssss[i].Id")'><i class='glyphicon glyphicon-remove'></i> </a>
+                        <a download href='@attachmentsssss[i].Filepath'>@attachmentsssss[i].Filefullname  </a> &nbsp;  <a href='javascript: void (0);' class = 'fujianshanchu'  onclick='js_method(this,"@attachmentsssss[i].Id")'><i class='glyphicon glyphicon-remove'></i> </a>
                         <input type="hidden" name="attachmentid" value="@attachmentsssss[i].Id" />
                         <input type="hidden" name="Filepath" value="@attachmentsssss[i].Filepath" />
                         <input type="hidden" name="Filefullname" value="@attachmentsssss[i].Filefullname" />
@@ -184,7 +231,7 @@
     </form>
 
     <script type="text/javascript">
-       
+
 
         var hh = document.body.clientHeight - $('.ibox-title').height() - $("#top").height() * 2 - 95;
         $("#div_content").height(hh);
@@ -209,33 +256,74 @@
 
 
         $(function () {
-            $(".ldate").each(function (el) {
-                laydate({
-                    elem: "#" + $(this).attr('id'), //瀵瑰簲id
-                    format: 'YYYY-MM-DD hh:mm', //鏃ユ湡鏍煎紡 // 鍒嗛殧绗﹀彲浠ヤ换鎰忓畾涔夛紝璇ヤ緥瀛愯〃绀哄彧鏄剧ず骞存湀
-                    min: '2021-01-01', //璁惧畾鏈�灏忔棩鏈熶负褰撳墠鏃ユ湡
-                    max: '2099-06-16', //鏈�澶ф棩鏈�
-                    type: 'datetime',
-                    festival: false, //鏄剧ず鑺傛棩
-                    istime: true, 聽 //鏄惁鏄剧ず鏃跺垎绉�
-                    istoday: true, //鏄惁鏄粖澶�
-                    choose: function (datas) { //閫夋嫨鏃ユ湡瀹屾瘯鐨勫洖璋�
-                         // console.log("234234234234324");
-                        // end.min = datas; //寮�濮嬫棩閫夊ソ鍚庯紝閲嶇疆缁撴潫鏃ョ殑鏈�灏忔棩鏈�
-                        // end.start = datas //灏嗙粨鏉熸棩鐨勫垵濮嬪�艰瀹氫负寮�濮嬫棩
-                        checktime();
-                    }
-                });
-
-            });
+           
             $("#Lavetype").val("@Model.Lavetype");
-          
 
+
+
+             if ("@shifoubiaoji" != "A") {
+                $("input").attr('readonly', true);
+                $("textarea").attr('readonly', true);
+                $(':radio').attr('disabled', true);
+                $(':checkbox').attr('disabled', true);
+                $(':button').attr('disabled', true);
+                //$('a').removeAttr('onclick');
+                 $('select').attr('disabled', true);
+                 $("#fileUp").attr('disabled', true);
+
+                 $('.fujianshanchu').removeAttr('onclick');  
+
+                
+                 if ("@sifoudangqian" == "A") {
+                     $("#Content").attr('readonly', false);
+                      $('#tijiao').hide();
+                 } else {
+                     $('#tongyi').hide();
+                      $('#jujue').hide();
+                     $('#tijiao').hide();
+                     $('#shenpiyijian').hide();
+                 }
+
+            } else {
+
+
+                  //瀹℃壒鐩稿叧
+                 $('#shenpiyijian').hide();
+                 if ("@sifoudangqian" == "A") {
+                     $('#tongyi').hide();
+                     $('#jujue').hide();
+                 } else {
+                     $('#tongyi').hide();
+                      $('#jujue').hide();
+                      $('#tijiao').hide();
+                 }
+
+
+                 $(".ldate").each(function (el) {
+                     laydate({
+                         elem: "#" + $(this).attr('id'), //瀵瑰簲id
+                         format: 'YYYY-MM-DD hh:mm', //鏃ユ湡鏍煎紡 // 鍒嗛殧绗﹀彲浠ヤ换鎰忓畾涔夛紝璇ヤ緥瀛愯〃绀哄彧鏄剧ず骞存湀
+                         min: '2021-01-01', //璁惧畾鏈�灏忔棩鏈熶负褰撳墠鏃ユ湡
+                         max: '2099-06-16', //鏈�澶ф棩鏈�
+                         type: 'datetime',
+                         festival: false, //鏄剧ず鑺傛棩
+                         istime: true, 聽 //鏄惁鏄剧ず鏃跺垎绉�
+                         istoday: true, //鏄惁鏄粖澶�
+                         choose: function (datas) { //閫夋嫨鏃ユ湡瀹屾瘯鐨勫洖璋�
+                             // console.log("234234234234324");
+                             // end.min = datas; //寮�濮嬫棩閫夊ソ鍚庯紝閲嶇疆缁撴潫鏃ョ殑鏈�灏忔棩鏈�
+                             // end.start = datas //灏嗙粨鏉熸棩鐨勫垵濮嬪�艰瀹氫负寮�濮嬫棩
+                             checktime();
+                         }
+                     });
+
+                 });
+            }
 
         })
 
 
-        function Save() {
+        function Save(tongyi) {
             if ($("#StratTime").val() == '') {
                 toastr.warning("寮�濮嬫棩鏈熶笉鑳戒负绌�");
                 return;
@@ -264,9 +352,9 @@
                 return;
             }
             
+            $("#Tongguojujue").val(tongyi);
 
-
-
+            
             //var data = { id: $("#Id").val(), StartTime:$("#StartTime").val(), Sheng: $("#Sheng").val(), job_level: $("#Job_level").val().toString(), ExistsAttachment: fileId != "" }
             $.ajax({
                 type: "POST",
@@ -355,7 +443,7 @@
                         var fileListDisplay = $("#file-list-display");
                         if (data.DataList && data.DataList.length > 0) {
                             for (var i = 0; i < data.DataList.length; i++) {
-                                var aaa = "<div><a download href ='" + data.DataList[i].Filepath + "'>" + data.DataList[i].Filefullname + " </a> &nbsp;  <a   href='javascript: void (0);' onclick='js_method(this,\"\")' ><i class='glyphicon glyphicon-remove'></i> </a> "
+                                var aaa = "<div><a download href ='" + data.DataList[i].Filepath + "'>" + data.DataList[i].Filefullname + " </a> &nbsp;  <a   href='javascript: void (0);' class = 'fujianshanchu' onclick='js_method(this,\"\")' ><i class='glyphicon glyphicon-remove'></i> </a> "
                                 aaa += ' <input type="hidden"  name="attachmentid" value="" />   ';
                                 aaa += ' <input type="hidden"  name="Filepath" value="' + data.DataList[i].Filepath + '" />  ';
                                 aaa += '  <input type="hidden"  name="Filefullname" value="' + data.DataList[i].Filefullname + '" />  ';
@@ -411,7 +499,7 @@
 
 
         }
-        
+
 
         function checktime() {
             if ($("#StratTime").val() == '') {
@@ -426,8 +514,8 @@
                 return;
             }
 
-            
- 
+
+
 
 
 
@@ -442,14 +530,14 @@
                 success: function (data) {
                     if (data.Result) {
                         $("#LaveDay").val(data.DataInfo.LaveDay);
-                        $("#LavehHour").val(data.DataInfo.LavehHour);  
+                        $("#LavehHour").val(data.DataInfo.LavehHour);
                     }
                     else {
                         toastr.error(data.Message);
 
                     }
-                   
-                    
+
+
 
                 },
                 error: function () {
diff --git a/zhengcaioa/zhengcaioa/Views/Signin/AskLeaveOff.cshtml b/zhengcaioa/zhengcaioa/Views/Signin/AskLeaveOff.cshtml
index 84f43e1..58f0816 100644
--- a/zhengcaioa/zhengcaioa/Views/Signin/AskLeaveOff.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/Signin/AskLeaveOff.cshtml
@@ -14,6 +14,13 @@
     }
 
     List<SysCodeDtl> Lavetype = ViewData["Lavetype"] as List<SysCodeDtl>; //鎷滆鏂瑰紡
+
+    //娴佺▼鐩稿叧
+    string shifoubiaoji = ViewBag.shifoubiaoji as string;
+    string sifoudangqian = ViewBag.sifoudangqian as string;
+    string dangqianbuzhou = ViewBag.dangqianbuzhou as string;
+
+    List<WfHistoryDTO> lishiyijian = ViewData["lishiyijian"] as List<WfHistoryDTO>; //鍘嗗彶鎰忚
 }
 
 <!DOCTYPE html>
@@ -107,28 +114,28 @@
             <tbody>
                 <tr>
                     <td class="title">鍗曟嵁鍚嶇О</td>
-                    <td>
+                    <td  colspan="4"> 
                         <input type="text" class="form-control" value="@Model.Tittle" name="Tittle" id="Tittle" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">
                     </td>
 
                 </tr>
                 <tr>
                     <td class="title">鐢宠浜�</td>
-                    <td>
+                    <td  colspan="4">
                         <input type="text" class="form-control" value="@Model.CreaterName" name="CreaterName" id="CreaterName" style="width:150px;margin-right: 4px;" validate="RequiredField" autocomplete="off" readonly="readonly">
                     </td>
 
                 </tr>
                 <tr>
                     <td class="title">閿�鍋囨椂闂�</td>
-                    <td>
+                    <td  colspan="4">
                         <input type="text" class="layui-input  layer-date  ldate form-control" value="@Model.StratTimeName" name="StratTime" id="StratTime" style="width:150px;margin-right: 4px;" autocomplete="off" readonly="readonly">-
                         <input type="text" class="layui-input  layer-date ldate form-control" value="@Model.EndTimeName" name="EndTime" id="EndTime" style="width:150px;margin-right: 4px;" autocomplete="off" readonly="readonly">
                     </td>
                 </tr>
                 <tr>
                     <td class="title">閿�鍋囩被鍨�</td>
-                    <td>
+                    <td  colspan="4">
                         <select class="leaveType form-control" name="Lavetype" id="Lavetype" style="width:150px;margin-right: 4px;">
                             <option value="" hassubinfo="true">璇烽�夋嫨</option>
                             @foreach (var item in Lavetype)
@@ -156,7 +163,7 @@
                 </tr>
                 <tr>
                     <td class="title">鐢宠鐞嗙敱</td>
-                    <td>
+                    <td  colspan="4"> 
                         <textarea name="Remark" style="width:374px; vertical-align: top;height:100px" maxlength="500">@Model.Remark</textarea>
                     </td>
                 </tr>
@@ -164,7 +171,7 @@
 
                 <tr style="height:120px;">
                     <td class="title">涓婁紶鐥呭巻</td>
-                    <td>
+                    <td  colspan="4">
                         <div class="img-box">
                             <div id="ImgMedicalRecord" class="ImgMedicalRecord"></div>
                             <input type="hidden" id="MedicalRecord" name="MedicalRecord" value="@Model.MedicalRecord" />
@@ -178,17 +185,57 @@
                     </td>
                 </tr>
                 <tr>
-                    <td class="title">涓婁紶闄勪欢</td>
-                    <td>
+                    <td class="title" >涓婁紶闄勪欢</td>
+                    <td  colspan="4" >
                         <input type="file" name="file" id="fileUp" multiple>
                     </td>
                 </tr>
+                <tr id="shenpiyijian">
+                    <td class="title">瀹℃壒鎰忚</td>
+                    <td colspan="4">
+                        <textarea class="form-control data" id="Content" name="Content" style="width:374px; vertical-align: top;height:100px" maxlength="500"></textarea>
+                    </td>
+                </tr>
+                <tr>
+                    <td class="title">鍘嗗彶鎰忚</td>
+                    <td colspan="4">
+                    </td>
+                </tr>
+                <tr>
+                    <td colspan="10">
+                        <table>
+                            @foreach (var wfHistory in lishiyijian)
+                            {
+                                <tr>
+                                    <td style="border:1px solid #ccc;width:150px;">@wfHistory.Step</td>
+                                    <td style="border:1px solid #ccc;width:50px;">@wfHistory.ChuliStatusName</td>
+                                    <td style="border:1px solid #ccc;width:150px;">@wfHistory.ModifytimeName</td>
+                                    <td style="border:1px solid #ccc;width:300px;">@wfHistory.Content</td>
+                                    <td style="border:1px solid #ccc;width:100px;">@wfHistory.DeelUserIdName</td>
+                                </tr>
+                            }
+                        </table>
+                    </td>
+                   
+
+                </tr>
                 <tr>
                     <td colspan="10" style="text-align: center">
-                        <a class="btn btn-success" href="javascript:void(0)" onclick="Save();" style="margin-left:4px; border-radius:4px;">
+                        <a class="btn btn-success" id="tijiao" href="javascript:void(0)" onclick="Save();" style="margin-left:4px; border-radius:4px;">
                             <span class="bold">鎻愪氦</span>
                         </a>
+
+                        <a class="btn btn-success" id="tongyi" href="javascript:void(0)" onclick="Save('A');" style="margin-left:4px; border-radius:4px;">
+                            <span class="bold">鍚屾剰</span>
+                        </a>
+
+                        <a class="btn btn-success" id="jujue" href="javascript:void(0)" onclick="Save('D');" style="margin-left:4px; border-radius:4px;">
+                            <span class="bold">鎷掔粷</span>
+                        </a>
+                        <input type="hidden" id="Tongguojujue" name="Tongguojujue" value="" />
+                        <input type="hidden" id="Step" name="Step" value="@dangqianbuzhou" />
                     </td>
+
                 </tr>
 
             </tbody>
@@ -233,27 +280,7 @@
         };
 
 
-
-        var imgPath = "@Url.Content("~/UploadFile/")";
-        $(function () {
-            $(".ldate").each(function (el) {
-                laydate({
-                    elem: "#" + $(this).attr('id'), //瀵瑰簲id
-                    format: 'YYYY-MM-DD hh:mm', //鏃ユ湡鏍煎紡 // 鍒嗛殧绗﹀彲浠ヤ换鎰忓畾涔夛紝璇ヤ緥瀛愯〃绀哄彧鏄剧ず骞存湀
-                    min: '2021-01-01', //璁惧畾鏈�灏忔棩鏈熶负褰撳墠鏃ユ湡
-                    max: '2099-06-16', //鏈�澶ф棩鏈�
-                    type: 'datetime',
-                    festival: false, //鏄剧ず鑺傛棩
-                    istime: true, 聽 //鏄惁鏄剧ず鏃跺垎绉�
-                    istoday: true, //鏄惁鏄粖澶�
-                    choose: function (datas) { //閫夋嫨鏃ユ湡瀹屾瘯鐨勫洖璋�
-                        // end.min = datas; //寮�濮嬫棩閫夊ソ鍚庯紝閲嶇疆缁撴潫鏃ョ殑鏈�灏忔棩鏈�
-                        // end.start = datas //灏嗙粨鏉熸棩鐨勫垵濮嬪�艰瀹氫负寮�濮嬫棩
-                    }
-                });
-
-            });
-
+          var imgPath = "@Url.Content("~/UploadFile/")";
             new DragImgUpload("#ImgMedicalRecord", {
                 callback: function (files) {
                     let img = imgUploadCallback(files);
@@ -265,7 +292,71 @@
             });
 
             let img = "@Model.MedicalRecord";
-            if ($.trim(img) !== "")
+
+        $(function () {
+             if ("@shifoubiaoji" != "A") {
+                $("input").attr('readonly', true);
+                $("textarea").attr('readonly', true);
+                $(':radio').attr('disabled', true);
+                $(':checkbox').attr('disabled', true);
+                $(':button').attr('disabled', true);
+                //$('a').removeAttr('onclick');
+
+                 $('select').attr('disabled', true);
+                 $("#fileUp").attr('disabled', true);
+
+                 $("#ImgMedicalRecord").unbind("click");
+
+                 $('.fujianshanchu').removeAttr('onclick');
+
+
+                 if ("@sifoudangqian" == "A") {
+                     $("#Content").attr('readonly', false);
+                      $('#tijiao').hide();
+                 } else {
+                     $('#tongyi').hide();
+                      $('#jujue').hide();
+                     $('#tijiao').hide();
+                     $('#shenpiyijian').hide();
+                 }
+
+            } else {
+
+
+                  //瀹℃壒鐩稿叧
+                 $('#shenpiyijian').hide();
+                 if ("@sifoudangqian" == "A") {
+                     $('#tongyi').hide();
+                     $('#jujue').hide();
+                 } else {
+                     $('#tongyi').hide();
+                      $('#jujue').hide();
+                      $('#tijiao').hide();
+                 }
+
+
+                 $(".ldate").each(function (el) {
+                     laydate({
+                         elem: "#" + $(this).attr('id'), //瀵瑰簲id
+                         format: 'YYYY-MM-DD hh:mm', //鏃ユ湡鏍煎紡 // 鍒嗛殧绗﹀彲浠ヤ换鎰忓畾涔夛紝璇ヤ緥瀛愯〃绀哄彧鏄剧ず骞存湀
+                         min: '2021-01-01', //璁惧畾鏈�灏忔棩鏈熶负褰撳墠鏃ユ湡
+                         max: '2099-06-16', //鏈�澶ф棩鏈�
+                         type: 'datetime',
+                         festival: false, //鏄剧ず鑺傛棩
+                         istime: true, 聽 //鏄惁鏄剧ず鏃跺垎绉�
+                         istoday: true, //鏄惁鏄粖澶�
+                         choose: function (datas) { //閫夋嫨鏃ユ湡瀹屾瘯鐨勫洖璋�
+                             // console.log("234234234234324");
+                             // end.min = datas; //寮�濮嬫棩閫夊ソ鍚庯紝閲嶇疆缁撴潫鏃ョ殑鏈�灏忔棩鏈�
+                             // end.start = datas //灏嗙粨鏉熸棩鐨勫垵濮嬪�艰瀹氫负寮�濮嬫棩
+                             checktime();
+                         }
+                     });
+
+                 });
+            }
+
+       if ($.trim(img) !== "")
             {
                 $("#ImgMedicalRecord img").each(function (i) {
                     $(this).attr("src", img);
@@ -274,7 +365,13 @@
            $("#Lavetype").val("@Model.Lavetype");
            $("#SigninId").val("@ViewBag.SigninId");
 
+
+
         })
+
+
+
+
 
          function imgUploadCallback(files) {
                 var fileName = "";
@@ -300,7 +397,7 @@
             return fileName;
         };
 
-        function Save() {
+        function Save(tongyi) {
             if ($("#StratTime").val() == '') {
                 toastr.warning("寮�濮嬫棩鏈熶笉鑳戒负绌�");
                 return;
@@ -316,17 +413,17 @@
                 return;
             }
 
-            
+
 
             if ($("#Lavetype").val() == '') {
                 toastr.warning("閿�鍋囩被鍨嬩笉鑳戒负绌�");
                 return;
             }
 
-           
+
+            $("#Tongguojujue").val(tongyi);
 
 
-          
             //var data = { id: $("#Id").val(), StartTime:$("#StartTime").val(), Sheng: $("#Sheng").val(), job_level: $("#Job_level").val().toString(), ExistsAttachment: fileId != "" }
             $.ajax({
                 type: "POST",
@@ -336,7 +433,7 @@
                 async: false,
                 data: $('form').serializeArray(),
                 success: function (data) {
-                  
+
 
                     if (data.Result) {
                         //  parent._afterSave(true);
@@ -418,7 +515,7 @@
                                 aaa += ' <input type="hidden"  name="attachmentid" value="" />   ';
                                 aaa += ' <input type="hidden"  name="Filepath" value="' + data.DataList[i].Filepath + '" />  ';
                                 aaa += '  <input type="hidden"  name="Filefullname" value="' + data.DataList[i].Filefullname + '" />  ';
-                                
+
                                 aaa += "</div>";
                                 fileListDisplay.append(aaa);
                             }
diff --git a/zhengcaioa/zhengcaioa/Views/WfApplytype/Index.cshtml b/zhengcaioa/zhengcaioa/Views/WfApplytype/Index.cshtml
index 18b8a51..e9c3185 100644
--- a/zhengcaioa/zhengcaioa/Views/WfApplytype/Index.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/WfApplytype/Index.cshtml
@@ -84,7 +84,7 @@
                 <div class="col-sm-12">
                     <div class="ibox float-e-margins">
                         <div class="ibox-title">
-                            <h5>                            <i class="fa fa-list"></i>&nbsp; 鍙戣捣娴佺▼</h5>@*<div class="ibox-tools">
+                            <h5>                            <i class="fa fa-list"></i>&nbsp; 鍙戣捣鐢宠</h5>@*<div class="ibox-tools">
                                                                                             <a class="collapse-link" onclick="collapseBox(this);"><i class="fa fa-chevron-up" title="鎶樺彔/灞曞紑鏄庣粏"></i></a>&nbsp;&nbsp;
                                 </div>*@
                         </div>
diff --git a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml
new file mode 100644
index 0000000..92e23f4
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/Index.cshtml
@@ -0,0 +1,80 @@
+锘緻{
+    ViewBag.Title = "WorkFlowTask";
+    Layout = "~/Views/Shared/_Layout_Search.cshtml";
+}
+@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: 'Remark', labtype: 'txt', hidden: false, width: 100,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"OpenWindow('瀹℃壒','100%','100%', '" + rowObject.Deelurl + "')\"  >瀹℃壒</a> ";
+                }
+            },
+
+
+        ];
+        dataUrl = "/WorkFlowTask/GetList";
+        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">
+
+
+
+
+
+
+    </script>
+}
diff --git a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexMyApply.cshtml b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexMyApply.cshtml
new file mode 100644
index 0000000..524b0f2
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexMyApply.cshtml
@@ -0,0 +1,81 @@
+锘緻{
+    ViewBag.Title = "WorkFlowTask";
+    Layout = "~/Views/Shared/_Layout_Search.cshtml";
+}
+@section headerStyle{
+    <script type="text/javascript">
+        var Applytiye = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.Applytiye))';
+        var ShenpiStatus = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.ShenpiStatus))';
+
+        
+        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> ";
+                }
+            },
+
+
+        ];
+        dataUrl = "/WorkFlowTask/GetListMyApply";
+        searchCol = [
+
+
+
+
+
+            { label: '鐢宠鏃堕棿', name: 'Applytime', labtype: 'datearea', hidden: false },
+            { label: '鐢宠鍗曞彿', name: 'Applyno', labtype: 'txt', hidden: false },
+
+            { label: '鐢宠娴佺▼', name: 'Applytiye', labtype: 'combox', hidden: false, data: JSON.parse(Applytiye)/*, cwidth: '5%', cccwidth: '8%' */ },
+            { label: '鎵瑰鐘舵��', name: 'ShenpiStatus', labtype: 'combox', hidden: false, data: JSON.parse(ShenpiStatus)/*, 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">
+
+
+
+
+
+
+    </script>
+}
diff --git a/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml
new file mode 100644
index 0000000..cdb716e
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Views/WorkFlowTask/IndexYiBan.cshtml
@@ -0,0 +1,79 @@
+锘緻{
+    ViewBag.Title = "WorkFlowTask";
+    Layout = "~/Views/Shared/_Layout_Search.cshtml";
+}
+@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: 'Remark', labtype: 'txt', hidden: false, width: 100,
+                formatter: function (cellvalue, options, rowObject) {
+                    return "<a onclick=\"OpenWindow('鏌ョ湅','100%','100%', '" + rowObject.Deelurl + "')\"  >鏌ョ湅</a> ";
+                }
+            },
+
+
+        ];
+        dataUrl = "/WorkFlowTask/GetListYiBan";
+        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">
+
+
+
+
+
+
+    </script>
+}
diff --git "a/\350\241\250\344\277\256\346\224\271.sql" "b/\350\241\250\344\277\256\346\224\271.sql"
index e4de1a1..1d9825a 100644
--- "a/\350\241\250\344\277\256\346\224\271.sql"
+++ "b/\350\241\250\344\277\256\346\224\271.sql"
@@ -1,3 +1,42 @@
+
+
+USE [zhengcaioa]
+GO
+
+
+ALTER TABLE [dbo].[wf_run_process] ADD  [deelurl] [nvarchar](500) NULL;
+GO
+
+
+
+
+
+
+ALTER TABLE [dbo].[IntentionCustomer] ADD  [Yixiangtime] [datetime]   NULL;
+GO
+
+ALTER TABLE [dbo].[IntentionCustomer] ADD  [Yixiang]  [nvarchar](50)   NULL;
+GO
+
+ALTER TABLE [dbo].[IntentionCustomer] ADD  [dianxiaozhuanyuan] [nvarchar](50)   NULL;
+GO
+
+ALTER TABLE [dbo].[IntentionCustomer] ADD  [zuijinzhuizongtime] [datetime]   NULL;
+GO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 USE [zhengcaioa]
 GO
 

--
Gitblit v1.9.1