dn收货 逻辑修改

master
hou 3 years ago
parent 07ec266d02
commit e788d96728

@ -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({

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

Loading…
Cancel
Save