From c866c43016f12a9db80095d9e5fd7bbc3dcaeb66 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 19 三月 2026 15:45:30 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs |   44 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 38 insertions(+), 6 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 eec793d..e34d7b7 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"
@@ -58,7 +58,8 @@
         private readonly ILocationInfoService _locationInfoService;
         private readonly 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)
+        private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
+        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, IRepository<Dt_AllocateOrder> allocateOrderRepository)
         {
             _unitOfWorkManage = unitOfWorkManage;
             InboundOrderDetailService = inboundOrderDetailService;
@@ -76,6 +77,7 @@
             _locationInfoService = locationInfoService;
             _takeStockOrder = takeStockOrder;
             _stockInfoDetailRepository = stockInfoDetailRepository;
+            _allocateOrderRepository = allocateOrderRepository;
         }
 
         public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto)
@@ -148,10 +150,22 @@
                     return content.Error($"褰撳墠鍘傚尯涓嶄竴鑷�");
                 }
 
-                if(inboundOrder.BusinessType != "11"&& inboundOrder.Details.FirstOrDefault().WarehouseCode != palletDto.WarehouseType)
+                if(inboundOrder.BusinessType != "11")
                 {
-                    return content.Error($"璇ユ潯鐮佹墍灞炰粨搴撲负{inboundOrder.Details.FirstOrDefault().WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
+                    var warehouseType = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().Where(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode).Select(x => x.WarehouseCode).First();
+
+                    if (string.IsNullOrEmpty(warehouseType))
+                    {
+                        return content.Error($"鏈煡璇㈠埌鏉$爜[{palletDto.Barcode}]瀵瑰簲鐨勪粨搴撲俊鎭紝涓嶅厑璁哥粍鐩�");
+                    }
+
+                    if (!warehouseType.Equals(palletDto.WarehouseType))
+                    {
+                        return content.Error($"璇ユ潯鐮佹墍灞炰粨搴撲负{warehouseType}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
+                    }
                 }
+
+                
 
                 Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync();
 
@@ -443,9 +457,27 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
+                Dt_InboundOrder inboundOrder = null;
+                var allocateOrder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.Id == id).First();
+                if (allocateOrder != null)
+                {
+                    inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == allocateOrder.OrderNo).First();
+                    if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱涓�.ObjToInt())
+                    {
+                        return content = WebResponseContent.Instance.OK($"璇ュ崟鎹睘浜庝笉鍒嗘壒鑷姩鍥炰紶锛屼笉鍙墜鍔ㄥ垎鎵瑰洖浼�");
+                    }
+                }else
+                {
+                    inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>()
                                     .Where(x => x.Id == id)
                                     .First();
+                    if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱涓�.ObjToInt())
+                    {
+                        return content = WebResponseContent.Instance.OK($"璇ュ崟鎹睘浜庝笉鍒嗘壒鑷姩鍥炰紶锛屼笉鍙墜鍔ㄥ垎鎵瑰洖浼�");
+                    }
+                }
+                
+                 
 
                 List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2);
                 foreach (var item in returnRecords)
@@ -558,7 +590,7 @@
                             inboundOrder.ReturnToMESStatus = 2;
                         }
                         _inboundOrderRepository.UpdateData(inboundOrder);
-                        return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+                        return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
 
                     var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
@@ -653,7 +685,7 @@
                             inboundOrder.ReturnToMESStatus = 2;
                         }
                         _inboundOrderRepository.UpdateData(inboundOrder);
-                        return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+                        return WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
                     var response = responseModel(inboundOrder, 3, feedmodel);
 

--
Gitblit v1.9.3