From 7d3d385f0bdcf40b0c42d14ab526df318e04a433 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期三, 10 十二月 2025 13:15:29 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_CheckService/ReCheckOrderService.cs             |   14 ++-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs                            |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs       |    9 +-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs             |    3 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Check/Dt_ReCheckOrder.cs           |    5 +
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundBatchPickingService.cs  |   16 ++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_CheckService/WIDESEA_CheckService.csproj        |    1 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs           |   43 +++++++---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs         |   31 +++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs              |   50 +++++++-----
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs                  |   58 ++++++++++----
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/WIDESEA_AllocateService.csproj  |    1 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateOrderDetail.cs |    1 
 13 files changed, 160 insertions(+), 74 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_AllocateService/AllocateService.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_AllocateService/AllocateService.cs"
index c44b258..89a2938 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_AllocateService/AllocateService.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_AllocateService/AllocateService.cs"
@@ -1,15 +1,5 @@
-锘縰sing Autofac.Core;
-using MailKit.Search;
-using Microsoft.Extensions.Logging;
+锘縰sing Microsoft.Extensions.Logging;
 using SqlSugar;
-using SqlSugar.Extensions;
-using System;
-using System.Collections.Generic;
-using System.Dynamic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
 using WIDESEA_Common.AllocateEnum;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core;
@@ -17,10 +7,10 @@
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Core.CodeConfigEnum;
 using WIDESEA_Core.DB;
-using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
 using WIDESEA_Core.Seed;
 using WIDESEA_IAllocateService;
+using WIDESEA_IBasicService;
 using WIDESEA_IInboundService;
 using WIDESEA_IOutboundService;
 using WIDESEA_Model.Models;
@@ -36,7 +26,7 @@
         public readonly IOutboundService _outboundService;
         public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
         public readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository;
-
+        private readonly IMaterielInfoService _materielInfoService;
         public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
 
         private readonly ILogger<AllocateService> _logger;
@@ -47,7 +37,8 @@
             IRepository<Dt_AllocateOrder> allocateOrderRepository,
             IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository,
             IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository,
-            ILogger<AllocateService> logger) : base(BaseDal)
+            ILogger<AllocateService> logger,
+            IMaterielInfoService materielInfoService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _inboundService = inboundService;
@@ -56,6 +47,7 @@
             _allocateOrderDetailRepository = allocateOrderDetailRepository;
             _logger = logger;
             _inboundOrderDetailRepository = inboundOrderDetailRepository;
+            _materielInfoService = materielInfoService;
         }
 
         public IRepository<Dt_AllocateOrder> Repository => BaseDal;
@@ -86,9 +78,18 @@
             {
                 if (BaseDal.QueryFirst(x => x.UpperOrderNo == allocateOrder.UpperOrderNo) != null)
                 {
-                    return WebResponseContent.Instance.Error($"璋冩嫧鍗曞彿閲嶅");
+                    return WebResponseContent.Instance.Error($"{allocateOrder.UpperOrderNo}璋冩嫧鍗曞彿閲嶅");
                 }
                 allocateOrder.OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.AllocateOrderCodeRule));
+                var materielCodes = allocateOrder.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+                foreach (var item in allocateOrder.Details)
+                {
+                    if (materielInfos.Any())
+                    {
+                        item.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                    }
+                }
                 Db.InsertNav(allocateOrder).Include(x => x.Details).ExecuteCommand();
                 await AddInOutData(allocateOrder);
                 return WebResponseContent.Instance.OK();
@@ -148,13 +149,13 @@
                 List<Dt_AllocateOrderDetail> allocateOrderDetails = new List<Dt_AllocateOrderDetail>();
                 List<Dt_AllocateOrderDetail> updateAllocateOrderDetails = new List<Dt_AllocateOrderDetail>();
                 List<int> detailIds = new List<int>();
