inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
@@ -18,6 +18,8 @@
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
/**
@@ -83,6 +85,14 @@
                    requestMap.put("newPartBatchNo", one.getLotBatchNo()); // 新零件批号
                    requestMap.put("stockQuantity", one.getLength()); // 库存数量1
                    requestMap.put("qty", one.getQtyStock()); // 库存数量2
                    // 导入长度为 km、重量为 kg;米重按 kg/km 向下保留 6 位,避免换算后超过原重量。
                    BigDecimal lengthKm = one.getLength();
                    BigDecimal weightKg = one.getQtyStock();
                    if (lengthKm == null || lengthKm.signum() <= 0 || weightKg == null || weightKg.signum() <= 0) {
                        throw new IllegalArgumentException("批号 " + one.getLotBatchNo() + " 的长度或重量为空或不大于 0,无法计算米重");
                    }
                    BigDecimal meterWeight = weightKg.divide(lengthKm, 6, RoundingMode.DOWN);
                    requestMap.put("meterWeight", meterWeight); // 米重,kg/km
                    requestMap.put("insulationColor", one.getInsulationColor()); // 绝缘颜色
                    requestMap.put("outerColor", one.getOuterColor()); // 外护颜色
                    requestMap.put("letteringInfo", one.getLetteringInfo()); // 印字信息