原材料收货

master
hou 4 years ago
parent 15d764bd32
commit 17e49d7901

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

@ -49,6 +49,7 @@
<view class="number-right">
<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="allNum" :placeholder="$t('message.po_PleaseInput')" :type="type" :border="border" class="input" disabled /> -->
</view>
</view>
<!-- 库位 -->
@ -108,13 +109,12 @@ export default class dnReceiptDom extends BasePage {
materialList: any = [];
//
every: any = {};
everyIndex: any = '';
value = '';
headers = headers;
type = 'text';
//
DNReceivingList: any = [];
//
DNReceivingListIndex: any = null;
border = true;
//
receiptAmount: any = '';
@ -172,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) => {
@ -211,6 +216,7 @@ export default class dnReceiptDom extends BasePage {
}
//
poListChoice(e: any) {
this.receiptAmount = '';
this.poNo = e.pickerName.value;
//
this.materialList = JSON.parse(JSON.stringify(this.removeDuplicates(this.material, 'materialCode')));
@ -229,9 +235,11 @@ export default class dnReceiptDom extends BasePage {
}
// receiptAmount requestAmount
async materialChoice(e: any) {
this.receiptAmount = '';
//
this.every = { ...e.pickerName };
//
console.log('this.every', this.every);
this.Location = [];
//
this.Location = await this.initLocation(this.every);
@ -240,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) {
@ -247,7 +262,8 @@ export default class dnReceiptDom extends BasePage {
}
//
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) {
uni.showToast({
icon: 'none',
@ -262,73 +278,66 @@ export default class dnReceiptDom extends BasePage {
});
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({
icon: 'none',
title: this.$t('message.Commission_tips4') as any,
});
return;
}
this.LocationList.push({
...this.every,
wlCode: this.wl.label,
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) {
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,
});
return (isTrue = false);
}
if (isTrue == true || wllistIsTrue == false) {
this.DNReceivingList[this.DNReceivingListIndex].wllist.push(this.LocationList[this.LocationList.length - 1]);
}
isTrue = false;
wllistIsTrue = false;
});
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];
}
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) {
this.DNReceivingList.forEach((item: any) => {
if (item.poNo == e.lineData.poNo || item.poLine == e.lineData.poLine || item.materialCode == e.lineData.materialCode) {
item.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) {
item.wllist.splice(index, 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;
}
});
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) {
return;
}
@ -354,7 +363,6 @@ export default class dnReceiptDom extends BasePage {
// this.material = [];
//
this.materialList = [];
//
this.receiptAmount = null;
this.DNReceivingList = [];
@ -368,12 +376,7 @@ export default class dnReceiptDom extends BasePage {
});
return null;
}
let obj = {
factoryCode: this.session.factoryCode,
loginName: this.session.loginName,
list: this.DNReceivingList,
};
await this.model.submitOrderInEnter(obj);
await this.model.submitOrderInEnter(this.DNReceivingList);
this.resetForm();
}
async bill() {
@ -392,10 +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);
}
}
</script>
<style lang="scss" scoped>

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

Loading…
Cancel
Save