原材料收货

master
hou 4 years ago
parent 15d764bd32
commit 17e49d7901

@ -400,6 +400,7 @@ export default class stoOutboundDom extends BasePage {
this.form.productDescZh = ''; this.form.productDescZh = '';
this.selectMaterielList = []; this.selectMaterielList = [];
(this.form.rowItem = ''), this.$table.onEmpty(); (this.form.rowItem = ''), this.$table.onEmpty();
this.query();
} }
// } // }
} }

@ -49,6 +49,7 @@
<view class="number-right"> <view class="number-right">
<view class="number-right-title">{{ $t('message.Cumulative') }}</view> <view class="number-right-title">{{ $t('message.Cumulative') }}</view>
<u-input v-model="every.receiptAmount" :placeholder="$t('message.po_PleaseInput')" :type="type" :border="border" class="input" disabled /> <u-input v-model="every.receiptAmount" :placeholder="$t('message.po_PleaseInput')" :type="type" :border="border" class="input" disabled />
<!-- <u-input v-model="allNum" :placeholder="$t('message.po_PleaseInput')" :type="type" :border="border" class="input" disabled /> -->
</view> </view>
</view> </view>
<!-- 库位 --> <!-- 库位 -->
@ -108,13 +109,12 @@ export default class dnReceiptDom extends BasePage {
materialList: any = []; materialList: any = [];
// //
every: any = {}; every: any = {};
everyIndex: any = '';
value = ''; value = '';
headers = headers; headers = headers;
type = 'text'; type = 'text';
// //
DNReceivingList: any = []; DNReceivingList: any = [];
//
DNReceivingListIndex: any = null;
border = true; border = true;
// //
receiptAmount: any = ''; receiptAmount: any = '';
@ -172,11 +172,16 @@ export default class dnReceiptDom extends BasePage {
icon: 'none', icon: 'none',
title: this.$t('message.successful') as any, title: this.$t('message.successful') as any,
}); });
console.log('orderInInfoList', this.model.orderInInfoList);
} }
let list: any = localStorage.getItem('list'); let list: any = localStorage.getItem('list');
localStorage.removeItem('list'); localStorage.removeItem('list');
this.material = JSON.parse(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'); let arr = this.removeDuplicates(this.poList, 'poNo');
// //
arr.forEach((item: any) => { arr.forEach((item: any) => {
@ -211,6 +216,7 @@ export default class dnReceiptDom extends BasePage {
} }
// //
poListChoice(e: any) { poListChoice(e: any) {
this.receiptAmount = '';
this.poNo = e.pickerName.value; this.poNo = e.pickerName.value;
// //
this.materialList = JSON.parse(JSON.stringify(this.removeDuplicates(this.material, 'materialCode'))); this.materialList = JSON.parse(JSON.stringify(this.removeDuplicates(this.material, 'materialCode')));
@ -229,9 +235,11 @@ export default class dnReceiptDom extends BasePage {
} }
// receiptAmount requestAmount // receiptAmount requestAmount
async materialChoice(e: any) { async materialChoice(e: any) {
this.receiptAmount = '';
// //
this.every = { ...e.pickerName }; this.every = { ...e.pickerName };
// //
console.log('this.every', this.every);
this.Location = []; this.Location = [];
// //
this.Location = await this.initLocation(this.every); this.Location = await this.initLocation(this.every);
@ -240,6 +248,13 @@ export default class dnReceiptDom extends BasePage {
this.LocationChoice({ this.LocationChoice({
pickerName: this.Location.find(() => true), 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) { LocationChoice(e: any) {
@ -247,7 +262,8 @@ export default class dnReceiptDom extends BasePage {
} }
// //
Add() { Add() {
const count = this.totalLocation(this.LocationList); // const count = this.totalLocation(this.LocationList);
const count = parseFloat(this.every.requestAmount);
if (this.receiptAmount == '' || !this.wl.value) { if (this.receiptAmount == '' || !this.wl.value) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -262,73 +278,66 @@ export default class dnReceiptDom extends BasePage {
}); });
return; return;
} }
if (parseFloat(this.receiptAmount) > this.every.requestAmount || +this.receiptAmount + count > this.every.requestAmount) { if (parseFloat(this.receiptAmount) > count || parseFloat(this.receiptAmount) + parseFloat(this.every.receiptAmount) > count) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: this.$t('message.Commission_tips4') as any, title: this.$t('message.Commission_tips4') as any,
}); });
return; return;
} }
this.LocationList.push({ let isTrue = true;
...this.every, this.DNReceivingList[this.everyIndex].wllist.forEach((item: any) => {
wlCode: this.wl.label, if (item.wlCode == this.wl.label && item.receiptAmount == this.receiptAmount) {
receiptAmount: this.receiptAmount,
});
this.every.wllist = [];
if (this.DNReceivingList.length == 0) {
this.DNReceivingList.push(this.every);
this.DNReceivingList[0].wllist.push(this.LocationList[this.LocationList.length - 1]);
} else {
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;
item.wllist.forEach((item: any) => {
if (item.poNo == this.LocationList.poNo || item.poLine == this.LocationList.poLine || item.materialCode == this.LocationList.materialCode || item.wlCode == this.LocationList.wlCode || item.receiptAmount == this.LocationList.receiptAmount) {
wllistIsTrue = true;
}
});
}
});
if (isTrue == false) {
this.DNReceivingList.push(this.every);
this.DNReceivingList[this.DNReceivingList.length - 1].wllist.push(this.LocationList[this.LocationList.length - 1]);
}
if (isTrue == true || wllistIsTrue == true) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: this.$t('message.repeatedly') as any, title: this.$t('message.repeatedly') as any,
}); });
return (isTrue = false);
} }
if (isTrue == true || wllistIsTrue == false) { });
this.DNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList[this.LocationList.length - 1]); if (isTrue == true) {
} this.LocationList.push({
isTrue = false; ...this.every,
wllistIsTrue = false; 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];
} }
this.receiptAmount = '';
this.business();
} }
deleteItem(e: any) { deleteItem(e: any) {
console.log('data', e.lineData);
uni.showModal({ uni.showModal({
title: this.$t('message.delete') as any, content: this.$t('message.product_Delete') as string,
cancelText: this.$t('message.Cancel') as any, cancelText: this.$t('message.Cancel') as string,
confirmText: this.$t('message.workArea_Confirm') as any, confirmText: this.$t('message.workArea_Confirm') as string,
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
this.DNReceivingList.forEach((item: any) => { this.LocationList.splice(e.contentIndex, 1);
if (item.poNo == e.lineData.poNo || item.poLine == e.lineData.poLine || item.materialCode == e.lineData.materialCode) { let externalIndex: number = 0;
item.wllist.forEach((item: any, index: any) => { this.DNReceivingList.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) { if (item.poNo == e.lineData.poNo && item.materialCode == e.lineData.materialCode && item.poLine == e.lineData.poLine) {
item.wllist.splice(index, 1); externalIndex = index;
}
});
} }
}); });
this.LocationList.splice(e.contentIndex, 1); 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) { } else if (res.cancel) {
return; return;
} }
@ -354,7 +363,6 @@ export default class dnReceiptDom extends BasePage {
// this.material = []; // this.material = [];
// //
this.materialList = []; this.materialList = [];
// //
this.receiptAmount = null; this.receiptAmount = null;
this.DNReceivingList = []; this.DNReceivingList = [];
@ -368,12 +376,7 @@ export default class dnReceiptDom extends BasePage {
}); });
return null; return null;
} }
let obj = { await this.model.submitOrderInEnter(this.DNReceivingList);
factoryCode: this.session.factoryCode,
loginName: this.session.loginName,
list: this.DNReceivingList,
};
await this.model.submitOrderInEnter(obj);
this.resetForm(); this.resetForm();
} }
async bill() { async bill() {
@ -392,10 +395,6 @@ export default class dnReceiptDom extends BasePage {
await this.model.querydetaildlist(content); await this.model.querydetaildlist(content);
this.toPage(this.page.raw.ingoods.dnReceipt.Local); this.toPage(this.page.raw.ingoods.dnReceipt.Local);
} }
//
business() {
this.every.receiptAmount = this.totalLocation(this.LocationList);
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -109,14 +109,12 @@ export default class dnReceiptDom extends BasePage {
materialList: any = []; materialList: any = [];
// //
every: any = {}; every: any = {};
everyIndex: any = '';
value = ''; value = '';
headers = headers; headers = headers;
type = 'text'; type = 'text';
// //
DNReceivingList: any = []; DNReceivingList: any = [];
allNum: any = 0;
//
DNReceivingListIndex: any = null;
border = true; border = true;
// //
receiptAmount: any = ''; receiptAmount: any = '';
@ -174,11 +172,16 @@ export default class dnReceiptDom extends BasePage {
icon: 'none', icon: 'none',
title: this.$t('message.successful') as any, title: this.$t('message.successful') as any,
}); });
console.log('orderInInfoList', this.model.orderInInfoList);
} }
let list: any = localStorage.getItem('list'); let list: any = localStorage.getItem('list');
localStorage.removeItem('list'); localStorage.removeItem('list');
this.material = JSON.parse(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'); let arr = this.removeDuplicates(this.poList, 'poNo');
// //
arr.forEach((item: any) => { arr.forEach((item: any) => {
@ -235,13 +238,8 @@ export default class dnReceiptDom extends BasePage {
this.receiptAmount = ''; this.receiptAmount = '';
// //
this.every = { ...e.pickerName }; 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 = [];
// //
this.Location = await this.initLocation(this.every); this.Location = await this.initLocation(this.every);
@ -250,6 +248,13 @@ export default class dnReceiptDom extends BasePage {
this.LocationChoice({ this.LocationChoice({
pickerName: this.Location.find(() => true), 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) { LocationChoice(e: any) {
@ -259,7 +264,6 @@ export default class dnReceiptDom extends BasePage {
Add() { Add() {
// const count = this.totalLocation(this.LocationList); // const count = this.totalLocation(this.LocationList);
const count = parseFloat(this.every.requestAmount); const count = parseFloat(this.every.requestAmount);
console.log('count', count);
if (this.receiptAmount == '' || !this.wl.value) { if (this.receiptAmount == '' || !this.wl.value) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -274,104 +278,66 @@ export default class dnReceiptDom extends BasePage {
}); });
return; 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({ uni.showToast({
icon: 'none', icon: 'none',
title: this.$t('message.Commission_tips4') as any, 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; return;
} }
this.LocationList.push({ let isTrue = true;
...this.every, this.DNReceivingList[this.everyIndex].wllist.forEach((item: any) => {
wlCode: this.wl.label, if (item.wlCode == this.wl.label && item.receiptAmount == this.receiptAmount) {
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) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: this.$t('message.repeatedly') as any, title: this.$t('message.repeatedly') as any,
}); });
// this.LocationList.splice(this.LocationList[this.LocationList.length - 1], 1); return (isTrue = false);
this.LocationList.pop();
console.log('this.DNReceivingList', this.DNReceivingList);
isTrue = false;
wllistIsTrue = false;
this.receiptAmount = '';
return;
} }
if (isTrue == true || wllistIsTrue == false) { });
this.DNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList[this.LocationList.length - 1]); if (isTrue == true) {
console.log('this.DNReceivingList', this.DNReceivingList); this.LocationList.push({
isTrue = false; ...this.every,
wllistIsTrue = false; receiptAmount: this.receiptAmount,
this.receiptAmount = ''; wlCode: this.wl.label,
return; });
} this.DNReceivingList[this.everyIndex].wllist.push(this.LocationList[this.LocationList.length - 1]);
isTrue = false; let num: any = 0;
wllistIsTrue = false; this.DNReceivingList[this.everyIndex].wllist.forEach((item: any) => {
this.DNReceivingListIndex = null; 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) { deleteItem(e: any) {
console.log('data', e.lineData);
uni.showModal({ uni.showModal({
title: this.$t('message.delete') as any, content: this.$t('message.product_Delete') as string,
cancelText: this.$t('message.Cancel') as any, cancelText: this.$t('message.Cancel') as string,
confirmText: this.$t('message.workArea_Confirm') as any, confirmText: this.$t('message.workArea_Confirm') as string,
success: (res) => { success: (res) => {
if (res.confirm) { 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); 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) { } else if (res.cancel) {
return; return;
} }
@ -397,7 +363,6 @@ export default class dnReceiptDom extends BasePage {
// this.material = []; // this.material = [];
// //
this.materialList = []; this.materialList = [];
// //
this.receiptAmount = null; this.receiptAmount = null;
this.DNReceivingList = []; this.DNReceivingList = [];
@ -430,11 +395,6 @@ export default class dnReceiptDom extends BasePage {
await this.model.querydetaildlist(content); await this.model.querydetaildlist(content);
this.toPage(this.page.raw.ingoods.dnReceipt.Local); 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save