From e788d967286c212af3163602d8e04ed1bb81e9b1 Mon Sep 17 00:00:00 2001 From: hou <1601990943@qq.com> Date: Tue, 18 Jan 2022 22:46:10 +0800 Subject: [PATCH] =?UTF-8?q?dn=E6=94=B6=E8=B4=A7=20=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../raw/ingoods/dnReceipt/dnReceiving.vue | 79 ++++++++++++++++--- src/pages/raw/ingoods/dnReceipt/model.ts | 1 + 2 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue b/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue index 119d3e8..c5d45c3 100644 --- a/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue +++ b/src/pages/raw/ingoods/dnReceipt/dnReceiving.vue @@ -123,6 +123,7 @@ export default class dnReceiptDom extends BasePage { every: any = {}; value = ''; type = 'text'; + DNReceivingListIndex: any = null; border = true; //本次数量 receiptAmount: any = ''; @@ -140,6 +141,8 @@ export default class dnReceiptDom extends BasePage { requestAmount: number = null; async onReady() { + this.model.DNReceivingList = []; + this.resetForm(); //this.initLocation(); } // 页面初始化 @@ -177,7 +180,7 @@ export default class dnReceiptDom extends BasePage { }); return; } - await this.model.queryOrderInInfo(this.form.documentNo); + await this.model.queryOrderInInfo(this.form.documentNo.trim()); if (model.code == '1') { uni.showToast({ icon: 'none', @@ -248,6 +251,21 @@ export default class dnReceiptDom extends BasePage { async materialChoice(e: any) { // 待放入新增中的公共对象 this.every = { ...e.pickerName }; + if (this.DNReceivingListIndex == null) { + this.model.DNReceivingList.push(this.every); + } + this.model.DNReceivingList.forEach((item: any, index: any) => { + if (item.poLine == this.every.poLine || item.materialCode == this.every.materialCode || item.dnNo == this.every.dnNo) { + this.DNReceivingListIndex = index; + } + }); + this.model.DNReceivingList.forEach((item: any, index: any) => { + if (item.poLine != this.every.poLine || item.materialCode != this.every.materialCode || item.dnNo != this.every.dnNo) { + this.model.DNReceivingList.push(this.every); + this.DNReceivingListIndex = index + 1; + } + }); + console.log('this.model.DNReceivingList', this.model.DNReceivingList); //清空库位列表 避免库位重复添加 this.Location = []; // 查询时初始化仓库 @@ -289,24 +307,37 @@ export default class dnReceiptDom extends BasePage { // 判断已添加库位和新添加库位是否相同,不相同return let isTrue = this.LocationList.some((item) => item.wlCode !== this.wl.label); - if (isTrue) { - uni.showToast({ - icon: 'none', - title: this.$t('message._tips5') as any, - }); - return; - } + // if (isTrue) { + // uni.showToast({ + // icon: 'none', + // title: this.$t('message._tips5') as any, + // }); + // return; + // } this.LocationList.push({ ...this.every, wlCode: this.wl.label, receiptAmount: this.receiptAmount, }); + this.model.DNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList); this.receiptAmount = ''; isTrue = true; + // this.addition(); this.business(); } - deleteItem(index: any) { - this.LocationList.splice(index, 1); + deleteItem(indexItem: any) { + let Item: any = {}; + this.model.DNReceivingList.forEach((item: any) => { + if (item.poLine == this.every.poLine || item.materialCode == this.every.materialCode || item.dnNo == this.every.dnNo) { + Item = item; + } + }); + Item.wllist.forEach((item: any, index: any) => { + if (item.poLine == this.LocationList[indexItem].poLine || item.materialCode == this.LocationList[indexItem].materialCode || item.dnNo == this.LocationList[indexItem].dnNo) { + Item.wllist.splice(index, 1); + } + }); + this.LocationList.splice(indexItem, 1); this.business(); // guoshuang 删除成功提示 uni.showToast({ @@ -346,11 +377,33 @@ export default class dnReceiptDom extends BasePage { }); return null; } - this.every.wllist = this.LocationList; - console.log('new this.every :::: ', this.every); - await this.model.submitOrderInEnter([this.every]); + await this.model.submitOrderInEnter(this.model.DNReceivingList); this.resetForm(); } + addition() { + if (this.model.DNReceivingList.length != 0) { + let whether: any = false; + let nnum: any; + this.model.DNReceivingList.forEach((item: any, index: any) => { + if (item.poLine == this.every.poLine || item.sendSpot == this.every.sendSpot || item.materialCode == this.every.materialCode) { + whether = true; + nnum = index; + return; + } + }); + console.log('nnum', nnum); + if (whether == true) { + this.model.DNReceivingList[nnum].wllist.push(this.LocationList[this.LocationList.length - 1]); + } else { + this.every.wllist.push(this.LocationList[this.LocationList.length - 1]); + this.model.DNReceivingList.push(this.every); + } + } + if (this.model.DNReceivingList.length == 0) { + this.model.DNReceivingList.push(this.every); + } + console.log('this.model.DNReceivingList', this.model.DNReceivingList); + } async bill() { if (this.form.documentNo == '') { uni.showToast({ diff --git a/src/pages/raw/ingoods/dnReceipt/model.ts b/src/pages/raw/ingoods/dnReceipt/model.ts index 51ba0fc..ff262eb 100644 --- a/src/pages/raw/ingoods/dnReceipt/model.ts +++ b/src/pages/raw/ingoods/dnReceipt/model.ts @@ -35,6 +35,7 @@ export class ReceiptModule extends VuexModule { dnNo = ''; code = ''; DNdetailedList: any; + DNReceivingList: any = []; /** * 看单号查询结果 */