|
|
@@ -986,7 +986,6 @@
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
|
|
import BigNumber from 'bignumber.js';
|
|
|
import headList from '@/components/headList';
|
|
|
- import { decryptCode } from '@/utils/crypto';
|
|
|
import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
|
|
|
// import dictMixins from '@/mixins/dictMixins';
|
|
|
@@ -1259,7 +1258,7 @@
|
|
|
|
|
|
if (e.key === 'Enter') {
|
|
|
if (this._scanning && this.scanBuffer.length > 3) {
|
|
|
- this.processScanCode(decryptCode(this.scanBuffer));
|
|
|
+ this.processScanCode(this.scanBuffer);
|
|
|
// 扫码枪结束,吞掉这次 Enter,避免触发表单提交/单元格回车跳转
|
|
|
e.preventDefault();
|
|
|
e.stopPropagation();
|
|
|
@@ -1302,7 +1301,7 @@
|
|
|
.trim();
|
|
|
console.log('扫码粘贴事件:', text);
|
|
|
if (text.length >= 3) {
|
|
|
- this.processScanCode(decryptCode(text));
|
|
|
+ this.processScanCode(text);
|
|
|
}
|
|
|
},
|
|
|
// 处理扫码结果:先匹配产品信息,再匹配包装明细
|
|
|
@@ -1312,7 +1311,56 @@
|
|
|
processScanCode(code) {
|
|
|
console.log('扫描条码:', code);
|
|
|
|
|
|
- // 1. 在产品信息表格按 产品编码-批次号 匹配(二维码由产品编码和批号用-拼接)
|
|
|
+ // 新格式(非 jobBom):以 ";" 分隔的 8 段
|
|
|
+ // productCode;partCode;partName;batchNo;originalBatchNo;certificateNo;originalCertificateNo;feedQuantity
|
|
|
+ if (code.includes(';')) {
|
|
|
+ const segs = code.split(';');
|
|
|
+ const partCode = segs[1] || '';
|
|
|
+ const batchNo = segs[3] || '';
|
|
|
+ const certificateNo = segs[5] || '';
|
|
|
+ console.log('扫码新格式匹配条件:', {
|
|
|
+ partCode,
|
|
|
+ batchNo,
|
|
|
+ certificateNo
|
|
|
+ });
|
|
|
+
|
|
|
+ // 1. 在产品信息表格按 产品编码 + 批次号 匹配
|
|
|
+ const productIndex = this.productList.findIndex(
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode &&
|
|
|
+ item.batchNo &&
|
|
|
+ item.categoryCode === partCode &&
|
|
|
+ item.batchNo === batchNo
|
|
|
+ );
|
|
|
+ if (productIndex > -1) {
|
|
|
+ this.productList[productIndex].confirmStatus = 1;
|
|
|
+ this.$message.success(
|
|
|
+ `产品信息匹配成功:${this.productList[productIndex].categoryCode}-${this.productList[productIndex].batchNo}`
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 在包装明细按 产品编码 + 批次号(+ 合格证号) 匹配
|
|
|
+ const packingIndex = this.packingList.findIndex(
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode === partCode &&
|
|
|
+ item.batchNo === batchNo &&
|
|
|
+ (!certificateNo ||
|
|
|
+ !item.certificateNo ||
|
|
|
+ item.certificateNo === certificateNo)
|
|
|
+ );
|
|
|
+ if (packingIndex > -1) {
|
|
|
+ this.packingList[packingIndex].confirmStatus = 1;
|
|
|
+ this.$message.success(`包装明细匹配成功:${code}`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$message.warning(`未匹配到对应数据:${code}`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 旧格式(jobBom):以 "-" 分隔
|
|
|
+ // 1. 在产品信息表格按 产品编码-批次号 匹配
|
|
|
const productIndex = this.productList.findIndex(
|
|
|
(item) =>
|
|
|
item.categoryCode &&
|