|
|
@@ -24,6 +24,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>
|
|
|
@@ -80,6 +112,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>
|
|
|
|
|
|
<materialModal ref="materialModalRef" @confirm="materialConfirm" />
|
|
|
@@ -249,7 +329,7 @@
|
|
|
computed: {
|
|
|
// 物料清单(包含上到工序产出明细)
|
|
|
materialList() {
|
|
|
- return [...this.preOutputDetails, ...this.localPickDetails];
|
|
|
+ return this.localPickDetails;
|
|
|
},
|
|
|
// 物料清单表头
|
|
|
materialColumns() {
|
|
|
@@ -304,7 +384,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter: (row) => {
|
|
|
return (row.quantity || 0) + (row.unit || '');
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'feedQuantityHeader'
|
|
|
},
|
|
|
{
|
|
|
label: '当次消耗数量',
|
|
|
@@ -317,10 +398,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标准产出
|
|
|
// 查询基数
|
|
|
@@ -352,7 +435,9 @@
|
|
|
return '0' + (row.unit || '');
|
|
|
}
|
|
|
// 当次消耗
|
|
|
- let needQuantity = outputItem.reportQuantity * count;
|
|
|
+ let needQuantity = this.formatNumber(
|
|
|
+ outputItem.reportQuantity * count
|
|
|
+ );
|
|
|
return needQuantity + (row.unit || '');
|
|
|
}
|
|
|
}
|
|
|
@@ -389,7 +474,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -400,7 +487,9 @@
|
|
|
item.categoryCode === this.categoryInfo.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -479,7 +568,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
// 在制品
|
|
|
@@ -492,7 +583,9 @@
|
|
|
item.categoryCode === this.categoryInfo.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -508,17 +601,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) {
|
|
|
@@ -618,7 +713,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter(row) {
|
|
|
return (row.sumReportQuantity || 0) + row.unit;
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumReportQuantityHeader'
|
|
|
},
|
|
|
{
|
|
|
label: '合格总数',
|
|
|
@@ -626,7 +722,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter(row) {
|
|
|
return (row.sumQualifiedQuantity || 0) + (row.unit || '');
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumQualifiedQuantityHeader'
|
|
|
},
|
|
|
{
|
|
|
label: '不合格总数',
|
|
|
@@ -634,7 +731,8 @@
|
|
|
minWidth: 120,
|
|
|
formatter(row) {
|
|
|
return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
|
|
|
- }
|
|
|
+ },
|
|
|
+ headerSlot: 'sumNoQualifiedQuantityHeader'
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
@@ -648,7 +746,6 @@
|
|
|
ruleId: this.ruleId,
|
|
|
produceTaskId: this.produceTaskId
|
|
|
},
|
|
|
- // ...this.localPickDetails, ...this.preOutputDetails
|
|
|
[]
|
|
|
);
|
|
|
},
|
|
|
@@ -885,10 +982,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) {
|
|
|
@@ -909,7 +1016,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preItem) {
|
|
|
- preCount += preItem.sumReportQuantity * proportion;
|
|
|
+ preCount += this.formatNumber(
|
|
|
+ preItem.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -919,15 +1028,14 @@
|
|
|
(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) {
|
|
|
const count =
|
|
|
@@ -951,6 +1059,7 @@
|
|
|
(item) => item.categoryCode === row.categoryCode
|
|
|
);
|
|
|
|
|
|
+ // debugger;
|
|
|
// 存在则当前row为在制品或BOM标准产出
|
|
|
if (preOutputItem) {
|
|
|
// 区分已执行状态
|
|
|
@@ -975,9 +1084,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;
|
|
|
}
|
|
|
@@ -1001,8 +1118,9 @@
|
|
|
this.materialQuotaInfo.standardOutput.categoryCode
|
|
|
);
|
|
|
if (preStd) {
|
|
|
- preOutputConsumedProportion +=
|
|
|
- preStd.sumReportQuantity * proportion;
|
|
|
+ preOutputConsumedProportion += this.formatNumber(
|
|
|
+ preStd.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1015,8 +1133,9 @@
|
|
|
(s) => s.categoryCode === this.categoryInfo.categoryCode
|
|
|
);
|
|
|
if (preWip) {
|
|
|
- preOutputConsumedProportion +=
|
|
|
- preWip.sumReportQuantity * proportion;
|
|
|
+ preOutputConsumedProportion += this.formatNumber(
|
|
|
+ preWip.sumReportQuantity * proportion
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1026,7 +1145,9 @@
|
|
|
: row.sumReportQuantity;
|
|
|
|
|
|
// 已执行的比例换算,换算为需要多少物料数量
|
|
|
- const consumedProportion = consumedQuantity * proportion;
|
|
|
+ const consumedProportion = this.formatNumber(
|
|
|
+ consumedQuantity * proportion
|
|
|
+ );
|
|
|
|
|
|
// 最大可报工数量
|
|
|
let maxQuantity =
|
|
|
@@ -1070,15 +1191,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}】未在物料清单中找到`
|
|
|
);
|
|
|
@@ -1122,6 +1245,11 @@
|
|
|
} else {
|
|
|
this.setMaterialQuotaInfo();
|
|
|
}
|
|
|
+ },
|
|
|
+ // 处理数字精度问题,不使用toFixed,避免4舍5入
|
|
|
+ formatNumber(value, decimalPlaces = 4) {
|
|
|
+ const factor = Math.pow(10, decimalPlaces);
|
|
|
+ return Math.floor(value * factor) / factor;
|
|
|
}
|
|
|
}
|
|
|
};
|