|
|
|
|
@ -109,14 +109,12 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
materialList: any = [];
|
|
|
|
|
// 当前被选择中原材料
|
|
|
|
|
every: any = {};
|
|
|
|
|
everyIndex: any = '';
|
|
|
|
|
value = '';
|
|
|
|
|
headers = headers;
|
|
|
|
|
type = 'text';
|
|
|
|
|
//要提交的数据
|
|
|
|
|
DNReceivingList: any = [];
|
|
|
|
|
allNum: any = 0;
|
|
|
|
|
//下标
|
|
|
|
|
DNReceivingListIndex: any = null;
|
|
|
|
|
border = true;
|
|
|
|
|
//本次数量
|
|
|
|
|
receiptAmount: any = '';
|
|
|
|
|
@ -174,11 +172,16 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: this.$t('message.successful') as any,
|
|
|
|
|
});
|
|
|
|
|
console.log('orderInInfoList', this.model.orderInInfoList);
|
|
|
|
|
}
|
|
|
|
|
let list: any = localStorage.getItem('list');
|
|
|
|
|
localStorage.removeItem('list');
|
|
|
|
|
this.material = JSON.parse(list);
|
|
|
|
|
this.poList = [...this.material]; //结构
|
|
|
|
|
this.DNReceivingList = JSON.parse(list);
|
|
|
|
|
this.DNReceivingList.forEach((item: any) => {
|
|
|
|
|
item.wllist = [];
|
|
|
|
|
});
|
|
|
|
|
this.poList = [...this.DNReceivingList]; //结构
|
|
|
|
|
let arr = this.removeDuplicates(this.poList, 'poNo');
|
|
|
|
|
// 组装下拉结构
|
|
|
|
|
arr.forEach((item: any) => {
|
|
|
|
|
@ -235,13 +238,8 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
// 待放入新增中的公共对象
|
|
|
|
|
this.every = { ...e.pickerName };
|
|
|
|
|
this.LocationList.forEach((item: any) => {
|
|
|
|
|
if (item.poNo == this.every.poNo || item.poLine == this.every.poLine || item.materialCode == this.every.materialCode) {
|
|
|
|
|
this.every.receiptAmount += parseFloat(item.receiptAmount);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.every.wllist = [];
|
|
|
|
|
//清空库位列表 避免库位重复添加
|
|
|
|
|
console.log('this.every', this.every);
|
|
|
|
|
this.Location = [];
|
|
|
|
|
// 查询时初始化仓库
|
|
|
|
|
this.Location = await this.initLocation(this.every);
|
|
|
|
|
@ -250,6 +248,13 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
this.LocationChoice({
|
|
|
|
|
pickerName: this.Location.find(() => true),
|
|
|
|
|
});
|
|
|
|
|
this.DNReceivingList.forEach((item: any, index: any) => {
|
|
|
|
|
if (item.poNo == this.every.poNo && item.materialCode == this.every.materialCode && item.poLine == this.every.poLine) {
|
|
|
|
|
this.everyIndex = index;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.every = this.DNReceivingList[this.everyIndex];
|
|
|
|
|
console.log('this.every', this.every);
|
|
|
|
|
}
|
|
|
|
|
//选择库位后触发的回调事件
|
|
|
|
|
LocationChoice(e: any) {
|
|
|
|
|
@ -259,7 +264,6 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
Add() {
|
|
|
|
|
// const count = this.totalLocation(this.LocationList);
|
|
|
|
|
const count = parseFloat(this.every.requestAmount);
|
|
|
|
|
console.log('count', count);
|
|
|
|
|
if (this.receiptAmount == '' || !this.wl.value) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
@ -274,104 +278,66 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (parseFloat(this.receiptAmount) > this.every.requestAmount || parseFloat(this.receiptAmount) + parseFloat(this.every.receiptAmount) > count) {
|
|
|
|
|
if (parseFloat(this.receiptAmount) > count || parseFloat(this.receiptAmount) + parseFloat(this.every.receiptAmount) > count) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: this.$t('message.Commission_tips4') as any,
|
|
|
|
|
});
|
|
|
|
|
console.log('2333');
|
|
|
|
|
console.log('parseFloat(this.every.this.receiptAmount)', this.receiptAmount + parseFloat(this.every.receiptAmount));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.LocationList.push({
|
|
|
|
|
...this.every,
|
|
|
|
|
wlCode: this.wl.label,
|
|
|
|
|
receiptAmount: this.receiptAmount,
|
|
|
|
|
});
|
|
|
|
|
if (this.DNReceivingList.length != 0) {
|
|
|
|
|
let isTrue: any = false;
|
|
|
|
|
let wllistIsTrue: any = false;
|
|
|
|
|
this.DNReceivingList.forEach((item: any, index: any) => {
|
|
|
|
|
if (item.poNo == this.every.poNo && item.poLine == this.every.poLine && item.materialCode == this.every.materialCode) {
|
|
|
|
|
isTrue = true;
|
|
|
|
|
this.DNReceivingListIndex = index;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log('isTrue', isTrue);
|
|
|
|
|
if (isTrue == true) {
|
|
|
|
|
this.DNReceivingList[this.DNReceivingListIndex].wllist.forEach((item: any) => {
|
|
|
|
|
if (item.poNo == this.LocationList[this.LocationList.length - 1].poNo && item.poLine == this.LocationList[this.LocationList.length - 1].poLine && item.materialCode == this.LocationList[this.LocationList.length - 1].materialCode && item.wlCode == this.LocationList[this.LocationList.length - 1].wlCode && item.receiptAmount == this.LocationList[this.LocationList.length - 1].receiptAmount) {
|
|
|
|
|
wllistIsTrue = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log('wllistIsTrue', wllistIsTrue);
|
|
|
|
|
}
|
|
|
|
|
console.log(1);
|
|
|
|
|
if (isTrue == false) {
|
|
|
|
|
this.DNReceivingList.push(this.every);
|
|
|
|
|
this.DNReceivingList[this.DNReceivingList.length - 1].wllist.push(this.LocationList[this.LocationList.length - 1]);
|
|
|
|
|
console.log('this.DNReceivingList', this.DNReceivingList);
|
|
|
|
|
isTrue = false;
|
|
|
|
|
wllistIsTrue = false;
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (isTrue == true || wllistIsTrue == true) {
|
|
|
|
|
let isTrue = true;
|
|
|
|
|
this.DNReceivingList[this.everyIndex].wllist.forEach((item: any) => {
|
|
|
|
|
if (item.wlCode == this.wl.label && item.receiptAmount == this.receiptAmount) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: this.$t('message.repeatedly') as any,
|
|
|
|
|
});
|
|
|
|
|
// this.LocationList.splice(this.LocationList[this.LocationList.length - 1], 1);
|
|
|
|
|
this.LocationList.pop();
|
|
|
|
|
console.log('this.DNReceivingList', this.DNReceivingList);
|
|
|
|
|
isTrue = false;
|
|
|
|
|
wllistIsTrue = false;
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
return;
|
|
|
|
|
return (isTrue = false);
|
|
|
|
|
}
|
|
|
|
|
if (isTrue == true || wllistIsTrue == false) {
|
|
|
|
|
this.DNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList[this.LocationList.length - 1]);
|
|
|
|
|
console.log('this.DNReceivingList', this.DNReceivingList);
|
|
|
|
|
isTrue = false;
|
|
|
|
|
wllistIsTrue = false;
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
isTrue = false;
|
|
|
|
|
wllistIsTrue = false;
|
|
|
|
|
this.DNReceivingListIndex = null;
|
|
|
|
|
});
|
|
|
|
|
if (isTrue == true) {
|
|
|
|
|
this.LocationList.push({
|
|
|
|
|
...this.every,
|
|
|
|
|
receiptAmount: this.receiptAmount,
|
|
|
|
|
wlCode: this.wl.label,
|
|
|
|
|
});
|
|
|
|
|
this.DNReceivingList[this.everyIndex].wllist.push(this.LocationList[this.LocationList.length - 1]);
|
|
|
|
|
let num: any = 0;
|
|
|
|
|
this.DNReceivingList[this.everyIndex].wllist.forEach((item: any) => {
|
|
|
|
|
num += parseFloat(item.receiptAmount);
|
|
|
|
|
item.wllist = null;
|
|
|
|
|
});
|
|
|
|
|
this.DNReceivingList[this.everyIndex].receiptAmount = num;
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
this.every = this.DNReceivingList[this.everyIndex];
|
|
|
|
|
}
|
|
|
|
|
if (this.DNReceivingList.length == 0) {
|
|
|
|
|
this.DNReceivingList.push(this.every);
|
|
|
|
|
this.DNReceivingList[0].wllist.push(this.LocationList[this.LocationList.length - 1]);
|
|
|
|
|
console.log('this.DNReceivingList', this.DNReceivingList);
|
|
|
|
|
this.DNReceivingListIndex = null;
|
|
|
|
|
}
|
|
|
|
|
this.receiptAmount = '';
|
|
|
|
|
this.business();
|
|
|
|
|
}
|
|
|
|
|
deleteItem(e: any) {
|
|
|
|
|
console.log('data', e.lineData);
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: this.$t('message.delete') as any,
|
|
|
|
|
cancelText: this.$t('message.Cancel') as any,
|
|
|
|
|
confirmText: this.$t('message.workArea_Confirm') as any,
|
|
|
|
|
content: this.$t('message.product_Delete') as string,
|
|
|
|
|
cancelText: this.$t('message.Cancel') as string,
|
|
|
|
|
confirmText: this.$t('message.workArea_Confirm') as string,
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
let DNIndex: any;
|
|
|
|
|
let nemIndex: any;
|
|
|
|
|
this.DNReceivingList.forEach((item: any, index: any) => {
|
|
|
|
|
if (item.poNo == e.lineData.poNo || item.poLine == e.lineData.poLine || item.materialCode == e.lineData.materialCode) {
|
|
|
|
|
DNIndex = index;
|
|
|
|
|
}
|
|
|
|
|
this.DNReceivingList[DNIndex].wllist.forEach((item: any, index: any) => {
|
|
|
|
|
if (item.poNo == e.lineData.poNo || item.poLine == e.lineData.poLine || item.materialCode == e.lineData.materialCode || item.wlCode == e.lineData.wlCode || item.receiptAmount == e.lineData.receiptAmount) {
|
|
|
|
|
nemIndex = index;
|
|
|
|
|
this.DNReceivingList[DNIndex].wllist.splice(nemIndex, 1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
this.LocationList.splice(e.contentIndex, 1);
|
|
|
|
|
let externalIndex: number = 0;
|
|
|
|
|
this.DNReceivingList.forEach((item: any, index: any) => {
|
|
|
|
|
if (item.poNo == e.lineData.poNo && item.materialCode == e.lineData.materialCode && item.poLine == e.lineData.poLine) {
|
|
|
|
|
externalIndex = index;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
let inside: number = 0;
|
|
|
|
|
this.DNReceivingList[externalIndex].wllist.forEach((item: any, index: any) => {
|
|
|
|
|
if (item.receiptAmount == e.lineData.receiptAmount && item.wlCode == e.lineData.wlCode) {
|
|
|
|
|
inside = index;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.DNReceivingList[externalIndex].wllist.splice(inside, 1);
|
|
|
|
|
let num: number = 0;
|
|
|
|
|
this.DNReceivingList[externalIndex].wllist.forEach((item: any) => {
|
|
|
|
|
num += parseFloat(item.receiptAmount);
|
|
|
|
|
});
|
|
|
|
|
this.DNReceivingList[externalIndex].receiptAmount = num;
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -397,7 +363,6 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
// this.material = [];
|
|
|
|
|
// 清空 去重后的物料列表
|
|
|
|
|
this.materialList = [];
|
|
|
|
|
|
|
|
|
|
// 清空 当前累计数量
|
|
|
|
|
this.receiptAmount = null;
|
|
|
|
|
this.DNReceivingList = [];
|
|
|
|
|
@ -430,11 +395,6 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
await this.model.querydetaildlist(content);
|
|
|
|
|
this.toPage(this.page.raw.ingoods.dnReceipt.Local);
|
|
|
|
|
}
|
|
|
|
|
//添加和删除操作的时候 计算累计收货数量
|
|
|
|
|
business() {
|
|
|
|
|
this.every.receiptAmount = this.totalLocation(this.LocationList);
|
|
|
|
|
console.log('this.every.receiptAmount', this.every.receiptAmount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|