From 9de6c7c6d835ba5161d64114d154bfc7676244a1 Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期一, 06 四月 2026 12:44:43 +0800
Subject: [PATCH] 同步

---
 项目代码/WMS/WMSServer/WIDESEA_StoragIntegrationServices/WCS/Partial/RequestInboundRoadWayNo.cs |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/WCS/Partial/RequestInboundRoadWayNo.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/WCS/Partial/RequestInboundRoadWayNo.cs"
index 68967e2..d1f14f2 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/WCS/Partial/RequestInboundRoadWayNo.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StoragIntegrationServices/WCS/Partial/RequestInboundRoadWayNo.cs"
@@ -6,6 +6,7 @@
 using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Common;
 using WIDESEA_Core;
 using WIDESEA_Core.Enums;
 using WIDESEA_DTO;
@@ -35,6 +36,9 @@
                     return response.OK("鐢宠鍏ュ簱鎴愬姛", data: checkTask);
                 }
 
+                var carInfo = _carBodyInfoRepository.QueryFirst(x => x.RFID == json.PVI && x.PalletCode == json.PalletCode);
+                if (carInfo == null) throw new Exception("鏈煡杞﹁韩淇℃伅,鏃犳硶鍏ュ簱");
+
                 //灞忚斀MES
                 if (json.Position == "EL01RB")
                 {
@@ -47,9 +51,7 @@
                     TZPassZZ(json);
                 }
 
-                var carInfo = _carBodyInfoRepository.QueryFirst(x => x.RFID == json.PVI && x.PalletCode == json.PalletCode);
-
-                if (carInfo == null) throw new Exception("鏈煡杞﹁韩淇℃伅,鏃犳硶鍏ュ簱");
+           
                 //{
                 //    Dt_CarBodyInfo _CarBodyInfo = new Dt_CarBodyInfo  //娴嬭瘯
                 //    {
@@ -72,10 +74,18 @@
 
                 //var locations = _locationRepository.QueryData(x => (x.LocationType == carInfo.CarType || x.LocationType == 3) && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == (int)EnableEnum.Enable);
 
-                var maxGroup = _locationRepository.QueryData(x => (x.LocationType == carInfo.CarType || x.LocationType == 3) && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == (int)EnableEnum.Enable)
+                var maxGroup = _locationRepository.QueryData(x => x.LocationType == carInfo.CarType && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == (int)EnableEnum.Enable)
                                 .GroupBy(x => x.RoadwayNo)
                                 .OrderByDescending(g => g.Count()) // 鏍规嵁姣忎釜缁勭殑鍏冪礌鏁伴噺鎺掑簭
                                 .ToList(); // 鍙栧嚭鏁伴噺鏈�澶氱殑缁�
+
+                if (maxGroup.Count == 0)
+                {
+                    maxGroup = _locationRepository.QueryData(x => x.LocationType == (int)BodyType.Empty && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == (int)EnableEnum.Enable)
+                   .GroupBy(x => x.RoadwayNo)
+                   .OrderByDescending(g => g.Count()) // 鏍规嵁姣忎釜缁勭殑鍏冪礌鏁伴噺鎺掑簭
+                   .ToList(); // 鍙栧嚭鏁伴噺鏈�澶氱殑缁�
+                }
 
                 if (maxGroup.Count == 0) return response.Error(12, "鏃犲彲鐢ㄥ簱浣�");
 
@@ -92,7 +102,7 @@
 
                 string maxRoadwayNo = result.OrderByDescending(x => x.Value).FirstOrDefault().Key; // 鏁伴噺鏈�澶氱殑缁勭殑Key
 
-                var stationList = _stationManagerRepository.QueryData(x => x.RoadwayNo == maxRoadwayNo && x.stationArea == json.area && x.stationType == 1);
+                var stationList = _stationManagerRepository.QueryData(x => x.RoadwayNo == maxRoadwayNo && x.stationArea == json.area && x.stationType == 1 && x.stationStatus == "1");
 
                 Dt_StationManager station = null;
 

--
Gitblit v1.9.3