From 93aa9012a70752773a64d66ab6289defa5e7baa0 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Tue, 29 Oct 2024 14:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E4=B8=8A=E6=9E=B6=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/record.js | 2 - .../record/recordComDetailCardBatch.vue | 225 ++++++++++++++++++ src/pages/putaway/record/putawayRecord.vue | 117 ++++++++- 3 files changed, 334 insertions(+), 10 deletions(-) create mode 100644 src/mycomponents/record/recordComDetailCardBatch.vue diff --git a/src/common/record.js b/src/common/record.js index 905b0501..10c6e606 100644 --- a/src/common/record.js +++ b/src/common/record.js @@ -81,8 +81,6 @@ export function calcHandleQty(detailSource) { } //添加数量 export function calcHandleQtyAdd(detailSource,label) { - console.log(label.qty) - console.log(detailSource) for (let item of detailSource) { item.handleQty = item.handleQty || new Decimal(0).toNumber(); item.qty = item.qty|| new Decimal(0).toNumber(); diff --git a/src/mycomponents/record/recordComDetailCardBatch.vue b/src/mycomponents/record/recordComDetailCardBatch.vue new file mode 100644 index 00000000..cb5eaf75 --- /dev/null +++ b/src/mycomponents/record/recordComDetailCardBatch.vue @@ -0,0 +1,225 @@ + + + + + \ No newline at end of file diff --git a/src/pages/putaway/record/putawayRecord.vue b/src/pages/putaway/record/putawayRecord.vue index 23d62c41..ab989921 100644 --- a/src/pages/putaway/record/putawayRecord.vue +++ b/src/pages/putaway/record/putawayRecord.vue @@ -15,12 +15,21 @@ + + + @removePack="removePack" + v-else> @@ -81,7 +90,8 @@ getBusinessType, createItemInfo, createDetailInfo, - calcHandleQty + calcHandleQty, + calcHandleQtyAdd } from '@/common/record.js'; import { @@ -97,6 +107,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' export default { components: { @@ -106,7 +117,8 @@ comBlankView, winScanLocation, winScanPackAndLocation, - recordComDetailCard + recordComDetailCard, + recordComDetailCardBatch }, data() { return { @@ -125,6 +137,7 @@ fromWarehouseCode: '', //来源仓库 businessTypeCode: "PurchasePutaway", editItem:{}, + managementType:'' }; }, onLoad(option) { @@ -157,7 +170,88 @@ mounted() {}, methods: { - getScanResult(result) { + getScanResult(result,managementType) { + this.managementType = managementType + if(managementType == "BY_BATCH" ||managementType == "BY_QUANTITY" ){ + this. getScanResultAfterBatch(result) + }else{ + this. getScanResultAfter(result) + } + + }, + getScanResultAfterBatch(result){ + let balance = result.balance; + let label = result.label; + let pack = result.package; + let poLine =label.poLine; + let poNumber =label.poNumber; + let supplierCode=label.supplierCode; + var item = this.detailSource.find(res => { + if (res.itemCode == balance.itemCode) { + return res + } + }) + if (this.fromWarehouseCode == '') { + this.fromWarehouseCode = balance.warehouseCode; + } + if (item == undefined) { + // 获取推荐库位 + this.getRecommendLocation(balance, pack, toLocation => { + var itemp = createItemInfo(balance, pack); + itemp.toLocationCode = toLocation.locationCode; + let newDetail = createDetailInfo(balance, pack); // + newDetail.toLocationCode = toLocation.locationCode; + newDetail.toWarehouseCode = toLocation.toWarehouseCode; + newDetail.poLine=poLine; + newDetail.poNumber=poNumber; + newDetail.supplierCode=supplierCode; + newDetail.fromInventoryStatus = balance.inventoryStatus; + newDetail.handleQty =0; + newDetail.balanceQty =result.balance.qty; + itemp.subList.push(newDetail); + this.detailSource.push(itemp) + calcHandleQtyAdd(this.detailSource,result.label); + }) + + } else { + var detail = item.subList.find(r => { + if ( + r.batch == balance.batch && + r.locationCode == balance.locationCode && + r.inventoryStatus == balance.inventoryStatus) { + return r; + } + }) + if (detail == undefined) { + this.getRecommendLocation(balance, pack, toLocation => { + let newDetail = createDetailInfo(balance, pack); + newDetail.toLocationCode = toLocation.locationCode; + newDetail.toWarehouseCode = toLocation.toWarehouseCode; + newDetail.poLine=poLine; + newDetail.poNumber=poNumber; + newDetail.supplierCode=supplierCode; + newDetail.fromInventoryStatus = balance.inventoryStatus; + newDetail.handleQty =0; + newDetail.balanceQty =result.balance.qty; + if(item.subList&&item.subList.length>0){ + if(item.subList[0].batch!=newDetail.batch){ + this.showErrorMessage("扫描的批次是["+newDetail.batch+"],请扫描["+item.subList[0].batch+"的批次的箱码") + } + }else { + item.subList.push(newDetail); + calcHandleQtyAdd(this.detailSource,result.label); + } + }); + } else { + if (detail.scaned == true) { + calcHandleQtyAdd(this.detailSource,result.label); + // this.showErrorMessage( "批次[" + balance.batch + "]重复扫描") + } + } + } + + }, + getScanResultAfter(result){ let balance = result.balance; let label = result.label; let pack = result.package; @@ -189,7 +283,7 @@ this.detailSource.push(itemp) calcHandleQty(this.detailSource); }) - + } else { var detail = item.subList.find(r => { if (r.packingNumber == balance.packingNumber && @@ -225,7 +319,6 @@ } }, - //获取推荐库位 getRecommendLocation(balance, pack, callback) { uni.showLoading({ @@ -344,8 +437,14 @@ if (res.success) { this.managementList = res.list; var params = this.setRecordParams() - console.log("提交参数", JSON.stringify(params)); - + console.log("提交参数", 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 + } putawayRecordSubmit(params).then(res => { uni.hideLoading() if (res.data) { @@ -415,6 +514,8 @@ submitItem.fromLocationCode = detail.locationCode; submitItem.toLocationCode = detail.toLocationCode; + submitItem.balanceQty = detail.balanceQty; + submitItem.itemName = item.itemName; // detail.toInventoryStatus = detail.inventoryStatus