From 2c5b37eacbb6f493073f7c5ca7aedcbba8a15a22 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Tue, 31 Mar 2026 11:55:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81orderNo-releaseNo-sequenceNo[?= =?UTF-8?q?-transQty]=20=E6=A0=BC=E5=BC=8F=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../production-inbound/inboundRegister.vue | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/views/modules/production-inbound/inboundRegister.vue b/src/views/modules/production-inbound/inboundRegister.vue index 2bfc90b..b283a0e 100644 --- a/src/views/modules/production-inbound/inboundRegister.vue +++ b/src/views/modules/production-inbound/inboundRegister.vue @@ -205,7 +205,8 @@ export default { warehouseId: localStorage.getItem('selectedWarehouse'), fullscreenLoading: false, loadingText: '加载中...', - autoCalculate: false + autoCalculate: false, + issueQty: '' }; }, computed: { @@ -215,8 +216,12 @@ export default { return sum + Math.round(Number(item.qty) * 10000); }, 0); const sum = sumInCents / 10000; - this.inboundItem.transQty = sum; - return sum; + // 仅在已有包装记录时,才回写此次入库数量,避免把扫描带入的transQty覆盖为0 + if (this.handlingUnit.length > 0) { + this.inboundItem.transQty = sum; + return sum; + } + return parseFloat(this.inboundItem.transQty) || 0; }, huKey() { return `hu_shop_${this.inboundItem.orderNo}_${this.inboundItem.releaseNo}`; @@ -265,14 +270,21 @@ export default { this.loadingText = '搜索中...'; this.fullscreenLoading = true; - // 解析工单号:支持 "3038851" 或 "3038851-1-2" 格式 + // 解析工单号:支持 "3038851"、"3038851-1-2" 或 "3038851-1-2-1000" 格式 let orderNo = this.scanCode.trim(); let releaseNo = "*"; let sequenceNo = "*"; + this.issueQty = ''; - // 如果包含"-",则按照 orderNo-releaseNo-sequenceNo 格式解析 + // 如果包含"-",则按照 orderNo-releaseNo-sequenceNo[-transQty] 格式解析 const parts = orderNo.split('-'); - if (parts.length >= 2) { + if (parts.length === 4) { + // 结构: orderNo-releaseNo-sequenceNo-transQty + orderNo = parts[0]; + releaseNo = parts[1] || "*"; + sequenceNo = parts[2] || "*"; + this.issueQty = parts[3]; + } else if (parts.length >= 2) { orderNo = parts[0]; releaseNo = parts[1]; if (parts.length >= 3) { @@ -281,8 +293,6 @@ export default { } const requestData = { - ifsDBName: "IFST", - domainUserID: "CCL_WMS", ifsSiteID: this.site, ifsOrderNo: orderNo, ifsReleaseNo: releaseNo, @@ -296,6 +306,8 @@ export default { this.shopOrderList = data.data || [] if (this.shopOrderList.length === 0) { this.$message.warning('未找到匹配的工单'); + } else if (this.shopOrderList.length === 1) { + this.selectShopOrder(this.shopOrderList[0]); } } else { this.$message.error(data.msg || '查询失败'); @@ -360,7 +372,7 @@ export default { this.inboundItem = { ...row, - transQty: '', + transQty: this.issueQty || '', // 如果扫描码中包含transQty,则优先使用,否则为空 unCompleteQty: parseFloat(row.lotSize) - parseFloat(row.qtyComplete), sequenceNoNew: nextSequence, batchNo: `${row.orderNo}-${row.releaseNo}-${row.sequenceNo}-${nextSequence}`, @@ -417,8 +429,8 @@ export default { return; } - // 优先使用"此次入库数量",如果没有则使用"未完成数量" - let qtyToReceive = parseFloat(this.inboundItem.transQty) || 0; + // 优先使用扫描码中的transQty,其次使用页面上的此次入库数量,最后兜底未完成数量 + let qtyToReceive = parseFloat(this.issueQty) || parseFloat(this.inboundItem.transQty) || 0; if (qtyToReceive <= 0) { qtyToReceive = parseFloat(this.inboundItem.unCompleteQty) || 0; }