+
+                var materielCodes = allocateOrder.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+                
                 foreach (var item in model.Details)
                 {
-                    if (string.IsNullOrEmpty(item.Barcode))
-                    {
-
-                    }
-                    else
+                    if (!string.IsNullOrEmpty(item.Barcode))
                     {
                         Dt_AllocateOrderDetail? allocateOrderDetail = allocateOrder.Details.FirstOrDefault(x => x.Barcode == item.Barcode);
                         if (allocateOrderDetail == null)
@@ -172,6 +173,10 @@
                                 BarcodeQty = (decimal)item.BarcodeQty,
                                 OrderQuantity = item.OrderQuantity
                             };
+                            if (materielInfos.Any())
+                            {
+                                allocateOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                            }
                             allocateOrderDetails.Add(allocateOrderDetail);
                         }
                         else
@@ -185,7 +190,10 @@
                             allocateOrderDetail.BarcodeUnit = item.BarcodeUnit;
                             allocateOrderDetail.BarcodeQty = item.BarcodeQty;
                             allocateOrderDetail.OrderQuantity = item.OrderQuantity;
-
+                            if (materielInfos.Any())
+                            {
+                                allocateOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                            }
 
                             updateAllocateOrderDetails.Add(allocateOrderDetail);
                             detailIds.Add(allocateOrderDetail.Id);
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_AllocateService/WIDESEA_AllocateService.csproj" "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_AllocateService/WIDESEA_AllocateService.csproj"
index 1493640..bd12492 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_AllocateService/WIDESEA_AllocateService.csproj"
+++ "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_AllocateService/WIDESEA_AllocateService.csproj"
@@ -9,6 +9,7 @@
   <ItemGroup>
     <ProjectReference Include="..\WIDESEA_Core\WIDESEA_Core.csproj" />
     <ProjectReference Include="..\WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj" />
+    <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" />
     <ProjectReference Include="..\WIDESEA_IInboundService\WIDESEA_IInboundService.csproj" />
     <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
     <ProjectReference Include="..\WIDESEA_Model\WIDESEA_Model.csproj" />
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_BasicService/LocationInfoService.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_BasicService/LocationInfoService.cs"
index e0263ed..0a34266 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_BasicService/LocationInfoService.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_BasicService/LocationInfoService.cs"
@@ -116,7 +116,7 @@
 
         private readonly static object _locker = new object();
         static List<LocationCache> locationCaches = new List<LocationCache>();
-        private int locationCacheTime = 10;
+        private int locationCacheTime = 20;
         /// <summary>
         /// 
         /// </summary>
