| | |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | public void doAfterReturning(JoinPoint joinPoint) { |
| | | Object[] args = joinPoint.getArgs(); |
| | | log.info("执行同步实时库存到MES,参数:{}",args); |
| | | if(Objects.nonNull(args) && args.length>0) { |
| | | IfsInventoryQuantity ifsInventoryQuantity = BeanUtil.toBean(args[0], IfsInventoryQuantity.class); |
| | | if(Objects.nonNull(ifsInventoryQuantity) && ifsInventoryQuantity.getIsSplitOrder()==1){ |
| | |
| | | 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()); // 印字信息 |