From e11b01a42209a6eecff945a6bca079622b4dcd8c Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Wed, 6 Nov 2024 16:42:23 +0800 Subject: [PATCH] =?UTF-8?q?YT-692=E9=87=87=E8=B4=AD=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E6=94=B6=E8=B4=A7=E5=BA=93=E5=8C=BA=E7=AE=A1=E7=90=86=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E4=B8=BA=E6=8C=89=E6=95=B0=E9=87=8F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8CPDA=E6=89=AB=E6=8F=8F=E6=A0=87=E7=AD=BE=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mycomponents/scan/winComScan.vue | 5 +- src/mycomponents/scan/winScanLocation.vue | 1 + .../inventoryMove/coms/comMoveRecord.vue | 8 +- .../inventoryMove/coms/okToHoldRecordPack.vue | 77 +++++++++- .../purchaseReceipt/job/receiptDetail.vue | 142 +++++++++++++++++- 5 files changed, 219 insertions(+), 14 deletions(-) diff --git a/src/mycomponents/scan/winComScan.vue b/src/mycomponents/scan/winComScan.vue index 979ae50c..f442f672 100644 --- a/src/mycomponents/scan/winComScan.vue +++ b/src/mycomponents/scan/winComScan.vue @@ -155,10 +155,11 @@ // title: '解析中...', // mask: true // }) + console.log(222) let that = this; // if(index==-1){ - // that.scanMsg =that.scanMsg + "\n"; - // } + // that.sc + console.log(that.scanMsg.includes('\n')) if (that.scanMsg.includes('\n')) { // that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; setTimeout(() => { diff --git a/src/mycomponents/scan/winScanLocation.vue b/src/mycomponents/scan/winScanLocation.vue index 68c18dfa..26e2b201 100644 --- a/src/mycomponents/scan/winScanLocation.vue +++ b/src/mycomponents/scan/winScanLocation.vue @@ -92,6 +92,7 @@ title: '扫描中...', mask: true }); + console.log(111,result) let label = result.label; if (label.barType === 'QRCode') { this.code = label.locationCode; diff --git a/src/pages/inventoryMove/coms/comMoveRecord.vue b/src/pages/inventoryMove/coms/comMoveRecord.vue index d4ca2eec..49af4c40 100644 --- a/src/pages/inventoryMove/coms/comMoveRecord.vue +++ b/src/pages/inventoryMove/coms/comMoveRecord.vue @@ -35,8 +35,8 @@ - - + + @@ -476,7 +476,9 @@ } calcHandleQty(this.detailSource); }, - fromLocationBlur(){ + fromLocationBlur(result){ + console.log('pooo',result) + this.$refs.scanFromLocationCode.getScanResult(result) // this.$refs.scanPopup. }, showErrorMessage(message) { diff --git a/src/pages/inventoryMove/coms/okToHoldRecordPack.vue b/src/pages/inventoryMove/coms/okToHoldRecordPack.vue index 9b4c50b5..0f210073 100644 --- a/src/pages/inventoryMove/coms/okToHoldRecordPack.vue +++ b/src/pages/inventoryMove/coms/okToHoldRecordPack.vue @@ -9,14 +9,14 @@ 来源库位: - + 零件: - + @@ -52,6 +52,11 @@ import { getBusinessType } from '@/common/record.js'; + + import { + getLabelInfo + } from '../../../common/label.js'; + export default { components: { @@ -111,10 +116,70 @@ } this.$emit("confirm",obj); }, - fromLocationBlur(){ - // this.$refs.scanLocationCode.openScanPopup() - console.log(this.fromLocationCode) - this.$emit("fromLocationBlur"); + fromLocationScanMsg(){ + this.scanMsg = this.fromLocationCode + this.handelScanMsg() + }, + itemCodeBlur(){ + this.scanMsg = this.itemCode + this.handelScanMsg() + }, + handelScanMsg() { + //点击了回车 + // uni.showLoading({ + // title: '解析中...', + // mask: true + // }) + let that = this; + console.log(that.scanMsg) + // if(index==-1){ + // that.scanMsg =that.scanMsg + "\n"; + // } + console.log(that.scanMsg.includes('\n')) + if (that.scanMsg.includes('\n')) { + // that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; + setTimeout(() => { + that.losefocus(); + let content = uni.$u.trim(that.scanMsg) + if (content == "") { + // that.getfocus(); + this.$refs.comMessage.showErrorMessage("扫描内容为空,请重新扫描", res => { + if (res) { + that.scanMsg = "" + that.getfocus(); + } + }) + return; + } + + if (that.isShowHistory) { + that.scanList.unshift(content); + } + + getLabelInfo(content, this.headerType, callback => { + // uni.hideLoading(); + let scanResult = callback; + scanResult.scanMessage = content + if (scanResult.success) { + // that.getfocus();//不能自动获取焦点 + that.$emit("fromLocationBlur", scanResult); + } else { + that.losefocus(); + this.$refs.comMessage.showErrorMessage(scanResult.message, res => { + if (res) { + that.getfocus(); + } + }) + } + }); + }, 200); + } + }, + losefocus() { + let that = this; + this.$nextTick(r => { + that.boxfocus = false; + }); }, }, watch: { diff --git a/src/pages/purchaseReceipt/job/receiptDetail.vue b/src/pages/purchaseReceipt/job/receiptDetail.vue index df6e75cc..a96f9c75 100644 --- a/src/pages/purchaseReceipt/job/receiptDetail.vue +++ b/src/pages/purchaseReceipt/job/receiptDetail.vue @@ -34,7 +34,7 @@ + v-if="managementType == 'BY_BATCH' || managementType =='BY_QUANTITY'"> @@ -317,8 +317,11 @@ }, getScanResult(result) { this.balanceInfo = result.balance - if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY' ){ + console.log(this.managementType) + if(this.managementType == 'BY_BATCH'){ this.getScanResultAfterBatch(result) + }else if(this.managementType == 'BY_QUANTITY' ){ + this.getScanResultAfterQuantity(result) }else{ this.getScanResultAfter(result) } @@ -559,6 +562,138 @@ this.showErrorMessage(e.message) } }, + // 数量扫码之后逻辑 + getScanResultAfterQuantity(result){ + try { + var itemCode = result.label.itemCode; + var detail = this.detailSource.find(r => r.itemCode == itemCode); + if (detail == undefined) { + this.showErrorMessage("物料号【" + itemCode + "】不在列表中") + return; + } + detail.scaned = true; + if (result.label.labelType == "ContainerLabel") { + var containerNumber = result.label.container; + var itemDetail = detail.subList.filter(r => r.containerNumber == containerNumber); + if (itemDetail.length == 0) { + this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】不在列表中") + } else { + if (itemDetail[0].scaned) { + this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】已经扫描") + } else { + itemDetail.forEach(item => { + item.scaned = true; + itemDetail.scanDate = new Date(); + item.handleQty = calc.add(item.handleQty,result.label.qty) + item.toLocationCode = this.toLocationCode; + }) + // calcHandleQty(this.detailSource); + this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 + this.continueScan() + this.$forceUpdate() + } + } + } else if (result.label.labelType == "PurchaseLabel") { + var packingNumber = result.package.number; + var parentpackingNumber = result.package.parentNumber; + var batch = result.label.batch; + var qty = result.label.qty; + var detail = this.detailSource.find(r => r.itemCode == itemCode); + console.log(8989,this.detailSource) + if (detail == undefined) { + this.showMessage("物料号【" + itemCode + "】不在列表中") + } else { + //物料在列表中 + // var itemDetail = detail.subList.find(r => r.batch == + // batch); + // if (itemDetail == undefined) { + // itemDetail = detail.subList.find(r => r.batch == + // batch); + + // if (itemDetail == undefined) { + // this.showMessage("批次【" + batch + "】不在列表中") + // } else { + // var pack = itemDetail.packList.find(p => + // p.batch == batch) + // if (pack == undefined) { + // this.showMessage("批次【" + batch + "】不在列表中") + // } else { + let isScan = false + const itemDetail = detail.subList[0] + let pack = detail.subList[0] && detail.subList[0].length>0 ?detail.subList[0] : {} + if(packingNumber){ + isScan = this.packingNumberList.some(item=>item == packingNumber) + }else{ + isScan = false + } + if (isScan) { + detail.subList[0].scanDate = new Date(); + // this.showMessage("箱码【" + packingNumber + "】已经扫描"); + + detail.subList[0].handleQty = calc.add(detail.subList[0].handleQty,result.label.qty) + } else { + this.packingNumberList.push(packingNumber) + detail.subList[0].scaned = true + detail.subList[0].scanDate = new Date(); + detail.subList[0].handleQty = Number(result.label.qty); + detail.subList[0].toLocationCode = this.toLocationCode; + detail.subList[0].labelQty = Number(result.label.qty); + } + // } + calcHandleQty(this.detailSource); + this.continueScan() + // itemDetail.packList[0] = detail.subList[0]; //按扫描信息排序 + this.$forceUpdate() + // } + + // } else { + // //扫描的是外包装,将包装集合全部扫描 + // var scanedLength = 0; + // itemDetail.packList.forEach(res => { + // if (res.scaned) { + // scanedLength++; + // } + // }) + // debugger + // let isScan = false + // if(packingNumber){ + // isScan = this.packingNumberList.some(item=>item == packingNumber) + // }else{ + // isScan = false + // } + // if (isScan) { + // itemDetail.scanDate = new Date(); + // // this.showMessage("箱码【" + packingNumber + "】已经扫描") + // itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) + // } else { + // this.packingNumberList.push(packingNumber) + // itemDetail.scaned = true; + // itemDetail.scanDate = new Date(); + // itemDetail.handleQty =itemDetail.handleQty ?itemDetail.handleQty:0 + // itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty) + // console.log(itemDetail.handleQty) + // itemDetail.toLocationCode = this.toLocationCode; + // itemDetail.labelQty = Number(result.label.qty); + // itemDetail.packList.forEach(pac => { + // pac.scaned = true + // pac.scanDate = new Date(); + // pac.handleQty = calc.add(pac.handleQty,result.label.qty); + // pac.toLocationCode = this.toLocationCode; + // }) + // detail.handleQty = itemDetail.handleQty + // this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序 + // this.continueScan() + // this.$forceUpdate() + // } + // calcHandleQty(this.detailSource); + // } + } + } + + } catch (e) { + this.showErrorMessage(e.message) + } + }, //继续扫描 continueScan() { this.scanCount = getScanCount(this.subList); @@ -714,7 +849,8 @@ var params = this.setParams(); let that = this - console.log(params) + console.log(877,params) + // return; purchaseReceiptJobSubmit(params).then(res => { if (res.data) { let isCheckPrint = getSwitchInfoByCode(this.switchCode)//是否显示上架指引单