From 455ef36364144c2863604265a038366a248c85ed Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Thu, 8 Aug 2024 14:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=8F=91=E6=96=99=E4=B8=8D?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=9D=A5=E6=BA=90=E5=BA=93=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../record/recordComDetailCard.vue | 6 +- src/pages/issue/record/directIssue.vue | 319 ++------ src/pages/issue/record/directIssue2.vue | 719 ++++++++++++++++++ 3 files changed, 786 insertions(+), 258 deletions(-) create mode 100644 src/pages/issue/record/directIssue2.vue diff --git a/src/mycomponents/record/recordComDetailCard.vue b/src/mycomponents/record/recordComDetailCard.vue index a0e9aa4c..26d24503 100644 --- a/src/mycomponents/record/recordComDetailCard.vue +++ b/src/mycomponents/record/recordComDetailCard.vue @@ -9,7 +9,7 @@ :isShowBalanceQty="isShowBalanceQty"> - + @@ -91,6 +91,10 @@ type: Boolean, default: true }, + isShowParentToLocation: { + type: Boolean, + default: true + }, isShowBalanceQty: { type: Boolean, diff --git a/src/pages/issue/record/directIssue.vue b/src/pages/issue/record/directIssue.vue index c5451866..3153d83f 100644 --- a/src/pages/issue/record/directIssue.vue +++ b/src/pages/issue/record/directIssue.vue @@ -1,7 +1,7 @@ @@ -98,6 +97,7 @@ import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' + import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' export default { components: { @@ -109,7 +109,8 @@ winScanPackAndLocation, recordComDetailCard, recordDetailCard, - balanceSelect + balanceSelect, + winComScanBalance }, data() { return { @@ -130,7 +131,8 @@ positionList: [], show: false, positionInfo: "请选择生产线", - resultData: {} + resultData: {}, + itemCode:"" }; }, onLoad(option) { @@ -138,16 +140,7 @@ title: option.title }) this.clearData(); - getBusinessType(this.businessTypeCode, res => { - if (res.success) { - this.businessType = res.businessType; - this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; - this.toLocationAreaTypeList = res.toLocationAreaTypeList; - this.showFromLocationPopup(); - } else { - this.showErrorMessage(res.message) - } - }); + this.getBusinessType() // if (this.positionList.length == 0) { getWorkShopLineStation().then(res => { @@ -177,163 +170,62 @@ mounted() {}, methods: { - getBalance(label, packageInfo, callback) { - var filters = [] - - if (packageInfo.parentNumber) { - var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; - filters.push({ - column: "packingNumber", - action: "in", - value: packingNumber - }) - } else { - filters.push({ - column: "packingNumber", - action: "==", - value: label.packingNumber - }) - } - - filters.push({ - column: "itemCode", - action: "==", - value: label.itemCode - }) - filters.push({ - column: "batch", - action: "==", - value: label.batch - }) - - if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") { - filters.push({ - column: "inventoryStatus", - action: "in", - value: this.fromInventoryStatuses - }) - } - - var params = { - filters: filters, - pageNo: 1, - pageSize: 100, - } - getBalanceByFilter(params).then(res => { - callback(res.data) - }).catch(err => { - this.showErrorMessage(err.message); - }) - }, - getScanResult(result) { - this.resultData = result; - let packageInfo = result.package; - this.getBalance(result.label, packageInfo, balances => { - //扫描的是外包装 - let s = ''; - if (!result.package.parentNumber) { - if (balances.list.length == 0) { - this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - let newBalances = balances.list.filter(b => b.locationCode == this - .fromLocationCode); - if (newBalances.length == 0) { - this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else if (newBalances.length == 1) { - let balance = newBalances[0]; - result.balance = balance; - this.afterGetBalance(result); - } else { - this.showBalanceSelect(newBalances); - } - } + + getBusinessType() { + getBusinessType(this.businessTypeCode, res => { + if (res.success) { + this.businessType = res.businessType; + this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses); + this.fromLocationAreaTypeList = res.fromLocationAreaTypeList + this.openScanPopup(); } else { - //扫描的是小包装 - if (balances.list.length == 0) { - this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') - } else { - //小包装库存 - let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo - .number) - //外包装库存 - let subParentPackitems = balances.list.filter(r => r.packingNumber == - packageInfo - .parentNumber && r.locationCode == this.fromLocationCode) - //小包装没有库存, - if (subPackitems.length == 0) { - //外包装有库存,出库后剩余库存未转换为出库包装规格 - - if (subParentPackitems.length > 0) { - if (subParentPackitems.length == 1) { - let balance = subParentPackitems[0]; - balance.qty = packageInfo.qty; - result.balance = balance; - this.afterGetBalance(result); - } else { - this.showBalanceSelect(subParentPackitems); - } - - } else { - this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + - packageInfo.number + '】都未查找到库存余额') - } - } else { - var locationCode = this.fromLocationCode - if (balances.list == 1) { - locationCode = balances.list[0].locationCode - } else { - var manyBlances = balances.list.filter(r => r.locationCode != this - .fromLocationCode) - if (manyBlances.length > 0) { - locationCode = manyBlances[0].locationCode; - this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + - locationCode + - '】已经有库存余额,请重新扫描') - } else { - this.afterGetBalance(result); - } - } - } - } + this.showErrorMessage(res.message) } - }) - }, - - showBalanceSelect(items) { - this.$refs.balanceSelect.openPopup(items); + }); }, - - selectBalanceItem(balance) { - this.resultData.balance = balance; - this.afterGetBalance(this.resultData); + + getScanResult(result) { + this.setData(result); }, - - afterGetBalance(result) { + setData(result) { let balance = result.balance; let label = result.label; let pack = result.package; - let packUnit = pack.packUnit; - let packQty = pack.packQty + + + if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { + this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this + .fromLocationCode + "]没有库存余额") + return; + } + var item = this.detailSource.find(res => { if (res.itemCode == balance.itemCode) { return res } }) - if (this.fromWarehouseCode == '') { - this.fromWarehouseCode = balance.warehouseCode; - } if (item == undefined) { - + if (this.itemCode != "" && this.itemCode != balance.itemCode) { + this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码") + return; + } + if (this.fromWarehouseCode == '') { + this.fromWarehouseCode = balance.warehouseCode; + } var itemp = createItemInfo(balance, pack); let newDetail = createDetailInfo(balance, pack); // newDetail.parentNumber = pack.parentNumber; newDetail.packingNumber = pack.number - newDetail.packUnit = packUnit; - newDetail.packQty = packQty; + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty + } itemp.subList.push(newDetail); this.detailSource.push(itemp) - calcHandleQty(this.detailSource); - + this.itemCode = balance.itemCode; + this.fromLocationCode = balance.locationCode + this.scanPopupGetFocus() } else { var detail = item.subList.find(r => { if (r.packingNumber == pack.number && @@ -347,98 +239,20 @@ let newDetail = createDetailInfo(balance, pack); newDetail.parentNumber = pack.parentNumber; newDetail.packingNumber = pack.number - newDetail.packUnit = packUnit; - newDetail.packQty = packQty; - item.subList.push(newDetail); - calcHandleQty(this.detailSource); - } else { - if (detail.scaned == true) { - this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]已经在列表中") + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty } - } - } - }, - - - getScanResult1(result) { - let balance = result.balance; - let label = result.label; - let pack = result.package; - let packUnit = pack.packUnit; - let packQty = pack.packQty - var item = this.detailSource.find(res => { - if (res.itemCode == balance.itemCode) { - return res - } - }) - if (this.fromWarehouseCode == '') { - this.fromWarehouseCode = balance.warehouseCode; - } - if (item == undefined) { - - var itemp = createItemInfo(balance, pack); - let newDetail = createDetailInfo(balance, pack); // - newDetail.packUnit = packUnit; - newDetail.packQty = packQty; - itemp.subList.push(newDetail); - this.detailSource.push(itemp) - calcHandleQty(this.detailSource); - - } else { - var detail = item.subList.find(r => { - if (r.packingNumber == balance.packingNumber && - r.batch == balance.batch && - r.locationCode == balance.locationCode && - r.inventoryStatus == balance.inventoryStatus) { - return r; - } - }) - if (detail == undefined) { - let newDetail = createDetailInfo(balance, pack); - newDetail.packUnit = packUnit; - newDetail.packQty = packQty; item.subList.push(newDetail); - calcHandleQty(this.detailSource); + this.scanPopupGetFocus() } else { if (detail.scaned == true) { - this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") + this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]已经在列表中") } } } - }, - - //获取推荐库位 - getRecommendLocation(balance, pack, callback) { - uni.showLoading({ - title: '扫描中...', - mask: true - }) - let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode); - if (recommend == undefined) { - let param = { - itemCode: balance.itemCode, - batch: balance.batch, - inventoryStatus: balance.inventoryStatus, - supplierCode: pack.supplierCode, - businessCode: this.businessTypeCode - }; - console.log(JSON.stringify(param)) - getPutawayRecommendLocation(param).then(res => { - this.recommendLocationList.push({ - itemCode: balance.itemCode, - locationCode: res.data.code - }) - callback(res.data); - uni.hideLoading(); - }).catch(error => { - uni.hideLoading() - this.showErrorMessage(error); - uni.hideLoading(); - }) - - } else { - callback(recommend); - } + calcHandleQty(this.detailSource); }, showErrorMessage(message) { @@ -531,11 +345,11 @@ }, openScanPopup() { - if (this.fromLocationCode == "") { - this.showFromLocationPopup(); - return + if (this.businessType) { + this.$refs.scanPopup.openScanPopup(this.businessType); + } else { + this.getBusinessType() } - this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); }, showFromLocationPopup() { @@ -674,16 +488,6 @@ this.fromLocationCode = code; this.openScanPopup(); }, - getToLocationCode(location, code) { - if (this.fromLocationCode == code) { - uni.showToast({ - title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", - duration: 2000 - }) - return - } - this.toLocationCode = code; - }, showCommitSuccessMessage(hint) { this.$refs.comMessage.showSuccessMessage(hint, res => { @@ -710,6 +514,7 @@ this.toWarehouseCode = ''; this.detailSource = []; this.positionInfo = "请选择生产线"; + this.itemCode="" } } } diff --git a/src/pages/issue/record/directIssue2.vue b/src/pages/issue/record/directIssue2.vue new file mode 100644 index 00000000..c5451866 --- /dev/null +++ b/src/pages/issue/record/directIssue2.vue @@ -0,0 +1,719 @@ + + + + + \ No newline at end of file