|
|
|
@ -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>
|
|
|
|
|
<!-- 库位 -->
|
|
|
|
@ -113,6 +114,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
type = 'text';
|
|
|
|
|
//要提交的数据
|
|
|
|
|
DNReceivingList: any = [];
|
|
|
|
|
allNum: any = 0;
|
|
|
|
|
//下标
|
|
|
|
|
DNReceivingListIndex: any = null;
|
|
|
|
|
border = true;
|
|
|
|
@ -211,6 +213,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,8 +232,15 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
}
|
|
|
|
|
//选择物料后触发的回调事件 本次数量:receiptAmount 需求数量:requestAmount
|
|
|
|
|
async materialChoice(e: any) {
|
|
|
|
|
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 = [];
|
|
|
|
|
//清空库位列表 避免库位重复添加
|
|
|
|
|
this.Location = [];
|
|
|
|
|
// 查询时初始化仓库
|
|
|
|
@ -247,7 +257,9 @@ 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);
|
|
|
|
|
console.log('count', count);
|
|
|
|
|
if (this.receiptAmount == '' || !this.wl.value) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
@ -262,11 +274,13 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (parseFloat(this.receiptAmount) > this.every.requestAmount || +this.receiptAmount + count > this.every.requestAmount) {
|
|
|
|
|
if (parseFloat(this.receiptAmount) > this.every.requestAmount || 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({
|
|
|
|
@ -274,39 +288,64 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
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 {
|
|
|
|
|
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) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
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({
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
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 (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();
|
|
|
|
@ -324,13 +363,13 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
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;
|
|
|
|
|
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) {
|
|
|
|
|
nemIndex = index;
|
|
|
|
|
this.DNReceivingList[DNIndex].wllist.splice(nemIndex, 1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
@ -372,12 +411,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() {
|
|
|
|
@ -399,6 +433,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
//添加和删除操作的时候 计算累计收货数量
|
|
|
|
|
business() {
|
|
|
|
|
this.every.receiptAmount = this.totalLocation(this.LocationList);
|
|
|
|
|
console.log('this.every.receiptAmount', this.every.receiptAmount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
@ -571,7 +606,7 @@ export default class dnReceiptDom extends BasePage {
|
|
|
|
|
line-height: 100rpx;
|
|
|
|
|
}
|
|
|
|
|
.search {
|
|
|
|
|
padding-left: 1px;
|
|
|
|
|
padding-left: 20px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.library-right {
|
|
|
|
|