diff --git a/package.json b/package.json
index b1237a1..835081a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "wms-pda",
- "version": "1.0.145",
+ "version": "1.0.146",
"private": true,
"description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)",
"scripts": {
diff --git a/src/core/utils/voice.js b/src/core/utils/voice.js
index 74401b9..8658d48 100644
--- a/src/core/utils/voice.js
+++ b/src/core/utils/voice.js
@@ -9,6 +9,7 @@ class VoiceBroadcastManager {
this.lastText = '';
this.lastSpeakAt = 0;
this.audio = null;
+ this.httpFailedUntil = 0;
}
isSupported() {
@@ -91,6 +92,8 @@ class VoiceBroadcastManager {
try {
if (status !== successCode && status !== 0) {
console.warn('[VoiceBroadcast] TTS 初始化失败, status:', status);
+ this.tts = null;
+ this.initListener = null;
resolve(false);
return;
}
@@ -247,8 +250,14 @@ class VoiceBroadcastManager {
return false;
}
- // 1. 优先 HTTP 语音接口
- const httpResult = await this.playByHttp(content);
+ // 1. 优先 HTTP 语音接口(近期失败过则跳过,避免每次 3 秒超时阻塞后续原生/TTS 播报)
+ let httpResult = false;
+ if (now >= this.httpFailedUntil) {
+ httpResult = await this.playByHttp(content);
+ if (!httpResult) {
+ this.httpFailedUntil = Date.now() + 60000;
+ }
+ }
if (httpResult) {
this.lastText = content;
this.lastSpeakAt = Date.now();
diff --git a/src/manifest.json b/src/manifest.json
index aa12702..47ebe11 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -2,8 +2,8 @@
"name" : "WMS_PDA",
"appid" : "__UNI__0B3DAD3",
"description" : "多平台快速开发的UI框架",
- "versionName" : "1.0.145",
- "versionCode" : 1000145,
+ "versionName" : "1.0.146",
+ "versionCode" : 1000146,
"transformPx" : false,
"app-plus" : {
"statusbar" : {
diff --git a/src/pages/B2BOperation/pickupOperation.vue b/src/pages/B2BOperation/pickupOperation.vue
index d3d809e..5fa5c2d 100644
--- a/src/pages/B2BOperation/pickupOperation.vue
+++ b/src/pages/B2BOperation/pickupOperation.vue
@@ -67,6 +67,10 @@
总箱数:
{{ item.total_box_count || 0 }}
+
+ 快递:
+ {{ getLogisticsName(item) || '--' }}
+
备货人:
{{ getPrepOperatorName(item) }}
@@ -463,6 +467,9 @@
const flag = item?.has_sn_item ?? item?.is_sn_order ?? item?.need_sn ?? item?.has_sn ?? item?.is_sn;
return String(flag || '').toUpperCase() === 'Y';
},
+ getLogisticsName(item) {
+ return item?.logistics_name || item?.sys_logistics_name || '';
+ },
getPickupStatus(item) {
return String(item?.is_picked_up || 'N');
},
diff --git a/src/pages/B2BOperation/stockPreparation.vue b/src/pages/B2BOperation/stockPreparation.vue
index e9a9981..a711169 100644
--- a/src/pages/B2BOperation/stockPreparation.vue
+++ b/src/pages/B2BOperation/stockPreparation.vue
@@ -67,6 +67,10 @@
总箱数:
{{ item.total_box_count || 0 }}
+
+ 快递:
+ {{ getLogisticsName(item) || '--' }}
+
备货人:
{{ item.prep_operator_name || '--' }}
@@ -160,6 +164,7 @@
this.safeDispatchBroadcast('resume');
// 从详情页返回时刷新备货状态(首次进入由 onLoad 拉取,避免重复)
if (this._hasShown) {
+ this.keyword = '';
this.currentPage = 1;
this.fetchList();
}
@@ -348,6 +353,9 @@
const flag = item?.has_sn_item ?? item?.is_sn_order ?? item?.need_sn ?? item?.has_sn ?? item?.is_sn;
return String(flag || '').toUpperCase() === 'Y';
},
+ getLogisticsName(item) {
+ return item?.logistics_name || item?.sys_logistics_name || '';
+ },
getPrepStatus(item) {
return String(item?.prep_status || 'none');
},
@@ -434,9 +442,9 @@
uni.showToast({ title: '该订单已由其他工号备货,无法操作', icon: 'none', duration: 2500 });
return;
}
- this.goDetail(orderId);
+ this.goDetail(orderId, this.getWaybillText(item));
} else {
- this.goDetail(orderId);
+ this.goDetail(orderId, this.getWaybillText(item));
}
},
isCurrentOperator(item) {
@@ -444,9 +452,13 @@
if (!operatorId) return true;
return operatorId === this.currentUserId;
},
- goDetail(orderId) {
+ goDetail(orderId, waybillText) {
+ const waybill = String(waybillText || '').trim();
+ const url = waybill
+ ? `./stockPreparationDetail?orderId=${orderId}&waybill=${encodeURIComponent(waybill)}`
+ : `./stockPreparationDetail?orderId=${orderId}`;
uni.navigateTo({
- url: `./stockPreparationDetail?orderId=${orderId}`,
+ url,
animationType: 'slide-in-right'
});
},
@@ -456,9 +468,9 @@
uni.showToast({ title: '订单ID缺失', icon: 'none' });
return;
}
- this.doStartPrepAndEnter(orderId);
+ this.doStartPrepAndEnter(orderId, this.getWaybillText(item));
},
- async doStartPrepAndEnter(orderId) {
+ async doStartPrepAndEnter(orderId, waybillText) {
uni.showLoading({ title: '开始备货中...' });
try {
const response = await this.$http('order.startB2bPrep', { ids: [orderId] }, '', false);
@@ -468,7 +480,7 @@
uni.showToast({ title: msg, icon: 'none', duration: 2500 });
return;
}
- this.goDetail(orderId);
+ this.goDetail(orderId, waybillText);
} catch (error) {
console.error('[stockPreparation] startB2bPrep error:', error);
uni.showToast({ title: '网络异常', icon: 'none' });
diff --git a/src/pages/B2BOperation/stockPreparationDetail.vue b/src/pages/B2BOperation/stockPreparationDetail.vue
index fc0b06e..6f6a250 100644
--- a/src/pages/B2BOperation/stockPreparationDetail.vue
+++ b/src/pages/B2BOperation/stockPreparationDetail.vue
@@ -16,8 +16,8 @@
- 发货单号:
- {{ detail.delivery_order_code || '--' }}
+ 运单号:
+ {{ waybillText }}
备货状态:
@@ -40,6 +40,7 @@
应拣
@@ -58,8 +59,16 @@
删除
-
- + 添加箱号
+
+
+ + 箱数
+
+
+ + 总箱数
+
+
+ 批量删除
+
@@ -190,6 +199,56 @@
+
+
+
+
+
+
+
+ 添加总箱数
+
+
+ 总箱数
+
+
+
+ 每箱数量
+
+
+
+ 末箱自动填剩余数量(应拣 − 每箱数量 × (总箱数 − 1))
+
+ 取消
+ 生成箱号
+
+
+
+
+
+
+
+
+
+
+ 批量删除箱号
+
+
+ 起始箱号
+
+
+
+ 结束箱号
+
+
+
+ 删除箱号区间 [起始, 结束] 内的全部分箱
+
+ 清空全部
+ 删除
+
+
+
@@ -198,6 +257,7 @@
data() {
return {
orderId: null,
+ waybill: '',
loading: false,
detail: {},
editing: false,
@@ -214,6 +274,12 @@
showFinishPrepConfirm: false,
showValidateConfirm: false,
validateMessage: '',
+ showBatchBoxPanel: false,
+ batchBoxIdx: -1,
+ batchBoxForm: { totalBoxes: '', perBoxQty: '' },
+ showBatchDeletePanel: false,
+ batchDeleteIdx: -1,
+ batchDeleteForm: { start: '', end: '' },
pendingPrepRemark: '',
pendingPrepTotalBoxCount: 0
}
@@ -252,16 +318,43 @@
return count;
}
return Number(this.detail.total_box_count || 0);
+ },
+ waybillText() {
+ const passed = String(this.waybill || '').trim();
+ if (passed) return passed;
+ const raw = this.detail?.waybill_codes ?? this.detail?.express_numbers;
+ if (Array.isArray(raw)) {
+ const codes = raw.map(String).filter(Boolean);
+ return codes.length > 0 ? codes.join(' / ') : '--';
+ }
+ if (typeof raw === 'string' && raw.trim()) {
+ const codes = raw.split(/[,,]/).map(s => s.trim()).filter(Boolean);
+ return codes.length > 0 ? codes.join(' / ') : '--';
+ }
+ return '--';
}
},
onLoad(options) {
this.orderId = Number(options.orderId || 0);
+ this.waybill = this.decodeWaybill(options.waybill);
+ this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
+ this.safeDispatchBroadcast('start');
if (this.orderId) {
this.fetchDetail();
} else {
uni.showToast({ title: '订单ID缺失', icon: 'none' });
}
},
+ onShow() {
+ this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
+ this.safeDispatchBroadcast('resume');
+ },
+ onHide() {
+ this.safeDispatchBroadcast('pause');
+ },
+ onUnload() {
+ this.safeDispatchBroadcast('stop');
+ },
onBackPress() {
// 提交/取消成功后放行,避免返回键再次拦截导致无法返回列表页
if (this.allowDirectBack) {
@@ -279,6 +372,26 @@
return false;
},
methods: {
+ safeDispatchBroadcast(action, payload) {
+ try {
+ const task = this.$store.dispatch(`broadcast/${action}`, payload);
+ if (task && typeof task.catch === 'function') {
+ task.catch(error => {
+ console.warn(`[stockPreparationDetail] broadcast/${action} 调用失败:`, error);
+ });
+ }
+ } catch (error) {
+ console.warn(`[stockPreparationDetail] broadcast/${action} 调用异常:`, error);
+ }
+ },
+ decodeWaybill(value) {
+ if (value === null || value === undefined || value === '') return '';
+ try {
+ return decodeURIComponent(String(value));
+ } catch (error) {
+ return String(value);
+ }
+ },
speakMessage(message, options = {}) {
const text = String(message || '').trim();
if (!text) {
@@ -299,6 +412,92 @@
console.warn('[stockPreparationDetail] 语音播报异常:', error);
}
},
+ normalizeUniScanResult(scanResult) {
+ if (!scanResult) {
+ return '';
+ }
+ if (typeof scanResult === 'string') {
+ return scanResult.trim();
+ }
+ if (typeof scanResult.result === 'string') {
+ return scanResult.result.trim();
+ }
+ if (Array.isArray(scanResult.result)) {
+ const firstResult = scanResult.result.find(item => item);
+ if (typeof firstResult === 'string') {
+ return firstResult.trim();
+ }
+ if (firstResult && typeof firstResult.data === 'string') {
+ return firstResult.data.trim();
+ }
+ }
+ if (typeof scanResult.data === 'string') {
+ return scanResult.data.trim();
+ }
+ return '';
+ },
+ normalizeScanCode(value) {
+ return String(value || '').replace(/\s+/g, '').toUpperCase();
+ },
+ extractItemBarcodeCandidates(item) {
+ const sourceFields = [
+ item?.barcode,
+ item?.barcodes,
+ item?.skuCode,
+ item?.sku_code,
+ item?.item_barcode,
+ item?.bar_code,
+ item?.item_code
+ ];
+ const result = [];
+ sourceFields.forEach(source => {
+ const list = Array.isArray(source) ? source : [source];
+ list.forEach(s => {
+ const text = String(s || '').trim();
+ if (!text) return;
+ text.split(/[;,,、|\s]+/)
+ .map(part => this.normalizeScanCode(part))
+ .filter(Boolean)
+ .forEach(part => result.push(part));
+ });
+ });
+ return Array.from(new Set(result));
+ },
+ handleBroadcastResult(result) {
+ const rawCode = this.normalizeUniScanResult(result);
+ if (!rawCode) return;
+ this.markItemScannedByCode(rawCode);
+ },
+ markItemScannedByCode(rawCode) {
+ if (!this.editing) return false;
+ const code = this.normalizeScanCode(rawCode);
+ if (!code) return false;
+ const matched = [];
+ this.editItems.forEach((it, idx) => {
+ if (this.extractItemBarcodeCandidates(it).includes(code)) {
+ matched.push(idx);
+ }
+ });
+ if (matched.length === 0) {
+ uni.showToast({ title: '无记录', icon: 'none' });
+ this.speakMessage('无记录');
+ return false;
+ }
+ let newlyScanned = 0;
+ matched.forEach(idx => {
+ if (!this.editItems[idx].scanned) {
+ this.editItems[idx].scanned = true;
+ newlyScanned++;
+ }
+ });
+ if (newlyScanned > 0) {
+ uni.showToast({ title: `已扫 ${newlyScanned} 个商品`, icon: 'none' });
+ this.speakMessage('数据一致');
+ } else {
+ uni.showToast({ title: '该条码对应商品已全部标记', icon: 'none' });
+ }
+ return true;
+ },
async fetchDetail() {
this.loading = true;
try {
@@ -407,6 +606,13 @@
item_name: it.item_name,
plan_qty: it.plan_qty,
pick_locations: it.pick_locations || [],
+ barcode: it.barcode,
+ barcodes: it.barcodes,
+ skuCode: it.skuCode,
+ sku_code: it.sku_code,
+ item_barcode: it.item_barcode,
+ bar_code: it.bar_code,
+ scanned: false,
boxes: (Array.isArray(it.boxes) && it.boxes.length > 0)
? it.boxes.map(b => ({ box_no: b.box_no || '', quantity: b.quantity || 0 }))
: []
@@ -436,6 +642,103 @@
this.editItems[idx].boxes.splice(bi, 1);
this.scheduleAutoSave();
},
+ openBatchBoxPanel(idx) {
+ if (!this.editItems[idx]) return;
+ this.batchBoxIdx = idx;
+ this.batchBoxForm = { totalBoxes: '', perBoxQty: '' };
+ this.showBatchBoxPanel = true;
+ },
+ handleBatchBoxCancel() {
+ this.showBatchBoxPanel = false;
+ this.batchBoxIdx = -1;
+ },
+ handleBatchBoxConfirm() {
+ const item = this.editItems[this.batchBoxIdx];
+ if (!item) {
+ this.handleBatchBoxCancel();
+ return;
+ }
+ const plan = Number(item.plan_qty || 0);
+ const totalBoxes = Number(this.batchBoxForm.totalBoxes);
+ const perBoxQty = Number(this.batchBoxForm.perBoxQty);
+ if (!Number.isInteger(totalBoxes) || totalBoxes < 1) {
+ uni.showToast({ title: '请输入有效的总箱数', icon: 'none' });
+ return;
+ }
+ if (!Number.isInteger(perBoxQty) || perBoxQty < 1) {
+ uni.showToast({ title: '请输入有效的每箱数量', icon: 'none' });
+ return;
+ }
+ const lastQty = plan - perBoxQty * (totalBoxes - 1);
+ if (lastQty <= 0) {
+ uni.showToast({ title: '每箱数量×箱数超过应拣数量', icon: 'none' });
+ return;
+ }
+ const existing = Array.isArray(item.boxes) ? item.boxes : [];
+ let startNo = 1;
+ existing.forEach(b => {
+ const n = Number(b.box_no);
+ if (Number.isFinite(n) && n >= startNo) startNo = n + 1;
+ });
+ const newBoxes = [];
+ for (let i = 0; i < totalBoxes; i++) {
+ const quantity = (i === totalBoxes - 1) ? lastQty : perBoxQty;
+ newBoxes.push({ box_no: String(startNo + i), quantity });
+ }
+ item.boxes = existing.concat(newBoxes);
+ this.scheduleAutoSave();
+ uni.showToast({ title: `已生成 ${newBoxes.length} 个箱号`, icon: 'none' });
+ this.handleBatchBoxCancel();
+ },
+ openBatchDeletePanel(idx) {
+ if (!this.editItems[idx]) return;
+ this.batchDeleteIdx = idx;
+ this.batchDeleteForm = { start: '', end: '' };
+ this.showBatchDeletePanel = true;
+ },
+ handleBatchDeleteCancel() {
+ this.showBatchDeletePanel = false;
+ this.batchDeleteIdx = -1;
+ },
+ handleBatchDeleteConfirm() {
+ const item = this.editItems[this.batchDeleteIdx];
+ if (!item) {
+ this.handleBatchDeleteCancel();
+ return;
+ }
+ const start = Number(this.batchDeleteForm.start);
+ const end = Number(this.batchDeleteForm.end);
+ if (!Number.isInteger(start) || start < 1) {
+ uni.showToast({ title: '请输入有效的起始箱号', icon: 'none' });
+ return;
+ }
+ if (!Number.isInteger(end) || end < start) {
+ uni.showToast({ title: '请输入有效的结束箱号', icon: 'none' });
+ return;
+ }
+ const boxes = Array.isArray(item.boxes) ? item.boxes : [];
+ const before = boxes.length;
+ item.boxes = boxes.filter(b => {
+ const n = Number(b.box_no);
+ return !(Number.isFinite(n) && n >= start && n <= end);
+ });
+ const removed = before - item.boxes.length;
+ this.scheduleAutoSave();
+ uni.showToast({ title: `已删除 ${removed} 个箱号`, icon: 'none' });
+ this.handleBatchDeleteCancel();
+ },
+ handleBatchDeleteAll() {
+ const item = this.editItems[this.batchDeleteIdx];
+ if (!item) {
+ this.handleBatchDeleteCancel();
+ return;
+ }
+ const removed = Array.isArray(item.boxes) ? item.boxes.length : 0;
+ item.boxes = [];
+ this.scheduleAutoSave();
+ uni.showToast({ title: `已清空 ${removed} 个箱号`, icon: 'none' });
+ this.handleBatchDeleteCancel();
+ },
buildPackingItems() {
const packingItems = [];
for (const it of this.editItems) {
@@ -925,6 +1228,17 @@
color: #303133;
}
+ .goods-item__scanned {
+ flex-shrink: 0;
+ margin-left: 12rpx;
+ padding: 2rpx 14rpx;
+ font-size: 36rpx;
+ line-height: 1.4;
+ color: #18a058;
+ background-color: #f0f9eb;
+ border-radius: 6rpx;
+ }
+
.goods-item__row {
display: flex;
align-items: center;
@@ -1083,6 +1397,12 @@
color: #f56c6c;
}
+ .box-actions {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
.box-add {
display: inline-block;
padding: 8rpx 20rpx;
@@ -1090,6 +1410,22 @@
border-radius: 8rpx;
}
+ .box-add--batch {
+ background-color: #f0f9eb;
+ }
+
+ .box-add--batch .box-add__text {
+ color: #67c23a;
+ }
+
+ .box-add--batch-del {
+ background-color: #fef0f0;
+ }
+
+ .box-add--batch-del .box-add__text {
+ color: #f56c6c;
+ }
+
.box-add__text {
font-size: 36rpx;
color: #2979ff;
@@ -1190,4 +1526,49 @@
background: #2979ff;
color: #ffffff;
}
+
+ .batch-dialog {
+ align-items: stretch;
+ }
+
+ .batch-form {
+ margin-top: 32rpx;
+ }
+
+ .batch-form-row {
+ display: flex;
+ align-items: center;
+ margin-bottom: 20rpx;
+ }
+
+ .batch-form-label {
+ flex-shrink: 0;
+ width: 160rpx;
+ font-size: 36rpx;
+ color: #303133;
+ }
+
+ .batch-form-input {
+ flex: 1;
+ min-width: 0;
+ height: 72rpx;
+ padding: 0 16rpx;
+ box-sizing: border-box;
+ font-size: 36rpx;
+ color: #303133;
+ background-color: #f8f8f8;
+ border: 1rpx solid #dcdfe6;
+ border-radius: 8rpx;
+ }
+
+ .batch-tip {
+ margin-top: 8rpx;
+ font-size: 28rpx;
+ line-height: 1.5;
+ color: #909399;
+ }
+
+ .batch-del-actions .confirm-btn:first-child {
+ margin-left: 0;
+ }