From deb12fd2b06ccc821104aa475a8fb784c39dfb2c Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 02 二月 2026 19:01:00 +0800
Subject: [PATCH] 添加音频播放和优化调拨明细查询方法
---
项目代码/WIDESEA_WMSClient/src/assets/audio/error.mp3 | 0
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue | 88 +++++++++++++++++++++++++++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateService.cs | 50 +++++++++-------
项目代码/WIDESEA_WMSClient/src/assets/audio/success.mp3 | 0
项目代码/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue | 7 ++
5 files changed, 122 insertions(+), 23 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/assets/audio/error.mp3" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/assets/audio/error.mp3"
new file mode 100644
index 0000000..0512ff8
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/assets/audio/error.mp3"
Binary files differ
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/assets/audio/success.mp3" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/assets/audio/success.mp3"
new file mode 100644
index 0000000..584cffc
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/assets/audio/success.mp3"
Binary files differ
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
index 5c9a1b6..2630979 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
@@ -218,6 +218,15 @@
isSubmitting: false,
palletGroupedBarcodes: {},
+ // 闊抽閰嶇疆
+ audioConfig: {
+ successPath: '/assets/audio/success.mp3', // 瀵瑰簲 public 涓嬬殑璺緞
+ errorPath: '/assets/audio/error.mp3'
+ },
+ // 缂撳瓨闊抽瀹炰緥锛岄伩鍏嶉噸澶嶅垱寤�
+ successAudio: null,
+ errorAudio: null,
+
totalStockSum: 0,
totalStockCount: 0,
uniqueUnit: '',
@@ -337,9 +346,84 @@
// 纭繚缁勪欢閿�姣佹椂绉婚櫎鐩戝惉
this.removeKeyPressListener();
this.clearAllTimers();
+
+ this.removeKeyPressListener();
+ this.clearAllTimers();
+
+ //閿�姣侀煶棰戝疄渚�
+ this.successAudio = null;
+ this.errorAudio = null;
},
methods: {
+
+ /**
+ * 鍒濆鍖栭煶棰戝疄渚嬶紙鎳掑姞杞斤紝鍙垱寤轰竴娆★級
+ * @param {String} type - 闊抽绫诲瀷锛歴uccess/error
+ * @returns {Audio} 闊抽瀹炰緥
+ */
+ initAudioInstance(type) {
+ if (type === 'success' && this.successAudio) {
+ return this.successAudio;
+ }
+ if (type === 'error' && this.errorAudio) {
+ return this.errorAudio;
+ }
+
+ const audioPath = type === 'success'
+ ? this.audioConfig.successPath
+ : this.audioConfig.errorPath;
+
+ const audioInstance = new Audio(audioPath);
+
+ // 缂撳瓨闊抽瀹炰緥
+ if (type === 'success') {
+ this.successAudio = audioInstance;
+ } else {
+ this.errorAudio = audioInstance;
+ }
+
+ // 闊抽鍔犺浇澶辫触鍥炶皟锛堝彲閫夛紝鐢ㄤ簬璋冭瘯锛�
+ audioInstance.onerror = (err) => {
+ console.error(`銆�${type} 闊抽銆戝姞杞藉け璐, err);
+ };
+
+ return audioInstance;
+ },
+
+ /**
+ * 鎾斁闊抽
+ * @param {String} type - 闊抽绫诲瀷锛歴uccess/error
+ */
+ playAudio(type) {
+ try {
+ const audioInstance = this.initAudioInstance(type);
+
+ // 閲嶇疆鎾斁杩涘害锛堥伩鍏嶉噸澶嶆挱鏀炬椂闊抽鏈粨鏉燂級
+ audioInstance.currentTime = 0;
+
+ // 鎾斁闊抽锛堣繑鍥� Promise 澶勭悊鎾斁缁撴灉锛屽吋瀹归儴鍒嗘祻瑙堝櫒闄愬埗锛�
+ audioInstance.play().catch((err) => {
+ console.warn('闊抽鎾斁澶辫触锛堝彲鑳芥槸娴忚鍣ㄨ嚜鍔ㄦ挱鏀剧瓥鐣ラ檺鍒讹級', err);
+ });
+ } catch (err) {
+ console.error('鎾斁闊抽鏃跺彂鐢熷紓甯�', err);
+ }
+ },
+
+ /**
+ * 鎾斁鎴愬姛闊抽
+ */
+ playSuccessAudio() {
+ this.playAudio('success');
+ },
+
+ /**
+ * 鎾斁澶辫触闊抽
+ */
+ playErrorAudio() {
+ this.playAudio('error');
+ },
// 娣诲姞閿洏浜嬩欢鐩戝惉
addKeyPressListener() {
if (!this.keyPressListenerAdded) {
@@ -717,6 +801,7 @@
this.error = `鏉$爜 ${currentBarcode} 宸茶褰撳墠鎵樼洏缁勭洏锛岃鍕块噸澶嶆搷浣渀;
this.barcode = '';
this.focusBarcodeInput();
+ this.playErrorAudio();
return;
}
@@ -726,6 +811,7 @@
.then(valid => {
if (!valid) {
this.isSubmitting = false;
+ this.playErrorAudio();
return;
}
@@ -792,6 +878,8 @@
this.scanCode = '';
this.isScanning = false;
+ this.playSuccessAudio();
+
setTimeout(() => {
this.focusBarcodeInput();
}, 100);
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue"
index e135a69..888147c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/inbound/allocateinboundOrder.vue"
@@ -339,6 +339,13 @@
bind: { key: "orderDetailStatusEnum", data: [] },
},
{
+ field: "pallet",
+ title: "宸茬粍鎵樼洏鍙�",
+ type: "string",
+ width: 180,
+ align: "left",
+ },
+ {
field: "creater",
title: "鍒涘缓浜�",
type: "string",
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 38b7329..5e198a5 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"
@@ -666,7 +666,6 @@
public override PageGridData<Dt_InboundOrderDetail> GetDetailPage(PageDataOptions options)
{
string wheres = ValidatePageOptions(options);
- //鑾峰彇鎺掑簭瀛楁
Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
List<OrderByModel> orderByModels = new List<OrderByModel>();
foreach (var item in orderbyDic)
@@ -679,7 +678,6 @@
orderByModels.Add(orderByModel);
}
-
int totalCount = 0;
List<SearchParameters> searchParametersList = new List<SearchParameters>();
if (!string.IsNullOrEmpty(options.Wheres))
@@ -691,35 +689,41 @@
}
catch { }
}
- //var data = BaseDal.Db.Queryable<Dt_AllocateOrderDetail>()
- // .WhereIF(!wheres.IsNullOrEmpty(), wheres)
- // .OrderBy(orderByModels)
- // .ToPageList(options.Page, options.Rows, ref totalCount);
- //Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == (int)options.Value);
- //Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
- //var details = _inboundOrderDetailRepository.QueryData(x => x.OrderId == _InboundOrder.Id );
- //foreach (var item in data)
- //{
- // var detail = details.Where(x => x.MaterielCode == item.MaterielCode).FirstOrDefault();
- // if (detail != null)
- // {
- // item.OrderQuantity = detail.OrderQuantity;
- // item.ReceiptQuantity = detail.ReceiptQuantity;
- // item.OverInQuantity = detail.OverInQuantity;
- // item.OrderDetailStatus = detail.OrderDetailStatus;
- // }
- //}
- //return new PageGridData<Dt_AllocateOrderDetail>(totalCount, data);
Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == (int)options.Value);
Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
var Id = _InboundOrder == null ? 0 : _InboundOrder.Id;
+
var data = BaseDal.Db.Queryable<Dt_InboundOrderDetail>()
- .WhereIF(!wheres.IsNullOrEmpty(), wheres)
- .Where( x => x.OrderId == Id)
+ .WhereIF(!string.IsNullOrEmpty(wheres), wheres)
+ .Where(x => x.OrderId == Id)
.OrderBy(orderByModels)
.ToPageList(options.Page, options.Rows, ref totalCount);
+ foreach (var detail in data)
+ {
+ if (string.IsNullOrEmpty(detail.Barcode))
+ {
+ detail.Pallet = string.Empty;
+ continue;
+ }
+
+ var stockDetail = BaseDal.Db.Queryable<Dt_StockInfoDetail>()
+ .Where(sd => sd.Barcode == detail.Barcode)
+ .First();
+
+ if (stockDetail == null || stockDetail.StockId <= 0)
+ {
+ detail.Pallet = string.Empty;
+ continue;
+ }
+
+ var stock = BaseDal.Db.Queryable<Dt_StockInfo>()
+ .Where(s => s.Id == stockDetail.StockId)
+ .First();
+
+ detail.Pallet = stock == null ? string.Empty : stock.PalletCode;
+ }
return new PageGridData<Dt_InboundOrderDetail>(totalCount, data);
}
--
Gitblit v1.9.3