From 97aa4f0b37b32ae0c9a062e2ec14aceba40785d6 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 15 三月 2022 15:26:08 +0800
Subject: [PATCH] 初始化投诉书

---
 zhengcaioa/zhengcaioa/Views/CooperOrder/EditTousushu.cshtml              |    4 +-
 zhengcaioa/IServices/ICooperOrderService.cs                              |    1 
 zhengcaioa/Services/CooperOrderService.cs                                |   47 +++++++++++++++++++++++
 zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs |   57 +++++++++++++++++++++++++---
 4 files changed, 100 insertions(+), 9 deletions(-)

diff --git a/zhengcaioa/IServices/ICooperOrderService.cs b/zhengcaioa/IServices/ICooperOrderService.cs
index 62931ab..8a24255 100644
--- a/zhengcaioa/IServices/ICooperOrderService.cs
+++ b/zhengcaioa/IServices/ICooperOrderService.cs
@@ -44,6 +44,7 @@
 
         List<TChallengeletterDTO> GetListChallengeletter(string OrderId);
         List<TChallengeletterDTO> GetListChallengeletterChosen();
+        List<TChallengeletterDTO> GetListChallengelettertousu(string customid,string XmCode);
 
         //璐ㄧ枒鍑戒簨椤瑰唴瀹瑰瓙琛�
         ResultEntity saveChallengeItem(TChallengeItemDTO dto);
diff --git a/zhengcaioa/Services/CooperOrderService.cs b/zhengcaioa/Services/CooperOrderService.cs
index 99e418d..1b05c4f 100644
--- a/zhengcaioa/Services/CooperOrderService.cs
+++ b/zhengcaioa/Services/CooperOrderService.cs
@@ -964,6 +964,53 @@
         }
 
 
