From 5b29f2b0da26cd9ac9b5fcc4ba538c8fe7460359 Mon Sep 17 00:00:00 2001 From: zhang_li <2235006734@qqq.com> Date: Thu, 31 Oct 2024 14:11:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E6=96=99=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/detail.js | 41 +- src/mycomponents/qty/recommendQtyEdit.vue | 7 + src/pages.json | 7 + .../issue/coms/comIssueDetailCardBatch.vue | 87 +- src/pages/issue/job/issueDetail.vue | 16 +- src/pages/issue/job/issueDetailBatch.vue | 764 ++++++++++++++++++ src/pages/issue/job/issueJob.vue | 38 +- .../coms/comProductRecordBatch.vue | 171 ++++ .../record/productReceiptRecord.vue | 118 ++- 9 files changed, 1173 insertions(+), 76 deletions(-) create mode 100644 src/pages/issue/job/issueDetailBatch.vue create mode 100644 src/pages/productReceipt/coms/comProductRecordBatch.vue diff --git a/src/common/detail.js b/src/common/detail.js index 47e53bb7..89721e7a 100644 --- a/src/common/detail.js +++ b/src/common/detail.js @@ -41,10 +41,49 @@ export function getTreeDataSource(dataList) { }) ) } - return items; } +export function getThreeDataSource(data) { + let items = [] + // let obj ={ + // ...data.subList[0] + // } + // console.log(12) + // data.subList.forEach((item)=>{ + // item.threeList = [{ + // fromLocationCode:item.fromLocationCode, + // batch:item.batch, + // handleQty:0, + // qty:item.qty, + // inventoryStatus:item.inventoryStatus, + // toLocationCode:item.toLocationCode, + // }] + // item.packList=[{ + // scaned : false, + // scanDate: new Date() + // }] + // }) + // obj.subList = data.subList + // items.push(obj) + // return items; + data.subList.forEach((item)=>{ + item.subList = [{ + fromLocationCode:item.fromLocationCode, + batch:item.batch, + handleQty:0, + qty:item.qty, + inventoryStatus:item.inventoryStatus, + toLocationCode:item.toLocationCode, + // packList:[{ + // scaned : false, + // scanDate: new Date() + // }] + }] + }) + items = data.subList + return items; +} export function getDataSource(subList) { let items = []; subList.forEach(detail => { diff --git a/src/mycomponents/qty/recommendQtyEdit.vue b/src/mycomponents/qty/recommendQtyEdit.vue index 9510cb05..56b6ccb1 100644 --- a/src/mycomponents/qty/recommendQtyEdit.vue +++ b/src/mycomponents/qty/recommendQtyEdit.vue @@ -41,6 +41,13 @@ + + 库存数量 : + + {{Number(dataContent.balanceQty)}} + + + diff --git a/src/pages.json b/src/pages.json index d26dec1e..3b6dd86d 100644 --- a/src/pages.json +++ b/src/pages.json @@ -636,6 +636,13 @@ "enablePullDownRefresh": false } }, + { + "path": "pages/issue/job/issueDetailBatch", + "style": { + "navigationBarTitleText": "发料任务详情", + "enablePullDownRefresh": false + } + }, { "path": "pages/issue/job/issueJob0816", "style": { diff --git a/src/pages/issue/coms/comIssueDetailCardBatch.vue b/src/pages/issue/coms/comIssueDetailCardBatch.vue index b70a9763..33de6657 100644 --- a/src/pages/issue/coms/comIssueDetailCardBatch.vue +++ b/src/pages/issue/coms/comIssueDetailCardBatch.vue @@ -3,40 +3,30 @@ - + - + - - - - - - - - + + + + - - - - - + + - + + + @@ -54,6 +44,7 @@ import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue' import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' import batch from '@/mycomponents/balance/batch.vue' + import qtyEdit from '@/mycomponents/qty/qtyEdit.vue' import { getDetailOption, getEditRemoveOption, @@ -73,17 +64,21 @@ location, detailInfoPopup, comIssueRequestInfo, - batch + batch, }, props: { dataContent: { - type: Object, - default: {} + type: Array, + default: [] }, settingParam: { type: Object, default: {} }, + isEdit: { + type: Boolean, + default: true + }, }, watch: { @@ -97,7 +92,8 @@ batchItem: {}, detailOptions: [], scanOptions: [], - removeOptions: [] + removeOptions: [], + editAndRemoveOptions:[] } }, @@ -105,17 +101,18 @@ this.detailOptions = getDetailOption(); this.scanOptions = getEditRemoveOption(); this.removeOptions = getRemoveOption() + this.editAndRemoveOptions = getEditRemoveOption() + console.log(888,this.dataContent) }, methods: { resizeCollapse() { this.$nextTick(r => { - this.$refs.collapse.forEach(r => { - r.childrens.forEach(i => { + this.$refs.collapse.resize() + this.$refs.collapse.childrens.forEach(i => { i.init(); }) - r.resize(); - }) + }); }, swipeClick(e, batch, @@ -132,18 +129,19 @@ }, itemCoceClick(e, item, index) { - if (e.content.text == "移除") { - this.dataContent.Items.splice(index, 1); - this.$emit('removeItemCode') + if (e.content.text == "编辑") { + this.edit(item) + } else if (e.content.text == "移除") { + // this.dataContent.subList.splice(index, 1); + item.scaned = false + item.handleQty=0 + this.$emit('updateData') } }, - edit(batch, item) { - let that = this; - that.editItem = item; - that.batchItem = batch; - item.balance.balanceQty = item.balance.qty; - that.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty); + edit(item) { + this.editItem = item; + this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty); }, detail(item) { @@ -167,13 +165,8 @@ }); }, confirm(val) { - this.editItem.qty = val; + this.editItem.handleQty = Number(val); this.$emit('updateData', this.editItem) - // let qty = 0; - // this.batchItem.Records.forEach(r => { - // qty += Number(r.qty); - // }) - // this.batchItem.handleQty = qty; } } } diff --git a/src/pages/issue/job/issueDetail.vue b/src/pages/issue/job/issueDetail.vue index e171f0ed..9ddc72ac 100644 --- a/src/pages/issue/job/issueDetail.vue +++ b/src/pages/issue/job/issueDetail.vue @@ -15,18 +15,11 @@ - - - + @updateData='updateData'> @@ -46,7 +39,7 @@ + @afterScan='afterScan'> @@ -115,8 +108,7 @@ jobStatus: "", scanMessage: '', managementList: [], - managementType: "", - fromLocationCode:'' + managementType: "" }; }, @@ -301,7 +293,7 @@ this.showErrorMessage("请扫描您需要提交的发料任务") return } - console.log("提交参数", params); + console.log("提交参数", JSON.stringify(params)); issueJobSubmit(params).then(res => { uni.hideLoading() if (res.data) { diff --git a/src/pages/issue/job/issueDetailBatch.vue b/src/pages/issue/job/issueDetailBatch.vue new file mode 100644 index 00000000..4ebb2c30 --- /dev/null +++ b/src/pages/issue/job/issueDetailBatch.vue @@ -0,0 +1,764 @@ + + + + + \ No newline at end of file diff --git a/src/pages/issue/job/issueJob.vue b/src/pages/issue/job/issueJob.vue index 6ab76832..bfe490a6 100644 --- a/src/pages/issue/job/issueJob.vue +++ b/src/pages/issue/job/issueJob.vue @@ -61,6 +61,11 @@ getDetailGiveupOption, getDetailCloseOption } from '@/common/array.js'; + + + import { + getManagementPrecisions + } from '@/common/balance.js'; import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue' @@ -355,8 +360,7 @@ openJobDetail(item, scanMessage = '') { - this.getJobInfoByNumber(item.number, scanMessage) - + this.getJobInfoByNumber(item, scanMessage) }, showItemList(itemList) { @@ -433,7 +437,7 @@ }) }, - getJobInfoByNumber(number, scanMessage) { + getJobInfoByNumber(item, scanMessage) { let that = this; uni.showLoading({ title: "加载中....", @@ -448,7 +452,7 @@ filters.push({ column: "number", action: "==", - value: number + value: item.number }) var params = { @@ -475,11 +479,27 @@ return; } - uni.navigateTo({ - url: './issueDetail?id=' + result.masterId + '&status=' + result.status + - '&scanMessage=' + - scanMessage + '&title=' + this.title - }); + + getManagementPrecisions([item.itemCode], item.fromLocationCode, res => { + if (res.success) { + this.managementList = res.list; + this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision + if(this.managementType == 'BY_BATCH'){ + uni.navigateTo({ + url: './issueDetailBatch?id=' + result.masterId + '&status=' + result.status + + '&scanMessage=' + + scanMessage + '&title=' + this.title + }); + }else{ + uni.navigateTo({ + url: './issueDetail?id=' + result.masterId + '&status=' + result.status + + '&scanMessage=' + + scanMessage + '&title=' + this.title + }); + } + } + }) + this.scanMessage = "" } }).catch(error => { diff --git a/src/pages/productReceipt/coms/comProductRecordBatch.vue b/src/pages/productReceipt/coms/comProductRecordBatch.vue new file mode 100644 index 00000000..ba777607 --- /dev/null +++ b/src/pages/productReceipt/coms/comProductRecordBatch.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/src/pages/productReceipt/record/productReceiptRecord.vue b/src/pages/productReceipt/record/productReceiptRecord.vue index d12eabf4..6b0ba794 100644 --- a/src/pages/productReceipt/record/productReceiptRecord.vue +++ b/src/pages/productReceipt/record/productReceiptRecord.vue @@ -8,8 +8,11 @@ + + + @updateData="updateData" @removePack="removePack" v-else> @@ -42,6 +45,12 @@ + + + + + @@ -79,14 +88,20 @@ import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPack from '@/mycomponents/scan/winScanPack.vue' import comProductRecord from '@/pages/productReceipt/coms/comProductRecord.vue' + import comProductRecordBatch from '@/pages/productReceipt/coms/comProductRecordBatch.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue' + import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" + import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" export default { components: { winScanButton, winScanPack, comProductRecord, + comProductRecordBatch, comBlankView, + winScanLocation, + winScanPackAndLocation, }, data() { return { @@ -108,6 +123,7 @@ workShopName: "", productionLineName: "", workStationName: "", + managementType:'' }; }, onLoad(option) { @@ -142,7 +158,53 @@ mounted() {}, methods: { - getScanResult(result) { + getScanResult(result,managementTypeParams ) { + this.managementType = managementTypeParams + if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ + this.setDataBatch(result) + }else{ + this.setData(result) + } + }, + async setDataBatch(result) { + let label = result.label; + let pack = result.package; + + var item = this.detailSource.find(res => { + if (res.itemCode == label.itemCode) { + return res + } + }) + + if (item == undefined) { + var itemp = this.createItemInfo(label, pack); + let newDetail = this.createDetailInfo(label, pack); + newDetail.handleQty =0; + newDetail.balanceQty =result.balance.qty; + itemp.subList.push(newDetail); + this.detailSource.push(itemp) + } else { + var detail = item.subList.find(r => { + if (r.packingNumber == label.packingNumber && + r.batch == label.batch) { + return r; + } + }) + + if (detail == undefined) { + let newDetail = this.createDetailInfo(label, pack); + newDetail.handleQty =0; + newDetail.balanceQty =result.balance.qty; + item.subList.push(newDetail); + } else { + if (detail.scaned == true) { + // this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + label.batch + "]重复扫描") + } + } + } + this.calcHandleQtyAdd(result.label); + }, + async setData(result) { let label = result.label; let pack = result.package; @@ -218,14 +280,40 @@ this.$forceUpdate(); }, + calcHandleQtyAdd(label) { + for (let item of this.detailSource) { + item.handleQty = item.handleQty || new Decimal(0).toNumber(); + for (let detail of item.subList) { + if (detail != undefined) { + item.handleQty = calc.add(item.handleQty,label.qty) + detail.handleQty = calc.add(detail.handleQty,label.qty) + } + } + } + console.log(this.detailSource) + this.scanPopupGetFocus(); + this.$forceUpdate(); + }, updateData() { this.calcHandleQty(); }, openScanPopup() { - this.$refs.scanPopup.openScanPopup(); + // this.$refs.scanPopup.openScanPopup(); + this.openFromLocationScanPopup() + }, + openFromLocationScanPopup() { + if (this.fromLocationCode == "") { + this.showFromLocationPopup(); + return + } + this.$refs.winScanPackAndLocationRef.openScanPopupForType(this.fromLocationCode, this.businessType); + }, + showFromLocationPopup() { + this.$nextTick(() => { + this.$refs.winScanFromLocation.openScanPopup(); + }) }, - commit() { if (this.positionInfo == "请选择位置") { this.showMessage("请先选择位置") @@ -240,12 +328,21 @@ }); this.managementList = []; var precisionStrategParams = this.setPrecisionStrategParams() - + getPrecisionStrategyList(precisionStrategParams, res => { if (res.success) { this.managementList = res.list; var params = this.setParams() - 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 + } + return productionReceiptRecordSubmit(params).then(res => { uni.hideLoading() if (res.data) { @@ -379,7 +476,14 @@ this.$refs.scanPopup.losefocus(); } }, - + getLocation(location, code) { + this.getFromLocationCode(location, code) + }, + getFromLocationCode(location, code) { + this.fromLocationInfo = location; + this.fromLocationCode = code; + this.openScanPopup(); + }, afterCloseMessage() { this.scanPopupGetFocus(); },