|
|
@@ -10,7 +10,7 @@
|
|
|
cache-key="prenatal-examination-material-list-table-2511031522"
|
|
|
autoAmendPage
|
|
|
:needPage="false"
|
|
|
- @refresh="$emit('refresh', 'material')"
|
|
|
+ @refresh="$emit('refresh')"
|
|
|
>
|
|
|
<template v-slot:toolbar>
|
|
|
<el-button type="primary" @click="openMaterialModal"
|
|
|
@@ -36,7 +36,7 @@
|
|
|
cache-key="prenatal-examination-output-list-table-2511031523"
|
|
|
autoAmendPage
|
|
|
:needPage="false"
|
|
|
- @refresh="$emit('refresh', 'output')"
|
|
|
+ @refresh="localOutputDetailsRefresh"
|
|
|
>
|
|
|
<template v-slot:reportQuantity="{ row }">
|
|
|
<el-input-number
|
|
|
@@ -431,9 +431,7 @@
|
|
|
return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
|
|
|
}
|
|
|
}
|
|
|
- ],
|
|
|
- // bomInfo
|
|
|
- materialQuotaInfo: null
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
mounted() {},
|
|
|
@@ -486,31 +484,32 @@
|
|
|
this.produceTaskId
|
|
|
);
|
|
|
console.log('this.materialQuotaInfo', data);
|
|
|
- if (!data.standardOutput) {
|
|
|
- return this.$message.warning('未配置标准产出物料');
|
|
|
- }
|
|
|
this.materialQuotaInfo = data;
|
|
|
- // 赋值产出
|
|
|
- this.localOutputDetails = [
|
|
|
- {
|
|
|
- ...data.standardOutput,
|
|
|
- id: null,
|
|
|
- reportQuantity: 0,
|
|
|
- qualifiedQuantity: 0,
|
|
|
- noQualifiedQuantity: 0,
|
|
|
- msg: '',
|
|
|
- sumReportQuantity: 0,
|
|
|
- sumQualifiedQuantity: 0,
|
|
|
- sumNoQualifiedQuantity: 0,
|
|
|
- ruleId: this.ruleId,
|
|
|
- outputType: this.outputType,
|
|
|
- produceTaskId: this.produceTaskId,
|
|
|
- produceTaskInstanceId: this.produceTaskInstanceId,
|
|
|
- produceTaskName: this.produceTaskName,
|
|
|
- workOrderId: this.workOrderId
|
|
|
- }
|
|
|
- ];
|
|
|
- this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
+ //
|
|
|
+ if (data && data.standardOutput) {
|
|
|
+ // 赋值产出
|
|
|
+ this.localOutputDetails = [
|
|
|
+ {
|
|
|
+ ...data.standardOutput,
|
|
|
+ id: null,
|
|
|
+ reportQuantity: 0,
|
|
|
+ qualifiedQuantity: 0,
|
|
|
+ noQualifiedQuantity: 0,
|
|
|
+ msg: '',
|
|
|
+ sumReportQuantity: 0,
|
|
|
+ sumQualifiedQuantity: 0,
|
|
|
+ sumNoQualifiedQuantity: 0,
|
|
|
+ ruleId: this.ruleId,
|
|
|
+ outputType: this.outputType,
|
|
|
+ produceTaskId: this.produceTaskId,
|
|
|
+ produceTaskInstanceId: this.produceTaskInstanceId,
|
|
|
+ produceTaskName: this.produceTaskName,
|
|
|
+ workOrderId: this.workOrderId
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
+ }
|
|
|
+
|
|
|
console.log('this.localOutputDetails', this.localOutputDetails);
|
|
|
}
|
|
|
},
|
|
|
@@ -523,7 +522,7 @@
|
|
|
},
|
|
|
selectedChange(row) {
|
|
|
console.log('row', row);
|
|
|
- if(this.outputType != 1) return;
|
|
|
+ if (this.outputType != 1) return;
|
|
|
|
|
|
if (row.selected) {
|
|
|
// 判断是否存在
|
|
|
@@ -568,25 +567,28 @@
|
|
|
// getCategoryAndLevelByCategoryId 获取产品
|
|
|
async getCategoryAndLevelByCategoryId() {
|
|
|
const data = await getCategoryAndLevelByCategoryId(this.categoryId);
|
|
|
- this.localOutputDetails = [
|
|
|
- {
|
|
|
- ...data,
|
|
|
- id: null,
|
|
|
- reportQuantity: 0,
|
|
|
- qualifiedQuantity: 0,
|
|
|
- noQualifiedQuantity: 0,
|
|
|
- msg: '',
|
|
|
- sumReportQuantity: 0,
|
|
|
- sumQualifiedQuantity: 0,
|
|
|
- sumNoQualifiedQuantity: 0,
|
|
|
- ruleId: this.ruleId,
|
|
|
- outputType: this.outputType,
|
|
|
- produceTaskId: this.produceTaskId,
|
|
|
- produceTaskInstanceId: this.produceTaskInstanceId,
|
|
|
- produceTaskName: this.produceTaskName,
|
|
|
- workOrderId: this.workOrderId
|
|
|
- }
|
|
|
- ];
|
|
|
+ if (data) {
|
|
|
+ this.localOutputDetails = [
|
|
|
+ {
|
|
|
+ ...data,
|
|
|
+ id: null,
|
|
|
+ reportQuantity: 0,
|
|
|
+ qualifiedQuantity: 0,
|
|
|
+ noQualifiedQuantity: 0,
|
|
|
+ msg: '',
|
|
|
+ sumReportQuantity: 0,
|
|
|
+ sumQualifiedQuantity: 0,
|
|
|
+ sumNoQualifiedQuantity: 0,
|
|
|
+ ruleId: this.ruleId,
|
|
|
+ outputType: this.outputType,
|
|
|
+ produceTaskId: this.produceTaskId,
|
|
|
+ produceTaskInstanceId: this.produceTaskInstanceId,
|
|
|
+ produceTaskName: this.produceTaskName,
|
|
|
+ workOrderId: this.workOrderId
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
|
|
|
const bomInfo = await getMaterialQuotaInfo(
|
|
|
@@ -603,15 +605,19 @@
|
|
|
// 物料本身 不能超过已报工数量减领料数量
|
|
|
return row.quantity - row.sumReportQuantity;
|
|
|
}
|
|
|
+ if (row.outputType == 2) {
|
|
|
+ // 在物料中查询对应的物料
|
|
|
+ const pickitem = this.preOutputDetails.find(
|
|
|
+ (pick) => pick.categoryId == row.categoryId
|
|
|
+ );
|
|
|
+ if (pickitem) {
|
|
|
+ return pickitem.qualifiedQuantity;
|
|
|
+ }
|
|
|
+ }
|
|
|
return Infinity;
|
|
|
},
|
|
|
// 判断生成产出清单的物料数量是合格
|
|
|
async validateOutputQuantities() {
|
|
|
- if (this.localPickDetails.length == 0) {
|
|
|
- this.$message.warning(`物料清单不能为空`);
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
if (this.localOutputDetails.length == 0) {
|
|
|
this.$message.warning(`产出清单不能为空`);
|
|
|
return false;
|
|
|
@@ -626,18 +632,20 @@
|
|
|
}
|
|
|
|
|
|
// 判断当次合格数量 和 不合格数量 之和需要等于 报工数量
|
|
|
- if (
|
|
|
- item.reportQuantity !==
|
|
|
- item.qualifiedQuantity + item.noQualifiedQuantity
|
|
|
- ) {
|
|
|
+ if (!item.qualifiedQuantity) {
|
|
|
this.$message.warning(
|
|
|
- `物料【${item.categoryName}】的当次合格数量和不合格数量之和必须等于报工数量`
|
|
|
+ `请填写产出清单【${item.categoryName}】的当次合格数量`
|
|
|
);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (this.outputType == 1) {
|
|
|
+ if (this.localPickDetails.length == 0) {
|
|
|
+ this.$message.warning(`物料清单不能为空`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
for (const item of this.localOutputDetails) {
|
|
|
const pickitem = this.localPickDetails.find(
|
|
|
(pick) =>
|
|
|
@@ -661,7 +669,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.outputType == 2 || this.outputType == 3) {
|
|
|
+ if (this.outputType == 2) {
|
|
|
let val = true;
|
|
|
|
|
|
if (!this.materialQuotaInfo) {
|
|
|
@@ -671,6 +679,15 @@
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ // 没有配置产出清单 、没有原材料 不检查
|
|
|
+ if (
|
|
|
+ !this.materialQuotaInfo ||
|
|
|
+ !this.materialQuotaInfo.standardOutput ||
|
|
|
+ this.localPickDetails.length == 0
|
|
|
+ ) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
this.materialQuotaInfo.materialQuota.forEach((i) => {
|
|
|
// 避免重复提示
|
|
|
if (!val) {
|
|
|
@@ -726,25 +743,25 @@
|
|
|
}
|
|
|
}
|
|
|
// 上一道工序产出物存在
|
|
|
- if (preOutputItem) {
|
|
|
- if (needQuantity > preOutputItem.quantity) {
|
|
|
- this.$message.warning(
|
|
|
- `物料【${preOutputItem.categoryName}】领料数量不足,需${needQuantity}${preOutputItem.unit},当前仅有${preOutputItem.quantity}${preOutputItem.unit}`
|
|
|
- );
|
|
|
- val = false;
|
|
|
- return false;
|
|
|
- }
|
|
|
- // 判断累计报工数量是否足够
|
|
|
- let preOutputItemSumReportQuantity =
|
|
|
- preOutputItem.sumReportQuantity + preOutputItem.reportQuantity;
|
|
|
- if (needQuantity > preOutputItemSumReportQuantity) {
|
|
|
- this.$message.warning(
|
|
|
- `物料【${preOutputItem.categoryName}】累计报工数量不足,需${needQuantity}${preOutputItem.unit},当前仅有${preOutputItemSumReportQuantity}${preOutputItem.unit}`
|
|
|
- );
|
|
|
- val = false;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (preOutputItem) {
|
|
|
+ // if (needQuantity > preOutputItem.quantity) {
|
|
|
+ // this.$message.warning(
|
|
|
+ // `物料【${preOutputItem.categoryName}】领料数量不足,需${needQuantity}${preOutputItem.unit},当前仅有${preOutputItem.quantity}${preOutputItem.unit}`
|
|
|
+ // );
|
|
|
+ // val = false;
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // // 判断累计报工数量是否足够
|
|
|
+ // let preOutputItemSumReportQuantity =
|
|
|
+ // preOutputItem.sumReportQuantity + preOutputItem.reportQuantity;
|
|
|
+ // if (needQuantity > preOutputItemSumReportQuantity) {
|
|
|
+ // this.$message.warning(
|
|
|
+ // `物料【${preOutputItem.categoryName}】累计报工数量不足,需${needQuantity}${preOutputItem.unit},当前仅有${preOutputItemSumReportQuantity}${preOutputItem.unit}`
|
|
|
+ // );
|
|
|
+ // val = false;
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
});
|
|
|
|
|
|
return val;
|
|
|
@@ -756,6 +773,15 @@
|
|
|
qualifiedQuantityChange(row) {
|
|
|
row.noQualifiedQuantity = row.reportQuantity - row.qualifiedQuantity;
|
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
+ },
|
|
|
+ localOutputDetailsRefresh() {
|
|
|
+ if (this.outputType == 1) {
|
|
|
+ $emit('refresh', 'output');
|
|
|
+ } else if (this.outputType == 2) {
|
|
|
+ this.getCategoryAndLevelByCategoryId();
|
|
|
+ } else {
|
|
|
+ this.getMaterialQuotaInfo();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|