From 17e49d79018021b8f494b17d5d10590fe58d7480 Mon Sep 17 00:00:00 2001
From: hou <1601990943@qq.com>
Date: Fri, 21 Jan 2022 17:04:55 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8E=9F=E6=9D=90=E6=96=99=E6=94=B6=E8=B4=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../outbound/stoOutbound/DN-delivergoods.vue | 1 +
src/pages/raw/ingoods/dnReceipt/ImportDN.vue | 125 +++++++-------
.../raw/ingoods/dnReceipt/dnReceiving.vue | 154 +++++++-----------
3 files changed, 120 insertions(+), 160 deletions(-)
diff --git a/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue b/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue
index fcaf892..f5593ee 100644
--- a/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue
+++ b/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue
@@ -400,6 +400,7 @@ export default class stoOutboundDom extends BasePage {
this.form.productDescZh = '';
this.selectMaterielList = [];
(this.form.rowItem = ''), this.$table.onEmpty();
+ this.query();
}
// }
}
diff --git a/src/pages/raw/ingoods/dnReceipt/ImportDN.vue b/src/pages/raw/ingoods/dnReceipt/ImportDN.vue
index a3b2827..5881b89 100644
--- a/src/pages/raw/ingoods/dnReceipt/ImportDN.vue
+++ b/src/pages/raw/ingoods/dnReceipt/ImportDN.vue
@@ -49,6 +49,7 @@
{{ $t('message.Cumulative') }}
+
@@ -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);
- }
}