From 5f247206b0174d9b4cedb642e1b9d26a1fdbd9a6 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Wed, 20 Dec 2023 14:44:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E5=88=92=E5=A4=96?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/request2.js | 6 +- common/basic.js | 11 --- pages/scrap/record/scrapRecord.vue | 108 +++++++++++------------ pages/unPlanned/record/issueRecord.vue | 42 ++++++--- pages/unPlanned/record/receiptRecord.vue | 58 +++++++----- 5 files changed, 125 insertions(+), 100 deletions(-) diff --git a/api/request2.js b/api/request2.js index 4e501e6d..fe9b77c1 100644 --- a/api/request2.js +++ b/api/request2.js @@ -1349,7 +1349,7 @@ export function unPlannedReceiptRequestHandle(id) { */ export function unPlannedReceiptRecordbSubmit(id, params) { return request({ - url: baseApi + "/magic-api/pda/job/purchasereturn/jobSubmit?id=" + id, + url: baseApi + "/wms/unplannedreceipt-record-main/create", method: "post", data: params, }); @@ -2819,8 +2819,8 @@ export function scrapRequestHandle(id) { */ export function scrapRecordSubmit(params) { return request({ - url: baseApi + "/wms/purchasereturn-request-main/submit", - method: "put", + url: baseApi + "/wms/scrap-record-main/create", + method: "post", data: params, }); } diff --git a/common/basic.js b/common/basic.js index 3b5fd75c..84ab342c 100644 --- a/common/basic.js +++ b/common/basic.js @@ -320,17 +320,6 @@ export function getUnPlannedIssuseReasonList(value) { return unplannedIissueReason } -//获取报废出库原因 -export function getScarpReasonList(value) { - if (scrapReasonList.length == 0) { - scrapReasonList = getDirectoryInfo("scrap_reason") - } - scrapReasonList.forEach(res => { - res.text = res.label; - res.value = res.code - }) - return scrapReasonList -} //获取检验不合格原因 export function getInspectReasonList(value) { diff --git a/pages/scrap/record/scrapRecord.vue b/pages/scrap/record/scrapRecord.vue index f2f27e65..6b54bdbd 100644 --- a/pages/scrap/record/scrapRecord.vue +++ b/pages/scrap/record/scrapRecord.vue @@ -10,7 +10,7 @@ + @change="reasonChange"> @@ -56,12 +56,12 @@ import { goHome, updateTitle, - getScarpReasonList } from '@/common/basic.js'; import { getInventoryStatusDesc, getDirectoryItemArray, + getScarpReasonList } from '@/common/directory.js'; import { @@ -94,27 +94,19 @@ data() { return { id: '', - receiptJob: {}, - received: false, - isShowPackingCode: true, - scanCount: 0, dataContent: {}, //任务内容 subList: [], //接口返回的任务subList detailSource: [], //绑定在页面上的数据源 locationTypeList: [], - toLocationInfo: {}, - businessTypeInfo: {}, - fromLocationInfo: {}, fromLocationCode: "", - isShowLocation: false, fromlocationTypeList: [], tolocationTypeList: [], - allowModifyLocation: false, inInventoryStatus: "", //目标入库库存状态 outInventoryStatus: "", //来源出库库存状态 businessType: {}, reasonList: [], - reason: "", + reasonText: "", + reasonCode:"", }; }, onLoad(option) { @@ -249,7 +241,7 @@ commit() { - if(this.reason==""){ + if(this.reasonText==""){ this.showMessage("请先选择报废原因") return; } @@ -258,19 +250,18 @@ title: "提交中....", mask: true }); - - // scrapRecordSubmit(params).then(res => { - // uni.hideLoading() - // if (res.data) { - // this.showCommitSuccessMessage("提交成功
生成采购收货记录" + res.data, ) - // } else { - // this.showErrorMessage("提交失败[" + res.msg + "]") - // } - // }).catch(error => { - // uni.hideLoading() - // this.showErrorMessage(error) - // }) + scrapRecordSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成报废出库记录" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) }, @@ -279,10 +270,26 @@ 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; + detail.itemCode = detail.itemCode; + detail.itemName = detail.package.itemName; + detail.itemDesc1 = detail.package.itemDesc1; + detail.itemDesc2 = detail.package.itemDesc2; + + detail.inventoryStatus = detail.inventoryStatus; + + detail.fromPackingNumber = detail.packingNumber; + detail.toPackingNumber = detail.packingNumber; + + detail.fromContainerNumber = detail.containerNumber; + detail.toContainerNumber = detail.containerNumber + + detail.fromBatch = detail.batch; + detail.toBatch = detail.batch; + + detail.fromLocationCode = detail.locationCode; + detail.toLocationCode = ""; + + detail.reason = this.reasonCode; subList.push(detail) } }) @@ -290,31 +297,7 @@ return subList; }, - setRequestParams(){ - var subList = [] - var supplierCode="" - this.detailSource.forEach(item => { - item.subList.forEach(detail => { - if (detail.scaned) { - if(supplierCode==""){ - supplierCode = detail.package.supplierCode - } - subList.push(detail) - } - }) - }) - - this.dataContent.subList = subList - this.dataContent.supplierCode = supplierCode - this.dataContent.businessType = "PurchasePutaway" - this.dataContent.departmentCode= "研发部门"; - this.dataContent.status= 1 ; - this.dataContent.autoCommit = "FALSE"; - this.dataContent.autoAgree = "FALSE"; - this.dataContent.autoExecute = "FALSE"; - this.dataContent.directCreateRecord = "FALSE"; - return this.dataContent; - }, + showMessage(message) { @@ -345,14 +328,18 @@ this.getFromLocationCode(location, code) }, getFromLocationCode(location, code) { - this.fromLocationInfo = location; this.fromLocationCode = code; this.openScanPopup(); }, showCommitSuccessMessage(hint) { this.$refs.comMessage.showSuccessMessage(hint, res => { - this.fromLocationCode = ''; + this.reasonCode = "" + this.reasonText = ""; + this.detailSource = []; + this.subList =[]; + this.managementList =[]; + this.dataContent ={} }) }, @@ -365,6 +352,15 @@ this.detailSource.splice(i, 1) } } + }, + reasonChange(e) { + if (e.detail.value.length == 0) { + this.reasonCode = "" + this.reasonText = "" + } else { + this.reasonCode = e.detail.value[0].value + this.reasonText = e.detail.value[0].text + } } } } diff --git a/pages/unPlanned/record/issueRecord.vue b/pages/unPlanned/record/issueRecord.vue index 8214c1ce..8d36ad07 100644 --- a/pages/unPlanned/record/issueRecord.vue +++ b/pages/unPlanned/record/issueRecord.vue @@ -7,7 +7,7 @@ + placeholder="请选择出库原因" popup-title="出库原因" :localdata="reasonList" @change="reasonChange"> @@ -98,13 +98,15 @@ toInventoryStatus: [], businessType: {}, //业务类型 detailSource: [], //绑定在页面上的数据源 - reason: "", + reasonText: "", + reasonCode:"", reasonList: [], dataContent:{} } }, mounted() { + this.reasonList = getUnPlannedIssuseReasonList(); var typeCode = "UnplannedDeliver" getBusinessType(typeCode, res => { if (res.success) { @@ -209,11 +211,12 @@ this.detailSource.splice(index, 1) }, commit() { - if (this.reason == '') { + if (this.reasonText == '') { this.showErrorMessage("请选择出库原因") return; } var params =this.setParams() + console.log("提交" + JSON.stringify(params)) // unPlannedIssueRecordSubmit(params).then(res => { // uni.hideLoading() // if (res.data) { @@ -232,8 +235,6 @@ this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { - // var info = getPackingNumberAndBatch(this.managementList, detail.itemCode, - // detail.packingNumber, detail.batch); detail.itemCode = detail.itemCode; detail.itemName = detail.package.itemName; detail.itemDesc1 = detail.package.itemDesc1; @@ -241,17 +242,19 @@ detail.inventoryStatus = detail.inventoryStatus; - detail.fromPackingNumber = info.packingNumber; - detail.toPackingNumber = info.packingNumber; + detail.fromPackingNumber = detail.packingNumber; + detail.toPackingNumber = detail.packingNumber; detail.fromContainerNumber = detail.containerNumber; detail.toContainerNumber = detail.containerNumber - detail.fromBatch = info.batch; - detail.toBatch = info.batch; + detail.fromBatch = detail.batch; + detail.toBatch = detail.batch; detail.fromLocationCode = detail.locationCode; - detail.toLocationCode = detail.toLocationCode; + detail.toLocationCode = ""; + + detail.reason = this.reasonCode; subList.push(detail) } }) @@ -259,6 +262,25 @@ return subList; }, + reasonChange(e) { + if (e.detail.value.length == 0) { + this.reasonCode = "" + this.reasonText = "" + } else { + this.reasonCode = e.detail.value[0].value + this.reasonText = e.detail.value[0].text + } + }, + showCommitSuccessMessage(hint) { + this.$refs.comMessage.showSuccessMessage(hint, res => { + this.reasonCode = "" + this.reasonText = ""; + this.detailSource = []; + this.managementList =[]; + this.dataContent ={} + }) + }, + } } diff --git a/pages/unPlanned/record/receiptRecord.vue b/pages/unPlanned/record/receiptRecord.vue index ca0ecd21..f56bf620 100644 --- a/pages/unPlanned/record/receiptRecord.vue +++ b/pages/unPlanned/record/receiptRecord.vue @@ -8,7 +8,7 @@ + @change="reasonChange"> @@ -27,7 +27,7 @@ - @@ -92,14 +92,13 @@ data() { return { toLocationCode: "", - toLocationInfo: {}, toInventoryStatus: [], businessType: {}, //业务类型 detailSource: [], //绑定在页面上的数据源 businessTypeCode: "UnplannedReceipt", - reason: "", + reasonText: "", + reasonCode:"", reasonList: [], - showToLoaction:true, dataContent:{}, managementList:[] } @@ -229,11 +228,11 @@ this.detailSource.splice(index, 1) }, commit() { - if (this.showToLoaction &&this.toLocationCode == "") { + if (this.toLocationCode == "") { this.showErrorMessage("请先选择目标库位") return; } - if (this.reason == '') { + if (this.reasonText == '') { this.showErrorMessage("请选择入库原因") return; } @@ -251,19 +250,18 @@ if (res.success) { this.managementList = res.list; var params = this.setParams() - debugger console.log("提交" + JSON.stringify(params)) - // unPlannedReceiptRecordbSubmit(params).then(res => { - // uni.hideLoading() - // if (res.data) { - // this.showCommitSuccessMessage("提交成功
生成计划外入库记录
" + res.data) - // } else { - // this.showErrorMessage("提交失败[" + res.msg + "]") - // } - // }).catch(error => { - // uni.hideLoading() - // this.showErrorMessage(error) - // }) + unPlannedReceiptRecordbSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成计划外入库记录
" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) } else { uni.hideLoading(); @@ -331,7 +329,8 @@ detail.fromLocationCode = ""; detail.toLocationCode = detail.toLocationCode; - + + detail.reason = this.reasonCode; subList.push(detail) } @@ -341,6 +340,25 @@ this.dataContent.creator = creator; return this.dataContent; }, + reasonChange(e) { + if (e.detail.value.length == 0) { + this.reasonCode = "" + this.reasonText = "" + } else { + this.reasonCode = e.detail.value[0].value + this.reasonText = e.detail.value[0].text + } + }, + showCommitSuccessMessage(hint) { + this.$refs.comMessage.showSuccessMessage(hint, res => { + this.reasonCode = "" + this.reasonText = ""; + this.detailSource = []; + this.managementList=[]; + this.dataContent ={} + this.toLocationCode ="" + }) + }, }