+        public List<TChallengeletterDTO> GetListChallengelettertousu(string customid, string XmCode)
+        {
+
+            var entity = (from a in _context.CooperOrders.Where(x=>x.OrderType1== "浠f嫙璐ㄧ枒鍑�" && x.RecStatus == "A" && x.Khdw == customid)
+                          join b in _context.TChallengeletters.Where(x=>x.XmCode == XmCode) on a.Id equals b.OrderId 
+                          select b ).ToList();
+
+
+            //_context.TChallengeletters.Where(x =>/* x.Status == 1 && */x.OrderId == OrderId).ToList();
+
+
+
+            var result = _mapper.Map<List<TChallengeletterDTO>>(entity);
+
+
+            var listCode = (from a in _context.SysCodeDtls
+                            join b in _context.SysCodes
+                            on a.CodeId equals b.Id
+                            where a.RecStatus == "A"
+                                          && b.RecStatus == "A"
+                            select new CodeDataEntity()
+                            {
+                                CodeId = b.Id,
+                                CodeTable = b.CodeTable,
+                                CodeField = b.CodeField,
+                                CodeSn = a.CodeSn,
+                                Comments = a.Comments,
+                                Contents = a.Contents,
+                                RecStatus = a.RecStatus,
+                                Sort = a.Sort
+                            }
+                   ).Where(x => x.CodeTable == "t_challengeletter" && x.CodeField == "request_info").ToList();
+            foreach (var challengeletterDTO in result)
+            {
+                var codeDataEntity = listCode.Where(x => x.CodeSn == challengeletterDTO.RequestInfo).FirstOrDefault();
+                if (codeDataEntity != null)
+                {
+                    challengeletterDTO.RequestInfoName = codeDataEntity.Comments;
+                }
+
+            }
+
+
+            return result;
+        }
+
+
         public List<TChallengeletterDTO> GetListChallengeletterChosen()
         {
             var query = (from a in _context.TChallengeletters
diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
index 90534e2..6747a39 100644
--- a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
@@ -1612,13 +1612,7 @@
             actionEntity.PageIco = "fa fa-search";
             actionEntity.ActionName = "鏌ヨ";
             actionlist.Add(actionEntity);
-            ActionEntity actionEntity1 = new ActionEntity();
-            actionEntity1.OpenType = 0;
-            actionEntity1.ActionUrl = "";
-            actionEntity1.ActionFun = "Add";
-            actionEntity1.PageIco = "fa fa-plus";
-            actionEntity1.ActionName = "鏂板";
-            actionlist.Add(actionEntity1);
+           
 
             ViewData["ActionInfo"] = actionlist;
             ViewBag.status = _liaotianService.GetSYScode("t_challengeletter", "status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
@@ -2262,8 +2256,57 @@
                 complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>()/* { new TComplaintGongyingshangDTO() }*/;
 
             }
+            //鍒ゆ柇鏄惁鏈夎川鐤戝嚱
+            if (complaintletterDTO.Status != 2)
+            {
+                CooperOrderDTO cooperOrderDTO = _cooperOrderService.Get(complaintletterDTO.OrderId);
+                List<TChallengeletterDTO> challengeletterDTOs = _cooperOrderService.GetListChallengelettertousu(cooperOrderDTO.Khdw, complaintletterDTO.XmCode);
+
+                if(challengeletterDTOs!=null&& challengeletterDTOs.Count > 0)
+                {
+                    TChallengeletterDTO challengeletterDTO = challengeletterDTOs[0];
+                    complaintletterDTO.PurchaserName = challengeletterDTO.PurchaserName;
+                    complaintletterDTO.ChallengeDateName = challengeletterDTO.DocumentsDate.HasValue ? challengeletterDTO.DocumentsDate.Value.ToString("yyyy-MM-dd") : "";
+                    complaintletterDTO.RequestInfo = challengeletterDTO.RequestInfo;
+                    complaintletterDTO.Questioned = challengeletterDTO.PurchaserName;
+                    complaintletterDTO.complaintShouquandaibiaoDTOs = _cooperOrderService.GetListComplaintShouquandaibiao(challengeletterDTO.Id);
+                    if (complaintletterDTO.complaintShouquandaibiaoDTOs.Count == 0)
+                        complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
 
 
+                    List<TChallengeItemDTO> challengeItemDTOs = _cooperOrderService.GetListChallengeItem(challengeletterDTO.Id);
+                    if (challengeItemDTOs.Count > 0)
+                    {
+                        List<TComplaintItemDTO> complaintItemDTOs = new List<TComplaintItemDTO>();
+                        foreach(var challengeItemDTO in challengeItemDTOs)
+                        {
+                            TComplaintItemDTO complaintItemDTO = new TComplaintItemDTO();
+                            complaintItemDTO.Id = challengeItemDTO.Id;
+                            complaintItemDTO.ComplaintId = challengeItemDTO.ChallengeId;
+                            complaintItemDTO.Question = challengeItemDTO.Question;
+                            complaintItemDTO.Evidential = challengeItemDTO.Evidential;
+                            complaintItemDTO.Law = challengeItemDTO.Law;
+                            complaintItemDTO.Lawcoment = challengeItemDTO.Lawcoment;
+                            complaintItemDTO.Sort = challengeItemDTO.Sort;
+
+                            complaintItemDTOs.Add(complaintItemDTO);
+                        }
+
+                        complaintletterDTO.complaintItemDTOs = complaintItemDTOs;
+                        foreach (var complaintItemDTO in complaintletterDTO.complaintItemDTOs)
+                        {
+                            var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == complaintItemDTO.Question).ToList();
+                            complaintItemDTO.sysCodeDtls = sysCodeDtls2;
+                        }
+                    }
+                    else
+                    {
+                        complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
+                        complaintletterDTO.complaintItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
+                    }
+
+                }
+            }
 
 
             ViewBag.request_info = _liaotianService.GetSYScode("t_challengeletter", "request_info").OrderBy(x => x.CodeSn).ToList();//璐ㄧ枒璇锋眰
diff --git a/zhengcaioa/zhengcaioa/Views/CooperOrder/EditTousushu.cshtml b/zhengcaioa/zhengcaioa/Views/CooperOrder/EditTousushu.cshtml
index f4cbae4..5a33af5 100644
--- a/zhengcaioa/zhengcaioa/Views/CooperOrder/EditTousushu.cshtml
+++ b/zhengcaioa/zhengcaioa/Views/CooperOrder/EditTousushu.cshtml
@@ -165,7 +165,7 @@
 
                                     </div>
 
-                                    <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">璐ㄧ枒鍑�</label>
+                                    @*<label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">璐ㄧ枒鍑�</label>
                                     <div class="col-sm-2 col-md-2" grouptype="Vdata">
                                         <select id="TsrId" class="form-control" name="TsrId" data-placeholder="閫夋嫨 搴忓垪 ..." onchange="TsrIdchangge();">
                                             <option value="" hassubinfo="true">璇烽�夋嫨</option>
@@ -188,7 +188,7 @@
 
 
                                         </select>
-                                    </div>
+                                    </div>*@
 
 
 

--
Gitblit v1.9.1