Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -1870,6 +1870,10 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
}
|
||||
|
||||
// 检查长度/厚度偏差并插入告警
|
||||
// 退火工序没有actionId(不创建代操作记录),直接设置actionType=600
|
||||
if ("annealing".equals(qrcodeStepType)) {
|
||||
bo.setActionType(600);
|
||||
}
|
||||
materialWarningService.checkAndInsertWarnings(newCoil, bo);
|
||||
|
||||
// 如果实际库区id为-1,则清空钢卷上的实际库区绑定
|
||||
|
||||
@@ -198,6 +198,10 @@ public class WmsMaterialWarningServiceImpl implements IWmsMaterialWarningService
|
||||
log.warn("查询产线类型失败, actionId={}", bo.getActionId(), e);
|
||||
}
|
||||
}
|
||||
// 兜底:如果没有actionId(如退火工序不创建代操作记录),直接使用bo中的actionType
|
||||
if (actionType == null && bo != null && bo.getActionType() != null) {
|
||||
actionType = bo.getActionType();
|
||||
}
|
||||
if (actionType != null) {
|
||||
for (WmsMaterialWarning w : warnings) {
|
||||
w.setActionType(actionType);
|
||||
@@ -281,16 +285,19 @@ public class WmsMaterialWarningServiceImpl implements IWmsMaterialWarningService
|
||||
}
|
||||
|
||||
// 理论厚度 - 规格厚度 > 阈值 → 触发
|
||||
BigDecimal diff = theoreticalThickness.subtract(specThickness);
|
||||
if (diff.compareTo(threshold) > 0) {
|
||||
// 先统一 round 到 3 位小数再比较,避免理论厚度公式计算引入的高精度尾数
|
||||
// 导致比较结果与存储值不一致(如 diff=-0.0096 > -0.01 触发,但存储时都 round 成 -0.010)
|
||||
BigDecimal diff = theoreticalThickness.subtract(specThickness).setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal scaledThreshold = threshold.setScale(3, RoundingMode.HALF_UP);
|
||||
if (diff.compareTo(scaledThreshold) > 0) {
|
||||
WmsMaterialWarning warning = new WmsMaterialWarning();
|
||||
warning.setCoilId(coil.getCoilId());
|
||||
warning.setWarningType("THICKNESS");
|
||||
warning.setTheoreticalVal(theoreticalThickness.setScale(3, RoundingMode.HALF_UP));
|
||||
warning.setActualVal(specThickness.setScale(3, RoundingMode.HALF_UP));
|
||||
warning.setAllowDeviation(threshold.setScale(3, RoundingMode.HALF_UP));
|
||||
warning.setDeviationValue(theoreticalThickness.subtract(specThickness).setScale(3, RoundingMode.HALF_UP));
|
||||
BigDecimal rate = diff.divide(specThickness, 10, RoundingMode.HALF_UP)
|
||||
warning.setAllowDeviation(scaledThreshold);
|
||||
warning.setDeviationValue(diff);
|
||||
BigDecimal rate = diff.divide(specThickness.setScale(3, RoundingMode.HALF_UP), 10, RoundingMode.HALF_UP)
|
||||
.multiply(new BigDecimal("100")).setScale(1, RoundingMode.HALF_UP);
|
||||
warning.setDeviationRate(rate);
|
||||
warning.setWarningLevel("WARNING");
|
||||
|
||||
Reference in New Issue
Block a user