|
@@ -44,7 +44,8 @@
|
|
|
v-model.number="row.reportQuantity"
|
|
v-model.number="row.reportQuantity"
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
- :max="row.feedQuantity"
|
|
|
|
|
|
|
+ :max="reportQuantitymax(row)"
|
|
|
|
|
+ @change="$emit('update:outputDetails', localOutputDetails)"
|
|
|
></el-input-number>
|
|
></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:qualifiedQuantity="{ row }">
|
|
<template v-slot:qualifiedQuantity="{ row }">
|
|
@@ -54,6 +55,7 @@
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:max="qualifiedQuantityMax(row)"
|
|
:max="qualifiedQuantityMax(row)"
|
|
|
|
|
+ @change="$emit('update:outputDetails', localOutputDetails)"
|
|
|
></el-input-number>
|
|
></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:noQualifiedQuantity="{ row }">
|
|
<template v-slot:noQualifiedQuantity="{ row }">
|
|
@@ -63,6 +65,7 @@
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
:max="noQualifiedQuantityMax(row)"
|
|
:max="noQualifiedQuantityMax(row)"
|
|
|
|
|
+ @change="$emit('update:outputDetails', localOutputDetails)"
|
|
|
></el-input-number>
|
|
></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:msg="{ row }">
|
|
<template v-slot:msg="{ row }">
|
|
@@ -71,6 +74,7 @@
|
|
|
type="textarea"
|
|
type="textarea"
|
|
|
rows="1"
|
|
rows="1"
|
|
|
autosize
|
|
autosize
|
|
|
|
|
+ @change="$emit('update:outputDetails', localOutputDetails)"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
@@ -114,13 +118,23 @@
|
|
|
// 规则id
|
|
// 规则id
|
|
|
ruleId: {
|
|
ruleId: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
- required: true
|
|
|
|
|
|
|
+ required: false
|
|
|
},
|
|
},
|
|
|
// 工序id
|
|
// 工序id
|
|
|
produceTaskId: {
|
|
produceTaskId: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
|
required: true
|
|
required: true
|
|
|
},
|
|
},
|
|
|
|
|
+ // 工序实例id
|
|
|
|
|
+ produceTaskInstanceId: {
|
|
|
|
|
+ type: [String, Number],
|
|
|
|
|
+ required: true
|
|
|
|
|
+ },
|
|
|
|
|
+ // 工序名称
|
|
|
|
|
+ produceTaskName: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ required: true
|
|
|
|
|
+ },
|
|
|
// BOM产品分类id
|
|
// BOM产品分类id
|
|
|
bomCategoryId: {
|
|
bomCategoryId: {
|
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
@@ -140,31 +154,44 @@
|
|
|
watch: {
|
|
watch: {
|
|
|
pickDetails: {
|
|
pickDetails: {
|
|
|
handler(newVal) {
|
|
handler(newVal) {
|
|
|
- this.localPickDetails = JSON.parse(JSON.stringify(newVal));
|
|
|
|
|
|
|
+ this.localPickDetails = JSON.parse(JSON.stringify(newVal)).map(
|
|
|
|
|
+ (i) => {
|
|
|
|
|
+ i.ruleId = this.ruleId;
|
|
|
|
|
+ i.bomCategoryId = this.bomCategoryId;
|
|
|
|
|
+ return i;
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
},
|
|
},
|
|
|
- deep: true
|
|
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ immediate: true
|
|
|
},
|
|
},
|
|
|
outputDetails: {
|
|
outputDetails: {
|
|
|
handler(newVal) {
|
|
handler(newVal) {
|
|
|
- this.localOutputDetails = JSON.parse(JSON.stringify(newVal));
|
|
|
|
|
|
|
+ this.localOutputDetails = JSON.parse(JSON.stringify(newVal)).map(
|
|
|
|
|
+ (i) => {
|
|
|
|
|
+ i.ruleId = this.ruleId;
|
|
|
|
|
+ i.outputType = this.outputType;
|
|
|
|
|
+ i.bomCategoryId = this.bomCategoryId;
|
|
|
|
|
+ i.id = null;
|
|
|
|
|
+ return i;
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
},
|
|
},
|
|
|
- deep: true
|
|
|
|
|
- },
|
|
|
|
|
- bomCategoryId: {
|
|
|
|
|
- handler() {
|
|
|
|
|
- this.getMaterialQuotaInfo();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- produceTaskId: {
|
|
|
|
|
- handler() {
|
|
|
|
|
- this.getMaterialQuotaInfo();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ immediate: true
|
|
|
},
|
|
},
|
|
|
outputType: {
|
|
outputType: {
|
|
|
handler() {
|
|
handler() {
|
|
|
// 重置产出明细
|
|
// 重置产出明细
|
|
|
this.localOutputDetails = [];
|
|
this.localOutputDetails = [];
|
|
|
|
|
|
|
|
|
|
+ this.localPickDetails = this.localPickDetails.map((item) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ selected: false
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
// 根据不同的类型,重置物料明细
|
|
// 根据不同的类型,重置物料明细
|
|
|
if (this.outputType == 1) {
|
|
if (this.outputType == 1) {
|
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
@@ -177,6 +204,27 @@
|
|
|
this.getMaterialQuotaInfo();
|
|
this.getMaterialQuotaInfo();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ ruleId: {
|
|
|
|
|
+ handler() {
|
|
|
|
|
+ // 更新物料明细的ruleId
|
|
|
|
|
+ this.localPickDetails = this.localPickDetails.map((item) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ ruleId: this.ruleId
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ // 更新产出明细的ruleId
|
|
|
|
|
+ this.localOutputDetails = this.localOutputDetails.map((item) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ ruleId: this.ruleId
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ // 通知父组件更新
|
|
|
|
|
+ this.$emit('update:pickDetails', this.localPickDetails);
|
|
|
|
|
+ this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -238,6 +286,36 @@
|
|
|
formatter: (row) => {
|
|
formatter: (row) => {
|
|
|
return (row.quantity || '') + (row.unit || '');
|
|
return (row.quantity || '') + (row.unit || '');
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '当次消耗数量',
|
|
|
|
|
+ prop: '',
|
|
|
|
|
+ minWidth: 120,
|
|
|
|
|
+ formatter: (row) => {
|
|
|
|
|
+ // 取值产出清单
|
|
|
|
|
+ const outputItem = this.localOutputDetails.find(
|
|
|
|
|
+ (item) => item.categoryId === row.categoryId
|
|
|
|
|
+ );
|
|
|
|
|
+ return (
|
|
|
|
|
+ (outputItem ? outputItem.reportQuantity : 0) + (row.unit || '')
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '累计消耗数量',
|
|
|
|
|
+ prop: '',
|
|
|
|
|
+ minWidth: 120,
|
|
|
|
|
+ formatter: (row) => {
|
|
|
|
|
+ const outputItem = this.localOutputDetails.find(
|
|
|
|
|
+ (item) => item.categoryId === row.categoryId
|
|
|
|
|
+ );
|
|
|
|
|
+ if (!outputItem) {
|
|
|
|
|
+ return '0' + (row.unit || '');
|
|
|
|
|
+ }
|
|
|
|
|
+ let count =
|
|
|
|
|
+ outputItem.sumReportQuantity + outputItem.reportQuantity;
|
|
|
|
|
+ return count + (row.unit || '');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
];
|
|
];
|
|
|
if (this.outputType == 1) {
|
|
if (this.outputType == 1) {
|
|
@@ -255,8 +333,9 @@
|
|
|
|
|
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- localPickDetails: JSON.parse(JSON.stringify(this.pickDetails)),
|
|
|
|
|
- localOutputDetails: JSON.parse(JSON.stringify(this.outputDetails)),
|
|
|
|
|
|
|
+ localPickDetails: [],
|
|
|
|
|
+ localOutputDetails: [],
|
|
|
|
|
+ // bom配置的 标准产出信息
|
|
|
materialQuotaInfo: null,
|
|
materialQuotaInfo: null,
|
|
|
// 产出清单表头
|
|
// 产出清单表头
|
|
|
outputDetailsColumns: [
|
|
outputDetailsColumns: [
|
|
@@ -308,34 +387,19 @@
|
|
|
label: '当次报工数量',
|
|
label: '当次报工数量',
|
|
|
prop: 'reportQuantity',
|
|
prop: 'reportQuantity',
|
|
|
minWidth: 160,
|
|
minWidth: 160,
|
|
|
- slot: 'reportQuantity',
|
|
|
|
|
- formatter: (row) => {
|
|
|
|
|
- return (
|
|
|
|
|
- (row.reportQuantity == null ? '' : row.unit) +
|
|
|
|
|
- (row.feedUnit || '')
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ slot: 'reportQuantity'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '当次合格数量',
|
|
label: '当次合格数量',
|
|
|
prop: 'qualifiedQuantity',
|
|
prop: 'qualifiedQuantity',
|
|
|
minWidth: 160,
|
|
minWidth: 160,
|
|
|
- slot: 'qualifiedQuantity',
|
|
|
|
|
- formatter: (row) => {
|
|
|
|
|
- return (
|
|
|
|
|
- (row.qualifiedQuantity == null ? '' : row.unit) +
|
|
|
|
|
- (row.feedUnit || '')
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ slot: 'qualifiedQuantity'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '当次不合格数量',
|
|
label: '当次不合格数量',
|
|
|
prop: 'noQualifiedQuantity',
|
|
prop: 'noQualifiedQuantity',
|
|
|
minWidth: 160,
|
|
minWidth: 160,
|
|
|
- slot: 'noQualifiedQuantity',
|
|
|
|
|
- formatter: (row) => {
|
|
|
|
|
- return (row.noQualifiedQuantity || 0) + (row.unit || '');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ slot: 'noQualifiedQuantity'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '不合格原因',
|
|
label: '不合格原因',
|
|
@@ -367,17 +431,12 @@
|
|
|
return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
|
|
return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- ]
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ // bomInfo
|
|
|
|
|
+ materialQuotaInfo: null
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
- mounted() {
|
|
|
|
|
- if (this.outputType == 2) {
|
|
|
|
|
- this.getCategoryAndLevelByCategoryId();
|
|
|
|
|
- }
|
|
|
|
|
- if (this.outputType == 3) {
|
|
|
|
|
- this.getMaterialQuotaInfo();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ mounted() {},
|
|
|
methods: {
|
|
methods: {
|
|
|
// 选择物料
|
|
// 选择物料
|
|
|
openMaterialModal() {
|
|
openMaterialModal() {
|
|
@@ -405,13 +464,21 @@
|
|
|
this.localPickDetails[index].quantity = newItem.quantity;
|
|
this.localPickDetails[index].quantity = newItem.quantity;
|
|
|
} else {
|
|
} else {
|
|
|
// 不存在则添加
|
|
// 不存在则添加
|
|
|
- this.localPickDetails.push({ ...newItem });
|
|
|
|
|
|
|
+ this.localPickDetails.push({
|
|
|
|
|
+ ...newItem,
|
|
|
|
|
+ ruleId: this.ruleId,
|
|
|
|
|
+ bomCategoryId: this.bomCategoryId,
|
|
|
|
|
+ produceTaskId: this.produceTaskId,
|
|
|
|
|
+ produceTaskInstanceId: this.produceTaskInstanceId,
|
|
|
|
|
+ produceTaskName: this.produceTaskName,
|
|
|
|
|
+ workOrderId: this.workOrderId
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.$emit('update:pickDetails', this.localPickDetails);
|
|
this.$emit('update:pickDetails', this.localPickDetails);
|
|
|
},
|
|
},
|
|
|
- // 获取bom的产出
|
|
|
|
|
|
|
+ // 获取bom的产出清单
|
|
|
async getMaterialQuotaInfo() {
|
|
async getMaterialQuotaInfo() {
|
|
|
if (this.bomCategoryId && this.produceTaskId) {
|
|
if (this.bomCategoryId && this.produceTaskId) {
|
|
|
const data = await getMaterialQuotaInfo(
|
|
const data = await getMaterialQuotaInfo(
|
|
@@ -422,17 +489,25 @@
|
|
|
if (!data.standardOutput) {
|
|
if (!data.standardOutput) {
|
|
|
return this.$message.warning('未配置标准产出物料');
|
|
return this.$message.warning('未配置标准产出物料');
|
|
|
}
|
|
}
|
|
|
|
|
+ this.materialQuotaInfo = data;
|
|
|
// 赋值产出
|
|
// 赋值产出
|
|
|
this.localOutputDetails = [
|
|
this.localOutputDetails = [
|
|
|
{
|
|
{
|
|
|
...data.standardOutput,
|
|
...data.standardOutput,
|
|
|
|
|
+ id: null,
|
|
|
reportQuantity: 0,
|
|
reportQuantity: 0,
|
|
|
qualifiedQuantity: 0,
|
|
qualifiedQuantity: 0,
|
|
|
noQualifiedQuantity: 0,
|
|
noQualifiedQuantity: 0,
|
|
|
msg: '',
|
|
msg: '',
|
|
|
sumReportQuantity: 0,
|
|
sumReportQuantity: 0,
|
|
|
sumQualifiedQuantity: 0,
|
|
sumQualifiedQuantity: 0,
|
|
|
- sumNoQualifiedQuantity: 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);
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
@@ -461,13 +536,21 @@
|
|
|
// 不存在则添加
|
|
// 不存在则添加
|
|
|
this.localOutputDetails.push({
|
|
this.localOutputDetails.push({
|
|
|
...row,
|
|
...row,
|
|
|
|
|
+ id: null,
|
|
|
reportQuantity: 0,
|
|
reportQuantity: 0,
|
|
|
qualifiedQuantity: 0,
|
|
qualifiedQuantity: 0,
|
|
|
noQualifiedQuantity: 0,
|
|
noQualifiedQuantity: 0,
|
|
|
msg: '',
|
|
msg: '',
|
|
|
sumReportQuantity: 0,
|
|
sumReportQuantity: 0,
|
|
|
sumQualifiedQuantity: 0,
|
|
sumQualifiedQuantity: 0,
|
|
|
- sumNoQualifiedQuantity: 0
|
|
|
|
|
|
|
+ sumNoQualifiedQuantity: 0,
|
|
|
|
|
+ ruleId: this.ruleId,
|
|
|
|
|
+ outputType: this.outputType,
|
|
|
|
|
+ bomCategoryId: this.bomCategoryId,
|
|
|
|
|
+ produceTaskId: this.produceTaskId,
|
|
|
|
|
+ produceTaskInstanceId: this.produceTaskInstanceId,
|
|
|
|
|
+ produceTaskName: this.produceTaskName,
|
|
|
|
|
+ workOrderId: this.workOrderId
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
this.$message.warning('该物料已存在于产出清单中');
|
|
this.$message.warning('该物料已存在于产出清单中');
|
|
@@ -482,17 +565,186 @@
|
|
|
this.localOutputDetails = [
|
|
this.localOutputDetails = [
|
|
|
{
|
|
{
|
|
|
...data,
|
|
...data,
|
|
|
|
|
+ id: null,
|
|
|
reportQuantity: 0,
|
|
reportQuantity: 0,
|
|
|
qualifiedQuantity: 0,
|
|
qualifiedQuantity: 0,
|
|
|
noQualifiedQuantity: 0,
|
|
noQualifiedQuantity: 0,
|
|
|
msg: '',
|
|
msg: '',
|
|
|
sumReportQuantity: 0,
|
|
sumReportQuantity: 0,
|
|
|
sumQualifiedQuantity: 0,
|
|
sumQualifiedQuantity: 0,
|
|
|
- sumNoQualifiedQuantity: 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);
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
|
|
+
|
|
|
|
|
+ const bomInfo = await getMaterialQuotaInfo(
|
|
|
|
|
+ this.bomCategoryId,
|
|
|
|
|
+ this.produceTaskId
|
|
|
|
|
+ );
|
|
|
|
|
+ this.materialQuotaInfo = bomInfo;
|
|
|
console.log('this.localOutputDetails', this.localOutputDetails);
|
|
console.log('this.localOutputDetails', this.localOutputDetails);
|
|
|
|
|
+ console.log('this.materialQuotaInfo', this.materialQuotaInfo);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 计算报工数量最大值
|
|
|
|
|
+ reportQuantitymax(row) {
|
|
|
|
|
+ if (this.outputType == 1) {
|
|
|
|
|
+ // 物料本身 不能超过已报工数量减领料数量
|
|
|
|
|
+ return row.quantity - row.sumReportQuantity;
|
|
|
|
|
+ }
|
|
|
|
|
+ return Infinity;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 判断生成产出清单的物料数量是合格
|
|
|
|
|
+ async validateOutputQuantities() {
|
|
|
|
|
+ if (this.localPickDetails.length == 0) {
|
|
|
|
|
+ this.$message.warning(`物料清单不能为空`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (this.localOutputDetails.length == 0) {
|
|
|
|
|
+ this.$message.warning(`产出清单不能为空`);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (const item of this.localOutputDetails) {
|
|
|
|
|
+ if (!item.reportQuantity) {
|
|
|
|
|
+ this.$message.warning(
|
|
|
|
|
+ `请填写产出清单【${item.categoryName}】的当次报工数量`
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 判断当次合格数量 和 不合格数量 之和需要等于 报工数量
|
|
|
|
|
+ if (
|
|
|
|
|
+ item.reportQuantity !==
|
|
|
|
|
+ item.qualifiedQuantity + item.noQualifiedQuantity
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.$message.warning(
|
|
|
|
|
+ `物料【${item.categoryName}】的当次合格数量和不合格数量之和必须等于报工数量`
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (this.outputType == 1) {
|
|
|
|
|
+ for (const item of this.localOutputDetails) {
|
|
|
|
|
+ const pickitem = this.localPickDetails.find(
|
|
|
|
|
+ (pick) =>
|
|
|
|
|
+ pick.categoryId == item.categoryId &&
|
|
|
|
|
+ pick.produceTaskInstanceId == item.produceTaskInstanceId
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if (pickitem == null) {
|
|
|
|
|
+ this.$message.warning(
|
|
|
|
|
+ `所需物料【${item.categoryName}】未在物料清单中找到`
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (item.reportQuantity > item.quantity) {
|
|
|
|
|
+ this.$message.error(
|
|
|
|
|
+ `物料【${item.categoryName}】的报工数量不能超过领料数量`
|
|
|
|
|
+ );
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (this.outputType == 2 || this.outputType == 3) {
|
|
|
|
|
+ let val = true;
|
|
|
|
|
+
|
|
|
|
|
+ if (!this.materialQuotaInfo) {
|
|
|
|
|
+ this.materialQuotaInfo = await getMaterialQuotaInfo(
|
|
|
|
|
+ this.bomCategoryId,
|
|
|
|
|
+ this.produceTaskId
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.materialQuotaInfo.materialQuota.forEach((i) => {
|
|
|
|
|
+ // 避免重复提示
|
|
|
|
|
+ if (!val) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 需要的物料数量比例
|
|
|
|
|
+ let count = i.count / this.materialQuotaInfo.baseCount;
|
|
|
|
|
+
|
|
|
|
|
+ // 产出清单的报工数量 当次报工+累计报工
|
|
|
|
|
+ const outputItem = this.localOutputDetails[0];
|
|
|
|
|
+
|
|
|
|
|
+ // 产出物料数量
|
|
|
|
|
+ const outputQuantity =
|
|
|
|
|
+ outputItem.reportQuantity + outputItem.sumReportQuantity;
|
|
|
|
|
+ const needQuantity = outputQuantity * count;
|
|
|
|
|
+
|
|
|
|
|
+ // 查询物料清单 是否满足数量
|
|
|
|
|
+ const pickitem = this.localPickDetails.find(
|
|
|
|
|
+ (pick) => pick.categoryId == i.id
|
|
|
|
|
+ );
|
|
|
|
|
+ // 查询preOutputDetails 上一道工序产出物
|
|
|
|
|
+ const preOutputItem = this.preOutputDetails.find(
|
|
|
|
|
+ (pre) => pre.categoryId == i.id
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ // 所需物料是 物料或者是上一道工序产出物
|
|
|
|
|
+ if (pickitem == null && preOutputItem == null) {
|
|
|
|
|
+ this.$message.warning(
|
|
|
|
|
+ `所需物料【${i.categoryName}】未在物料清单中找到`
|
|
|
|
|
+ );
|
|
|
|
|
+ val = false;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 物料对象存在
|
|
|
|
|
+ if (pickitem) {
|
|
|
|
|
+ if (needQuantity > pickitem.quantity) {
|
|
|
|
|
+ this.$message.warning(
|
|
|
|
|
+ `物料【${pickitem.categoryName}】领料数量不足,需${needQuantity}${pickitem.unit},当前仅有${pickitem.quantity}${pickitem.unit}`
|
|
|
|
|
+ );
|
|
|
|
|
+ val = false;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 判断累计报工数量是否足够
|
|
|
|
|
+ let pickitemSumReportQuantity =
|
|
|
|
|
+ pickitem.sumReportQuantity + pickitem.reportQuantity;
|
|
|
|
|
+ if (needQuantity > pickitemSumReportQuantity) {
|
|
|
|
|
+ this.$message.warning(
|
|
|
|
|
+ `物料【${pickitem.categoryName}】累计报工数量不足,需${needQuantity}${pickitem.unit},当前仅有${pickitemSumReportQuantity}${pickitem.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;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|