From 74d731cd8ac6bd995fbda485ee3371300af29a74 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 21 七月 2025 18:05:07 +0800
Subject: [PATCH] 优化时间段查询不出数据问题,PDA出库抽检出库任务卡控

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |  101 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 89 insertions(+), 12 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 ff3257c..125b4a3 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"
@@ -205,20 +205,52 @@
             Dt_StationManager station;
             if (stationOut.WorkstationO == "0")
             {
-                station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::1" && x.stationType == 2);
+                var hasTaskOne = BaseDal.QueryFirst(x => x.TargetAddress == "B001::1");
+                if (hasTaskOne == null)
+                {
+                    station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::1" && x.stationType == 2);
+                }
+                else
+                {
+                    if (stationOut.WorkstationT == "0")
+                    {
+                        var hasTaskTwo = BaseDal.QueryFirst(x => x.TargetAddress == "B001::2");
+                        if (hasTaskTwo == null)
+                        {
+                            station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::2" && x.stationType == 2);
+                        }
+                        else
+                        {
+                            return content.Error("鏈壘鍒板彲鐢ㄧ珯鍙帮紝璇锋煡鐪嬬珯鍙版槸鍚﹀瓨鍦ㄤ换鍔�");
+                        }
+                    }
+                    else
+                    {
+                        return content.Error("鍑哄簱绔欏彴鐘舵�佷笉鏄┖闂诧紝璇风‘璁ゅ啀涓嬪彂鍑哄簱浠诲姟");
+                    }
+                }
+                
             }
             else if (stationOut.WorkstationT == "0")
             {
-                station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::2" && x.stationType == 2);
+                var hasTaskOne = BaseDal.QueryFirst(x => x.TargetAddress == "B001::2");
+                if (hasTaskOne == null)
+                {
+                    station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::2" && x.stationType == 2);
+                }
+                else
+                {
+                    return content.Error("鏈壘鍒板彲鐢ㄧ珯鍙帮紝璇锋煡鐪嬬珯鍙版槸鍚﹀瓨鍦ㄤ换鍔�");
+                }
             }
             else
             {
                 return content.Error("鍑哄簱绔欏彴鐘舵�佷笉鏄┖闂诧紝璇风‘璁ゅ啀涓嬪彂鍑哄簱浠诲姟");
             }
-            if (station == null)
-            {
-                return content.Error("鏈壘鍒板嚭搴撶珯鍙颁俊鎭�");
-            }
+            //if (station == null)
+            //{
+            //    return content.Error("鏈壘鍒板嚭搴撶珯鍙颁俊鎭�");
+            //}
 
             Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == taskDTO.PalletCode);
             if (task != null)
@@ -272,22 +304,67 @@
                 return content.Error("鑾峰彇鍑哄簱绔欏彴淇℃伅澶辫触锛岃閲嶆柊鍑哄簱");
             }
             Dt_StationManager station;
+            //if (stationOut.WorkstationO == "0")
+            //{
+            //    station = _stationManagerRepository.QueryFirst(x => x.stationName == "B002::1" && x.stationType == 1);
+            //}
+            //else if (stationOut.WorkstationT == "0")
+            //{
+            //    station = _stationManagerRepository.QueryFirst(x => x.stationName == "B002::2" && x.stationType == 1);
+            //}
+            //else
+            //{
+            //    return content.Error("鍑哄簱绔欏彴鐘舵�佷笉鏄┖闂诧紝璇风‘璁ゅ啀涓嬪彂鍑哄簱浠诲姟");
+            //}
+            //if (station == null)
+            //{
+            //    return content.Error("鏈壘鍒板嚭搴撶珯鍙颁俊鎭�");
+            //}
             if (stationOut.WorkstationO == "0")
             {
-                station = _stationManagerRepository.QueryFirst(x => x.stationName == "B002::1" && x.stationType == 1);
+                var hasTaskOne = BaseDal.QueryFirst(x => x.TargetAddress == "B001::1");
+                if (hasTaskOne == null)
+                {
+                    station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::1" && x.stationType == 2);
+                }
+                else
+                {
+                    if (stationOut.WorkstationT == "0")
+                    {
+                        var hasTaskTwo = BaseDal.QueryFirst(x => x.TargetAddress == "B001::2");
+                        if (hasTaskTwo == null)
+                        {
+                            station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::2" && x.stationType == 2);
+                        }
+                        else
+                        {
+                            return content.Error("鏈壘鍒板彲鐢ㄧ珯鍙帮紝璇锋煡鐪嬬珯鍙版槸鍚﹀瓨鍦ㄤ换鍔�");
+                        }
+                    }
+                    else
+                    {
+                        return content.Error("鍑哄簱绔欏彴鐘舵�佷笉鏄┖闂诧紝璇风‘璁ゅ啀涓嬪彂鍑哄簱浠诲姟");
+                    }
+                }
+
             }
             else if (stationOut.WorkstationT == "0")
             {
-                station = _stationManagerRepository.QueryFirst(x => x.stationName == "B002::2" && x.stationType == 1);
+                var hasTaskOne = BaseDal.QueryFirst(x => x.TargetAddress == "B001::2");
+                if (hasTaskOne == null)
+                {
+                    station = _stationManagerRepository.QueryFirst(x => x.stationName == "B001::2" && x.stationType == 2);
+                }
+                else
+                {
+                    return content.Error("鏈壘鍒板彲鐢ㄧ珯鍙帮紝璇锋煡鐪嬬珯鍙版槸鍚﹀瓨鍦ㄤ换鍔�");
+                }
             }
             else
             {
                 return content.Error("鍑哄簱绔欏彴鐘舵�佷笉鏄┖闂诧紝璇风‘璁ゅ啀涓嬪彂鍑哄簱浠诲姟");
             }
-            if (station == null)
-            {
-                return content.Error("鏈壘鍒板嚭搴撶珯鍙颁俊鎭�");
-            }
+
             var stock = _stockInfoRepository.QueryFirst(x => x.LocationCode == taskDTO.SourceAddress);
             if (stock == null)
             {

--
Gitblit v1.9.3