OEE添加合格品次品待判级内容
This commit is contained in:
@@ -3,7 +3,6 @@ package com.klp.pocket.acid.domain.vo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 酸轧线OEE日汇总视图对象
|
||||
@@ -45,18 +44,36 @@ public class AcidOeeDailySummaryVo {
|
||||
/** 总产量(卷) */
|
||||
private Long totalOutputCoil;
|
||||
|
||||
/** 良品量(吨) */
|
||||
/** 良品量(A系列,吨) */
|
||||
private BigDecimal goodOutputTon;
|
||||
|
||||
/** 良品量(卷) */
|
||||
/** 良品量(A系列,卷) */
|
||||
private Long goodOutputCoil;
|
||||
|
||||
/** 不良量(吨)= total_output_ton - good_output_ton */
|
||||
/** 合格品量(B系列,吨) */
|
||||
private BigDecimal qualifiedOutputTon;
|
||||
|
||||
/** 合格品量(B系列,卷) */
|
||||
private Long qualifiedOutputCoil;
|
||||
|
||||
/** 合格品合计(A+B,吨) */
|
||||
private BigDecimal abOutputTon;
|
||||
|
||||
/** 合格品合计(A+B,卷) */
|
||||
private Long abOutputCoil;
|
||||
|
||||
/** 次品量(C/D系列,吨) */
|
||||
private BigDecimal defectOutputTon;
|
||||
|
||||
/** 不良量(卷)= total_output_coil - good_output_coil */
|
||||
/** 次品量(C/D系列,卷) */
|
||||
private Long defectOutputCoil;
|
||||
|
||||
/** 待判级量(O系列,吨) */
|
||||
private BigDecimal pendingOutputTon;
|
||||
|
||||
/** 待判级量(O系列,卷) */
|
||||
private Long pendingOutputCoil;
|
||||
|
||||
/** 理论节拍(min/吨;回归斜率) */
|
||||
private BigDecimal idealCycleTimeMinPerTon;
|
||||
|
||||
@@ -72,9 +89,18 @@ public class AcidOeeDailySummaryVo {
|
||||
/** 派生指标:性能稼动率(卷维度) */
|
||||
private BigDecimal performanceCoil;
|
||||
|
||||
/** 派生指标:良品率 */
|
||||
/** 派生指标:良品率(A/总量) */
|
||||
private BigDecimal quality;
|
||||
|
||||
/** 派生指标:合格品率(A+B/总量) */
|
||||
private BigDecimal qualifiedRate;
|
||||
|
||||
/** 派生指标:次品率(C/D系列/总量) */
|
||||
private BigDecimal defectRate;
|
||||
|
||||
/** 派生指标:待判级率(O系列/总量) */
|
||||
private BigDecimal pendingRate;
|
||||
|
||||
/** 派生指标:OEE(建议以吨维度为主) */
|
||||
private BigDecimal oee;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ import java.util.Set;
|
||||
@Service
|
||||
public class AcidOeeServiceImpl implements IAcidOeeService {
|
||||
|
||||
/** 次品判级集合:命中这些 quality_status 判为次品 */
|
||||
private static final Set<String> SCRAP_QUALITY_STATUS = new HashSet<>(
|
||||
/** 次品判级集合(C/D系列) */
|
||||
private static final Set<String> CD_SERIES = new HashSet<>(
|
||||
Arrays.asList("C+", "C", "C-", "D+", "D", "D-")
|
||||
);
|
||||
|
||||
@@ -105,11 +105,17 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
|
||||
List<CoilInfo> coilInfos = coilInfoByDate.get(statDate);
|
||||
calculateQualityOutput(summary, coilInfos);
|
||||
} else {
|
||||
// 如果没有卷号,默认全部为良品(或根据业务规则处理)
|
||||
summary.setGoodOutputTon(summary.getTotalOutputTon());
|
||||
summary.setGoodOutputCoil(summary.getTotalOutputCoil());
|
||||
// 没有卷明细时,全部归待判级
|
||||
summary.setGoodOutputTon(BigDecimal.ZERO);
|
||||
summary.setGoodOutputCoil(0L);
|
||||
summary.setQualifiedOutputTon(BigDecimal.ZERO);
|
||||
summary.setQualifiedOutputCoil(0L);
|
||||
summary.setAbOutputTon(BigDecimal.ZERO);
|
||||
summary.setAbOutputCoil(0L);
|
||||
summary.setDefectOutputTon(BigDecimal.ZERO);
|
||||
summary.setDefectOutputCoil(0L);
|
||||
summary.setPendingOutputTon(summary.getTotalOutputTon());
|
||||
summary.setPendingOutputCoil(summary.getTotalOutputCoil());
|
||||
}
|
||||
|
||||
calculateDerivedMetrics(summary);
|
||||
@@ -378,51 +384,64 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
|
||||
* 卷号信息内部类
|
||||
*/
|
||||
private static class CoilInfo {
|
||||
final String coilNo;
|
||||
final BigDecimal weight;
|
||||
final String qualityStatus;
|
||||
|
||||
CoilInfo(String coilNo, BigDecimal weight, String qualityStatus) {
|
||||
this.coilNo = coilNo;
|
||||
this.weight = weight;
|
||||
this.qualityStatus = qualityStatus;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算良品/次品产量
|
||||
* 计算质量细分产量:A良品、B合格品、C/D次品、O待判级。
|
||||
*/
|
||||
private void calculateQualityOutput(AcidOeeDailySummaryVo summary, List<CoilInfo> coilInfos) {
|
||||
BigDecimal goodTon = BigDecimal.ZERO;
|
||||
long goodCoil = 0L;
|
||||
BigDecimal defectTon = BigDecimal.ZERO;
|
||||
long defectCoil = 0L;
|
||||
BigDecimal aTon = BigDecimal.ZERO;
|
||||
long aCoil = 0L;
|
||||
BigDecimal bTon = BigDecimal.ZERO;
|
||||
long bCoil = 0L;
|
||||
BigDecimal cdTon = BigDecimal.ZERO;
|
||||
long cdCoil = 0L;
|
||||
BigDecimal oTon = BigDecimal.ZERO;
|
||||
long oCoil = 0L;
|
||||
|
||||
for (CoilInfo coilInfo : coilInfos) {
|
||||
BigDecimal coilWeight = coilInfo.weight != null ? coilInfo.weight : BigDecimal.ZERO;
|
||||
String qualityStatus = StringUtils.trim(coilInfo.qualityStatus);
|
||||
String qualityStatus = StringUtils.upperCase(StringUtils.trim(coilInfo.qualityStatus));
|
||||
|
||||
// 没有判级时按良品处理(避免再次跨库匹配导致错配)
|
||||
if (StringUtils.isBlank(qualityStatus)) {
|
||||
goodTon = goodTon.add(coilWeight);
|
||||
goodCoil++;
|
||||
if (StringUtils.isBlank(qualityStatus) || "O".equals(qualityStatus)) {
|
||||
oTon = oTon.add(coilWeight);
|
||||
oCoil++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SCRAP_QUALITY_STATUS.contains(qualityStatus)) {
|
||||
// 次品
|
||||
defectTon = defectTon.add(coilWeight);
|
||||
defectCoil++;
|
||||
if (qualityStatus.startsWith("A")) {
|
||||
aTon = aTon.add(coilWeight);
|
||||
aCoil++;
|
||||
} else if (qualityStatus.startsWith("B")) {
|
||||
bTon = bTon.add(coilWeight);
|
||||
bCoil++;
|
||||
} else if (CD_SERIES.contains(qualityStatus)) {
|
||||
cdTon = cdTon.add(coilWeight);
|
||||
cdCoil++;
|
||||
} else {
|
||||
// 良品
|
||||
goodTon = goodTon.add(coilWeight);
|
||||
goodCoil++;
|
||||
// 未识别等级统一归待判级
|
||||
oTon = oTon.add(coilWeight);
|
||||
oCoil++;
|
||||
}
|
||||
}
|
||||
|
||||
summary.setGoodOutputTon(goodTon);
|
||||
summary.setGoodOutputCoil(goodCoil);
|
||||
summary.setDefectOutputTon(defectTon);
|
||||
summary.setDefectOutputCoil(defectCoil);
|
||||
summary.setGoodOutputTon(aTon);
|
||||
summary.setGoodOutputCoil(aCoil);
|
||||
summary.setQualifiedOutputTon(bTon);
|
||||
summary.setQualifiedOutputCoil(bCoil);
|
||||
summary.setAbOutputTon(aTon.add(bTon));
|
||||
summary.setAbOutputCoil(aCoil + bCoil);
|
||||
summary.setDefectOutputTon(cdTon);
|
||||
summary.setDefectOutputCoil(cdCoil);
|
||||
summary.setPendingOutputTon(oTon);
|
||||
summary.setPendingOutputCoil(oCoil);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,12 +490,29 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
|
||||
summary.setPerformanceCoil(performanceCoil);
|
||||
}
|
||||
|
||||
// 良品率
|
||||
// 质量细分比率
|
||||
if (totalOutputTon != null && totalOutputTon.compareTo(BigDecimal.ZERO) > 0) {
|
||||
BigDecimal goodOutputTon = summary.getGoodOutputTon() != null ? summary.getGoodOutputTon() : BigDecimal.ZERO;
|
||||
BigDecimal quality = goodOutputTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
|
||||
BigDecimal aTon = summary.getGoodOutputTon() != null ? summary.getGoodOutputTon() : BigDecimal.ZERO;
|
||||
BigDecimal bTon = summary.getQualifiedOutputTon() != null ? summary.getQualifiedOutputTon() : BigDecimal.ZERO;
|
||||
BigDecimal cdTon = summary.getDefectOutputTon() != null ? summary.getDefectOutputTon() : BigDecimal.ZERO;
|
||||
BigDecimal oTon = summary.getPendingOutputTon() != null ? summary.getPendingOutputTon() : BigDecimal.ZERO;
|
||||
|
||||
BigDecimal quality = aTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
|
||||
.multiply(BigDecimal.valueOf(100));
|
||||
summary.setQuality(quality);
|
||||
|
||||
BigDecimal qualifiedRate = aTon.add(bTon)
|
||||
.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
|
||||
.multiply(BigDecimal.valueOf(100));
|
||||
summary.setQualifiedRate(qualifiedRate);
|
||||
|
||||
BigDecimal defectRate = cdTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
|
||||
.multiply(BigDecimal.valueOf(100));
|
||||
summary.setDefectRate(defectRate);
|
||||
|
||||
BigDecimal pendingRate = oTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
|
||||
.multiply(BigDecimal.valueOf(100));
|
||||
summary.setPendingRate(pendingRate);
|
||||
}
|
||||
|
||||
// OEE(以吨维度为主)
|
||||
|
||||
Reference in New Issue
Block a user