diff --git a/api/request2.js b/api/request2.js index 3f52d27a..fdb5b334 100644 --- a/api/request2.js +++ b/api/request2.js @@ -856,7 +856,7 @@ export function cancleTakeProductionReceiptJob(id) { /** - * 生产收料 提交 + * 生产收料任务 提交 * @param {*} params */ export function productionReceiptJobSubmit(params) { @@ -1422,6 +1422,19 @@ export function productDismantleJobSubmit(params) { }); } +/** + * 制品拆解 任务提交 + * @param {*} 任务id + * + */ +export function productDismantleRecordSubmit(params) { + return request({ + url: baseApi + "/wms/purchasereceipt-job-main/abandon", + method: "put", + data: params, + }); +} + /** * 制品发货 任务 * status 任务状态 diff --git a/mycomponents/detail/comDetailCard.vue b/mycomponents/detail/comDetailCard.vue index b4f3f7b9..76885570 100644 --- a/mycomponents/detail/comDetailCard.vue +++ b/mycomponents/detail/comDetailCard.vue @@ -37,7 +37,7 @@ } from '@/common/array.js'; export default { - emits: ['openDetail'], + emits: ['openDetail',"updateData"], components: { itemCompareQty, recommend, @@ -79,6 +79,7 @@ return { option: [], showItem: {}, + locatonItem:{}, editItem: {}, detailOptions: [], scanOptions: [] @@ -101,6 +102,8 @@ this.detail(item) } else if (e.content.text == "编辑") { this.edit(item) + } else if (e.content.text == "库位") { + this.showLocation(item) } else if (e.content.text == "移除") { this.remove(item) } @@ -131,6 +134,10 @@ this.editItem.qty = qty; this.$emit('updateData') }, + showLocation(item) { + this.locatonItem = item; + this.$refs.scanLocationCode.openScanPopup(); + }, //扫描源库位 getLocation(location, code) { this.locatonItem.toLocationCode =code; diff --git a/mycomponents/detail/comRequestDetailCard.vue b/mycomponents/detail/comRequestDetailCard.vue index 91587423..8cb916fa 100644 --- a/mycomponents/detail/comRequestDetailCard.vue +++ b/mycomponents/detail/comRequestDetailCard.vue @@ -15,7 +15,7 @@ + :isShowBatch="isShowBatch" :isShowFromLocation="isShowLocation"> diff --git a/mycomponents/job/jobcomDetailCard.vue b/mycomponents/job/jobcomDetailCard.vue index 236935ff..6f419f4d 100644 --- a/mycomponents/job/jobcomDetailCard.vue +++ b/mycomponents/job/jobcomDetailCard.vue @@ -12,7 +12,7 @@ + :isShowBatch="isShowBatch" :isShowFromLocation="isShowLocation"> diff --git a/pages/count/coms/comCountDetailCard.vue b/pages/count/coms/comCountDetailCard.vue index a2402c77..68b86d06 100644 --- a/pages/count/coms/comCountDetailCard.vue +++ b/pages/count/coms/comCountDetailCard.vue @@ -14,7 +14,7 @@ - + diff --git a/pages/count/job/countDetail.vue b/pages/count/job/countDetail.vue index 568ffcc2..d4d3e02d 100644 --- a/pages/count/job/countDetail.vue +++ b/pages/count/job/countDetail.vue @@ -39,7 +39,7 @@ diff --git a/pages/unPlanned/coms/comIssueDetailCard.vue b/pages/unPlanned/coms/comIssueDetailCard.vue index 5972c493..aaff9605 100644 --- a/pages/unPlanned/coms/comIssueDetailCard.vue +++ b/pages/unPlanned/coms/comIssueDetailCard.vue @@ -10,7 +10,7 @@ - + diff --git a/pages/unPlanned/coms/comReceiptDetailCard.vue b/pages/unPlanned/coms/comReceiptDetailCard.vue index 39eb29a4..d39e7a3f 100644 --- a/pages/unPlanned/coms/comReceiptDetailCard.vue +++ b/pages/unPlanned/coms/comReceiptDetailCard.vue @@ -10,23 +10,19 @@ - + - - - 入库库位 - {{item.toLocationCode}} - - - + + @@ -39,11 +35,11 @@ import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' import comMessage from '@/mycomponents/common/comMessage.vue' import detailInfoPopup from '@/pages/unPlanned/coms/detailInfoPopup.vue' + import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import { getDetailOption, - getDetailRemoveOption, - getDetailEditRemoveOption + getPurchaseReceiptOption } from '@/common/array.js'; export default { @@ -52,7 +48,8 @@ recommend, recommendQtyEdit, detailInfoPopup, - comMessage + comMessage, + winScanLocation }, props: { dataContent: { @@ -66,7 +63,11 @@ isShowLocation: { type: Boolean, default: false - } + }, + locationTypeList: { + type: Object, + default: {} + }, }, watch: { @@ -90,11 +91,7 @@ this.detailOptions = getDetailOption(); } if (this.scanOptions.length == 0) { - if (this.settingParam.allowModifyQty == 1) { - this.scanOptions = getDetailEditRemoveOption(); - } else { - this.scanOptions = getDetailRemoveOption(); - } + this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty,this.settingParam.allowModifyLocation) } }, @@ -104,36 +101,45 @@ this.detail(item) } else if (e.content.text == "编辑") { this.edit(item) + } else if (e.content.text == "库位") { + this.showLocation(item) } else if (e.content.text == "移除") { this.remove(item) } }, edit(item) { - this.editItem = item; - this.$refs.qtyEdit.openTaskEditPopup(item.qty, item.record.label.qty); - }, - - detail(item) { - this.showItem = item; - this.$refs.detailInfoPopup.openPopup(item); - - }, - remove(item) { - this.$refs.message.showQuestionMessage("确定移除扫描信息?", - res => { - if (res) { - item.scaned = false - item.record = {} - // item.record.qty = 0; - this.$forceUpdate() - this.$emit('remove', item) - } - }); - }, - confirm(qty) { - this.editItem.record.qty = qty; - this.$emit('updateData') - } + this.editItem = item; + this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty,item.labelQty); + }, + showLocation(item) { + this.locatonItem =item; + this.$refs.scanLocationCode.openScanPopup(); + }, + //扫描源库位 + getLocation(location, code) { + this.locatonItem.toLocationCode =code; + this.$emit('updateData') + }, + + detail(item) { + this.showItem = item; + this.$refs.detailInfoPopup.openPopup(item) + }, + remove(item) { + this.$refs.message.showQuestionMessage("确定移除扫描信息?", + res => { + if (res) { + item.scaned = false + item.handleQty = null + this.$forceUpdate() + this.$emit('remove', item) + } + }); + }, + confirm(qty) { + this.editItem.handleQty = qty; + this.$emit('updateData') + } } } diff --git a/pages/unPlanned/job/issueJobDetail.vue b/pages/unPlanned/job/issueJobDetail.vue index 3898767a..06ec14c9 100644 --- a/pages/unPlanned/job/issueJobDetail.vue +++ b/pages/unPlanned/job/issueJobDetail.vue @@ -46,7 +46,8 @@ goHome, getCurrDateTime, getPackingNumberAndBatch, - getDirectoryItemArray + getDirectoryItemArray, + getInventoryStatusName, } from '@/common/basic.js'; import { @@ -57,7 +58,6 @@ } from '@/common/detail.js'; import winScanButton from '@/mycomponents/scan/winScanButton.vue' - import requiredLocation from '@/mycomponents/location/requiredLocation.vue' import comMessage from '@/mycomponents/common/comMessage.vue' import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" @@ -69,7 +69,6 @@ winScanButton, winScanPackAndLocation, comMessage, - requiredLocation, comDetailCard, detailInfoPopup }, @@ -81,7 +80,6 @@ jobContent: {}, //任务内容 subList: [], //接口返回的任务subList detailSource: [], //绑定在页面上的数据源 - locationTypeList: [], businessTypeInfo: {}, managementList: [] }; @@ -125,10 +123,10 @@ } }, - // onPullDownRefresh() { - // this.getDetail(); - // uni.stopPullDownRefresh(); - // }, + onPullDownRefresh() { + this.getDetail(); + uni.stopPullDownRefresh(); + }, mounted() { @@ -158,10 +156,8 @@ } else { if (res.data.subList.length > 0) { that.jobContent = res.data; - that.locationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes); that.subList = res.data.subList; that.detailSource = getDataSource(that.subList) - } else { that.showErrorMessage('列表数据为0'); } @@ -173,27 +169,6 @@ }) }, - createItemInfo(res) { - let item = { - itemCode: res.itemCode, - itemName: res.itemName, - stdPackQty: res.stdPackQty, - stdPackUnit: res.stdPackUnit, - qty: res.qty, - handleQty: 0, - uom: res.uom, - subList: [] - } - return item; - }, - - createDetailInfo(data) { - data.scaned = false; - // data.record = {}; - let detail = data; - return detail; - }, - //继续扫描 continueScan() { this.scanCount = getScanCount(this.subList); @@ -220,35 +195,69 @@ getScanResult(result) { try { - var packingNumber = result.label.packingNumber; - var batch = result.label.batch; - var qty = result.label.qty; - var itemCode = result.label.itemCode; + var packingNumber = result.balance.packingNumber; + var batch = result.balance.batch; + var qty = result.balance.qty; + var itemCode = result.balance.itemCode; + var locationCode = result.balance.locationCode; + var inventoryStatus = result.balance.inventoryStatus; var detail = this.detailSource.find(r => r.itemCode == itemCode); + if (detail == undefined) { - this.showMessage("物料号【" + itemCode + "】不在列表中") + this.showErrorMessage("物料号【" + itemCode + "】不在列表中") } else { - var itemDetail = detail.subList.find(r => r.packingNumber == packingNumber); + var itemDetail = detail.subList.find(r => { + return r.packingNumber == packingNumber && + r.batch == batch + }) if (itemDetail == undefined) { - this.showMessage("箱码【" + packingNumber + "】不在列表中") + this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]不在列表中") } else { if (itemDetail.scaned) { - this.showMessage("箱码【" + packingNumber + "】已经扫描") + this.showErrorMessage("箱码[" + packingNumber + "]" + "批次[" + batch + "]已经扫描") } else { - itemDetail.scaned = true; - itemDetail.handleQty = Number(result.label.qty); - - this.calcHandleQty(); + let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); + let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); + if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { + this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + + ']不一致,是否继续上架?', res => { + if (res) { + itemDetail.scaned = true; + itemDetail.handleQty = Number(result.label.qty) > Number(result.balance + .qty) ? Number(result.balance.qty) : Number(result.label.qty); + itemDetail.balance = result.balance; + itemDetail.balance.balanceQty = result.balance.qty; + itemDetail.balance.stdPackQty = result.package.stdPackQty + itemDetail.balance.stdPackUnit = result.package.stdPackUnit + this.calcHandleQty(); + } else { + this.scanPopupGetFocus(); + } + }); + } else { + itemDetail.scaned = true; + itemDetail.handleQty = Number(result.label.qty) > Number(result.balance.qty) ? Number( + result.balance.qty) : Number(result.label.qty); + itemDetail.balance = result.balance; + itemDetail.balance.balanceQty = result.balance.qty; + itemDetail.balance.stdPackQty = result.package.stdPackQty + itemDetail.balance.stdPackUnit = result.package.stdPackUnit + this.calcHandleQty(); + } } } } - } catch (e) { - this.showErrorMessage(e.message) + this.showMessage(e.message) } }, - async commit() { + commit() { + this.scanCount = getScanCount(this.subList); + if (this.scanCount == 0) { + this.showErrorMessage("扫描数为0,请先扫描") + return; + } //扫描数量和任务数量相等,直接提交 if (this.scanCount == this.subList.length) { this.submitJob(); @@ -271,62 +280,45 @@ }, - async submitJob() { + submitJob() { uni.showLoading({ title: "提交中....", mask: true }); - var itemCodes = [] - this.detailSource.forEach(item => { - itemCodes.push(item.itemCode) - }) + //没有目标库位,不查询管理模式 + var params = this.setParams() + console.log("提交参数", JSON.stringify(params)); + // unPlannedIssueJobSubmit(params).then(res => { + // uni.hideLoading() + // if (res.data) { + // this.showCommitSuccessMessage("提交成功
生成计划外出库记录" + res.data ) + // } else { + // this.showErrorMessage("提交失败"+res.msg) + // } + // }).catch(error => { + // uni.hideLoading() + // this.showErrorMessage(error) + // }) - getManagementPrecisions(itemCodes,"", res => { - if (res.success) { - this.managementList = res.list; - var params = this.setParams() - console.log("提交参数", JSON.stringify(params)); - // unPlannedIssueJobSubmit(this.id, params).then(res => { - // if (res.data) { - // this.showCommitSuccessMessage("提交成功
生成采购收货记录" + res.data.Number, ) - // } else { - // this.showErrorMessage("提交失败") - // } - // uni.hideLoading() - // }).catch(error => { - // uni.hideLoading() - // this.showErrorMessage(error) - // }) - } else { - uni.hideLoading(); - this.showErrorMessage(res.message); - } - }); }, - + setParams() { var subList = [] - var createTime = getCurrDateTime(); var creator = this.$store.state.user.id - + this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { - var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, - detail.packingNumber, detail.batch); - detail.toPackingNumber = info.packingNumber; - detail.toBatch = info.batch; subList.push(detail) } }) }) this.jobContent.subList = subList - this.jobContent.createTime = createTime; this.jobContent.creator = creator; return this.jobContent; }, - + @@ -400,13 +392,10 @@ showCommitSuccessMessage(hint) { this.$refs.comMessage.showSuccessMessage(hint, res => { - - }) - setTimeout(() => { uni.navigateTo({ url: './issueJob' }) - }, 3000) + }) }, } } diff --git a/pages/unPlanned/job/receiptJobDetail.vue b/pages/unPlanned/job/receiptJobDetail.vue index a34e39fe..ae35485b 100644 --- a/pages/unPlanned/job/receiptJobDetail.vue +++ b/pages/unPlanned/job/receiptJobDetail.vue @@ -5,13 +5,17 @@ + @remove="updateData" @updateData="updateData" :locationTypeList='toLocationTypeList'> + + 0) { that.jobContent = res.data; - // that.toLocationCode=that.jobContent.toLocationCode; - that.locationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes); + that.toLocationTypeList = getDirectoryItemArray(that.jobContent.toLocationTypes); that.subList = res.data.subList; - that.detailSource = that.getDataSource(that.subList) + this.toLocationCode = that.subList[0].toLocationCode + that.detailSource = getDataSource(that.subList) } else { that.showErrorMessage('列表数据为0'); } @@ -161,59 +172,22 @@ }) }, - getDataSource(subList) { - let items = []; - subList.forEach(detail => { - var item = items.find(r => - r.itemCode == detail.itemCode) - if (item == undefined) { - item = this.createItemInfo(detail); - let newDetail = this.createDetailInfo(detail); // - item.subList.push(newDetail); - items.push(item) - } else { - item.qty += detail.qty - let newDetail = this.createDetailInfo(detail); // - item.subList.push(newDetail); - } + scanLocationCode(location, code) { + this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { + this.toLocationCode = code + this.detailSource.forEach(item => { + item.subList.forEach(detail => { + detail.toLocationCode = code + }) + }) }) - return items; }, - createItemInfo(res) { - let item = { - itemCode: res.itemCode, - itemName: res.itemName, - stdPackQty: res.stdPackQty, - stdPackUnit: res.stdPackUnit, - qty: res.qty, - handleQty: 0, - uom: res.uom, - subList: [] - } - return item; - }, - - createDetailInfo(data) { - data.scaned = false; - // data.record = {}; - let detail = data; - return detail; - }, - getScanCount(closeScan) { - let items = this.subList.filter(r => { - if (r.scaned) { - return r; - } - }) - let scanCount = items != null ? items.length : 0; - return scanCount; - }, //继续扫描 continueScan() { - this.scanCount = this.getScanCount(); + this.scanCount = getScanCount(this.subList); if (this.scanCount == this.subList.length) { this.closeScanPopup(); } else { @@ -221,34 +195,11 @@ } }, - calcHandleQty() { - for (let item of this.detailSource) { - item.handleQty = 0; - for (let detail of item.subList) { - if (detail.record != undefined) { - item.handleQty += Number(detail.record.qty) - } - } - } - this.continueScan() - this.$forceUpdate(); - }, updateData() { - this.calcHandleQty(); + calcHandleQty(this.detailSource); }, - createRecordInfo(detail, label) { - var record = {} - detail.scaned = true; - // let record = JSON.parse(JSON.stringify(detail)); - //克隆对象,深度克隆,防止双向绑定同一个变量 - Object.assign(record, detail) - record.qty = Number(label.qty); - record.toLocationCode = this.toLocationCode; - record.label = label; - return record; - }, getScanResult(result) { try { @@ -269,9 +220,11 @@ this.showMessage("箱码【" + packingNumber + "】已经扫描") } else { itemDetail.scaned = true; - itemDetail.record = this.createRecordInfo(itemDetail, result.label); - - this.calcHandleQty(); + itemDetail.handleQty = Number(result.label.qty); + itemDetail.toLocationCode = this.toLocationCode; + itemDetail.labelQty = Number(result.label.qty); + calcHandleQty(this.detailSource); + this.continueScan() } } } @@ -281,18 +234,16 @@ } }, - scanLocationCode(location, code) { - this.$refs.comMessage.showQuestionMessage("是否把所有的目标库位都变成默认库位[" + code + "]", res => { - this.toLocationCode = code - this.detailSource.forEach(item => { - item.subList.forEach(detail => { - detail.toLocationCode = code - }) - }) - }) - }, - - async commit() { + commit() { + this.scanCount = getScanCount(this.subList); + if( this.scanCount==0){ + this.showErrorMessage("扫描数为0,请先扫描") + return; + } + //校验库位、 + if (!this.checkLocation()) { + return + } //扫描数量和任务数量相等,直接提交 if (this.scanCount == this.subList.length) { this.submitJob(); @@ -313,9 +264,29 @@ } } }, + + checkLocation() { + var isPass = true; + if (this.toLocationCode == "" || this.toLocationCode == null) { + this.showMessageHint('请扫描收货库位', callback => { + this.$refs.comScanLocation.showLocation(); + }) + + return isPass = false; + } + return isPass; + }, + + showMessageHint(hint, callback) { + this.$refs.comMessage.showErrorMessage(hint, res => { + if (res) { + callback() + } + }); + }, - async submitJob() { + submitJob() { uni.showLoading({ title: "提交中....", mask: true @@ -325,14 +296,14 @@ itemCodes.push(item.itemCode) }) - getManagementPrecisions(itemCodes,"", res => { + getManagementPrecisions(itemCodes, this.toLocationCode, res => { if (res.success) { this.managementList = res.list; var params = this.setParams() console.log("提交参数", JSON.stringify(params)); - // unPlannedReceiptJobSubmit(this.id, params).then(res => { + // unPlannedReceiptJobSubmit(params).then(res => { // if (res.data) { - // this.showCommitSuccessMessage("提交成功
生成采购收货记录" + res.data.Number, ) + // this.showCommitSuccessMessage("提交成功
生成计划外入库记录" + res.data) // } else { // this.showErrorMessage("提交失败") // } @@ -347,12 +318,11 @@ } }); }, - + setParams() { var subList = [] - var createTime = getCurrDateTime(); var creator = this.$store.state.user.id - + this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { @@ -365,13 +335,12 @@ }) }) this.jobContent.subList = subList - this.jobContent.createTime = createTime; this.jobContent.creator = creator; return this.jobContent; }, - + showMessage(message) { setTimeout(r => {