From 4d0fe253aa6244533da77a33343507f518927d78 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Fri, 22 Nov 2024 11:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9A=94=E7=A6=BB=E8=BD=AC?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/directory.js | 19 +++ src/common/record.js | 6 +- .../inventoryMove/coms/comMoveRecord.vue | 115 +++++++++++++----- 3 files changed, 107 insertions(+), 33 deletions(-) diff --git a/src/common/directory.js b/src/common/directory.js index 377e99fe..1903a950 100644 --- a/src/common/directory.js +++ b/src/common/directory.js @@ -211,6 +211,18 @@ export function getListItemTypeDesc(list) { return desc; } +//获取物品状态(多个) +export function getListItemStatusDesc(list) { + let desc = ''; + list.forEach(res => { + desc += getItemStateInfo(res).label + "," + }) + desc = desc.slice(0, -1); + return desc; +} + + + //获取物品类型 export function getItemTypeInfo(value) { var resultInfo = ""; @@ -311,6 +323,13 @@ export function getItemTypeName(value) { return location == '' ? value : location.label; } +//获取物品状态名称 +export function getItemStatusName(value) { + let location = getItemStateInfo(value); + + return location == '' ? value : location.label; +} + //获取库位类型名称 export function getLocationTypeName(value) { diff --git a/src/common/record.js b/src/common/record.js index 02c4dac7..c6b44261 100644 --- a/src/common/record.js +++ b/src/common/record.js @@ -151,7 +151,8 @@ export function getBusinessType(typeCode, callback) { businessType: '', fromLocationAreaTypeList: '', toLocationAreaTypeList: '', - itemCodeTypeList: "", + itemTypeList: "", + itemStatusList:"", useOnTheWay: "FALSE", fromInventoryStatuses: '', toInventoryStatuses: '', @@ -162,7 +163,8 @@ export function getBusinessType(typeCode, callback) { result.businessType = res.data.list[0]; result.fromLocationAreaTypeList = getDirectoryItemArray(res.data.list[0].outAreaTypes); result.toLocationAreaTypeList = getDirectoryItemArray(res.data.list[0].inAreaTypes); - result.itemCodeTypeList = getDirectoryItemArray(res.data.list[0].itemTypes) + result.itemTypeList = getDirectoryItemArray(res.data.list[0].itemTypes) + result.itemStatusList =getDirectoryItemArray(res.data.list[0].itemStatuses) result.fromInventoryStatuses = res.data.list[0].outInventoryStatuses; result.toInventoryStatuses = res.data.list[0].inInventoryStatuses; result.useOnTheWay = res.data.list[0].useOnTheWay diff --git a/src/pages/inventoryMove/coms/comMoveRecord.vue b/src/pages/inventoryMove/coms/comMoveRecord.vue index c0de0d71..63fd55c6 100644 --- a/src/pages/inventoryMove/coms/comMoveRecord.vue +++ b/src/pages/inventoryMove/coms/comMoveRecord.vue @@ -36,13 +36,13 @@ + @onConfirm='okToHoldRecordPackConfirm' @getInputMsgResult="getInputMsgResult"> + @@ -57,9 +57,6 @@ import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import okToHoldRecordPack from '@/pages/inventoryMove/coms/okToHoldRecordPack.vue' - import { - getInventoryStatusName - } from '@/common/directory.js'; import { inventoryMoveRecordSubmit, getBasicLocationByCode, @@ -69,8 +66,12 @@ import { getDirectoryItemArray, getItemTypeName, + getInventoryStatusName, checkDirectoryItemExist, - getListItemTypeDesc + getListItemTypeDesc, + getListItemStatusDesc, + getItemStatusName, + getInventoryStatusDesc } from '@/common/directory.js'; import { @@ -104,7 +105,7 @@ comBlankView, winScanLocation, winScanPackAndLocation, - okToHoldRecordPack + okToHoldRecordPack, }, props: { // fromInventoryStatus: { @@ -155,7 +156,9 @@ dataContent: {}, fromLocationAreaTypeList: [], toLocationAreaTypeList: [], - itemCodeTypeList: [], + itemTypeList: [], + itemStatusList: [], + fromInventoryStatuses:[], isShowEditLocation: false, isJustReplay: true, //是否只是回显,不走库存余额接口 fromWarehouseCode: "" @@ -166,9 +169,11 @@ getBusinessType(this.businessTypeCode, res => { if (res.success) { this.businessType = res.businessType; - this.itemCodeTypeList = res.itemCodeTypeList; + this.itemTypeList = res.itemTypeList; + this.itemStatusList = res.itemStatusList; this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; this.toLocationAreaTypeList = res.toLocationAreaTypeList; + this.fromInventoryStatuses =getDirectoryItemArray(res.fromInventoryStatuses); this.showPopup() } else { this.showErrorMessage(res.message) @@ -288,17 +293,46 @@ this.toLocationInfo = location; }, getScanResult(result, managementTypeParams) { - this.fromWarehouseCode =result.fromWarehouseCode + this.fromWarehouseCode = result.fromWarehouseCode this.managementType = managementTypeParams if (this.showOnePop) { if (this.isJustReplay) { - this.$refs.okToHoldRecordPackRef.itemCode = result.label.itemCode - this.$refs.okToHoldRecordPackRef.batch = result.label.batch - this.$refs.okToHoldRecordPackRef.uom = result.balance?result.balance.uom:"" - this.getResult = result //存储接受的结果 - this.$refs.scanPopup.closeScanPopup() + this.checkItemCode(result.label.itemCode, callBack => { + if (callBack) { + var itemType = callBack.itemType + var itemStatus = callBack.itemStatus + if (checkDirectoryItemExist(this.itemTypeList, itemType)) { + if (checkDirectoryItemExist(this.itemStatusList, itemStatus)) { + this.$refs.okToHoldRecordPackRef.itemCode = result.label.itemCode + this.$refs.okToHoldRecordPackRef.batch = result.label.batch + this.$refs.okToHoldRecordPackRef.uom = result.balance ? result.balance.uom : "" + this.getResult = result //存储接受的结果 + this.$refs.scanPopup.closeScanPopup() + } else { + this.$refs.okToHoldRecordPackRef.itemCode = '' + var hint = getListItemStatusDesc(this.itemStatusList); + this.showErrorMessage("扫描物料[" + result.label.itemCode + "]是[" + + getItemStatusName(itemStatus) + "],需要的物料状态是[" + hint + "]") + } + + } else { + this.$refs.okToHoldRecordPackRef.itemCode = '' + var hint = getListItemTypeDesc(this.itemTypeList); + this.showErrorMessage("扫描物料[" + result.label.itemCode + "]是[" + + getItemTypeName(callBack) + "],需要的物料类型是[" + hint + "]") + } + + } else { + this.$refs.okToHoldRecordPackRef.itemCode = '' + this.showErrorMessage('未查找到物料【' + result.label.itemCode + '】'); + } + }) + + } else { this.getScanResultAfterBatch(result, managementTypeParams) + + } } else { if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") { @@ -323,7 +357,7 @@ this.$refs.comMessage.showErrorMessage('请输入数量'); return; } - + this.getResult = this.getResult ? this.getResult : { label: {}, fromLocationCode: '' @@ -336,12 +370,16 @@ this.$refs.scanPopup.getScanResult(this.getResult, this.businessType) }, - //checkItemCode checkItemCode(itemCode, callBack) { getBasicItemByCode(itemCode).then(res => { if (res.data.list.length > 0) { var itemType = res.data.list[0].type - callBack(itemType) + var itemStatus = res.data.list[0].status + var info = { + itemType: itemType, + itemStatus: itemStatus + } + callBack(info) } else { callBack(null) } @@ -350,14 +388,17 @@ callBack(null) }) }, - - isInItemCodeTypeList(itemType) { - var item = this.itemCodeTypeList.find(res => res == itemType) - - if (item = undefined) { - return false - } - return true + + checkInventoryStatus(result,inventoryStatus) { + var isPass=true; + if (!checkDirectoryItemExist(this.fromInventoryStatuses, inventoryStatus)) { + isPass=false + var hint = getInventoryStatusDesc(this.fromInventoryStatuses); + this.showErrorMessage("查询库存是[" + + getInventoryStatusName(inventoryStatus) + "],需要的库存状态是[" + hint + "]") + + } + return isPass; }, clearFromLocationCode() { @@ -426,6 +467,9 @@ calcHandleQty(this.detailSource); }, getScanResultAfterBatch(result, managementTypeParams) { + if(!this.checkInventoryStatus(result,result.balance.inventoryStatus)){ + return; + } var balance = result.balance; this.balanceInfo = result.balance; var pack = result.package; @@ -539,11 +583,22 @@ result.label.itemCode = result.label.code this.checkItemCode(result.label.itemCode, callBack => { if (callBack) { - if (checkDirectoryItemExist(this.itemCodeTypeList, callBack)) { - this.$refs.scanPopup.getScanResult(result) + var itemType = callBack.itemType + var itemStatus = callBack.itemStatus + + if (checkDirectoryItemExist(this.itemTypeList, itemType)) { + if (checkDirectoryItemExist(this.itemStatusList, itemStatus)) { + this.$refs.scanPopup.getScanResult(result) + } else { + this.$refs.okToHoldRecordPackRef.itemCode = '' + var hint = getListItemStatusDesc(this.itemStatusList); + this.showErrorMessage("扫描物料[" + result.label.itemCode + "]是[" + + getItemStatusName(itemStatus) + "],需要的物料状态是[" + hint + "]") + } + } else { this.$refs.okToHoldRecordPackRef.itemCode = '' - var hint = getListItemTypeDesc(this.itemCodeTypeList); + var hint = getListItemTypeDesc(this.itemTypeList); this.showErrorMessage("扫描物料[" + result.label.itemCode + "]是[" + getItemTypeName(callBack) + "],需要的物料类型是[" + hint + "]") } @@ -554,8 +609,6 @@ } }) - - this.$refs.scanPopup.getScanResult(result) } }, // 清除来源库位