diff --git a/src/common/record.js b/src/common/record.js index df840606..6cbcb38b 100644 --- a/src/common/record.js +++ b/src/common/record.js @@ -39,7 +39,7 @@ export function createDetailInfo(balance, pack) { let detail = deepCopyData(balance); detail.balanceQty = new Decimal(detail.qty).toNumber() detail.qty = new Decimal(detail.qty).toNumber(); - detail.packQty = pack.packQty?new Decimal(pack.packQty).toNumber():0 + detail.packQty = pack.packQty ? new Decimal(pack.packQty).toNumber() : 0 detail.packUnit = pack.packUnit detail.handleQty = new Decimal(detail.qty).toNumber(); detail.package = pack; @@ -49,6 +49,21 @@ export function createDetailInfo(balance, pack) { return detail; } + +export function createDetailByPackInfo(pack) { + + // data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus; + // data.inventoryStatus = data.inventoryStatus; + let detail = deepCopyData(pack); detail.scaned = true; + detail.balanceQty = new Decimal(detail.qty).toNumber() + detail.qty = new Decimal(detail.qty).toNumber(); + detail.packQty = pack.packQty ? new Decimal(pack.packQty).toNumber() : 0 + detail.packUnit = pack.packUnit + detail.handleQty = new Decimal(detail.qty).toNumber(); + detail.package = pack; + return detail; +} + //计算实际数量 export function calcHandleQty(detailSource) { for (let item of detailSource) { diff --git a/src/mycomponents/balance/balance.vue b/src/mycomponents/balance/balance.vue index b4ed53fb..fc5582ab 100644 --- a/src/mycomponents/balance/balance.vue +++ b/src/mycomponents/balance/balance.vue @@ -2,7 +2,8 @@ - + @@ -91,6 +92,10 @@ type: Boolean, default: false }, + isShowParentPack: { + type: Boolean, + default: true + }, }, watch: { diff --git a/src/mycomponents/record/recordComDetailCard.vue b/src/mycomponents/record/recordComDetailCard.vue index 26d24503..cd6be527 100644 --- a/src/mycomponents/record/recordComDetailCard.vue +++ b/src/mycomponents/record/recordComDetailCard.vue @@ -9,7 +9,8 @@ :isShowBalanceQty="isShowBalanceQty"> - + @@ -21,7 +22,7 @@ :right-options="detail.scaned?scanOptions:detailOptions"> + :isShowToLocation="isShowToLocation" :isShowParentPack="isShowParentPack"> @@ -100,6 +101,11 @@ type: Boolean, default: false }, + + isShowParentPack: { + type: Boolean, + default: true + }, }, watch: { @@ -146,7 +152,7 @@ this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?", res => { if (res) { - this.$emit('removeItem',dataContent) + this.$emit('removeItem', dataContent) // this.$emit('removeItem', this.dataContent) } }); diff --git a/src/mycomponents/scan/winScanPackage.vue b/src/mycomponents/scan/winScanPackage.vue index eb7f074a..a0c47f8c 100644 --- a/src/mycomponents/scan/winScanPackage.vue +++ b/src/mycomponents/scan/winScanPackage.vue @@ -208,7 +208,7 @@ getBalanceByFilter(params).then(res => { if (res.data.list.length > 0) { res.data.list.forEach(r => { - if (packageInfo.parentNumber !== null) { + if (packageInfo.parentNumber) { r.parentPackingNumber = packageInfo.parentNumber } else { r.parentPackingNumber = packageInfo.number @@ -258,7 +258,7 @@ }, losefocus() { - if (this.$refs.comscan ) { + if (this.$refs.comscan) { this.$refs.comscan.losefocus(); } }, diff --git a/src/mycomponents/scan/winScanParentPackage.vue b/src/mycomponents/scan/winScanParentPackage.vue new file mode 100644 index 00000000..8a0553a8 --- /dev/null +++ b/src/mycomponents/scan/winScanParentPackage.vue @@ -0,0 +1,273 @@ + + + + + \ No newline at end of file diff --git a/src/pages/inventoryMove/coms/comMoveJob.vue b/src/pages/inventoryMove/coms/comMoveJob.vue index 7446bf81..4e77583f 100644 --- a/src/pages/inventoryMove/coms/comMoveJob.vue +++ b/src/pages/inventoryMove/coms/comMoveJob.vue @@ -212,14 +212,14 @@ uni.stopPullDownRefresh(); } - var list = res.data.list; + let list = res.data.list; this.totalCount = res.data.total this.loadingType = "loadmore"; + this.jobList = type === "refresh" ? list : this.jobList.concat(list); if (list == null || list.length == 0) { this.loadingType = "nomore"; return; } - this.jobList = type === "refresh" ? list : this.jobList.concat(list); this.pageNo++; this.updateTitle(); }).catch(error => { diff --git a/src/pages/issue/record/directIssue0816.vue b/src/pages/issue/record/directIssue0816.vue index 8efa0038..9a28e633 100644 --- a/src/pages/issue/record/directIssue0816.vue +++ b/src/pages/issue/record/directIssue0816.vue @@ -18,9 +18,8 @@ + @removePack="removePack" :isShowParentPack="false"> - @@ -45,9 +44,10 @@ - - - + + + @@ -79,6 +79,7 @@ getBusinessType, createItemInfo, createDetailInfo, + createDetailByPackInfo, calcTreeHandleQty, calcHandleQty } from '@/common/record.js'; @@ -100,7 +101,7 @@ import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' // import balanceQuery from '@/mycomponents/query/balanceQuery.vue' - + import winScanParentPackage from '@/mycomponents/scan/winScanParentPackage.vue' export default { components: { @@ -114,6 +115,7 @@ recordDetailCard, balanceSelect, winComScanBalance, + winScanParentPackage // balanceQuery }, data() { @@ -181,7 +183,6 @@ // showDrawer() { // this.$refs.showRight.open(); // }, - getBusinessType() { getBusinessType(this.businessTypeCode, res => { if (res.success) { @@ -197,72 +198,86 @@ getScanResult(result) { let pack = result.package; - let balance = result.balance; + let childBalance = result.balance.childBalance; + let parentBalance = result.balance.parentBalance[0]; + + //1.先判断是否重复扫描 + if (this.itemCode) { + var item = this.detailSource.find(res => res.itemCode == pack.itemCode) + if (item == undefined) { + this.showErrorMessage("请扫描物料为【" + this.itemCode + "】不在此次发料记录中") + return; + } + if (item.subList.length > 0) { + var detail = item.subList.find(r => { + if (r.packingNumber == pack.number && + r.batch == pack.batch) { + return r; + } + }) - if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { - this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this - .fromLocationCode + "]没有库存余额") - return; + if (detail && detail.scaned) { + this.showErrorMessage("箱码[" + pack.number + "批次[" + pack.batch + "]重复扫描") + return; + } + } } + //2.向列表中增加明细 //扫描的是子包装 if (pack.parentNumber) { - this.setPackageData(result); + //子包装没有库存 + if (childBalance.length == 0) { + this.setPackageData(parentBalance, pack); + } else { //子包装有库存 + this.setPackageData(childBalance[0], pack); + } } else { - this.setContainerData(result); + //扫描的是父包装,要过滤掉不在超市的库存,加上没有的库存 + pack.subList.forEach(sub => { + let subBalance = childBalance.find(r => r.packingNumber == sub.number); + if (subBalance) { + //校验父包装和子包装是否在一个库位 + if (subBalance.locationCode == parentBalance.locationCode) { + this.setPackageData(subBalance, sub); + } else { + //不在一个库位暂时先不加 + } + + } else { + //如果子包装没有库存,取父包装库存 + this.setPackageData(parentBalance, sub); + } + }) } }, - setPackageData(result) { - let balance = result.balance; - let label = result.label; - let pack = result.package; - + setPackageData(balance, pack) { var item = this.detailSource.find(res => { if (res.itemCode == balance.itemCode) { return res } }) 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 = pack.packUnit; - newDetail.packQty = pack.packQty; - if (balance.lableQty) { - newDetail.handleQty = balance.lableQty - } + let newDetail = this.createPackageDetail(balance, pack); itemp.subList.push(newDetail); - this.detailSource.push(itemp) + this.detailSource.push(itemp); this.itemCode = balance.itemCode; - this.fromLocationCode = balance.locationCode + this.fromLocationCode = balance.locationCode; + this.fromWarehouseCode = balance.warehouseCode; this.scanPopupGetFocus() } else { var detail = item.subList.find(r => { if (r.packingNumber == pack.number && - r.batch == balance.batch && - r.locationCode == balance.locationCode && + r.batch == pack.batch && + r.locationCode == pack.locationCode && r.inventoryStatus == balance.inventoryStatus) { return r; } }) if (detail == undefined) { - let newDetail = createDetailInfo(balance, pack); - newDetail.parentNumber = pack.parentNumber; - newDetail.packingNumber = pack.number - newDetail.packUnit = pack.packUnit; - newDetail.packQty = pack.packQty; - if (balance.lableQty) { - newDetail.handleQty = balance.lableQty - } + let newDetail = this.createPackageDetail(balance, pack); item.subList.push(newDetail); this.scanPopupGetFocus() } else { @@ -274,73 +289,26 @@ calcHandleQty(this.detailSource); }, - setContainerData(result) { - //1.查询托和箱所有的库存 - this.getBalance(result, resList => { - - }); - }, - - getBalance(result, callback) { - let packageInfo = result.package; - let filters = [{ - column: "itemCode", - action: "==", - value: packageInfo.itemCode - }, { - column: "batch", - action: "==", - value: packageInfo.batch - }]; - if (this.businessType.outInventoryStatuses != null) { - filters.push({ - column: "inventoryStatus", - action: "in", - value: this.businessType.outInventoryStatuses - }) - } - if (this.businessType.outAreaTypes != null) { - filters.push({ - column: "areaType", - action: "in", - value: this.businessType.outAreaTypes - }) - } - - - let packingNumber = packageInfo.number; - packageInfo.subList.forEach(sub => { - packingNumber = packingNumber + ',' + sub.number - }) - packingNumber = packingNumber.trimEnd(','); - filters.push({ - column: "packingNumber", - action: "in", - value: packingNumber - }) - var params = { - filters: filters, - pageNo: 1, - pageSize: 100, - } - getBalanceByFilter(params).then(res => { - if (res.data.list.length > 0) { - res.data.list.forEach(r => { - // if (packageInfo.parentNumber !== null) { - // r.parentPackingNumber = packageInfo.parentNumber - // } else { - // r.parentPackingNumber = packageInfo.number - // } - }) - callback(res.data.list) - } else { + createPackageDetail(balance, pack) { + let newDetail = {}; + if (balance.packingNumber != pack.number) { + newDetail = createDetailByPackInfo(pack); + newDetail.inventoryStatus = balance.inventoryStatus; + } else { + newDetail = createDetailInfo(balance, pack); + if (balance.lableQty) { + newDetail.handleQty = balance.lableQty } - }).catch(err => { - this.showErrorMessage(err.message); - }) + } + newDetail.parentNumber = pack.parentNumber; + newDetail.packingNumber = pack.number + newDetail.packUnit = pack.packUnit; + newDetail.packQty = pack.packQty; + return newDetail; }, + showErrorMessage(message) { this.$refs.comMessage.showErrorMessage(message, res => { if (res) { @@ -432,12 +400,18 @@ this.updateData(); }, + // openScanPopup() { + // if (this.businessType) { + // this.$refs.scanPopup.openScanPopup(this.businessType); + // } else { + // this.getBusinessType() + // } + // }, + openScanPopup() { - if (this.businessType) { - this.$refs.scanPopup.openScanPopup(this.businessType); - } else { - this.getBusinessType() - } + setTimeout(r => { + this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType); + }) }, showFromLocationPopup() { diff --git a/src/pages/productReceipt/job/productReceiptDetail.vue b/src/pages/productReceipt/job/productReceiptDetail.vue index 1c6c3cb3..574f5b56 100644 --- a/src/pages/productReceipt/job/productReceiptDetail.vue +++ b/src/pages/productReceipt/job/productReceiptDetail.vue @@ -228,9 +228,9 @@ that.jobToLocationCode = that.subList[0].toLocationCode; that.productionLineCode = that.jobContent.subList[0].productionLineCode; - if (that.jobContent.allowModifyLocation == 'FALSE') { - that.toLocationCode = that.subList[0].toLocationCode - } + // if (that.jobContent.allowModifyLocation == 'FALSE') { + // that.toLocationCode = that.subList[0].toLocationCode + // } that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes) that.detailSource = getDataSource(that.subList) if (that.scanMessage) { diff --git a/src/pages/productionReceipt/job/productionReceiptJob.vue b/src/pages/productionReceipt/job/productionReceiptJob.vue index fe5f82a4..a78c388d 100644 --- a/src/pages/productionReceipt/job/productionReceiptJob.vue +++ b/src/pages/productionReceipt/job/productionReceiptJob.vue @@ -460,6 +460,17 @@ }else{ this.filterItemCode = '' } + if (params.status) { + this.status = params.status + + }else{ + this.status = "1,2" + } + if(params.creationTime==""){ + this.checkedToday = false; + } + this.todayTime = params.creationTime + this.getList('refresh', this.productionLine, this.filterItemCode) },