From 4c4f1863d9e75b3aedcb01631bc706b3b2a6a340 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 28 七月 2021 13:59:16 +0800
Subject: [PATCH] 今日开发 用车申请 销售费用

---
 zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs |  233 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 229 insertions(+), 4 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
index e668754..a8c1fb5 100644
--- a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
@@ -23,10 +23,12 @@
         private readonly IWfHistoryService _wfHistoryService;
         private readonly IWfNeeddeelService _wfNeeddeelService;
         private readonly IAdmGoodsManageService _admGoodsManageService;
+        private readonly ILiaotianService _liaotianService;
 
         public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService
             , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
-            , IAdmGoodsManageService admGoodsManageService)
+            , IAdmGoodsManageService admGoodsManageService
+            , ILiaotianService liaotianService)
         {
             _logger = logger;
             _hrDeptService = hrDeptService;
@@ -35,6 +37,7 @@
             _wfHistoryService = wfHistoryService;
             _wfNeeddeelService = wfNeeddeelService;
             _admGoodsManageService = admGoodsManageService;
+            _liaotianService = liaotianService;
         }
 
         public IActionResult Askcost(string id = "")
@@ -68,7 +71,7 @@
                 else
                 {
                     dangqianbuzhou = wfRunProcessDTO.Step;
-                    //鏌ヨ鍘嗗彶鎰忚
+                    //鏌ヨ瀹℃壒杩涘害
                     lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
                     if (wfRunProcessDTO.Step != "鎻愪氦")
                     {
@@ -177,7 +180,7 @@
                 else
                 {
                     dangqianbuzhou = wfRunProcessDTO.Step;
-                    //鏌ヨ鍘嗗彶鎰忚
+                    //鏌ヨ瀹℃壒杩涘害
                     lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
                     if (wfRunProcessDTO.Step != "鎻愪氦")
                     {
@@ -307,7 +310,7 @@
                 else
                 {
                     dangqianbuzhou = wfRunProcessDTO.Step;
-                    //鏌ヨ鍘嗗彶鎰忚
+                    //鏌ヨ瀹℃壒杩涘害
                     lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
                     if (wfRunProcessDTO.Step != "鎻愪氦")
                     {
@@ -383,5 +386,227 @@
             }
             return new JsonResult(resultEntity);
         }
+
+        public IActionResult AskCar(string id = "")
+        {
+            AdmAskCarDTO dto = new AdmAskCarDTO();
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+
+
+            //娴佺▼鐩稿叧
+            string shifoubiaoji = "A";
+            string sifoudangqian = "A";
+            string dangqianbuzhou = "鎻愪氦";
+            var lishiyijian = new List<WfHistoryDTO>();
+
+            if (string.IsNullOrEmpty(id))
+            {
+                dto.CreaterName = curentuser.UserName;
+                dto.Tittle = "鐢ㄨ溅鐢宠锛�" + curentuser.UserName + "锛�";
+            }
+            else if (dto != null)
+            {
+                dto = _askService.GetAskCar(id);
+                dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
+
+                var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "06").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;
+
+            ViewBag.CarLaiyuan = _liaotianService.GetSYScode("ADM_AskCar", "CarLaiyuan"); ;
+
+            ViewData.Model = dto;
+            return View();
+        }
+
+
+        /// <summary>
+        /// 淇濆瓨鐢ㄨ溅鐢宠
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveAskCar(AdmAskCarDTO data)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                if (data.Step == "鎻愪氦")
+                {
+
+                    data.ShenpiStatus = "D";
+                    data.RecStatus = "A";
+                    data.Creater = curentuser.Id;
+                    data.Createtime = DateTime.Now;
+                    data.Modifier = data.Creater;
+                    data.Modifytime = data.Createtime;
+
+                    resultEntity = _askService.SaveAskCar(data);
+                    if (!resultEntity.Result)
+                    {
+                        return new JsonResult(resultEntity);
+                    }
+                }
+                
+
+
+                //鍙戣捣娴佺▼鐩稿叧
+
+                resultEntity = _wfRunProcessService.WfAskCar(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
+                if (!resultEntity.Result)
+                {
+                    return new JsonResult(resultEntity);
+                }
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
+        }
+
+        public IActionResult AskMarketingCost(string id = "")
+        {
+            AdmAskMarketingCostDTO dto = new AdmAskMarketingCostDTO();
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+
+
+            //娴佺▼鐩稿叧
+            string shifoubiaoji = "A";
+            string sifoudangqian = "A";
+            string dangqianbuzhou = "鎻愪氦";
+            var lishiyijian = new List<WfHistoryDTO>();
+
+            if (string.IsNullOrEmpty(id))
+            {
+                dto.CreaterName = curentuser.UserName;
+                dto.Tittle = "閿�鍞垂鐢ㄧ敵璇凤紙" + curentuser.UserName + "锛�";
+            }
+            else if (dto != null)
+            {
+                dto = _askService.GetAskMarketingCost(id);
+                dto.FeiyongName = dto.Feiyong.Value.ToString("F2");
+
+                var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "07").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;
+
+          
+
+            ViewData.Model = dto;
+            return View();
+        }
+
+
+        /// <summary>
+        /// 淇濆瓨閿�鍞垂鐢ㄧ敵璇�
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveAskMarketingCost(AdmAskMarketingCostDTO data)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                if (data.Step == "鎻愪氦")
+                {
+
+                    data.ShenpiStatus = "D";
+                    data.RecStatus = "A";
+                    data.Creater = curentuser.Id;
+                    data.Createtime = DateTime.Now;
+                    data.Modifier = data.Creater;
+                    data.Modifytime = data.Createtime;
+
+                    resultEntity = _askService.SaveAskMarketingCost(data);
+                    if (!resultEntity.Result)
+                    {
+                        return new JsonResult(resultEntity);
+                    }
+                }
+
+
+
+                //鍙戣捣娴佺▼鐩稿叧
+
+                resultEntity = _wfRunProcessService.WfAskMarketingCost(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
+                if (!resultEntity.Result)
+                {
+                    return new JsonResult(resultEntity);
+                }
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
+        }
     }
 }

--
Gitblit v1.9.1