From 95c92db3c831c73b05068b09221c13ad4a250322 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期一, 02 二月 2026 20:07:00 +0800
Subject: [PATCH] 条码扫描成功音频播放功能,代码优化

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs |   61 ++++++++++++++++--------------
 1 files changed, 33 insertions(+), 28 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 5999773..ca8c34e 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"
@@ -12,6 +12,7 @@
 using System.Data;
 using System.Linq;
 using System.Net;
+using System.Reflection.Metadata;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Common.AllocateEnum;
@@ -95,10 +96,12 @@
                 
                 var details = _inboundOrderDetailRepository.QueryData(x => (x.OutBoxbarcodes == palletDto.Barcode|| x.Barcode == palletDto.Barcode) && x.OrderDetailStatus == (int)InOrderStatusEnum.鏈紑濮�);
 
+  
                 if (details.Count() <= 0)
                 {
-                    var inbounddetail =_inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode);
-                    if(inbounddetail == null)
+
+                    var inbounddetail = _inboundOrderDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode);
+                    if (inbounddetail == null)
                     {
                         return content.Error($"鏉$爜{palletDto.Barcode}涓嶅瓨鍦�");
                     }
@@ -108,26 +111,26 @@
                         return content.Error("鍗曟嵁涓嶈兘涓虹┖");
                     }
 
-                    var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d,o)=>d.OrderId==o.Id).Where((d, o) => d.OrderId == inbound.Id
+                    var detail = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().LeftJoin<Dt_InboundOrder>((d, o) => d.OrderId == o.Id).Where((d, o) => d.OrderId == inbound.Id
                       && d.ReceiptQuantity != 0
                       && d.OverInQuantity == 0).Select((d, o) => new
-                {
-                    orderNo=o.InboundOrderNo,
-                    d.Barcode,
-                    d.MaterielCode,
-                    d.BatchNo,
-                    d.ReceiptQuantity,
-                    d.Unit,
-                    d.SupplyCode,
-                    d.WarehouseCode
-                }).ToList();
-                   var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode);
+                      {
+                          orderNo = o.InboundOrderNo,
+                          d.Barcode,
+                          d.MaterielCode,
+                          d.BatchNo,
+                          d.ReceiptQuantity,
+                          d.Unit,
+                          d.SupplyCode,
+                          d.WarehouseCode
+                      }).ToList();
+                    var palletId = _stockInfoDetailRepository.QueryFirst(x => x.Barcode == palletDto.Barcode);
                     if (palletId == null)
                     {
-                        return content.Error($"鏉$爜鏉$爜{palletDto.Barcode}涓嶅瓨鍦�");
+                        return content.Error($"鏉$爜{palletDto.Barcode}宸茬粍鐩�");
                     }
-                    var pallet =_stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId);
-                    return content.Error($"鏉$爜{palletDto.Barcode}宸茬粡缁勫埌{pallet.PalletCode}",detail);   
+                    var pallet = _stockInfoRepository.QueryFirst(x => x.Id == palletId.StockId);
+                    return content.Error($"鏉$爜{palletDto.Barcode}宸茬粡缁勫埌{pallet.PalletCode}", detail);
                 }
                 inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Includes(x=>x.Details).Where(x => x.Id == details.First().OrderId).First();
 
@@ -285,7 +288,16 @@
                 {
                     return content.Error("宸蹭笂鏋剁殑鎵樼洏涓嶈兘鍐嶆缁勭洏");
                 }
-
+                var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode);
+                if (nullpallet != null)
+                {
+                    return content.Error($"璇ユ墭鐩榹palletDto.PalletCode}宸茬粡杩涜绌烘墭缁勭洏,涓嶈兘鍦ㄨ繘琛岀粍鐩�");
+                }
+                var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.鍑哄簱瀹屾垚 && x.PalletCode == palletDto.PalletCode);
+                if (outbundPallet != null)
+                {
+                    return content.Error($"璇ユ墭鐩榹palletDto.PalletCode}鏈繘琛屽彇绌虹,涓嶈兘杩涜缁勭洏");
+                }
                 if (_stockService.StockInfoDetailService.ExistBarcodes(palletDto.Barcode))
                 {
                     return content.Error($"{palletDto.Barcode} 鏉$爜鍦ㄥ簱瀛樹腑宸插瓨鍦�");
@@ -300,16 +312,6 @@
                 if (stockInfo != null && stockInfo.Details.Count > 0 && stockInfo.Details.FirstOrDefault()?.WarehouseCode != palletDto.WarehouseType)
                 {
                     return content.Error($"璇ユ墭鐩樼粍鐩樹粨搴撲负{stockInfo.Details.FirstOrDefault()?.WarehouseCode}涓庡綋鍓嶄粨搴搟palletDto.WarehouseType}涓嶄竴鑷达紝涓嶅厑璁哥粍鐩�");
-                }
-                var nullpallet = _stockInfoRepository.QueryFirst(x => x.PalletType == -1 && x.PalletCode == palletDto.PalletCode);
-                if (nullpallet != null)
-                {
-                    return content.Error($"璇ユ墭鐩榹palletDto.PalletCode}宸茬粡杩涜绌烘墭缁勭洏,涓嶈兘鍦ㄨ繘琛岀粍鐩�");
-                }
-                var outbundPallet = _stockInfoRepository.QueryFirst(x => x.StockStatus == (int)StockStatusEmun.鍑哄簱瀹屾垚 && x.PalletCode == palletDto.PalletCode);
-                if (outbundPallet != null)
-                {
-                    return content.Error($"璇ユ墭鐩榹palletDto.PalletCode}鏈繘琛屽彇绌虹,涓嶈兘杩涜缁勭洏");
                 }
                 Dt_AllocateMaterialInfo allocateMaterialInfo = _allocateMaterialInfo.QueryFirst(x => x.Barcode == palletDto.Barcode);
                 if(allocateMaterialInfo == null)
@@ -956,5 +958,8 @@
                 return content.Error(ex.Message);
             }
         }
+
+       
+        
     }
 }

--
Gitblit v1.9.3