@@ -164,7 +164,6 @@
                 if (first != null)
                 {
                     locationCaches.Add(new LocationCache { LocationCode = first?.LocationCode, DateTime = DateTime.Now });
-
 
                     using (var sugarClient = new SqlSugarClient(new ConnectionConfig
                     {
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_CheckService/ReCheckOrderService.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_CheckService/ReCheckOrderService.cs"
index 3822dee..538c006 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_CheckService/ReCheckOrderService.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_CheckService/ReCheckOrderService.cs"
@@ -14,6 +14,7 @@
 using WIDESEA_Core.CodeConfigEnum;
 using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
+using WIDESEA_IBasicService;
 using WIDESEA_ICheckService;
 using WIDESEA_IOutboundService;
 using WIDESEA_Model.Models;
@@ -27,15 +28,16 @@
         private readonly IUnitOfWorkManage _unitOfWorkManage;
         private readonly WebSocketServer _webSocketServer;
         private readonly ILogger<ReCheckOrderService> _logger;
-
+        private readonly IMaterielInfoService _materielInfoService;
         public readonly IOutboundService _outboundService;
         public IRepository<Dt_ReCheckOrder> Repository => BaseDal;
-        public ReCheckOrderService(IRepository<Dt_ReCheckOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage, WebSocketServer webSocketServer, ILogger<ReCheckOrderService> logger, IOutboundService outboundService) : base(BaseDal)
+        public ReCheckOrderService(IRepository<Dt_ReCheckOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage, WebSocketServer webSocketServer, ILogger<ReCheckOrderService> logger, IOutboundService outboundService, IMaterielInfoService materielInfoService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _webSocketServer = webSocketServer;
             _logger = logger;
             _outboundService = outboundService;
+            _materielInfoService = materielInfoService;
         }
 
         public async Task<WebResponseContent> ReceiveReCheckOrder(Dt_ReCheckOrder models, int operateType)
@@ -65,11 +67,14 @@
 
                 if (BaseDal.QueryFirst(x => x.OrderNo == model.OrderNo) != null)
                 {
-                    return WebResponseContent.Instance.Error($"鍗曞彿閲嶅");
+                    return WebResponseContent.Instance.Error($"{model.OrderNo}鍗曞彿閲嶅");
                 }
+  
+                var materielInfo = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().First(x => model.MaterielCode.Equals(x.MaterielCode));
 
                 model.Creater = "MES";
                 model.CreateDate = DateTime.Now;
+                model.MaterielName = materielInfo?.MaterielName ?? "";
                 BaseDal.AddData(model);
                 var outboundOrders = ConvertToOutboundOrders(model);
              
@@ -109,7 +114,8 @@
                 recheckOrder.FactoryArea = model.FactoryArea;
                 recheckOrder.Modifier = "MES";
                 recheckOrder.ModifyDate = DateTime.Now;
-
+                var materielInfo = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().First(x => model.MaterielCode.Equals(x.MaterielCode));
+                recheckOrder.MaterielName= materielInfo?.MaterielName??"";
                 BaseDal.UpdateData(recheckOrder);
 
                 if (isupdate)
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_CheckService/WIDESEA_CheckService.csproj" "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_CheckService/WIDESEA_CheckService.csproj"
index 7623d66..e5ef170 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_CheckService/WIDESEA_CheckService.csproj"
+++ "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_CheckService/WIDESEA_CheckService.csproj"
@@ -7,6 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" />
     <ProjectReference Include="..\WIDESEA_ICheckService\WIDESEA_ICheckService.csproj" />
     <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
   </ItemGroup>
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/InboundOrderService.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/InboundOrderService.cs"
index ccbb4de..cb1c301 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/InboundOrderService.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/InboundOrderService.cs"
@@ -34,6 +34,7 @@
 
         private IStockService _stockService;
         private readonly IMaterialUnitService _materialUnitService;
+        private readonly IMaterielInfoService _materielInfoService;
         private readonly IInboundOrderDetailService _inboundOrderDetailService;
         private readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
         private readonly IRepository<Dt_StockInfoDetail> _stockDetailRepository;
@@ -43,7 +44,7 @@
         private readonly IRepository<Dt_StockInfo> _stockRepository;
         public IRepository<Dt_InboundOrder> Repository => BaseDal;
 
-        public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository) : base(BaseDal)
+        public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -57,6 +58,7 @@
             _warehouseAreaRepository = warehouseAreaRepository;
             _stockRepository = stockRepository;
             _locationTypeRepository = locationTypeRepository;
+            _materielInfoService = materielInfoService;
         }
 
         public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType)
@@ -86,17 +88,24 @@
                 {
                     if (BaseDal.QueryFirst(x => x.UpperOrderNo == model.UpperOrderNo) != null)
                     {
-                        return WebResponseContent.Instance.Error($"鍏ュ簱鍗曞彿閲嶅");
+                        return WebResponseContent.Instance.Error($"{model.UpperOrderNo}鍏ュ簱鍗曞彿閲嶅");
                     }
                 }
 
                 foreach (var model in models)
                 {
+                    var materielCodes = model.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                    var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+
                     foreach (var item in model.Details)
                     {
                         var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync(item.MaterielCode, item.BarcodeQty);
                         item.Unit = purchaseToStockResult.Unit;
                         item.OrderQuantity = purchaseToStockResult.Quantity;
+                        if (materielInfos.Any())
+                        {
+                            item.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                        }
                     }
                     if (model.OrderType != InOrderTypeEnum.AllocatInbound.ObjToInt())
                     {
@@ -134,13 +143,12 @@
                     List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
                     List<Dt_InboundOrderDetail> updateInboundOrderDetails = new List<Dt_InboundOrderDetail>();
                     List<int> detailIds = new List<int>();
+                    var materielCodes = model.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                    var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+
                     foreach (var item in model.Details)
                     {
-                        if (string.IsNullOrEmpty(item.Barcode))
-                        {
-
-                        }
-                        else
+                        if (!string.IsNullOrEmpty(item.Barcode))
                         {
                             Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.Barcode == item.Barcode);
                             if (inboundOrderDetail == null)
@@ -163,11 +171,18 @@
                                 var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync(item.MaterielCode, item.BarcodeQty);
                                 inboundOrderDetail.Unit = purchaseToStockResult.Unit;
                                 inboundOrderDetail.OrderQuantity = purchaseToStockResult.Quantity;
-
+                                if (materielInfos.Any())
+                                {
+                                    inboundOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                                }
                                 inboundOrderDetails.Add(inboundOrderDetail);
                             }
                             else
                             {
+                                if (materielInfos.Any())
+                                {
+                                    inboundOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                                }
                                 inboundOrderDetail.lineNo = item.lineNo;
                                 inboundOrderDetail.MaterielCode = item.MaterielCode;
                                 inboundOrderDetail.SupplyCode = item.SupplyCode;
@@ -649,16 +664,16 @@
 
         public WebResponseContent UndoPalletGroup(string palletCode, string barcode = "")
         {
-            
+
             if (string.IsNullOrWhiteSpace(palletCode))
             {
                 return WebResponseContent.Instance.Error("鎵樼洏鍙蜂笉鑳戒负绌�");
             }
 
-            
+
             try
             {
-                _unitOfWorkManage.BeginTran(); 
+                _unitOfWorkManage.BeginTran();
 
                 // 2. 鏌ヨ鎵樼洏搴撳瓨涓昏褰曪紙閬垮厤鏃犳暟鎹姏寮傚父锛�
                 var stock = _stockRepository.Db.Queryable<Dt_StockInfo>()
@@ -682,7 +697,7 @@
                         return WebResponseContent.Instance.Error($"鎵樼洏{palletCode}涓嬫湭鎵惧埌鏉$爜{barcode}鐨勬槑缁嗚褰�");
                     }
 
-                    ResetInboundOrderStatus(new List<string> { targetDetail.OrderNo},new List<string> { targetDetail.Barcode});
+                    ResetInboundOrderStatus(new List<string> { targetDetail.OrderNo }, new List<string> { targetDetail.Barcode });
                     // 鍒犻櫎鎸囧畾鏄庣粏
                     _stockDetailRepository.DeleteData(targetDetail);
 
@@ -735,7 +750,7 @@
             }
             catch (Exception ex)
             {
-                _unitOfWorkManage.RollbackTran(); 
+                _unitOfWorkManage.RollbackTran();
                 return WebResponseContent.Instance.Error($"鎵樼洏鎾ら攢澶辫触锛歿ex.Message}");
             }
         }
@@ -801,7 +816,7 @@
             if (!string.IsNullOrEmpty(options.Wheres))
             {
                 try
-                {                  
+                {
                     searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
                     if (searchParametersList.Count > 0)
                     {
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_Model/Models/Allocate/Dt_AllocateOrderDetail.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_Model/Models/Allocate/Dt_AllocateOrderDetail.cs"
index 73a6f5c..dec7580 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_Model/Models/Allocate/Dt_AllocateOrderDetail.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_Model/Models/Allocate/Dt_AllocateOrderDetail.cs"
@@ -35,6 +35,7 @@
         public string MaterielCode { get; set; }
 
 
+        public string MaterielName { get; set; }
         /// <summary>
         /// 鎵规鍙�
         /// </summary>
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_Model/Models/Check/Dt_ReCheckOrder.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_Model/Models/Check/Dt_ReCheckOrder.cs"
index 6bc6055..b966e93 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_Model/Models/Check/Dt_ReCheckOrder.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_Model/Models/Check/Dt_ReCheckOrder.cs"
@@ -38,6 +38,11 @@
         public string MaterielCode { get; set; } = null!;
 
         /// <summary>
+        /// 
+        /// </summary>
+        public string MaterielName { get; set; }    
+
+        /// <summary>
         /// 澶�  娉�:
         /// 榛樿鍊�:
         ///</summary>
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_OutboundService/OutboundBatchPickingService.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_OutboundService/OutboundBatchPickingService.cs"
index cb55dde..a28397a 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_OutboundService/OutboundBatchPickingService.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_OutboundService/OutboundBatchPickingService.cs"
@@ -1852,8 +1852,8 @@
                     catch (Exception ex)
                     {
                         _unitOfWorkManage.RollbackTran();
-                        _logger.LogError($"绌虹鍥炲簱澶辫触: {ex.Message}");
-                        return WebResponseContent.Instance.Error($"绌虹鍥炲簱澶辫触锛歿ex.Message}");
+                        _logger.LogError($"绌虹鍥炲簱ExecutePalletReturn澶辫触: {ex.Message}");
+                        return WebResponseContent.Instance.Error($"绌虹鍥炲簱ExecutePalletReturn澶辫触锛歿ex.Message}");
                     }
                 }
 
@@ -1883,7 +1883,7 @@
                 }
                 catch (Exception taskEx)
                 {
-                    _logger.LogError($"鍥炲簱浠诲姟鍒涘缓澶辫触: {taskEx.Message}");
+                    _logger.LogError($"鍥炲簱浠诲姟CreateReturnTaskWithoutESS鍒涘缓澶辫触: {taskEx.Message}");
                     // 浠诲姟鍒涘缓澶辫触涓嶅奖鍝嶆暟鎹洖搴�
                 }
                 _unitOfWorkManage.CommitTran();
@@ -1908,8 +1908,8 @@
             catch (Exception ex)
             {
                 _unitOfWorkManage.RollbackTran();
-                _logger.LogError($"鍥炲簱澶辫触: {ex.Message}");
-                return WebResponseContent.Instance.Error($"鍥炲簱澶辫触锛歿ex.Message}");
+                _logger.LogError($"ExecutePalletReturn 鍥炲簱澶辫触: {ex.Message}");
+                return WebResponseContent.Instance.Error($"ExecutePalletReturn 鍥炲簱澶辫触锛歿ex.Message}");
             }
         }
 
@@ -2687,12 +2687,12 @@
                 // 鍒涘缓鍥炲簱浠诲姟锛堜笉鍙戦�丒SS鍛戒护锛�
                 var returnTaskInfo = await CreateEmptyPalletReturnTask(orderNo, palletCode, emptyStockInfo, currentTask);
 
-                return WebResponseContent.Instance.OK("绌烘墭鐩樺洖搴撴垚鍔�");
+                return WebResponseContent.Instance.OK("绌烘墭鐩樺洖搴撴垚鍔�", returnTaskInfo);
             }
             catch (Exception ex)
             {
-                _logger.LogError($"绌烘墭鐩樺洖搴撳け璐�: {ex.Message}");
-                return WebResponseContent.Instance.Error($"绌烘墭鐩樺洖搴撳け璐�: {ex.Message}");
+                _logger.LogError($"绌烘墭鐩樺洖搴撳け璐� HandleEmptyPalletReturn: {ex.Message}");
+                return WebResponseContent.Instance.Error($"绌烘墭鐩樺洖搴撳け璐� HandleEmptyPalletReturn: {ex.Message}");
             }
         }
 
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_OutboundService/OutboundOrderService.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_OutboundService/OutboundOrderService.cs"
index a1ce7f9..9526c9a 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_OutboundService/OutboundOrderService.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_OutboundService/OutboundOrderService.cs"
@@ -3,6 +3,7 @@
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Logging;
 using SqlSugar;
+using WIDESEA_BasicService;
 using WIDESEA_Common.AllocateEnum;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core;
@@ -23,17 +24,19 @@
     {
         private readonly IMapper _mapper;
         private readonly IUnitOfWorkManage _unitOfWorkManage;
+        private readonly IMaterielInfoService _materielInfoService;
         public IRepository<Dt_OutboundOrder> Repository => BaseDal;
         private readonly ILogger<OutboundOrderService> _logger;
         private readonly IRepository<Dt_OutboundOrderDetail> _outboundOrderDetailRepository;
         private readonly IMaterialUnitService _materialUnitService;
-        public OutboundOrderService(IRepository<Dt_OutboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, ILogger<OutboundOrderService> logger, IMaterialUnitService materialUnitService) : base(BaseDal)
+        public OutboundOrderService(IRepository<Dt_OutboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, ILogger<OutboundOrderService> logger, IMaterialUnitService materialUnitService, IMaterielInfoService materielInfoService) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
             _outboundOrderDetailRepository = outboundOrderDetailRepository;
             _logger = logger;
             _materialUnitService = materialUnitService;
+            _materielInfoService = materielInfoService;
         }
 
         private int[] OrderTypes = new int[] { (int)InOrderTypeEnum.AllocatOutbound, (int)InOrderTypeEnum.InternalAllocat, (int)InOrderTypeEnum.ReCheck };
@@ -63,8 +66,12 @@
 
                 if (BaseDal.QueryFirst(x => x.UpperOrderNo == model.UpperOrderNo) != null)
                 {
-                    return WebResponseContent.Instance.Error($"鍑哄簱鍗曞彿閲嶅");
+                    return WebResponseContent.Instance.Error($"{model.UpperOrderNo}鍑哄簱鍗曞彿閲嶅");
                 }
+
+                var materielCodes = model.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+
                 foreach (var item in model.Details)
                 {
                     var issueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeQty);
@@ -72,6 +79,11 @@
                     item.OrderQuantity = issueoStockResult.Quantity;
                     var moveissueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeMoveQty);
                     item.MoveQty = moveissueoStockResult.Quantity;
+                    if (materielInfos.Any())
+                    {
+                        item.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                    }
+
                 }
                 if (!OrderTypes.Contains(model.OrderType))
                 {
@@ -108,6 +120,11 @@
                 List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
                 List<Dt_OutboundOrderDetail> updateoutboundOrderDetails = new List<Dt_OutboundOrderDetail>();
                 List<int> detailIds = new List<int>();
+
+                var materielCodes = model.Details.Select(x => x.MaterielCode).Distinct().ToList();
+                var materielInfos = _materielInfoService.Db.Queryable<Dt_MaterielInfo>().Where(x => materielCodes.Contains(x.MaterielCode)).ToList();
+
+
                 foreach (var item in model.Details)
                 {
 
@@ -135,6 +152,11 @@
                         var moveissueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeMoveQty);
                         item.MoveQty = moveissueoStockResult.Quantity;
 
+                        if (materielInfos.Any())
+                        {
+                            outboundOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                        }
+
                         outboundOrderDetails.Add(outboundOrderDetail);
                     }
                     else
