diff --git a/src/api/request2.js b/src/api/request2.js index de9b1b23..cb1d2fc0 100644 --- a/src/api/request2.js +++ b/src/api/request2.js @@ -866,7 +866,18 @@ export function getPurchaseReceiptJobDetail(id) { data: {}, }); } - +/** + * 采购收货 获取收货记录的列表 + * @param {*} id 任务id + * + */ +export function getPurchaseReceiptJobDetailListByNmber(requestNumber) { + return request({ + url: baseApi + "/wms/purchasereceipt-record-detail/listByNmber?requestNumber=" + requestNumber, + method: "get", + data: {}, + }); +} /** * 采购收货 任务提交 * @param {*} 任务id diff --git a/src/pages/purchaseReceipt/job/receiptDetail.vue b/src/pages/purchaseReceipt/job/receiptDetail.vue index a791e5b8..70d58910 100644 --- a/src/pages/purchaseReceipt/job/receiptDetail.vue +++ b/src/pages/purchaseReceipt/job/receiptDetail.vue @@ -89,7 +89,8 @@ getPurchaseReceiptJobDetail, takePurchaseReceiptJob, cancleTakePurchaseReceiptJob, - getPutawayJobList + getPutawayJobList, + getPurchaseReceiptJobDetailListByNmber } from '@/api/request2.js'; import { @@ -287,6 +288,7 @@ } else { that.toLocationCode = that.jobToLocationCode; } + console.log(777,that.toLocationCode) that.isAllReceived = false; //获取管理模式,封装参数 @@ -300,6 +302,11 @@ this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' } }) + // 获取收货记录列表,用于判断扫描包装是否已被收货 + getPurchaseReceiptJobDetailListByNmber(that.jobContent.requestNumber).then((res)=>{ + console.log(res) + this.receiptRecordList = res.data + }) // if (uni.getStorageSync('purchaseReceiptDetailPointParams')) { // const purchaseReceiptDetailPointParams = uni.getStorageSync( // 'purchaseReceiptDetailPointParams') @@ -489,6 +496,11 @@ this.showMessage("批次【" + batch + "】不在列表中") } else { // 箱码是否已经扫描 + var isHavePackingNumber1 =this.receiptRecordList.find(r => r.packingNumber == packingNumber); + if(isHavePackingNumber1){ + this.showMessage("箱码【" + packingNumber + "】已经生成任务"); + return + } var isHavePackingNumber =this.packingNumberList.find(r => r.packingNumber == packingNumber); if(isHavePackingNumber){ this.showMessage("箱码【" + packingNumber + "】已经扫描"); @@ -624,12 +636,12 @@ } } - // this.toLocationCode = code - // this.detailSource.forEach(item => { - // item.subList.forEach(detail => { - // detail.toLocationCode = code - // }) - // }) + // this.toLocationCode = code + // this.detailSource.forEach(item => { + // item.subList.forEach(detail => { + // detail.toLocationCode = code + // }) + // }) }, commit() { @@ -674,6 +686,7 @@ //提交 this.$refs.comMessage.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => { if (res) { + this.submitJob() } }); @@ -693,6 +706,7 @@ //扫描数量和任务数量相等,直接提交 let str = '' let str1 = '' + let str2 = '' this.detailSource.forEach((item) => { item.subList.forEach(cur=>{ if(cur.scaned){ @@ -702,6 +716,9 @@ if(parseFloat(cur.qty) { if (res) { - this.submitJob() + if(str2){ + setTimeout(()=>{ + this.$refs.comMessage.showQuestionMessage1(str2 + "是否提交?", 'red', res => { + if (res) { + this.submitJob() + } + }); + },100) + }else{ + this.submitJob() + } + } }); } else { @@ -772,7 +800,12 @@ mask: true }); - var params = this.setParams(); + var params = ''; + if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ + params = this.setParamsBatch() + }else{ + params = this.setParams() + } let that = this console.log(877,params) purchaseReceiptJobSubmit(params).then(res => { @@ -883,11 +916,53 @@ }, - setParams() { + setParamsBatch() { var subList = [] var createTime = getCurrDateTime(); var creator = this.$store.state.user.id console.log(8787,this.detailSource) + this.detailSource.forEach(item => { + let obj = '' + item.subList.forEach(detail => { + // if (!detail.scaned) { + // detail.handleQty = 0 + // } + if(detail.scaned){ + detail.packList.forEach(pack => { + obj= {...item,...detail, ...pack} + obj.toLocationCode = detail.toLocationCode + if (!pack.scaned) { + pack.handleQty = 0 + } + obj.toPackingNumber =pack.packingNumber + // obj.packingNumber = '' + delete obj.subList + delete obj.packList + subList.push(obj) + }) + // // obj.packList = [] + // obj.toLocationCode = this.toLocationCode ? this.toLocationCode :this.jobToLocationCode + var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,detail.packingNumber, detail.batch); + // console.log(info) + // obj.toPackingNumber =info.packingNumber; + // obj.packingNumber = info.packingNumber; + // obj.formPackingNumber = info.packingNumber; + obj.toBatch = info.batch; + } + + }) + }) + + this.jobContent.subList = subList + this.jobContent.createTime = createTime; + this.jobContent.creator = creator; + return this.jobContent; + }, + setParams() { + var subList = [] + var createTime = getCurrDateTime(); + var creator = this.$store.state.user.id + this.detailSource.forEach(item => { item.subList.forEach(detail => { // if (!detail.scaned) { @@ -898,15 +973,11 @@ console.log(8787,this.detailSource) pack.handleQty = 0 } }) - let obj = {...detail} - obj.packList = [] - obj.toLocationCode = this.toLocationCode ? this.toLocationCode :this.jobToLocationCode - var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,detail.packingNumber, detail.batch); - obj.toPackingNumber = info.packingNumber; - obj.packingNumber = info.packingNumber; - obj.formPackingNumber = info.packingNumber; - obj.toBatch = info.batch; - subList.push(obj) + 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