From 2de09bec5cc05bf875543fa8956167ca7db73021 Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期三, 25 六月 2025 11:36:44 +0800
Subject: [PATCH] 合并

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs |   80 ++++++++++++++++++++++++++++++++++------
 1 files changed, 68 insertions(+), 12 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
index 2191322..f428eab 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs"
@@ -1,6 +1,7 @@
 锘縰sing log4net.Core;
 using Masuit.Tools;
 using System.Collections.Generic;
+using System.Net;
 using WIDESEA_Common;
 using WIDESEA_Core.Const;
 using WIDESEA_DTO.WMS;
@@ -39,10 +40,23 @@
             var inWheelsInfo = _InWheels_MesRepository.QueryFirst(x => x.Wheels_CurrentStatue == "0");
 
             //鏌ヨ鍒涘缓鐨勫埗鍔ㄧ洏淇℃伅
+            var inZDPInfo = _InZdp_MesRepository.QueryFirst(x => x.Zdp_CurrentStatue == "0");
+
+            //鏌ヨ鍒涘缓鐨勫埗鍔ㄧ洏淇℃伅
             //var inBrakeInfo = _InWheels_MesRepository.QueryFirst(x => x.Wheels_CurrentStatue == "0");
             //if (inBrakeInfo == null) throw new Exception("褰撳墠鏃犺溅杞垨鍒跺姩鐩樺叆搴撲俊鎭�");
 
-            if (inWheelsInfo == null /*&& inBrakeInfo == null*/) throw new Exception("褰撳墠鏃犺溅杞垨鍒跺姩鐩樺叆搴撲俊鎭�");
+            //褰撹溅杞俊鎭笌鍒跺姩鐩樹俊鎭悓鏃跺嚭鐜伴渶瑕佸叆搴撶殑锛屽垯涓嶅彲鍏ュ簱
+            if(inWheelsInfo != null && inZDPInfo != null) throw new Exception("褰撳墠鍑虹幇鍒跺姩鐩樹笌杞﹁疆鍚屾椂鍏ュ簱鐢宠锛岀敵璇烽敊璇紝璇风‘淇濆彧鏈変竴涓墽琛屽叆搴�");
+
+            if (inWheelsInfo == null && inZDPInfo == null) throw new Exception("褰撳墠鏃犺溅杞垨鍒跺姩鐩樺叆搴撲俊鎭�");
+
+            //榛樿涓鸿溅杞叆搴擄紝浣嗘槸褰撹溅杞俊鎭负绌哄垯涓哄埗鍔ㄧ洏鍏ュ簱
+            int rktype = 1;
+            if(inWheelsInfo == null)
+            {
+                 rktype = 2;
+            }
 
             var newtask = new Dt_Task
             {
@@ -54,16 +68,16 @@
                 MaterialNo = "",
                 NextAddress = input.Roadways,
                 OrderNo = null,
-                PalletCode = inWheelsInfo.Wheels_Num,
+                PalletCode = rktype==1?inWheelsInfo.Wheels_Num: inZDPInfo.Zdp_code,
                 SourceAddress = input.Position,
                 TaskState = (int)TaskInStatusEnum.InNew,
-                TaskType = (int)TaskInboundTypeEnum.InWheels,  //inWheelsInfo == null ? (int)TaskInboundTypeEnum.InBrake :
+                TaskType = rktype == 1 ? (int)TaskInboundTypeEnum.InWheels: (int)TaskInboundTypeEnum.InBrake,  //inWheelsInfo == null ? (int)TaskInboundTypeEnum.InBrake :
                 TaskNum = await BaseDal.GetTaskNo(),
-                CarType = inWheelsInfo.Wheels_CarType,
+                CarType = rktype == 1 ? inWheelsInfo.Wheels_CarType:inZDPInfo.Zdp_chexing,
                 IsCheck = true,
-                wheels_mttype = inWheelsInfo.Wheels_mttype,
-                wheels_gkcc = inWheelsInfo.Wheels_gkcc,
-                WheelsNewOrOld = inWheelsInfo.Wheels_NewOrOld,
+                wheels_mttype = rktype == 1 ? inWheelsInfo.Wheels_mttype:"",
+                wheels_gkcc = rktype == 1 ? inWheelsInfo.Wheels_gkcc: inZDPInfo.Zdp_GKJZ,
+                WheelsNewOrOld = rktype == 1 ? inWheelsInfo.Wheels_NewOrOld : inZDPInfo.Zdp_neworold,
                 Creater = "Systeam"
             };
 