@@ -155,7 +177,10 @@
                         outboundOrderDetail.OrderQuantity = issueoStockResult.Quantity;
                         var moveissueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeMoveQty);
                         outboundOrderDetail.MoveQty = moveissueoStockResult.Quantity;
-
+                        if (materielInfos.Any())
+                        {
+                            outboundOrderDetail.MaterielName = materielInfos.FirstOrDefault(x => x.MaterielCode == item.MaterielCode)?.MaterielName ?? "";
+                        }
 
                         updateoutboundOrderDetails.Add(outboundOrderDetail);
                         detailIds.Add(outboundOrderDetail.Id);
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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
index 0da15ed..099b0dc 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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
@@ -34,6 +34,7 @@
     /// </summary>
     public class OutboundPickingService : ServiceBase<Dt_PickingRecord, IRepository<Dt_PickingRecord>>, IOutboundPickingService
     {
+        #region 鏋勯�犲嚱鏁�
         private readonly IUnitOfWorkManage _unitOfWorkManage;
         public IRepository<Dt_PickingRecord> Repository => BaseDal;
 
@@ -100,6 +101,7 @@
             _interfaceLog = interfaceLog;
         }
 
+        #endregion
 
         #region 鏌ヨ鏂规硶
         // 鑾峰彇鏈嫞閫夊垪琛�
