|
|
@@ -1,10 +1,11 @@
|
|
|
<template>
|
|
|
<div class="ele-body">
|
|
|
<el-card shadow="never" v-loading="loading">
|
|
|
+
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:columns="columns"
|
|
|
- :datasource="poList"
|
|
|
+ :datasource="poList.filter((item) => item.disposalStatus != 2)"
|
|
|
:selection.sync="selection"
|
|
|
:needPage="false"
|
|
|
row-key="id"
|
|
|
@@ -291,7 +292,7 @@
|
|
|
<el-input-number
|
|
|
v-model="singleQuantity"
|
|
|
:min="0"
|
|
|
- :max="total"
|
|
|
+ :max="availableTotal"
|
|
|
style="width: 120px"
|
|
|
></el-input-number>
|
|
|
</template>
|
|
|
@@ -450,11 +451,14 @@
|
|
|
oldList: [],
|
|
|
addDialogVisible: false,
|
|
|
addSelection: [],
|
|
|
- singleQuantity: ''
|
|
|
+ singleQuantity: '',
|
|
|
+ retainedSampleQuantity: 0,
|
|
|
+ retainedSampleUnqualified: 0,
|
|
|
+ lossNumber: 0,
|
|
|
+ lossNumberUnqualified: 0
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
-
|
|
|
disposeList() {
|
|
|
if (this.qualityType == 1) {
|
|
|
return this.allList.filter((item) => [5, 10].includes(item.value));
|
|
|
@@ -470,6 +474,14 @@
|
|
|
return this.allList;
|
|
|
}
|
|
|
},
|
|
|
+ // 可用总数 = 总数 - 留样数 - 消耗数
|
|
|
+ availableTotal() {
|
|
|
+ if (!this.sampleList.length) return this.total;
|
|
|
+ const usedQuantity = this.sampleList
|
|
|
+ .filter((item) => item.disposeType == 6 || item.disposeType == 7)
|
|
|
+ .reduce((sum, item) => sum + (item.measureQuantity || 0), 0);
|
|
|
+ return this.total - usedQuantity;
|
|
|
+ },
|
|
|
// 表格列配置
|
|
|
columns() {
|
|
|
const arr = [
|
|
|
@@ -478,7 +490,10 @@
|
|
|
type: 'selection',
|
|
|
columnKey: 'selection',
|
|
|
reserveSelection: true,
|
|
|
- align: 'center'
|
|
|
+ align: 'center',
|
|
|
+ selectable: (row, index) => {
|
|
|
+ return row.disposalStatus != 2;
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
columnKey: 'index',
|
|
|
@@ -548,6 +563,9 @@
|
|
|
width: '120',
|
|
|
showOverflowTooltip: true
|
|
|
},
|
|
|
+
|
|
|
+ { label: '计量数量', prop: 'measureQuantity', align: 'center' },
|
|
|
+ { label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
|
{
|
|
|
prop: 'weight',
|
|
|
label: '重量',
|
|
|
@@ -568,9 +586,6 @@
|
|
|
align: 'center'
|
|
|
},
|
|
|
|
|
|
- { label: '计量数量', prop: 'measureQuantity', align: 'center' },
|
|
|
- { label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
|
-
|
|
|
{
|
|
|
prop: 'produceRoutingName',
|
|
|
label: '工艺路线',
|
|
|
@@ -661,19 +676,25 @@
|
|
|
setQualifiedNumber() {
|
|
|
let isQualifiedNumber = true;
|
|
|
let noQualifiedNumber = this.poList
|
|
|
- .filter((item) => item.disposeType != 5)
|
|
|
+ .filter((item) => item.disposeType != 5 && item.disposalStatus != 2)
|
|
|
.reduce((acc, cur) => acc + cur.measureQuantity, 0);
|
|
|
|
|
|
+ console.log(
|
|
|
+ this.poList.map((item) => item.measureQuantity),
|
|
|
+ 'noQualifiedNumber'
|
|
|
+ );
|
|
|
+
|
|
|
if (
|
|
|
this.poList
|
|
|
.filter((item) => item.disposeType == 5)
|
|
|
- .reduce((acc, cur) => acc + cur.measureQuantity, 0) == this.total
|
|
|
+ .reduce((acc, cur) => acc + cur.measureQuantity, 0) ==
|
|
|
+ this.availableTotal
|
|
|
) {
|
|
|
isQualifiedNumber = false;
|
|
|
}
|
|
|
this.$emit('setQualifiedNumber', {
|
|
|
noQualifiedNumber,
|
|
|
- qualifiedNumber: this.total - noQualifiedNumber,
|
|
|
+ qualifiedNumber: this.availableTotal - noQualifiedNumber,
|
|
|
isQualifiedNumber
|
|
|
});
|
|
|
},
|
|
|
@@ -681,21 +702,40 @@
|
|
|
if (qualityResults == 1) {
|
|
|
this.poList = JSON.parse(JSON.stringify(this.oldList));
|
|
|
this.poList = this.poList.map((item) => {
|
|
|
- item.disposalStatus = 1;
|
|
|
- item.disposeType = 5;
|
|
|
+ if (item.disposalStatus != 2) {
|
|
|
+ item.disposalStatus = 1;
|
|
|
+ item.disposeType = 5;
|
|
|
+ }
|
|
|
+
|
|
|
return item;
|
|
|
});
|
|
|
}
|
|
|
if (qualityResults == 4) {
|
|
|
- this.poList = JSON.parse(JSON.stringify(this.inventoryList));
|
|
|
+ this.poList = [
|
|
|
+ ...JSON.parse(JSON.stringify(this.inventoryList)),
|
|
|
+ ...JSON.parse(
|
|
|
+ JSON.stringify(
|
|
|
+ this.oldList.filter((item) => item.disposalStatus == 2)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ];
|
|
|
this.poList = this.poList.map((item) => {
|
|
|
- item.disposalStatus = 1;
|
|
|
- item.disposeType = 5;
|
|
|
+ if (item.disposalStatus != 2) {
|
|
|
+ item.disposalStatus = 1;
|
|
|
+ item.disposeType = 5;
|
|
|
+ }
|
|
|
return item;
|
|
|
});
|
|
|
}
|
|
|
if (qualityResults == 2) {
|
|
|
- this.poList = JSON.parse(JSON.stringify(this.inventoryList));
|
|
|
+ this.poList = [
|
|
|
+ ...JSON.parse(JSON.stringify(this.inventoryList)),
|
|
|
+ ...JSON.parse(
|
|
|
+ JSON.stringify(
|
|
|
+ this.oldList.filter((item) => item.disposalStatus == 2)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ];
|
|
|
}
|
|
|
if (qualityResults == 3) {
|
|
|
this.poList = JSON.parse(JSON.stringify(this.oldList));
|
|
|
@@ -714,6 +754,7 @@
|
|
|
const arr = await getById(this.id);
|
|
|
this.oldList = JSON.parse(JSON.stringify(arr.poList));
|
|
|
this.poList = arr.poList;
|
|
|
+ this.setQualifiedNumber();
|
|
|
},
|
|
|
|
|
|
// async getRefluxTask() {
|
|
|
@@ -766,7 +807,7 @@
|
|
|
0
|
|
|
);
|
|
|
}
|
|
|
- if (poListTotal + selectedTotal > this.total) {
|
|
|
+ if (poListTotal + selectedTotal > this.availableTotal) {
|
|
|
this.$message.error('选中的计量数量之和加上已有数量不能超过总数');
|
|
|
return;
|
|
|
}
|
|
|
@@ -801,6 +842,7 @@
|
|
|
if (res.list.length > 0) {
|
|
|
this.inventoryList = res.list;
|
|
|
}
|
|
|
+ return;
|
|
|
},
|
|
|
|
|
|
async queryQualitySamplContent() {
|
|
|
@@ -809,6 +851,59 @@
|
|
|
size: 1000
|
|
|
});
|
|
|
this.sampleList = res.list;
|
|
|
+ [
|
|
|
+ 'retainedSampleQuantity',
|
|
|
+ 'retainedSampleUnqualified',
|
|
|
+ 'lossNumber',
|
|
|
+ 'lossNumberUnqualified'
|
|
|
+ ].forEach((key) => {
|
|
|
+ this[key] = 0;
|
|
|
+ });
|
|
|
+ if (this.sampleList.length > 0 && this.inventoryList.length > 0) {
|
|
|
+ const processedList = this.sampleList.filter(
|
|
|
+ (item) => item.disposeType == 6 || item.disposeType == 7
|
|
|
+ );
|
|
|
+ processedList.forEach((sampleItem) => {
|
|
|
+ if (sampleItem.disposeType == 6) {
|
|
|
+ sampleItem.qualityResults == 2
|
|
|
+ ? (this.retainedSampleQuantity += sampleItem.measureQuantity)
|
|
|
+ : (this.retainedSampleUnqualified +=
|
|
|
+ sampleItem.measureQuantity);
|
|
|
+ } else {
|
|
|
+ sampleItem.qualityResults == 2
|
|
|
+ ? (this.lossNumber += sampleItem.measureQuantity)
|
|
|
+ : (this.lossNumberUnqualified += sampleItem.measureQuantity);
|
|
|
+ }
|
|
|
+ const inventoryItem = this.inventoryList.find(
|
|
|
+ (item) => item.sourceId === sampleItem.sourceId
|
|
|
+ );
|
|
|
+ if (inventoryItem) {
|
|
|
+ inventoryItem.measureQuantity = Math.max(
|
|
|
+ 0,
|
|
|
+ (inventoryItem.measureQuantity || 0) -
|
|
|
+ (sampleItem.measureQuantity || 0)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (
|
|
|
+ this.inventoryList.length == 1 &&
|
|
|
+ !this.inventoryList[0].sourceId
|
|
|
+ ) {
|
|
|
+ this.inventoryList[0].measureQuantity =
|
|
|
+ this.inventoryList[0].measureQuantity -
|
|
|
+ this.lossNumber -
|
|
|
+ this.lossNumberUnqualified -
|
|
|
+ this.retainedSampleQuantity -
|
|
|
+ this.retainedSampleUnqualified;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$emit('setLossNumber', {
|
|
|
+ lossNumber: this.lossNumber,
|
|
|
+ lossNumberUnqualified: this.lossNumberUnqualified,
|
|
|
+ retainedSampleQuantity: this.retainedSampleQuantity,
|
|
|
+ retainedSampleUnqualified: this.retainedSampleUnqualified
|
|
|
+ });
|
|
|
+ return;
|
|
|
},
|
|
|
|
|
|
async handleDispose() {
|