|
|
@@ -20,6 +20,38 @@
|
|
|
@change="selectedChange(row)"
|
|
|
></el-checkbox>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-slot:feedQuantityHeader>
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="数量是指存在多次投料时,本道工序在本次记录表报工时的累计当时投料数量;"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span>数量</span>
|
|
|
+ <i
|
|
|
+ class="el-icon-info"
|
|
|
+ style="margin-left: 4px; color: #909399"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:sumConsumeQuantityHeader>
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="累计消耗数量是指存在多次记录表报工时,本次记录表报工时的累计实时消耗数量;"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span>累计消耗数量</span>
|
|
|
+ <i
|
|
|
+ class="el-icon-info"
|
|
|
+ style="margin-left: 4px; color: #909399"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
|
|
|
|
<header-title title="产出清单" style="margin-top: 20px"></header-title>
|
|
|
@@ -36,6 +68,7 @@
|
|
|
>
|
|
|
<template v-slot:reportQuantity="{ row }">
|
|
|
<div>
|
|
|
+ <!-- {{ reportQuantitymax(row) }} -->
|
|
|
<el-input-number
|
|
|
size="small"
|
|
|
v-model.number="row.reportQuantity"
|
|
|
@@ -75,6 +108,54 @@
|
|
|
@change="$emit('update:outputDetails', localOutputDetails)"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-slot:sumReportQuantityHeader>
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="已报工数量是指存在多次记录表报工时,多次报工数量的累计实时已报工数量;"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span>已报工数量</span>
|
|
|
+ <i
|
|
|
+ class="el-icon-info"
|
|
|
+ style="margin-left: 4px; color: #909399"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:sumQualifiedQuantityHeader>
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="合格品数量是指存在多次记录表报工时,多次报工数量的累计实时合格品数量;"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span>合格总数</span>
|
|
|
+ <i
|
|
|
+ class="el-icon-info"
|
|
|
+ style="margin-left: 4px; color: #909399"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:sumNoQualifiedQuantityHeader>
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="不合格品数量是指存在多次记录表报工时,多次报工数量的累计实时不合格品数量;"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span>不合格总数</span>
|
|
|
+ <i
|
|
|
+ class="el-icon-info"
|
|
|
+ style="margin-left: 4px; color: #909399"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -86,7 +167,6 @@
|
|
|
} from '@/api/producetaskrecordrulesrecord/index';
|
|
|
|
|
|
export default {
|
|
|
- components: {},
|
|
|
props: {
|
|
|
// 物料明细
|
|
|
pickDetails: {
|
|
|
@@ -239,7 +319,7 @@
|
|
|
computed: {
|
|
|
// 物料清单(包含上到工序产出明细)
|
|
|
materialList() {
|
|
|
- return [...this.preOutputDetails, ...this.localPickDetails];
|
|
|
+ return this.localPickDetails;
|
|
|
},
|
|
|
// 物料清单表头
|
|
|
materialColumns() {
|
|
|
@@ -294,7 +374,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter: (row) => {
|
|
|
return (row.quantity || 0) + (row.unit || '');
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'feedQuantityHeader'
|
|
|
},
|
|
|
{
|
|
|
label: '当次消耗数量',
|
|
|
@@ -307,10 +388,12 @@
|
|
|
const outputItem = this.localOutputDetails.find(
|
|
|
(item) => item.categoryCode === row.categoryCode
|
|
|
);
|
|
|
- return (
|
|
|
- (outputItem ? outputItem.reportQuantity : 0) +
|
|
|
- (row.unit || '')
|
|
|
- );
|
|
|
+
|
|
|
+ if (outputItem) {
|
|
|
+ return outputItem.reportQuantity + (row.unit || '');
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0 + (row.unit || '');
|
|
|
} else {
|
|
|
// 产出为在制品 或 BOM标准产出
|
|
|
// 查询基数
|
|
|
@@ -342,7 +425,9 @@
|
|
|
return '0' + (row.unit || '');
|
|
|
}
|
|
|
// 当次消耗
|
|
|
- let needQuantity = outputItem.reportQuantity * count;
|
|
|
+ let needQuantity = this.formatNumber(
|
|
|
+ outputItem.reportQuantity * count
|
|
|
+ );
|
|
|
return needQuantity + (row.unit || '');
|
|
|
}
|
|
|
}
|
|
|
@@ -365,38 +450,41 @@
|
|
|
(item) => item.categoryCode === row.categoryCode
|
|
|
);
|
|
|
|
|
|
- if (!materialQuotaItem) {
|
|
|
- return 0 + (row.unit || '');
|
|
|
- }
|
|
|
-
|
|
|
- // 计算比例
|
|
|
- const proportion =
|
|
|
- materialQuotaItem.count / this.materialQuotaInfo.baseCount;
|
|
|
-
|
|
|
- if (this.materialQuotaInfo.standardOutput) {
|
|
|
- // BOM标准产出
|
|
|
- const preItem = this.sumOutputDetails.find(
|
|
|
- (item) =>
|
|
|
- item.categoryCode ===
|
|
|
- this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
- );
|
|
|
- if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ if (materialQuotaItem) {
|
|
|
+ // 计算比例
|
|
|
+ const proportion =
|
|
|
+ materialQuotaItem.count /
|
|
|
+ this.materialQuotaInfo.baseCount;
|
|
|
+
|
|
|
+ if (this.materialQuotaInfo.standardOutput) {
|
|
|
+ // BOM标准产出
|
|
|
+ const preItem = this.sumOutputDetails.find(
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode ===
|
|
|
+ this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
+ );
|
|
|
+ if (preItem) {
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (this.categoryInfo) {
|
|
|
- // 在制品
|
|
|
- const preItem = this.sumOutputDetails.find(
|
|
|
- (item) =>
|
|
|
- item.categoryCode === this.categoryInfo.categoryCode
|
|
|
- );
|
|
|
- if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ if (this.categoryInfo) {
|
|
|
+ // 在制品
|
|
|
+ const preItem = this.sumOutputDetails.find(
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode === this.categoryInfo.categoryCode
|
|
|
+ );
|
|
|
+ if (preItem) {
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ // debugger;
|
|
|
let count = 0;
|
|
|
if (outputItem) {
|
|
|
if (this.executeStatus === 2) {
|
|
|
@@ -470,7 +558,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
// 在制品
|
|
|
@@ -483,7 +573,9 @@
|
|
|
item.categoryCode === this.categoryInfo.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -499,17 +591,19 @@
|
|
|
cumulativeOutputQuantity =
|
|
|
outputItem.sumReportQuantity + outputItem.reportQuantity;
|
|
|
}
|
|
|
- const needQuantity = cumulativeOutputQuantity * proportion;
|
|
|
+ const needQuantity = this.formatNumber(
|
|
|
+ cumulativeOutputQuantity * proportion
|
|
|
+ );
|
|
|
|
|
|
// 已消耗数量转换
|
|
|
- // const sumReportQuantity = row.sumReportQuantity * proportion;
|
|
|
const sumReportQuantity = row.sumReportQuantity;
|
|
|
|
|
|
return (
|
|
|
needQuantity + preCount + sumReportQuantity + (row.unit || '')
|
|
|
);
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumConsumeQuantityHeader'
|
|
|
}
|
|
|
];
|
|
|
if (this.outputType == 1) {
|
|
|
@@ -609,7 +703,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter(row) {
|
|
|
return (row.sumReportQuantity || 0) + row.unit;
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumReportQuantityHeader'
|
|
|
},
|
|
|
{
|
|
|
label: '合格总数',
|
|
|
@@ -617,7 +712,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter(row) {
|
|
|
return (row.sumQualifiedQuantity || 0) + (row.unit || '');
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumQualifiedQuantityHeader'
|
|
|
},
|
|
|
{
|
|
|
label: '不合格总数',
|
|
|
@@ -625,24 +721,13 @@
|
|
|
minWidth: 120,
|
|
|
formatter(row) {
|
|
|
return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumNoQualifiedQuantityHeader'
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- // 选择物料
|
|
|
- openMaterialModal() {
|
|
|
- this.$refs.materialModalRef.open(
|
|
|
- {
|
|
|
- workOrderId: this.workOrderId,
|
|
|
- ruleId: this.ruleId,
|
|
|
- produceTaskId: this.produceTaskId
|
|
|
- },
|
|
|
- // ...this.localPickDetails, ...this.preOutputDetails
|
|
|
- []
|
|
|
- );
|
|
|
- },
|
|
|
materialConfirm(data) {
|
|
|
// 选择物料后添加
|
|
|
console.log('data', data);
|
|
|
@@ -685,7 +770,7 @@
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+ console.log('this.localPickDetails', this.localPickDetails);
|
|
|
this.$emit('update:pickDetails', this.localPickDetails);
|
|
|
},
|
|
|
// bom标准产出赋值
|
|
|
@@ -744,9 +829,17 @@
|
|
|
);
|
|
|
console.log('this.materialQuotaInfo', data);
|
|
|
if (JSON.stringify(data) === '{}') {
|
|
|
- this.materialQuotaInfo = null;
|
|
|
+ this.materialQuotaInfo = this.materialQuota;
|
|
|
return;
|
|
|
}
|
|
|
+ if (data.materialQuota) {
|
|
|
+ // 过滤数据
|
|
|
+ data.materialQuota = data.materialQuota.filter((i) => {
|
|
|
+ return i.isReworkBom != 1;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ data.materialQuota = [];
|
|
|
+ }
|
|
|
this.materialQuotaInfo = data;
|
|
|
console.log('this.materialQuotaInfo', this.materialQuotaInfo);
|
|
|
}
|
|
|
@@ -812,7 +905,7 @@
|
|
|
(item) => !(item.categoryId === row.categoryId)
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+ console.log('this.localOutputDetails', this.localOutputDetails);
|
|
|
this.$emit('update:outputDetails', this.localOutputDetails);
|
|
|
},
|
|
|
// getCategoryAndLevelByCategoryId 获取产品 在制品信息
|
|
|
@@ -868,10 +961,20 @@
|
|
|
reportQuantitymax(row) {
|
|
|
if (this.outputType == 1) {
|
|
|
// 查询物料本身
|
|
|
- const pickItem = this.localPickDetails.find(
|
|
|
+ let pickItem = this.localPickDetails.find(
|
|
|
(item) => item.categoryCode === row.categoryCode
|
|
|
);
|
|
|
|
|
|
+ if (!pickItem) {
|
|
|
+ // 查询上到工序产出明细
|
|
|
+ pickItem = this.preOutputDetails.find(
|
|
|
+ (item) => item.categoryCode === row.categoryCode
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 未找到物料,则不限制
|
|
|
+ if (!pickItem) return Infinity;
|
|
|
+
|
|
|
// 查询其他工单sumOutputDetails中已产生的bom标准产出和在制品的累计消耗数量
|
|
|
let preCount = 0;
|
|
|
if (this.materialQuotaInfo) {
|
|
|
@@ -892,7 +995,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -902,22 +1007,27 @@
|
|
|
(item) => item.categoryCode === this.categoryInfo.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 未找到物料,则返回剩余数量
|
|
|
- if (!pickItem) return pickItem.quantity - preCount;
|
|
|
-
|
|
|
// 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
|
|
|
- if (this.executeStatus === 2) {
|
|
|
- return (
|
|
|
+ if (this.executeStatus == 2) {
|
|
|
+ const count =
|
|
|
pickItem.quantity -
|
|
|
- (pickItem.sumReportQuantity - row.reportQuantityCopy) -
|
|
|
- preCount
|
|
|
- );
|
|
|
+ (row.sumReportQuantity - row.reportQuantityCopy) -
|
|
|
+ preCount;
|
|
|
+
|
|
|
+ // 如果小于本次报工数量 则返回本次报工数量
|
|
|
+ if (count < row.reportQuantityCopy) {
|
|
|
+ return row.reportQuantityCopy;
|
|
|
+ } else {
|
|
|
+ return count;
|
|
|
+ }
|
|
|
} else {
|
|
|
return pickItem.quantity - pickItem.sumReportQuantity - preCount;
|
|
|
}
|
|
|
@@ -928,6 +1038,7 @@
|
|
|
(item) => item.categoryCode === row.categoryCode
|
|
|
);
|
|
|
|
|
|
+ // debugger;
|
|
|
// 存在则当前row为在制品或BOM标准产出
|
|
|
if (preOutputItem) {
|
|
|
// 区分已执行状态
|
|
|
@@ -952,9 +1063,17 @@
|
|
|
|
|
|
// 计算每个物料的最大可报工数量
|
|
|
const maxQuantities = quota.map((item) => {
|
|
|
- const pickItem = this.localPickDetails.find(
|
|
|
+ let pickItem = this.localPickDetails.find(
|
|
|
(p) => p.categoryCode === item.categoryCode
|
|
|
);
|
|
|
+
|
|
|
+ // 从上一道工序产出物中找
|
|
|
+ if (!pickItem) {
|
|
|
+ pickItem = this.preOutputDetails.find(
|
|
|
+ (p) => p.categoryCode === item.categoryCode
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
if (!pickItem) {
|
|
|
return Infinity;
|
|
|
}
|
|
|
@@ -978,8 +1097,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preStd) {
|
|
|
- preOutputConsumedProportion +=
|
|
|
- preStd.sumReportQuantity * proportion;
|
|
|
+ preOutputConsumedProportion += this.formatNumber(
|
|
|
+ preStd.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -992,8 +1112,9 @@
|
|
|
(s) => s.categoryCode === this.categoryInfo.categoryCode
|
|
|
);
|
|
|
if (preWip) {
|
|
|
- preOutputConsumedProportion +=
|
|
|
- preWip.sumReportQuantity * proportion;
|
|
|
+ preOutputConsumedProportion += this.formatNumber(
|
|
|
+ preWip.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1003,7 +1124,9 @@
|
|
|
: row.sumReportQuantity;
|
|
|
|
|
|
// 已执行的比例换算,换算为需要多少物料数量
|
|
|
- const consumedProportion = consumedQuantity * proportion;
|
|
|
+ const consumedProportion = this.formatNumber(
|
|
|
+ consumedQuantity * proportion
|
|
|
+ );
|
|
|
|
|
|
// 最大可报工数量
|
|
|
let maxQuantity =
|
|
|
@@ -1047,15 +1170,17 @@
|
|
|
}
|
|
|
|
|
|
for (const item of this.localOutputDetails) {
|
|
|
- const pickitem = this.localPickDetails.find(
|
|
|
- (pick) => pick.categoryCode == item.categoryCode
|
|
|
- );
|
|
|
-
|
|
|
- const prePickitem = this.preOutputDetails.find(
|
|
|
+ let pickitem = this.localPickDetails.find(
|
|
|
(pick) => pick.categoryCode == item.categoryCode
|
|
|
);
|
|
|
+ // 从上一道工序产出物中找
|
|
|
+ if (!pickitem) {
|
|
|
+ pickitem = this.preOutputDetails.find(
|
|
|
+ (pick) => pick.categoryCode == item.categoryCode
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- if (pickitem == null && prePickitem == null) {
|
|
|
+ if (!pickitem) {
|
|
|
this.$message.warning(
|
|
|
`所需物料【${item.categoryName}】未在物料清单中找到`
|
|
|
);
|
|
|
@@ -1099,6 +1224,11 @@
|
|
|
} else {
|
|
|
this.setMaterialQuotaInfo();
|
|
|
}
|
|
|
+ },
|
|
|
+ // 处理数字精度问题,不使用toFixed,避免4舍5入
|
|
|
+ formatNumber(value, decimalPlaces = 4) {
|
|
|
+ const factor = Math.pow(10, decimalPlaces);
|
|
|
+ return Math.floor(value * factor) / factor;
|
|
|
}
|
|
|
}
|
|
|
};
|