diff --git a/src/mycomponents/package/packageCard.vue b/src/mycomponents/package/packageCard.vue index 93a571b5..6c1f9269 100644 --- a/src/mycomponents/package/packageCard.vue +++ b/src/mycomponents/package/packageCard.vue @@ -6,7 +6,7 @@ - + diff --git a/src/mycomponents/scan/winScanPackAndLocation.vue b/src/mycomponents/scan/winScanPackAndLocation.vue index 08974039..75100eac 100644 --- a/src/mycomponents/scan/winScanPackAndLocation.vue +++ b/src/mycomponents/scan/winScanPackAndLocation.vue @@ -120,7 +120,11 @@ balanceFromInventoryStatuses: { //是否传fromInventoryStatuses type: Boolean, default: true - } + }, + toLocationCode: { + type: String, + default: "" + }, }, data() { return { @@ -209,8 +213,8 @@ this.inventoryStatus = getDirectoryItemArray(jobContent.outInventoryStatuses); //出库库存状态; //出库库存状态 this.fromLocationAreaTypeList = getDirectoryItemArray(jobContent.fromAreaTypes); //出库库存状态 uni.showLoading({ - title:"获取标签信息", - mask:true + title: "获取标签信息", + mask: true }) getLabelInfo(scanMessage, this.headerType, callback => { uni.hideLoading() @@ -308,7 +312,7 @@ // } }, - checkPackage(result) { + async checkPackage(result) { if (result.label != null) { this.scanResult = result; if (this.queryBalance == true) { @@ -317,7 +321,8 @@ // mask: true // }) // 采购上架任务--大哥让去掉 fromInventoryStatuses - getBalanceByManagementPrecisionByPacking(result.label, result.package, this.fromLocationCode, this + // 获取精度 + await getBalanceByManagementPrecisionByPacking(result.label, result.package, this.fromLocationCode, this .balanceFromInventoryStatuses ? this.fromInventoryStatuses : undefined, res => { uni.hideLoading(); @@ -365,9 +370,9 @@ }, //允许无库存 - allowNoneBalance(datas) { + async allowNoneBalance(datas) { if (datas.length == 0) { - this.packCallBack(null); + await this.packCallBack(null); } else { this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],已经查找到该包装的库存记录,请重新扫描', res => { this.packGetFocus(); @@ -440,7 +445,7 @@ this.$emit("getCountScanResult", data); }, - packCallBack(item) { + async packCallBack(item) { if (this.$refs.comscan) { this.$refs.comscan.clear(); } @@ -452,7 +457,12 @@ fromLocationCode: this.fromLocationCode, } this.packGetFocus(); - this.$emit("getResult", data); + // 如果管理精度是批次,给父组件多返回一个参数 + if (this.managementPrecision == 'BY_BATCH') { + this.$emit("getResult", data, this.managementPrecision); + } else { + this.$emit("getResult", data); + } }, packGetFocus() { @@ -476,9 +486,9 @@ let condition = '按照以下条件:\n'; let label = this.scanResult.label; var isShowStatus = this.balanceFromInventoryStatuses ? this.fromInventoryStatuses : undefined - let status="" + let status = "" if (isShowStatus) { - status = getInventoryStatusDesc(isShowStatus); + status = getInventoryStatusDesc(isShowStatus); } switch (this.managementPrecision) { diff --git a/src/pages/purchaseReceipt/job/receiptDetail.vue b/src/pages/purchaseReceipt/job/receiptDetail.vue index 5034b1ad..a82b2bcd 100644 --- a/src/pages/purchaseReceipt/job/receiptDetail.vue +++ b/src/pages/purchaseReceipt/job/receiptDetail.vue @@ -26,14 +26,18 @@ :isShowEdit="false"> --> - + - + + + + @@ -119,6 +123,7 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue' import comReceiptDetailCard from '@/pages/purchaseReceipt/coms/comReceiptDetailCard.vue' + import comReceiptDetailCardBacth from '@/pages/purchaseReceipt/coms/comReceiptDetailCardBacth.vue' import jobTopAsn from '@/mycomponents/job/jobTopAsn.vue' // import print from '@/mycomponents/print/print.vue' import { @@ -136,7 +141,8 @@ winScanPack, comReceiptDetailCard, locationCompare, - jobTopAsn, + jobTopAsn, + comReceiptDetailCardBacth // print }, data() { @@ -152,7 +158,8 @@ jobToLocationCode: "", toLocationInfo: {}, businessTypeInfo: {}, - managementList: [], + managementList: [], + managementType: '', //管理精度 jobStatus: "", isAllReceived: false, operation: '', @@ -267,6 +274,19 @@ that.toLocationCode = that.jobToLocationCode; } that.isAllReceived = false; + + //获取管理模式,封装参数 + var itemCodes = [] + this.detailSource.forEach(item => { + itemCodes.push(item.itemCode) + }) + getManagementPrecisions(itemCodes, that.jobToLocationCode, res => { + if (res.success) { + this.managementList = res.list; + this.managementType = this.managementList.some(item => item.ManagementPrecision == + 'BY_BATCH') ? 'BY_BATCH' : '' + } + }) // if (uni.getStorageSync('purchaseReceiptDetailPointParams')) { // const purchaseReceiptDetailPointParams = uni.getStorageSync( // 'purchaseReceiptDetailPointParams') @@ -462,10 +482,10 @@ } else { //不允许部分提交,提示 this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { - if (res) { - this.openScanPopup(); - } - }); + if (res) { + this.openScanPopup(); + } + }); } } @@ -515,7 +535,7 @@ if (res.success) { this.managementList = res.list; var params = this.setParams(); - let that =this + let that = this purchaseReceiptJobSubmit(params).then(res => { if (res.data) { let isCheckPrint = getSwitchInfoByCode(this.switchCode) @@ -524,7 +544,7 @@ // this.showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number) uni.redirectTo({ - url: '/pages/pointPutawayJob/index?number='+that.jobContent.number + url: '/pages/pointPutawayJob/index?number=' + that.jobContent.number }) } else { // if (res.data == '打印任务已发送,等待打印机处理!') { @@ -582,7 +602,8 @@ } uni.hideLoading() uni.redirectTo({ - url: '/pages/pointPutawayJob/index?number='+that.jobContent.number+'&data=' + + url: '/pages/pointPutawayJob/index?number=' + that.jobContent.number + + '&data=' + encodeURIComponent(JSON.stringify(dataParams)) }) } @@ -627,7 +648,9 @@ }) var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, detail.packingNumber, detail.batch); - detail.toPackingNumber = info.packingNumber; + detail.toPackingNumber = info.packingNumber; + detail.packingNumber = info.packingNumber; + detail.formPackingNumber = info.packingNumber; detail.toBatch = info.batch; subList.push(detail) }) @@ -711,7 +734,7 @@ showMessage(message) { - if(this.$refs.scanPopup){ + if (this.$refs.scanPopup) { this.$refs.scanPopup.losefocus(); } setTimeout(r => { @@ -724,7 +747,7 @@ }, showErrorMessage(message) { - if(this.$refs.scanPopup){ + if (this.$refs.scanPopup) { this.$refs.scanPopup.losefocus(); } setTimeout(r => { diff --git a/src/pages/putaway/job/putawayDetail.vue b/src/pages/putaway/job/putawayDetail.vue index 5c5591d0..b298b7c0 100644 --- a/src/pages/putaway/job/putawayDetail.vue +++ b/src/pages/putaway/job/putawayDetail.vue @@ -15,11 +15,15 @@ - + + + + + @@ -27,8 +31,7 @@ - + --> - + @@ -88,6 +91,7 @@ import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import comJobDetailCard from "@/mycomponents/detail/comJobDetailCard.vue" + import comJobDetailCardBatch from "@/mycomponents/detail/comJobDetailCardBatch.vue" import locationCompare from '@/mycomponents/location/locationCompare.vue' import jobTop from '@/mycomponents/job/jobTop.vue' @@ -98,7 +102,8 @@ winScanPackAndLocation, locationCompare, comJobDetailCard, - jobTop + jobTop, + comJobDetailCardBatch }, data() { return { @@ -114,7 +119,8 @@ jobStatus: "", jobToLocationCode: "", isCheckLocation: false, - scanMessage: "" + scanMessage: "", + managementType: '' //储存扫描后的管理精度 }; }, onLoad(option) { @@ -210,6 +216,19 @@ } else { that.toLocationCode = that.jobToLocationCode; } + //获取管理模式,封装参数 + var itemCodes = [] + this.detailSource.forEach(item => { + itemCodes.push(item.itemCode) + item.scaned = false + }) + getManagementPrecisions(itemCodes, that.jobToLocationCode, res => { + if (res.success) { + this.managementList = res.list; + this.managementType = this.managementList.some(item => item.ManagementPrecision == + 'BY_BATCH') ? 'BY_BATCH' : '' + } + }) //外部进入详情,如果有扫描信息,模拟自动扫描 if (this.scanMessage) { this.openScanPopupSimulate(this.scanMessage) @@ -256,7 +275,7 @@ updateData() { console.log("updateData") // this.calcHandleQty(); - calcTreeHandleQty(this.detailSource) + // calcTreeHandleQty(this.detailSource) }, //模拟扫描功能 openScanPopupSimulate(message) { @@ -307,8 +326,9 @@ this.$refs.scanPopup.closeScanPopup(); }, - getScanResult(result) { + getScanResult(result, managementPrecision) { try { + this.managementType = managementPrecision var packingNumber = result.label.packingNumber; var batch = result.label.batch; var qty = result.label.qty; @@ -326,88 +346,180 @@ if (detail == undefined) { this.showErrorMessage("物料号【" + itemCode + "】不在列表中") } else { - var itemDetail = detail.subList.find(r => { - return r.packingNumber == packingNumber && - r.batch == batch && - r.fromLocationCode == result.fromLocationCode - }) + detail.scaned = true + if (this.managementType == 'BY_BATCH') { + this.verificationBatch(detail, packingNumber, batch, qty, itemCode, locationCode, result) + } else { - if (itemDetail == undefined) { - var isExit; - for (let subItem of detail.subList) { - var item; - for (let pack of subItem.packList) { - if (pack.packingNumber == packingNumber && - pack.batch == batch) { - item = pack; - isExit = pack; - break; + var itemDetail = detail.subList.find(r => { + return r.packingNumber == packingNumber && + r.batch == batch && + r.fromLocationCode == result.fromLocationCode + }) + + if (itemDetail == undefined) { + var isExit; + for (let subItem of detail.subList) { + var item; + for (let pack of subItem.packList) { + if (pack.packingNumber == packingNumber && + pack.batch == batch) { + item = pack; + isExit = pack; + break; + } + } + if (item != undefined) { + subItem.scaned = true + subItem.handleQty = 0; + item = undefined } } - if (item != undefined) { - subItem.scaned = true - subItem.handleQty = 0; - item = undefined - } - } - if (isExit == undefined) { - this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result - .fromLocationCode + "】不在列表中") - } else { - if (!isExit.cancleScanedHiht && isExit.scaned) { - this.showMessage("箱码【" + packingNumber + "】已经扫描") + if (isExit == undefined) { + this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result + .fromLocationCode + "】不在列表中") } else { - isExit.scaned = true - let qty = 0; - if (result.balance != null) { - qty = Number(result.balance.qty); + if (!isExit.cancleScanedHiht && isExit.scaned) { + this.showMessage("箱码【" + packingNumber + "】已经扫描") } else { - qty = Number(result.label.qty); + isExit.scaned = true + let qty = 0; + if (result.balance != null) { + qty = Number(result.balance.qty); + } else { + qty = Number(result.label.qty); + } + + isExit.handleQty = Number(result.label.qty); + isExit.toLocationCode = this.toLocationCode; } - - isExit.handleQty = Number(result.label.qty); - isExit.toLocationCode = this.toLocationCode; - } - } - calcTreeHandleQty(this.detailSource); - this.continueScan() - this.$forceUpdate() - } else { - var scanedLength = 0; - itemDetail.packList.forEach(res => { - if (res.scaned) { - scanedLength++; } - }) - - //大哥让加的 - itemDetail.fromInventoryStatus = result.balance.inventoryStatus; - - if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList - .length) { - this.showMessage("箱码【" + packingNumber + "】已经扫描") - } else { - itemDetail.scaned = true; - this.detailSource[0].subList.sort(compareAsc('scaned')); //按扫描信息排序 - itemDetail.handleQty = result.label.qty; - // itemDetail.toInventoryStatus = "OK" - itemDetail.packList.forEach(pac => { - pac.scaned = true - pac.handleQty = Number(pac.qty); - pac.toLocationCode = this.toLocationCode; - }) - calcTreeHandleQty(this.detailSource); this.continueScan() this.$forceUpdate() + } else { + var scanedLength = 0; + itemDetail.packList.forEach(res => { + if (res.scaned) { + scanedLength++; + } + }) + + //大哥让加的 + itemDetail.fromInventoryStatus = result.balance.inventoryStatus; + + if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList + .length) { + this.showMessage("箱码【" + packingNumber + "】已经扫描") + } else { + itemDetail.scaned = true; + this.detailSource[0].subList.sort(compareAsc('scaned')); //按扫描信息排序 + itemDetail.handleQty = result.label.qty; + // itemDetail.toInventoryStatus = "OK" + itemDetail.packList.forEach(pac => { + pac.scaned = true + pac.handleQty = Number(pac.qty); + pac.toLocationCode = this.toLocationCode; + }) + + calcTreeHandleQty(this.detailSource); + this.continueScan() + this.$forceUpdate() + } } } } + if (this.managementType == 'BY_BATCH') { + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + detail.packingNumber = '' + }) + }) + } } catch (e) { this.showMessage(e.message) } }, - + // 按批次的时候校验 代码和按包装的代码基本一致,只不过是校验提示不一致 + verificationBatch(detail,packingNumber,batch,qty,itemCode,locationCode,result){ + var itemDetail = detail.subList.find(r => { + return r.batch == batch && + r.fromLocationCode == result.fromLocationCode + }) + + if (itemDetail == undefined) { + var isExit; + for (let subItem of detail.subList) { + var item; + for (let pack of subItem.packList) { + if (pack.batch == batch) { + item = pack; + isExit = pack; + break; + } + } + if (item != undefined) { + subItem.scaned = true + subItem.handleQty = 0; + item = undefined + } + } + + if (isExit == undefined) { + this.showErrorMessage("批次【" + batch + "】库位【" + result + .fromLocationCode + "】不在列表中") + } else { + if (!isExit.cancleScanedHiht && isExit.scaned) { + this.showMessage("批次【" + batch + "】已经扫描") + } else { + isExit.scaned = true + let qty = 0; + if (result.balance != null) { + qty = Number(result.balance.qty); + } else { + qty = Number(result.label.qty); + } + + isExit.handleQty = Number(result.label.qty); + isExit.toLocationCode = this.toLocationCode; + } + } + calcTreeHandleQty(this.detailSource); + this.continueScan() + this.$forceUpdate() + } else { + var scanedLength = 0; + itemDetail.packList.forEach(res => { + if (res.scaned) { + scanedLength++; + } + }) + + //大哥让加的 + itemDetail.fromInventoryStatus = result.balance.inventoryStatus; + + if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList + .length) { + // this.showMessage("箱码【" + packingNumber + "】已经扫描") + this.showMessage("批次【" + batch + "】已经扫描") + } else { + itemDetail.scaned = true; + this.detailSource[0].subList.sort(compareAsc('scaned')); //按扫描信息排序 + itemDetail.handleQty = result.label.qty; + // itemDetail.toInventoryStatus = "OK" + itemDetail.packList.forEach(pac => { + pac.scaned = true + pac.handleQty = Number(pac.qty); + pac.toLocationCode = this.toLocationCode; + }) + + calcTreeHandleQty(this.detailSource); + this.continueScan() + this.$forceUpdate() + } + } + + }, scanLocationCode(location, code) { this.toLocationCode = code this.detailSource.forEach(item => { @@ -516,8 +628,10 @@ item.subList.forEach(detail => { if (detail.scaned) { var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, - detail.packingNumber, detail.batch); + detail.packingNumber, detail.batch); detail.toPackingNumber = info.packingNumber; + detail.packingNumber = info.packingNumber; + detail.fromPackingNumber = info.packingNumber; detail.toBatch = info.batch; detail.toContainerNumber = '';