dn收货 逻辑修改

master
hou 3 years ago
parent 07ec266d02
commit e788d96728

@ -123,6 +123,7 @@ export default class dnReceiptDom extends BasePage {
every: any = {}; every: any = {};
value = ''; value = '';
type = 'text'; type = 'text';
DNReceivingListIndex: any = null;
border = true; border = true;
// //
receiptAmount: any = ''; receiptAmount: any = '';
@ -140,6 +141,8 @@ export default class dnReceiptDom extends BasePage {
requestAmount: number = null; requestAmount: number = null;
async onReady() { async onReady() {
this.model.DNReceivingList = [];
this.resetForm();
//this.initLocation(); //this.initLocation();
} }
// //
@ -177,7 +180,7 @@ export default class dnReceiptDom extends BasePage {
}); });
return; return;
} }
await this.model.queryOrderInInfo(this.form.documentNo); await this.model.queryOrderInInfo(this.form.documentNo.trim());
if (model.code == '1') { if (model.code == '1') {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -248,6 +251,21 @@ export default class dnReceiptDom extends BasePage {
async materialChoice(e: any) { async materialChoice(e: any) {
// //
this.every = { ...e.pickerName }; 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 = []; this.Location = [];
// //
@ -289,24 +307,37 @@ export default class dnReceiptDom extends BasePage {
// return // return
let isTrue = this.LocationList.some((item) => item.wlCode !== this.wl.label); let isTrue = this.LocationList.some((item) => item.wlCode !== this.wl.label);
if (isTrue) { // if (isTrue) {
uni.showToast({ // uni.showToast({
icon: 'none', // icon: 'none',
title: this.$t('message._tips5') as any, // title: this.$t('message._tips5') as any,
}); // });
return; // return;
} // }
this.LocationList.push({ this.LocationList.push({
...this.every, ...this.every,
wlCode: this.wl.label, wlCode: this.wl.label,
receiptAmount: this.receiptAmount, receiptAmount: this.receiptAmount,
}); });
this.model.DNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList);
this.receiptAmount = ''; this.receiptAmount = '';
isTrue = true; isTrue = true;
// this.addition();
this.business(); this.business();
} }
deleteItem(index: any) { deleteItem(indexItem: any) {
this.LocationList.splice(index, 1); 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(); this.business();
// guoshuang // guoshuang
uni.showToast({ uni.showToast({
@ -346,11 +377,33 @@ export default class dnReceiptDom extends BasePage {
}); });
return null; return null;
} }
this.every.wllist = this.LocationList; await this.model.submitOrderInEnter(this.model.DNReceivingList);
console.log('new this.every :::: ', this.every);
await this.model.submitOrderInEnter([this.every]);
this.resetForm(); 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() { async bill() {
if (this.form.documentNo == '') { if (this.form.documentNo == '') {
uni.showToast({ uni.showToast({

@ -35,6 +35,7 @@ export class ReceiptModule extends VuexModule {
dnNo = ''; dnNo = '';
code = ''; code = '';
DNdetailedList: any; DNdetailedList: any;
DNReceivingList: any = [];
/** /**
* *
*/ */

Loading…
Cancel
Save