From 550ae4989da1ce9ca874a00aec7423d252b67a27 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 02 十二月 2025 08:25:21 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 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_BasicService/InvokeMESService.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/InvokeMESService.cs"
index 1ce63f5..d6d8cc2 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/InvokeMESService.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/InvokeMESService.cs"
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.Extensions.Logging;
+锘縰sing Dm.filter;
+using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
 using Org.BouncyCastle.Asn1.Ocsp;
 using SqlSugar;
@@ -36,11 +37,11 @@
         private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
         private readonly IRepository<Dt_StockInfo> _stockInfoRepository;
         private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
-
+        private readonly IMaterialUnitService _materialUnitService;
         private readonly IOutboundOrderService _outboundOrderService;
         private readonly IOutboundOrderDetailService _outboundOrderDetailService;
         private readonly IOutStockLockInfoService _outStockLockInfoService;
-        public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService)
+        public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService)
         {
             _httpClientFactory = httpClientFactory;
             _logger = logger;
@@ -51,6 +52,7 @@
             _outboundOrderService = outboundOrderService;
             _outboundOrderDetailService = outboundOrderDetailService;
             _outStockLockInfoService = outStockLockInfoService;
+            _materialUnitService = materialUnitService;
         }
 
         /// <summary>
@@ -429,7 +431,6 @@
                         .Where(x => x.OrderNo == orderNo && detailids.Contains(x.OrderDetailId) &&
                                    x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
                         .ToListAsync();
-
                     var detailModel = new FeedbackOutboundDetailsModel
                     {
                         materialCode = detail.MaterielCode,
@@ -438,16 +439,32 @@
                         qty = detail.BarcodeQty, // 浣跨敤璁㈠崟鏄庣粏鐨勫凡鍑哄簱鏁伴噺
                         currentDeliveryQty = detail.BarcodeQty,
                         unit = detail.BarcodeUnit,
-                        barcodes = detailLocks.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
-                        {
-                            barcode = lockInfo.CurrentBarcode,
-                            supplyCode = lockInfo.SupplyCode,
-                            batchNo = lockInfo.BatchNo,
-                            unit = lockInfo.BarcodeUnit,
-                            qty = lockInfo.BarcodeQty // 鏉$爜绾у埆鐨勬暟閲忎粛鐢ㄩ攣瀹氳褰�
-                        }).ToList()
+                        barcodes =  new List<WIDESEA_DTO.Outbound.BarcodesModel> ()
                     };
 
+                    if (detailLocks.Any(x => x.BarcodeUnit != x.Unit))
+                    {
+                        foreach (var item in detailLocks)
+                        {
+                            var barmodel = new WIDESEA_DTO.Outbound.BarcodesModel
+                            {
+                                barcode = item.CurrentBarcode,
+                                supplyCode = item.SupplyCode,
+                                batchNo = item.BatchNo,
+                                unit = item.BarcodeUnit,
+                                qty = item.BarcodeQty // 鏉$爜绾у埆鐨勬暟閲忎粛鐢ㄩ攣瀹氳褰�
+                            };
+                            if (item.BarcodeUnit != item.Unit)
+                            {
+                                var issueoStockResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.BarcodeQty, item.Unit,item.BarcodeUnit);
+                                barmodel.unit = issueoStockResult.Unit;
+                                barmodel.qty = issueoStockResult.Quantity;
+                            }
+                            detailModel.qty = barmodel.qty;
+                            detailModel.currentDeliveryQty = barmodel.qty;
+                            detailModel.barcodes.Add(barmodel); 
+                        }
+                    }             
                     feedmodel.details.Add(detailModel);
                 }
 

--
Gitblit v1.9.3