refactor(WmsMaterialCoilService): 修复理论厚度和长度沿用老数据导致重复告警
- 移除理论厚度为空的条件判断,统一实际长度不为空时进行计算 - 移除理论长度为空的条件判断,改为直接计算并设置理论长度 - 保持原有的体积、宽度和厚度计算公式不变 - 简化代码结构,减少不必要的条件分支
This commit is contained in:
@@ -1119,17 +1119,15 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
|
||||
bo.setSpecThickness(thickness);
|
||||
// 计算理论厚度(需要实测长度)
|
||||
if (bo.getTheoreticalThickness() == null && bo.getActualLength() != null) {
|
||||
if (bo.getActualLength() != null) {
|
||||
BigDecimal length = new BigDecimal(bo.getActualLength());
|
||||
BigDecimal theoreticalThickness = volume.divide(length, 10, RoundingMode.HALF_UP).divide(width, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("1000"));
|
||||
bo.setTheoreticalThickness(theoreticalThickness);
|
||||
}
|
||||
|
||||
// 计算理论长度
|
||||
if (bo.getTheoreticalLength() == null) {
|
||||
BigDecimal theoreticalLength = volume.divide(thickness, 10, RoundingMode.HALF_UP).divide(width, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("1000"));
|
||||
bo.setTheoreticalLength(theoreticalLength);
|
||||
}
|
||||
BigDecimal theoreticalLength = volume.divide(thickness, 10, RoundingMode.HALF_UP).divide(width, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("1000"));
|
||||
bo.setTheoreticalLength(theoreticalLength);
|
||||
} catch (Exception e) {
|
||||
log.warn("计算理论厚度/长度失败", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user