From 51bd4ac4f323fab99ff9ac20763ca15af0e53a57 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 22 一月 2026 21:51:15 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs |   46 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 41 insertions(+), 5 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 9d1b22e..5990115 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"
@@ -3,6 +3,7 @@
 using MailKit.Search;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using Org.BouncyCastle.Asn1.X509;
+using Org.BouncyCastle.Bcpg;
 using SixLabors.ImageSharp;
 using SqlSugar;
 using System;
@@ -54,7 +55,8 @@
         private readonly IRepository<Dt_MesReturnRecord> _mesReturnRecord;
         private readonly ILocationInfoService _locationInfoService;
         private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder;
-        public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder)
+        private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
+        public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository)
         {
             _unitOfWorkManage = unitOfWorkManage;
             InboundOrderDetailService = inboundOrderDetailService;
@@ -71,6 +73,7 @@
             _mesReturnRecord = mesReturnRecord;
             _locationInfoService = locationInfoService;
             _takeStockOrder = takeStockOrder;
+            _stockInfoDetailRepository = stockInfoDetailRepository;
         }
 
         public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto)
@@ -93,7 +96,37 @@
 
                 if (details.Count() <= 0)
                 {
-                    return content.Error("璇风‘璁ゆ槸鍚﹀凡缁忕粍鐩�");
+                    var inbounddetail =_inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode);
+                    if(inbounddetail == null)
+                    {
+                        return content.Error($"鏉$爜{palletDto.Barcode}涓嶅瓨鍦�");
+                    }
+                    var inbound = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == inbounddetail.OrderId).First();
+                    if (inbound == null)
+                    {
+                        return content.Error("鍗曟嵁涓嶈兘涓虹┖");
+                    }
+
+                    var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d,o)=>d.OrderId==o.Id).Where((d, o) => d.OrderId == inbound.Id
+                      && d.ReceiptQuantity != 0
+                      && d.OverInQuantity == 0).Select((d, o) => new
+                {
+                    orderNo=o.InboundOrderNo,
+                    d.Barcode,
+                    d.MaterielCode,
+                    d.BatchNo,
+                    d.ReceiptQuantity,
+                    d.Unit,
+                    d.SupplyCode,
+                    d.WarehouseCode
+                }).ToList();
+                   var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode);
+                    if (palletId == null)
+                    {
+                        return content.Error($"鏉$爜鏉$爜{palletDto.Barcode}涓嶅瓨鍦�");
+                    }
+                    var pallet =_stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId);
+                    return content.Error($"鏉$爜{palletDto.Barcode}宸茬粡缁勫埌{pallet.PalletCode}",detail);   
                 }
                 inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x=>x.Details).Where(x => x.Id == details.First().OrderId).First();
 
@@ -142,8 +175,11 @@
 
                 foreach (var item in details)
                 {
-                    var datevaliDate = _inboundOrderRepository.Db.Queryable<Dt_MaterialExpirationDate>().Where(x=>x.MaterialCode.Contains(item.MaterielCode.Substring(0,6))).First();
-
+                    var datevaliDate = _inboundOrderRepository.Db.Queryable<Dt_MaterialExpirationDate>().Where(x => x.MaterialCode.Contains(item.MaterielCode.Substring(0, 6))).First();
+                    if (datevaliDate == null)
+                    {
+                        return content.Error($"璇ョ墿鏂檣item.MaterielCode}鏈壘鍒癕ES鎺ㄩ�佺殑鏈夋晥鏈熸暟鎹紝璇峰厛娣诲姞璇ョ墿鏂欑殑鏈夋晥鏈熷啀缁勭洏鍏ュ簱");
+                    }
                     stockInfo.Details.Add(new Dt_StockInfoDetail
                     {
                         StockId = stockInfo == null ? 0 : stockInfo.Id,
@@ -787,7 +823,7 @@
                 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}鐘舵��");
+                    return content.Error($"璇ラ噸妫�鏉$爜鐨勬壒娆″湪閲嶆鍗曚腑鏈嬁鍒伴噸妫�缁撴灉锛岃妫�鏌ラ噸妫�鍗曚腑鐗╂枡{stockInfoDetail.MaterielCode}鍜寋stockInfoDetail.BatchNo}鐗╂枡鎵规鐘舵��");
                 }
 
                 int newStatus = reCheckOrder.Result == 1 ? StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(): StockStatusEmun.鎵嬪姩鍐荤粨.ObjToInt();

--
Gitblit v1.9.3