From deb12fd2b06ccc821104aa475a8fb784c39dfb2c Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 02 二月 2026 19:01:00 +0800
Subject: [PATCH] 添加音频播放和优化调拨明细查询方法

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs |   65 ++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 9 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/OutboundService.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/OutboundService.cs"
index 0e2a158..8af03e8 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/OutboundService.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/OutboundService.cs"
@@ -22,6 +22,7 @@
 using WIDESEA_DTO.Base;
 using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.CalcOut;
+using WIDESEA_DTO.Outbound;
 using WIDESEA_DTO.ReturnMES;
 using WIDESEA_IBasicService;
 using WIDESEA_IOutboundService;
@@ -62,6 +63,8 @@
         private readonly IESSApiService _eSSApiService;
         private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
         private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfoRepository;
+        public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository;
+        public readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
 
         private Dictionary<string, string> stations = new Dictionary<string, string>
         {
@@ -75,7 +78,7 @@
             {"3-1","3-5" },
         };
 
-        public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository)
+        public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -98,6 +101,35 @@
             _eSSApiService = eSSApiService;
             _allocateOrderRepository = allocateOrderRepository;
             _allocateMaterialInfoRepository = allocateMaterialInfoRepository;
+            _inboundOrderDetailRepository = inboundOrderDetailRepository;
+            _inboundOrderRepository = inboundOrderRepository;
+        }
+
+        public WebResponseContent PrintFromData (string barcode)
+        {
+            var detail = _inboundOrderDetailRepository.QueryFirst(x => x.Barcode == barcode);
+            if(detail == null)
+            {
+                return WebResponseContent.Instance.Error();
+            }
+
+            var inbound = _inboundOrderRepository.QueryFirst(x=>x.Id ==  detail.OrderId);
+            if(inbound == null)
+            {
+                return WebResponseContent.Instance.Error();
+            }
+            var printFormData = new PrintFromDataDTO { 
+                materialCode = detail.MaterielCode,
+                materialName = detail.MaterielName,
+                materialSpec = detail.Unit,
+                batchNo = detail.BatchNo,
+                pruchaseOrderNo = inbound.UpperOrderNo,
+                factoryArea = inbound.FactoryArea,
+                suplierCode = detail.SupplyCode,
+                quantity = detail.BarcodeQty
+            };
+
+            return WebResponseContent.Instance.OK(data:printFormData);
         }
 
         #region 鍑哄簱鍒嗛厤
@@ -1574,7 +1606,7 @@
                         _feedbackMesService.BarcodeFeedback(newBarcode);
                     }
 
-                    if (CheckOutboundOrderDetailCompletedByMatCode(request.OrderNo, lockInfo.MaterielCode, outboundOrderDetails.First()))
+                    if (CheckOutboundOrderDetailCompletedByMatCode(request.OrderNo, lockInfo.MaterielCode, outboundOrderDetails))
                     {
                         Func<Dt_OutStockLockInfo, bool> supWhere = x => string.IsNullOrEmpty(outboundOrderDetails.First().SupplyCode) ? true : x.SupplyCode == outboundOrderDetails.First().SupplyCode;
 
@@ -1928,14 +1960,30 @@
         /// <summary>
         /// 妫�鏌ュ嚭搴撳崟鏄庣粏鏄惁瀹屾垚
         /// </summary>
-        public bool CheckOutboundOrderDetailCompletedByMatCode(string orderNo, string materialCode, Dt_OutboundOrderDetail outboundOrderDetail)
+        public bool CheckOutboundOrderDetailCompletedByMatCode(string orderNo, string materialCode, List<Dt_OutboundOrderDetail> outboundOrderDetails)
         {
+            if (string.IsNullOrEmpty(orderNo) || string.IsNullOrEmpty(materialCode) || outboundOrderDetails == null || !outboundOrderDetails.Any())
+                return false;
+
+            // 鏌ヨ涓昏鍗曪紝涓嶅瓨鍦ㄧ洿鎺ヨ繑鍥瀎alse
             Dt_OutboundOrder outboundOrder = _outboundRepository.QueryFirst(x => x.OrderNo == orderNo);
             if (outboundOrder == null) return false;
 
-            List<Dt_OutboundOrderDetail> details = _detailRepository.QueryData(x => x.OrderId == outboundOrder.Id && x.MaterielCode == materialCode && (string.IsNullOrEmpty(outboundOrderDetail.SupplyCode) || x.SupplyCode == outboundOrderDetail.SupplyCode) && (string.IsNullOrEmpty(outboundOrderDetail.WarehouseCode) || x.WarehouseCode == outboundOrderDetail.WarehouseCode));
+            var firstDetail = outboundOrderDetails.FirstOrDefault();
+            string supplyCode = firstDetail.SupplyCode;
+            string warehouseCode = firstDetail.WarehouseCode;
+            List<int> ids = outboundOrderDetails.Select(x => x.Id).ToList();
 
-            // 妫�鏌ユ墍鏈夋槑缁嗙殑宸插嚭鏁伴噺鏄惁閮界瓑浜庡崟鎹暟閲�
+            List<Dt_OutboundOrderDetail> details = _detailRepository.QueryData(x =>
+                x.OrderId == outboundOrder.Id
+                && x.MaterielCode == materialCode
+                && ids.Contains(x.Id)
+                && (string.IsNullOrEmpty(supplyCode) || x.SupplyCode == supplyCode)
+                && (string.IsNullOrEmpty(warehouseCode) || x.WarehouseCode == warehouseCode)
+            );
+
+            if (!details.Any()) return false;
+
             return details.All(x => x.OverOutQuantity >= x.OrderQuantity - x.MoveQty);
         }
 
@@ -1999,21 +2047,20 @@
                 if (stock.Details.Count <= 0)
                 {
                     stock.PalletType = (int)PalletTypeEnum.Empty;
-                    stock.StockStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨;
+                    stock.StockStatus = (int)StockStatusEmun.鍏ュ簱纭;
                     stock.LocationCode = "";
                 }
                 else if (stock.Details.Count > 0)
                 {
                     Dt_OutStockLockInfo lockInfo = _outboundLockInfoRepository.QueryFirst(x =>
-                       x.OrderNo == OrderNo &&
                        x.StockId == stock.Id &&
                        x.PalletCode == palletCode);
 
                     if (lockInfo != null && lockInfo.SortedQuantity != lockInfo.AssignQuantity)
                     {
-                        return content.Error($"鎵樼洏{palletCode}搴撳瓨鏈嫞閫夊畬涓嶅厑璁稿洖搴�");
+                        return content.Error($"鎵樼洏{palletCode}搴撳瓨锛屽湪鍗曟嵁{lockInfo.OrderNo}閲岄潰杩樻湭鎷i�夊畬鎴愶紝涓嶅厑璁稿洖搴�");
                     }
-                    stock.StockStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨;
+                    stock.StockStatus = (int)StockStatusEmun.鍏ュ簱纭;
                     stock.LocationCode = "";
                 }
 

--
Gitblit v1.9.3