|
|
@@ -48,19 +48,19 @@
|
|
|
"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
> -->
|
|
|
+ <!-- :datasource="sourceList" -->
|
|
|
|
|
|
+ <!-- :datasource="
|
|
|
+ btnType == 'add' ||
|
|
|
+ (btnType == 'edit' && (!isPackingList || !isSampleList))
|
|
|
+ ? sourceList
|
|
|
+ : datasource
|
|
|
+ " -->
|
|
|
<!-- 来料列表表格 -->
|
|
|
<ele-pro-table
|
|
|
ref="table12"
|
|
|
:columns="tableColumns"
|
|
|
- :datasource="datasource"
|
|
|
- :needPage="
|
|
|
- btnType == 'add' ||
|
|
|
- (btnType == 'edit' && !isPackingList) ||
|
|
|
- !isSampleList
|
|
|
- ? false
|
|
|
- : true
|
|
|
- "
|
|
|
+ :datasource="sourceList"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
|
<template
|
|
|
@@ -515,7 +515,8 @@
|
|
|
dimensionType: '',
|
|
|
isSampleList: true,
|
|
|
isPackingList: true,
|
|
|
- isSchemeList: true
|
|
|
+ isSchemeList: true,
|
|
|
+ newSampleList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -619,6 +620,7 @@
|
|
|
|
|
|
//分页后的来源列表
|
|
|
paginatedSourceList() {
|
|
|
+ console.log('分页');
|
|
|
const { currentPage, pageSize } = this.sourcePagination;
|
|
|
const start = (currentPage - 1) * pageSize;
|
|
|
const end = start + pageSize;
|
|
|
@@ -639,7 +641,6 @@
|
|
|
// 分页后的质检方案列表
|
|
|
paginatedSchemeList() {
|
|
|
if (this.rowIds && this.isScheme) {
|
|
|
- console.log('101010');
|
|
|
console.log(this.schemeList, 'test');
|
|
|
return this.schemeList;
|
|
|
}
|
|
|
@@ -703,7 +704,8 @@
|
|
|
// console.log(this.baseForm, 'form --');
|
|
|
// }
|
|
|
console.log('数据33333');
|
|
|
- this.$refs.table12.setData([]);
|
|
|
+ // this.$refs.table12.setData([]);
|
|
|
+ this.sourceList = [];
|
|
|
this.packingList = [];
|
|
|
this.isOrder = false;
|
|
|
let nums = Number(num);
|
|
|
@@ -738,7 +740,8 @@
|
|
|
}
|
|
|
console.log('数据22222');
|
|
|
console.log(this.isOrder);
|
|
|
- this.$refs.table12.setData(list);
|
|
|
+ // this.$refs.table12.setData(list);
|
|
|
+ this.sourceList = list;
|
|
|
this.packingList = list;
|
|
|
|
|
|
// *** 如果检验方式是全量的话 还需要同步样品清单数据
|
|
|
@@ -756,12 +759,15 @@
|
|
|
//成品类型检验类型,计划来源库存台账, 生成来源清单
|
|
|
changesStokledgerNumberModal(val, dimension, type) {
|
|
|
console.log(val, dimension, '获取成品检验订单数据', type);
|
|
|
- this.$refs.table12.setData([]);
|
|
|
+ // this.$refs.table12.setData([]);
|
|
|
+ this.sourceList = [];
|
|
|
this.packingList = [];
|
|
|
if (dimension) this.dimensionType = dimension;
|
|
|
if (dimension == 3) {
|
|
|
- this.$refs.table12.setData(val);
|
|
|
+ // this.$refs.table12.setData(val);
|
|
|
+ this.sourceList = val;
|
|
|
this.packingList = val;
|
|
|
+ this.calculateWeightAndQuantity(val);
|
|
|
if (this.baseForm.qualityMode == '1' || type) {
|
|
|
this.handleUnpackCase(val);
|
|
|
} else if (this.baseForm.qualityMode == '2' || type) {
|
|
|
@@ -799,7 +805,8 @@
|
|
|
// ...item
|
|
|
// });
|
|
|
console.log(list, 'for循环成品检验订单数据');
|
|
|
- this.$refs.table12.setData(list);
|
|
|
+ // this.$refs.table12.setData(list);
|
|
|
+ this.sourceList = list;
|
|
|
this.packingList = list;
|
|
|
if (this.baseForm.qualityMode == '1' || type) {
|
|
|
this.handleUnpackCase(list);
|
|
|
@@ -954,6 +961,7 @@
|
|
|
} else {
|
|
|
this.isCheck = false;
|
|
|
}
|
|
|
+ await this.getSourceList(row.id);
|
|
|
//操作行点击时查询清单
|
|
|
// await this.getInventoryList();
|
|
|
await this.reload({ planId: row.id });
|
|
|
@@ -969,6 +977,17 @@
|
|
|
this.$refs.table12.reload({ page: 1, where: where });
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ async getSourceList(id) {
|
|
|
+ const listData = await getInventoryListByPlanId({
|
|
|
+ planId: id,
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ this.sourceList = listData.list;
|
|
|
+ console.log(this.sourceList);
|
|
|
+ },
|
|
|
+
|
|
|
async getSampleList(id) {
|
|
|
let res = await getSampleListByPlanId({
|
|
|
planId: id,
|
|
|
@@ -978,8 +997,15 @@
|
|
|
console.log(res.list, 'yyyyyyyyyyyyyy样品----------------------------');
|
|
|
|
|
|
this.sampleList = res?.list || [];
|
|
|
- console.log(this.sampleList);
|
|
|
this.samplePagination.total = res.count;
|
|
|
+
|
|
|
+ let newRes = await getSampleListByPlanId({
|
|
|
+ planId: id,
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+
|
|
|
+ this.newSampleList = newRes?.list || [];
|
|
|
},
|
|
|
|
|
|
async getTemplateList(id) {
|
|
|
@@ -1003,7 +1029,6 @@
|
|
|
supplierMark
|
|
|
) {
|
|
|
//通过来源和产品 获取来料清单
|
|
|
- console.log(999999);
|
|
|
await this.getGoodsList(
|
|
|
receiveNo,
|
|
|
productCode,
|
|
|
@@ -1030,11 +1055,10 @@
|
|
|
supplierName,
|
|
|
supplierMark
|
|
|
) {
|
|
|
- console.log('数据1-1-1-1-1');
|
|
|
- this.$refs.table12.setData([]);
|
|
|
+ // this.$refs.table12.setData([]);
|
|
|
+ this.sourceList = [];
|
|
|
this.packingList = [];
|
|
|
|
|
|
- console.log(999999);
|
|
|
let res;
|
|
|
const res1 = await outInRecordsPage({
|
|
|
sourceBizNo: receiveNo,
|
|
|
@@ -1083,35 +1107,44 @@
|
|
|
delete m.id;
|
|
|
return { ...m };
|
|
|
});
|
|
|
- console.log(_arr1, '1234567890');
|
|
|
|
|
|
this.packingList = _arr1;
|
|
|
- console.log('数据1010101010');
|
|
|
- this.$refs.table12.setData(_arr1); //赋值
|
|
|
+ // this.$refs.table12.setData(_arr1); //赋值
|
|
|
+ this.sourceList = _arr1;
|
|
|
this.packingList = _arr1;
|
|
|
- const _arr2 = this.$refs.table12.getData();
|
|
|
- if (_arr2.length > 1) {
|
|
|
- this.baseForm.productNumber = _arr2.length;
|
|
|
+ // const _arr2 = this.$refs.table12.getData();
|
|
|
+ // if (_arr2.length > 1) {
|
|
|
+ // this.baseForm.productNumber = _arr2.length;
|
|
|
+ // } else {
|
|
|
+ // this.baseForm.productNumber = _arr2[0].measureQuantity;
|
|
|
+ // }
|
|
|
+ this.baseForm.totalWeight = this.sourceList.reduce((acc, pre) => {
|
|
|
+ return pre.weight ? acc + Number(pre.weight) : acc;
|
|
|
+ }, 0);
|
|
|
+
|
|
|
+ if (this.sourceList.length > 1) {
|
|
|
+ this.baseForm.productNumber = this.sourceList.reduce((acc, pre) => {
|
|
|
+ return pre.measureQuantity
|
|
|
+ ? acc + Number(pre.measureQuantity)
|
|
|
+ : acc;
|
|
|
+ }, 0);
|
|
|
} else {
|
|
|
- this.baseForm.productNumber = _arr2[0].measureQuantity;
|
|
|
+ this.baseForm.productNumber = this.sourceList[0].measureQuantity;
|
|
|
}
|
|
|
+
|
|
|
//处理样品清单
|
|
|
- console.log('+++++++++3');
|
|
|
+ console.log('处理来源清单数据');
|
|
|
// await this.handleSampleList();
|
|
|
await this.updatePackingList(_arr1);
|
|
|
} else {
|
|
|
- console.log('数据99999');
|
|
|
- this.$refs.table12.setData([]);
|
|
|
+ console.log('来料清单数据为空');
|
|
|
+ // this.$refs.table12.setData([]);
|
|
|
+ this.sourceList = val;
|
|
|
this.packingList = [];
|
|
|
}
|
|
|
},
|
|
|
async handleSampleList() {
|
|
|
// let packingList = this.$refs.table12.getData();
|
|
|
- console.log(
|
|
|
- this.baseForm.qualityMode,
|
|
|
- this.baseForm.inspectionStandards,
|
|
|
- this.btnType
|
|
|
- );
|
|
|
|
|
|
if (this.baseForm.type == '1' && this.btnType != 'detail') {
|
|
|
if (this.baseForm.inspectionStandards == '2') {
|
|
|
@@ -1134,7 +1167,8 @@
|
|
|
list.push(obj);
|
|
|
}
|
|
|
if (list.length > 0 && list[0].categoryCode) {
|
|
|
- this.$refs.table12.setData(list);
|
|
|
+ // this.$refs.table12.setData(list);
|
|
|
+ this.sourceList = list;
|
|
|
this.packingList = list;
|
|
|
let packList = this.$refs.table12.getData();
|
|
|
this.getFullInspectionWeight(packList);
|
|
|
@@ -1188,7 +1222,8 @@
|
|
|
if (this.baseForm.productNumber) {
|
|
|
console.log('数据777777');
|
|
|
if (this.$refs.table12) {
|
|
|
- this.$refs.table12.setData([]);
|
|
|
+ // this.$refs.table12.setData([]);
|
|
|
+ this.sourceList = [];
|
|
|
this.packingList = [];
|
|
|
let nums = Number(this.baseForm.productNumber);
|
|
|
let p = this.productItem;
|
|
|
@@ -1208,7 +1243,8 @@
|
|
|
list.push(obj);
|
|
|
}
|
|
|
console.log('数据666666');
|
|
|
- this.$refs.table12.setData(list);
|
|
|
+ // this.$refs.table12.setData(list);
|
|
|
+ this.sourceList = list;
|
|
|
this.packingList = list;
|
|
|
let packList = this.$refs.table12.getData();
|
|
|
await this.handleUnpackCase(packList);
|
|
|
@@ -1296,7 +1332,8 @@
|
|
|
console.log('数据55555');
|
|
|
console.log(list);
|
|
|
if (list.length > 0 && list[0].categoryCode) {
|
|
|
- this.$refs.table12.setData(list);
|
|
|
+ // this.$refs.table12.setData(list);
|
|
|
+ this.sourceList = list;
|
|
|
this.packingList = list;
|
|
|
let packList = this.$refs.table12.getData();
|
|
|
this.getFullInspectionWeight(packList);
|
|
|
@@ -1334,8 +1371,6 @@
|
|
|
|
|
|
//更新样品清单数据
|
|
|
async updatePackingList(list) {
|
|
|
- console.log(list);
|
|
|
- console.log(this.isScheme, this.isOrder);
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
list[i].sampleCode = await this.getSampleCode();
|
|
|
}
|
|
|
@@ -1610,7 +1645,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- console.log('+++++++++9');
|
|
|
this.isConsumable = val.category.isConsumable;
|
|
|
this.netWeight = val.category.netWeight;
|
|
|
this.productItem = val.category; //产品信息
|
|
|
@@ -1620,6 +1654,16 @@
|
|
|
this.$refs.baseInfoRefs.getsampleMeasureUnit(val);
|
|
|
},
|
|
|
|
|
|
+ calculateWeightAndQuantity(list) {
|
|
|
+ console.log(list);
|
|
|
+ this.baseForm.totalWeight = list.reduce((acc, pre) => {
|
|
|
+ return pre.weight ? acc + Number(pre.weight) : acc;
|
|
|
+ }, 0);
|
|
|
+ this.baseForm.productNumber = list.reduce((acc, pre) => {
|
|
|
+ return pre.measureQuantity ? acc + Number(pre.measureQuantity) : acc;
|
|
|
+ }, 0);
|
|
|
+ },
|
|
|
+
|
|
|
//整样确认按钮-样品列表右上角确认按钮
|
|
|
// handleExtractFull() {
|
|
|
// this.$refs.ruleForm.validate((valid) => {
|
|
|
@@ -1792,11 +1836,11 @@
|
|
|
console.log('样品清单', this.sampleList);
|
|
|
console.log('样品清单List', result);
|
|
|
this.sampleList = result;
|
|
|
- console.log(11111);
|
|
|
+
|
|
|
this.samplePagination.total = result.length;
|
|
|
- console.log(2222);
|
|
|
+
|
|
|
this.baseForm.sampleNumber = this.sampleList.length; // 更新样品数量
|
|
|
- console.log(33333);
|
|
|
+
|
|
|
this.changeSamUnit(sampleUnit);
|
|
|
},
|
|
|
|
|
|
@@ -1874,6 +1918,7 @@
|
|
|
},
|
|
|
table1() {
|
|
|
this.$refs.table12.setData([]);
|
|
|
+ this.sourceList = [];
|
|
|
this.packingList = [];
|
|
|
this.schemeList = [];
|
|
|
},
|
|
|
@@ -1984,20 +2029,19 @@
|
|
|
|
|
|
console.log(this.isSampleList);
|
|
|
console.log(this.isPackingList);
|
|
|
+ console.log(this.$refs.table12.getData());
|
|
|
|
|
|
const qualityListData =
|
|
|
this.btnType == 'add'
|
|
|
- ? this.$refs.table12.getData()
|
|
|
- : this.btnType == 'edit' &&
|
|
|
- this.isPackingList &&
|
|
|
- this.isSampleList
|
|
|
+ ? this.sourceList
|
|
|
+ : this.btnType == 'edit' && this.isPackingList
|
|
|
? []
|
|
|
- : this.$refs.table12.getData();
|
|
|
+ : this.sourceList;
|
|
|
const sampleListData =
|
|
|
this.btnType == 'add'
|
|
|
? this.sampleList
|
|
|
: this.btnType == 'edit' && this.isSampleList
|
|
|
- ? []
|
|
|
+ ? this.newSampleList
|
|
|
: this.sampleList;
|
|
|
|
|
|
// let params = {
|
|
|
@@ -2051,10 +2095,37 @@
|
|
|
this.baseForm.isUnpack = this.isCheck ? 1 : 2;
|
|
|
}
|
|
|
this.baseForm.conditionType = this.conditionType;
|
|
|
+ // let params = {
|
|
|
+ // ...this.baseForm,
|
|
|
+ // qualityInventoryList: this.$refs.table12.getData(),
|
|
|
+ // sampleList: this.sampleList,
|
|
|
+ // planTemplateList: this.schemeList
|
|
|
+ // };
|
|
|
+ // const qualityListData =
|
|
|
+ // this.btnType == 'add'
|
|
|
+ // ? this.sourceList
|
|
|
+ // : this.btnType == 'edit' && this.isPackingList
|
|
|
+ // ? []
|
|
|
+ // : this.sourceList;
|
|
|
+ console.log(this.newSampleList, 'newSampleList');
|
|
|
+ const qualityListData = this.sourceList;
|
|
|
+ const sampleListData =
|
|
|
+ this.btnType == 'add'
|
|
|
+ ? this.sampleList
|
|
|
+ : this.btnType == 'edit' && this.isSampleList
|
|
|
+ ? this.newSampleList
|
|
|
+ : this.sampleList;
|
|
|
+
|
|
|
+ // let params = {
|
|
|
+ // ...this.baseForm,
|
|
|
+ // qualityInventoryList: this.$refs.table12.getData(),
|
|
|
+ // sampleList: this.sampleList,
|
|
|
+ // planTemplateList: this.schemeList
|
|
|
+ // };
|
|
|
let params = {
|
|
|
...this.baseForm,
|
|
|
- qualityInventoryList: this.$refs.table12.getData(),
|
|
|
- sampleList: this.sampleList,
|
|
|
+ qualityInventoryList: qualityListData,
|
|
|
+ sampleList: sampleListData,
|
|
|
planTemplateList: this.schemeList
|
|
|
};
|
|
|
|
|
|
@@ -2117,40 +2188,82 @@
|
|
|
if (this.btnType != 'issued') {
|
|
|
this.baseForm.sampleNumber = '';
|
|
|
}
|
|
|
- console.log(
|
|
|
- this.baseForm.productNumber,
|
|
|
- 'productNumberproductNumber数量'
|
|
|
- );
|
|
|
|
|
|
if (this.baseForm.type == '3') {
|
|
|
- if (this.$refs.table12 && this.dimensionType) {
|
|
|
- const listData = this.$refs.table12.getData();
|
|
|
- console.log(listData, '成品检验订单数据');
|
|
|
+ console.log(this.sourceList, this.dimensionType, '更改检验方式223');
|
|
|
+ if (
|
|
|
+ this.sourceList &&
|
|
|
+ this.dimensionType &&
|
|
|
+ this.baseForm.qualityMode == '1'
|
|
|
+ ) {
|
|
|
+ // const listData = this.$refs.table12.getData();
|
|
|
+ console.log(this.sourceList, '成品检验订单数据');
|
|
|
this.changesStokledgerNumberModal(
|
|
|
- listData,
|
|
|
+ this.sourceList,
|
|
|
this.dimensionType,
|
|
|
'type'
|
|
|
);
|
|
|
- // if (this.dimensionType == 3) {
|
|
|
- // if (this.baseForm.qualityMode == '1') {
|
|
|
- // this.handleUnpackCase(val);
|
|
|
- // } else if (this.baseForm.qualityMode == '2') {
|
|
|
- // this.sampleList = [];
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (this.baseForm.qualityMode == '1') {
|
|
|
- // this.handleUnpackCase(listData);
|
|
|
- // } else if (this.baseForm.qualityMode == '2') {
|
|
|
- // this.sampleList = [];
|
|
|
- // }
|
|
|
- // }
|
|
|
+ return;
|
|
|
+ } else if (
|
|
|
+ this.sourceList &&
|
|
|
+ this.dimensionType &&
|
|
|
+ this.baseForm.qualityMode == '2'
|
|
|
+ ) {
|
|
|
+ this.sampleList = [];
|
|
|
+ } else {
|
|
|
+ if (
|
|
|
+ this.baseForm.qualityMode == '1' &&
|
|
|
+ this.sourceList.length > 1
|
|
|
+ ) {
|
|
|
+ this.changesStokledgerNumberModal(this.sourceList, '3', 'type');
|
|
|
+ } else if (
|
|
|
+ this.baseForm.qualityMode == '2' &&
|
|
|
+ this.sourceList.length > 1
|
|
|
+ ) {
|
|
|
+ this.sampleList = [];
|
|
|
+ } else if (
|
|
|
+ this.baseForm.qualityMode == '2' &&
|
|
|
+ this.sourceList.length > 0
|
|
|
+ ) {
|
|
|
+ this.changesStokledgerNumberModal(
|
|
|
+ this.sourceList,
|
|
|
+ this.dimensionType,
|
|
|
+ 'type'
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.sampleList = [];
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ // if (this.$refs.table12 && this.dimensionType) {
|
|
|
+ // const listData = this.$refs.table12.getData();
|
|
|
+ // console.log(listData, '成品检验订单数据');
|
|
|
+ // this.changesStokledgerNumberModal(
|
|
|
+ // listData,
|
|
|
+ // this.dimensionType,
|
|
|
+ // 'type'
|
|
|
+ // );
|
|
|
+ // // if (this.dimensionType == 3) {
|
|
|
+ // // if (this.baseForm.qualityMode == '1') {
|
|
|
+ // // this.handleUnpackCase(val);
|
|
|
+ // // } else if (this.baseForm.qualityMode == '2') {
|
|
|
+ // // this.sampleList = [];
|
|
|
+ // // }
|
|
|
+ // // } else {
|
|
|
+ // // if (this.baseForm.qualityMode == '1') {
|
|
|
+ // // this.handleUnpackCase(listData);
|
|
|
+ // // } else if (this.baseForm.qualityMode == '2') {
|
|
|
+ // // this.sampleList = [];
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // }
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (this.baseForm.qualityMode == 1) {
|
|
|
- console.log('+++++++++1');
|
|
|
- this.handleSampleList();
|
|
|
+ // console.log('+++++++++1');
|
|
|
+ // this.handleSampleList();
|
|
|
+ this.updatePackingList(this.sourceList);
|
|
|
} else {
|
|
|
this.sampleList = [];
|
|
|
}
|
|
|
@@ -2296,9 +2409,20 @@
|
|
|
},
|
|
|
|
|
|
validateSampleCount(sampleCount) {
|
|
|
- const invalidItem = this.selectedList.find(
|
|
|
- (item) => item.measureQuantity < sampleCount
|
|
|
- );
|
|
|
+ // const invalidItem = this.selectedList.find(
|
|
|
+ // (item) => item.measureQuantity < sampleCount
|
|
|
+ // );
|
|
|
+
|
|
|
+ // const totalNumber = this.sourceList.reduce((acc, pro) => {
|
|
|
+ // return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
|
|
|
+ // }, 0);
|
|
|
+
|
|
|
+ const chooseNumber = this.selectedList.reduce((acc, pro) => {
|
|
|
+ return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
|
|
|
+ }, 0);
|
|
|
+
|
|
|
+ const invalidItem = chooseNumber < sampleCount;
|
|
|
+
|
|
|
if (invalidItem) {
|
|
|
this.$message.info('所选的条目计量数量小于取样计量数量');
|
|
|
return false;
|