@@ -2055,8 +2057,6 @@
         }
         #endregion
 
-
-
         #region 杈呭姪鏂规硶
         /// <summary>
         /// 缁熶竴鍒嗘瀽鎵樼洏鐘舵�� - 杩斿洖鎵樼洏鐨勫畬鏁寸姸鎬佷俊鎭�
@@ -2144,7 +2144,6 @@
 
             return result;
         }
-
 
         private async Task<string> GenerateNewBarcode()
         {
@@ -2282,7 +2281,7 @@
             }
             return WebResponseContent.Instance.OK("鎷i�夌‘璁ゆ垚鍔�", new { SplitResults = new List<SplitResult>() });
         }
-
+        #endregion
 
 
         #region 铏氭嫙鍑哄叆搴�
@@ -2934,7 +2933,7 @@
         }
 
 
-        #endregion
+    
     }
 
     #region 鏀寔绫诲畾涔�
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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
index 80aec45..03574dc 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
@@ -297,10 +297,17 @@
             {
                 await Db.Deleteable(task).ExecuteCommandAsync();
             }
-            _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
-            _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
             try
+            {
+                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
+
+                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
+            }
+            catch(Exception ex)
+            {
+                _logger.LogInformation($"InboundTaskCompleted AddLocationStatusChangeRecord : {ex.Message} " );
+            }
+                try
             {
                 foreach (var inboundOrder in inboundOrders)
                 {
@@ -568,8 +575,14 @@
                 {
                     await Db.Deleteable(task).ExecuteCommandAsync();
                 }
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
+                try
+                {
+                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
+                }
+                catch(Exception ex)
+                {
+                    _logger.LogInformation($"InEmptyTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+                }
 
                 if (outboundOrder != null)
                 {
@@ -683,16 +696,23 @@
                 {
                     await Db.Deleteable(task).ExecuteCommandAsync();
                 }
-                // 璁板綍璐т綅鐘舵�佸彉鏇�
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
-                    locationInfo,
-                    beforelocationStatus,
-                    StockChangeType.Inbound.ObjToInt(),
-                    "",
-                    task.TaskNum
-                );
+             
                 await RecalculateOrderStatus(task.OrderNo);
-
+                try
+                {
+                    // 璁板綍璐т綅鐘舵�佸彉鏇�
+                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(
+                        locationInfo,
+                        beforelocationStatus,
+                        StockChangeType.Inbound.ObjToInt(),
+                        "",
+                        task.TaskNum
+                    );
+                }
+                catch (Exception ex)
+                {
+                    _logger.LogInformation($"InPickTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
+                }
 
                 _logger.LogInformation($"鎵樼洏鍥炲簱瀹屾垚澶勭悊鎴愬姛 - 浠诲姟鍙�: {task.TaskNum}, 鎵樼洏: {task.PalletCode}, 璁㈠崟: {task.OrderNo}");
                 _ = Task.Run(async () =>
@@ -1284,8 +1304,14 @@
                     _stockRepository.Db.Deleteable(stockInfo).ExecuteCommand();
                 }
                 _stockService.StockInfoService.DeleteData(stockInfo);
-                _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
-
+                try
+                {
+                    _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), stockInfo?.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+                }
+                catch (Exception ex)
+                {
+                    _logger.LogError($"TaskService OutEmptyTaskCompleted AddLocationStatusChangeRecord:  {ex.Message} ");
+                }
                 return await Task.FromResult(WebResponseContent.Instance.OK());
 
             }
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_WMSServer/Program.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_WMSServer/Program.cs"
index ee35fae..26711fb 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_WMSServer/Program.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_WMSServer/Program.cs"
@@ -49,7 +49,7 @@
     .WriteTo.File( // 配置输出到文件
         path: "logs/log-.txt", // 日志文件路径,会自动创建 logs 文件夹
         rollingInterval: RollingInterval.Day, // 按天滚动日志文件
-        retainedFileCountLimit: 7, // 最多保留7天的日志
+        retainedFileCountLimit: 365, // 最多保留7天的日志
         outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}"
     )
     .CreateLogger();

--
Gitblit v1.9.3