From b6a40a2d8fdcffb3accfc7e424c0726a87a59ddf Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期五, 05 十二月 2025 21:20:59 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 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_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 63012ed..4d20ff1 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"
@@ -7,6 +7,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection.Metadata;
 using System.Text;
 using System.Text.Json;
 using System.Threading.Tasks;
@@ -36,6 +37,7 @@
 using WIDESEA_Model.Models;
 using WIDESEA_Model.Models.Basic;
 using WIDESEA_Model.Models.Check;
+using WIDESEA_Model.Models.Outbound;
 
 namespace WIDESEA_OutboundService
 {
@@ -66,6 +68,7 @@
         private readonly IReCheckOrderService _reCheckOrderService;
         private readonly ITask_HtyService _task_HtyService;
         private readonly ILogger<OutboundPickingService> _logger;
+        private readonly IRepository<Dt_InterfaceLog> _interfaceLog;
 
         private Dictionary<string, string> stations = new Dictionary<string, string>
         {
@@ -84,7 +87,7 @@
         public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService,
             IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService,
             IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService,
-            IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService, ITask_HtyService task_HtyService) : base(BaseDal)
+            IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService, ITask_HtyService task_HtyService,IRepository<Dt_InterfaceLog> interfaceLog) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _stockInfoService = stockInfoService;
@@ -106,6 +109,7 @@
             _warehouseAreaRepository = warehouseAreaRepository;
             _reCheckOrderService = reCheckOrderService;
             _task_HtyService = task_HtyService;
+            _interfaceLog = interfaceLog;
         }
 
 
@@ -2851,10 +2855,11 @@
                 var result1 = await _invokeMESService.FeedbackInbound(infeedmodel);
                 if (result1 != null && result1.code == 200)
                 {
+                    var orderIds = inboundOrderDetails.Select(x => x.Id).Distinct().ToList();
                     _inboundOrderRepository.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
                     .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                     _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
-                    .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
+                    .Where(it => orderIds.Contains(it.Id)).ExecuteCommand();
                 }
                 //鍑哄簱鍥炰紶MES
 
@@ -2873,7 +2878,7 @@
                     status = outboundOrder.OrderStatus,
                     details = new List<FeedbackOutboundDetailsModel>()
                 };
-                foreach (var detail in outboundOrder.Details)
+                foreach (var detail in outboundOrderDetails)
                 {
                     // 鑾峰彇璇ユ槑缁嗗搴旂殑鏉$爜淇℃伅锛堜粠閿佸畾璁板綍锛�
                     var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
@@ -2903,18 +2908,37 @@
                           }).ToList();
                     outfeedmodel.details.AddRange(groupdata);
                 }
+                //瀛樺偍鍥炰紶鍙傛暟锛屼繚璇佸紓甯告墜鍔ㄥ洖浼�
+                Dt_InterfaceLog interfaceLog = new Dt_InterfaceLog
+                {
+                    OrderNo = outboundOrder.UpperOrderNo,
+                    DocumentNo = documentNo,
+                    OrderType = "铏氭嫙鍑哄叆搴�",
+                    Content = outfeedmodel.ToJson(),
+                    ReturnToMESStatus = 0,
+                    IsDeleted = false
+                };
+                _interfaceLog.AddData(interfaceLog);
+
                 var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
                 if (result != null && result.code == 200)
                 {
+                    var orderIds = outboundOrderDetails.Select(x => x.Id).Distinct().ToList();
                     await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
                         .SetColumns(x => x.ReturnToMESStatus == 1)
-                        .Where(x => x.OrderId == outboundOrder.Id)
+                        .Where(x => orderIds.Contains(x.Id))
                         .ExecuteCommandAsync();
+
 
                     await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
                         .SetColumns(x => x.ReturnToMESStatus == 1)
                         .Where(x => x.Id == outboundOrder.Id)
                         .ExecuteCommandAsync();
+
+                    await _interfaceLog.Db.Updateable<Dt_InterfaceLog>()
+                        .SetColumns(x => x.ReturnToMESStatus == 1)
+                        .Where(x=>x.DocumentNo == documentNo)
+                        .ExecuteCommandAsync();
                 }
                 return WebResponseContent.Instance.OK();
             }

--
Gitblit v1.9.3