@@ -93,8 +107,17 @@
                     WheelsLX = newtask.WheelsLX,
                 };
 
-                inWheelsInfo.Wheels_CurrentStatue = "1";
-                _InWheels_MesRepository.UpdateData(inWheelsInfo);
+                if (rktype == 2)
+                {
+                    inZDPInfo.Zdp_CurrentStatue = "1";
+                    _InZdp_MesRepository.UpdateData(inZDPInfo);
+                }
+                else
+                {
+                    inWheelsInfo.Wheels_CurrentStatue = "1";
+                    _InWheels_MesRepository.UpdateData(inWheelsInfo);
+                }
+                
 
                 content.OK(data: taskDTO);
             }
@@ -236,19 +259,52 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
-            var cacheinfo = await _CacheInfoRepository.QueryFirstAsync(x => x.czh == input.PalletCode);
+            /*var cacheinfo = await BaseDal.QueryFirstAsync(x => x.task_CZInfo == input.PalletCode);
 
             if (cacheinfo == null) throw new Exception($"鏈壘鍒皗input.PalletCode}杞﹁酱缂撳瓨浣嶄俊鎭�");
 
-            return content.OK(data: cacheinfo.targetAddress);
+            if(cacheinfo.Towhereabouts =="" && cacheinfo.Towhereabouts == null) throw new Exception($"{input.PalletCode}杩愯緭鐩爣鍦板潃涓虹┖");
+            return content.OK(data: cacheinfo.Towhereabouts);*/
+
+            var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            if (task == null) throw new Exception($"鏈壘鍒皗input.PalletCode}鎵樼洏淇℃伅");
+            if (task.Towhereabouts == "" && task.Towhereabouts == null) throw new Exception($"{input.PalletCode}杩愯緭鐩爣鍦板潃涓虹┖");
+            return content.OK(data: task.Towhereabouts);
+
+
         }
         catch (Exception err)
         {
             // 濡傛灉鍙戠敓寮傚父锛屽垯璋冪敤content.Error鏂规硶锛岃褰曢敊璇俊鎭紝骞惰緭鍑洪敊璇俊鎭�
             content.Error(err.Message);
-            Console.WriteLine($"杞﹁疆娴佸悜鍒嗛厤澶辫触:{err.Message}");
+            Console.WriteLine($"杞﹁疆娴佸悜鍒嗛厤澶辫触:{err.Message}锛屾墭鐩樻潯鐮侊細{input.PalletCode}");
             return content;
         }
     }
+
+    public WebResponseContent UpWheelsFlow(SaveModel saveModel)
+    {
+        WebResponseContent webResponse = new WebResponseContent();
+        try
+        {
+            string CZTM = saveModel.MainData["CZTM"].ToString();
+            string TargetAddress = saveModel.MainData["TargetAddress"].ToString();
+            List<Dt_Task> taskt = BaseDal.QueryData(x => x.task_CZInfo == CZTM).ToList();
+            if (taskt.Count() == 0)
+                return webResponse.Error($"鏈壘鍒板搴旇溅杞达細{CZTM}鐨勮溅杞嚭搴撲俊鎭�");
+            foreach (var item in taskt)
+            {
+                item.Towhereabouts = TargetAddress;
+            }
+            BaseDal.UpdateData(taskt);
+            return webResponse.OK();
+        }
+        catch (Exception ex)
+        {
+            // 濡傛灉鍙戠敓寮傚父锛屽垯璋冪敤content.Error鏂规硶锛岃褰曢敊璇俊鎭紝骞惰緭鍑洪敊璇俊鎭�
+            webResponse.Error(ex.Message);
+            return webResponse;
+        }
+    }
     #endregion
 }
\ No newline at end of file

--
Gitblit v1.9.3