diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index 92624f75..fffd929f 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -9,10 +9,18 @@ + + + @removePack="removePack" v-else> @@ -77,7 +85,8 @@ getBusinessType, createItemInfo, createDetailInfo, - calcHandleQty + calcHandleQty, + calcHandleQtyAdd } from '@/common/record.js'; import { @@ -97,6 +106,7 @@ import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' + import recordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' @@ -112,6 +122,7 @@ winScanLocation, winScanPackAndLocation, recordComDetailCard, + recordComDetailCardBatch, recordDetailCard, balanceSelect, winComScanBalance, @@ -137,7 +148,8 @@ show: false, positionInfo: "请选择生产线", resultData: {}, - itemCode: "" + itemCode: "", + managementType:'' }; }, onLoad(option) { @@ -192,8 +204,9 @@ }); }, - async getScanResult(result,managementType) { - if(managementType == "BY_BATCH" ||managementType == "BY_QUANTITY" ){ + async getScanResult(result,managementTypeParams) { + this.managementType = managementTypeParams + if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ this.setDataBatch(result); }else{ this.setData(result); @@ -356,11 +369,12 @@ newDetail.packUnit = pack.packUnit; newDetail.packQty = pack.packQty; newDetail.handleQty = 0 + newDetail.balanceQty =result.balance.qty; itemp.subList.push(newDetail); this.detailSource.push(itemp) this.itemCode = balance.itemCode; this.fromLocationCode = balance.locationCode - this.scanPopupGetFocus() + // this.scanPopupGetFocus() } else { var detail = item.subList.find(r => { @@ -418,6 +432,7 @@ newDetail.packQty = pack.packQty; newDetail.fromLocationCode=balance.locationCode newDetail.handleQty = 0 + newDetail.balanceQty =result.balance.qty; item.subList.push(newDetail); } }) @@ -430,32 +445,35 @@ newDetail.packUnit = pack.packUnit; newDetail.packQty = pack.packQty; newDetail.handleQty = 0 + newDetail.balanceQty =result.balance.qty; item.subList.push(newDetail); } } - this.scanPopupGetFocus() + // this.scanPopupGetFocus() } else { if (detail.scaned == true) { // this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") } } } - // calcHandleQty(this.detailSource); console.log(this.detailSource) - for (let item of this.detailSource) { - item.handleQty = new Decimal(0).toNumber(); - item.qty = new Decimal(0).toNumber(); - for (let detail of item.subList) { - if (detail != undefined) { - if (detail.scaned) { - item.handleQty = calc.add(result.label.qty, detail.handleQty) - detail.handleQty = calc.add(result.label.qty, detail.handleQty); - } - item.qty = calc.add(item.qty, detail.qty); - } - } - } + console.log(result.label) + calcHandleQtyAdd(this.detailSource, result.label); + // console.log(this.detailSource) + // for (let item of this.detailSource) { + // item.handleQty = new Decimal(0).toNumber(); + // item.qty = new Decimal(0).toNumber(); + // for (let detail of item.subList) { + // if (detail != undefined) { + // if (detail.scaned) { + // item.handleQty = calc.add(result.label.qty, detail.handleQty) + // detail.handleQty = calc.add(result.label.qty, detail.handleQty); + // } + // item.qty = calc.add(item.qty, detail.qty); + // } + // } + // } }, showErrorMessage(message) { @@ -595,6 +613,13 @@ ...this.setRecordParams() } console.log("提交参数", JSON.stringify(params)); + const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty) + if(isHaveItem){ + this.showErrorMessage(`物料号${isHaveItem.itemCode}`) + this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']') + uni.hideLoading() + return + } issueRecordSubmit(params).then(res => { uni.hideLoading() if (res.data) { @@ -637,6 +662,7 @@ // detail.toLocationCode = detail.toLocationCode submitItem.qty = detail.handleQty; submitItem.package = ""; + submitItem.balanceQty = detail.balanceQty; submitItem.recordList = [{ toInventoryStatus: detail.inventoryStatus, fromParentPackingNumber: detail.parentNumber, diff --git a/src/pages/putaway/record/putawayRecord.vue b/src/pages/putaway/record/putawayRecord.vue index ab989921..69841f91 100644 --- a/src/pages/putaway/record/putawayRecord.vue +++ b/src/pages/putaway/record/putawayRecord.vue @@ -171,8 +171,8 @@ methods: { getScanResult(result,managementType) { - this.managementType = managementType - if(managementType == "BY_BATCH" ||managementType == "BY_QUANTITY" ){ + this.managementType = managementTypeParams + if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ this. getScanResultAfterBatch(result) }else{ this. getScanResultAfter(result)