From 6c9b3926334f9eb043c1938ba6d46e2b37deca22 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期三, 14 一月 2026 18:02:40 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
index b7b4f4a..9d1b22e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs"
@@ -779,16 +779,19 @@
                 {
                     return content.Error($"璇ユ墭鐩樼粍鐩樹粨搴撲负{stockInfo.Details.FirstOrDefault()?.WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
                 }
-                Dt_StockInfoDetail stockInfoDetail = _stockInfoRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.Barcode == palletDto.Barcode && x.Status == StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt()).First();
+                Dt_StockInfoDetail stockInfoDetail = _stockInfoRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.Barcode == palletDto.Barcode && x.Status == StockStatusEmun.閲嶆涓�.ObjToInt()).First();
                 if(stockInfoDetail == null)
                 {
                     return content.Error("鏈壘鍒板簱瀛樹腑閲嶆鍐荤粨鐨勬潯鐮�");
                 }
-                Dt_ReCheckOrder reCheckOrder = _stockInfoRepository.Db.Queryable<Dt_ReCheckOrder>().Where(x => x.MaterielCode == stockInfoDetail.MaterielCode && x.BatchNo == stockInfoDetail.BatchNo && x.Result == 0).First();
-                if(reCheckOrder != null)
+                Dt_ReCheckOrder reCheckOrder = _stockInfoRepository.Db.Queryable<Dt_ReCheckOrder>().Where(x => x.MaterielCode == stockInfoDetail.MaterielCode && x.BatchNo == stockInfoDetail.BatchNo && x.OrderNo == stockInfoDetail.OrderNo && (x.Result == 1 || x.Result == 2 )).First();
+                if(reCheckOrder == null)
                 {
                     return content.Error($"璇ラ噸妫�鏉$爜鐨勬壒娆″湪閲嶆鍗曚腑鏈嬁鍒伴噸妫�缁撴灉锛岃妫�娴嬮噸妫�鍗晎reCheckOrder.OrderNo}鐘舵��");
                 }
+
+                int newStatus = reCheckOrder.Result == 1 ? StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(): StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt();
+
                 stockInfo.Details.Add(new Dt_StockInfoDetail
                 {
                     StockId = stockInfo == null ? 0 : stockInfo.Id,
@@ -803,7 +806,7 @@
                     BarcodeQty = stockInfoDetail.BarcodeQty,
                     BarcodeUnit = stockInfoDetail.BarcodeUnit,
                     FactoryArea = stockInfoDetail.FactoryArea,
-                    Status = stockInfoDetail.Status,
+                    Status = newStatus,
                     OrderNo = stockInfoDetail.OrderNo,
                     BusinessType = "30",
                     ValidDate = stockInfoDetail.ValidDate
@@ -819,6 +822,13 @@
                 _stockService.StockInfoService.AddMaterielGroup(stockInfo);
                 _unitOfWorkManage.CommitTran();
 
+                Dt_StockInfo oldStockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.Id == stockInfoDetail.StockId).Includes(x=>x.Details).First();
+                if (oldStockInfo.Details.Count <= 0)
+                {
+                    oldStockInfo.PalletType = (int)PalletTypeEnum.Empty;
+                }
+                _stockInfoRepository.UpdateData(oldStockInfo);
+
                 Dt_StockInfo? NewstockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
 
                 return WebResponseContent.Instance.OK(data: NewstockInfo.Details.OrderByDescending(x => x.Id));

--
Gitblit v1.9.3