From 9e579eda4601ed7b492b9d19a24e8146f6ebdf8d Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 19 四月 2025 19:50:43 +0800
Subject: [PATCH] 优化空托出入库逻辑

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs"
index 736d0c0..8a21d6b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs"
@@ -48,8 +48,19 @@
                     InDate = a.InDate,
                     StockId = a.Id
                 }).ToList();
-                StockViewDTO1? stockViewDTO = list.OrderByDescending(x => x.InDate).FirstOrDefault();
+                StockViewDTO1? stockViewDTO = list.OrderBy(x => x.InDate).FirstOrDefault();
                 if (stockViewDTO == null) throw new Exception("鏈壘鍒板彲鍑哄簱绌烘墭");
+                #region 鍒ゆ柇鏄惁涓虹涓�鎺掕揣浣�
+                var strings = stockViewDTO.LocationCode.ToLower().Split('-');
+                var Row = Convert.ToInt32(strings[0]);
+                if (Row == 1)
+                {
+                    var locationcode = 2.ToString("000") + "-" + strings[1] + "-" + strings[2];
+                    var stockViewDTO1 = list.Where(x => x.LocationCode == locationcode).OrderBy(x => x.InDate).FirstOrDefault();
+                    if (stockViewDTO1 != null) stockViewDTO = stockViewDTO1;
+                }
+                #endregion
+                stockViewDTO = list.Where(x => x.LocationCode == stockViewDTO.LocationCode).OrderByDescending(x => x.InDate).FirstOrDefault();
                 Dt_LocationInfo locationInfo = _dbBase.Queryable<Dt_LocationInfo>().Where(x => x.LocationCode == stockViewDTO.LocationCode).First();
                 if (locationInfo == null) throw new Exception($"鏈壘鍒拌揣浣嶃�恵stockViewDTO.LocationCode}銆戜俊鎭�");
                 Dt_StockInfo stockInfo = _stockService.Repository.QueryFirst(a => a.Id == stockViewDTO.StockId);

--
Gitblit v1.9.3