From 679893ee68e2f7d422431bb22b665e9217f23410 Mon Sep 17 00:00:00 2001
From: Admin <Admin@ADMIN>
Date: 星期四, 16 四月 2026 16:41:11 +0800
Subject: [PATCH] 深库位与浅库位出库时,进行浅货位移库不可直接出库

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |  108 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 73 insertions(+), 35 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
index 18299f0..54bf4fb 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs"
@@ -929,7 +929,7 @@
                 return content.Error("鏈壘鍒颁换鍔′俊鎭�!");
             }
 
-            if (task.TaskState != (int)TaskInStatusEnum.InNew && task.TaskState != (int)TaskOutStatusEnum.OutNew && task.TaskState != (int)TaskStatus.Created)
+            if (task.TaskState != (int)TaskInStatusEnum.InNew && task.TaskState != (int)TaskOutStatusEnum.OutNew && task.TaskState != (int)TaskStatus.Created && task.TaskState != (int)TaskInStatusEnum.InAbnormalCompletion && task.TaskState != (int)TaskOutStatusEnum.OutAbnormalCompletion)
             {
                 return content.Error("浠诲姟涓嶅浜庢柊寤虹姸鎬�,绂佹鍒犻櫎!");
             }
@@ -943,49 +943,87 @@
             //鍒ゆ柇浠诲姟绫诲瀷
             // 鏍规嵁浠诲姟绫诲瀷璋冪敤鐩稿簲鐨勫畬鎴愪换鍔℃柟娉�
 
+            //璋冨彇鍒犻櫎wcs浠诲姟
+            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
+            var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.DelteWCSTask)?.ConfigValue;
+            if (ReceiveByWMSTask == null || ipAddress == null)
+            {
+                throw new Exception("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
+
+            var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(task.TaskNum));
+
+            if (respon == null) return content.Error("WCS澶勭悊澶辫触");
+
+            WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
+            if (!respone.Status) return content.Error($"鍒犻櫎wcs浠诲姟澶辫触锛屽師鍥�=銆媨content.Message}");
+
             // 楠岃瘉搴撳瓨鏄惁瀛樺湪
-            var stock = _WheelsStockRepository.QueryFirstNavAsync(x => x.Wheels_Num.Contains(task.PalletCode) && x.Wheels_Location == task.SourceAddress);
-            var ZdpStock = _ZdpStockRepository.QueryFirstNavAsync(x => x.Zdp_code == task.PalletCode && x.Zdp_Location == task.SourceAddress);
-            bool res = false;
-            switch (task.TaskType)
+            if (task.TaskState== (int)TaskInStatusEnum.InAbnormalCompletion || task.TaskState == (int)TaskOutStatusEnum.OutAbnormalCompletion)
             {
-                case (int)TaskInboundTypeEnum.Inbound:
-                case (int)TaskInboundTypeEnum.InWheels:
-                case (int)TaskInboundTypeEnum.InBrake:
-                    LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟", "");
-                        res = SellectLocationInfo(task,1);
-                    break;
+                var taskHtyNG2 = CreateHistoricalTask(task, true);
 
-                case (int)TaskOutboundTypeEnum.Outbound:
-                case (int)TaskOutboundTypeEnum.OutWheels:
-                    LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
-                        res = SellectLocationInfo(task,2);
-                    break;
+                //if (task.TaskState == (int)TaskInStatusEnum.InNew || task.TaskState == (int)TaskOutStatusEnum.OutNew)
+                //{
+                //    //if(task.TaskType ==  )
+                //}
 
-                case (int)TaskOutboundTypeEnum.OutBrake:
-                    LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍒跺姩鐩樺嚭搴撲换鍔�", "");
-                        res = SellectLocationInfo(task,3);
-                    break;
+                // 娣诲姞鍘嗗彶浠诲姟
+                var isTaskHtyAdd2 = _task_HtyRepository.AddData(taskHtyNG2) > 0;
 
-                case (int)TaskRelocationTypeEnum.Relocation:
-                    if (stock != null)
-                    {
-                        res = SellectLocationInfo(task,4);
-                    }
-                    else 
-                    {
-                        res = SellectLocationInfo(task,5);
-                    }
-                    break;
+                // 鍒犻櫎浠诲姟鏁版嵁
+                var isTaskDelete2 = BaseDal.Delete(task.TaskId);
 
-                default:
-                    return content.Error("浠诲姟绫诲瀷涓嶅瓨鍦�");
+                return content.OK("鍒犻櫎鎴愬姛!");
             }
-
-            if (!res)
+            else
             {
-                return content.Error("鍦ㄦ墽琛屼换鍔″垎绫荤殑鏃跺�欏嚭鐜伴敊璇紒");
+                var stock = _WheelsStockRepository.QueryFirstNavAsync(x => x.Wheels_Num.Contains(task.PalletCode) && x.Wheels_Location == task.SourceAddress);
+                var ZdpStock = _ZdpStockRepository.QueryFirstNavAsync(x => x.Zdp_code == task.PalletCode && x.Zdp_Location == task.SourceAddress);
+                bool res = false;
+                switch (task.TaskType)
+                {
+                    case (int)TaskInboundTypeEnum.Inbound:
+                    case (int)TaskInboundTypeEnum.InWheels:
+                    case (int)TaskInboundTypeEnum.InBrake:
+                        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟", "");
+                        res = SellectLocationInfo(task, 1);
+                        break;
+
+                    case (int)TaskOutboundTypeEnum.Outbound:
+                    case (int)TaskOutboundTypeEnum.OutWheels:
+                        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
+                        res = SellectLocationInfo(task, 2);
+                        break;
+
+                    case (int)TaskOutboundTypeEnum.OutBrake:
+                        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍒跺姩鐩樺嚭搴撲换鍔�", "");
+                        res = SellectLocationInfo(task, 3);
+                        break;
+
+                    case (int)TaskRelocationTypeEnum.Relocation:
+                        if (stock != null)
+                        {
+                            res = SellectLocationInfo(task, 4);
+                        }
+                        else
+                        {
+                            res = SellectLocationInfo(task, 5);
+                        }
+                        break;
+
+                    default:
+                        return content.Error("浠诲姟绫诲瀷涓嶅瓨鍦�");
+                }
+
+                if (!res)
+                {
+                    return content.Error("鍦ㄦ墽琛屼换鍔″垎绫荤殑鏃跺�欏嚭鐜伴敊璇紒");
+                }
             }
+            
 
             var taskHtyNG = CreateHistoricalTask(task, true);
 

--
Gitblit v1.9.3