| | |
| | | import oshi.driver.mac.net.NetStat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | |
| | | } |
| | | for (ProductStructureDto productStructureDto : productStructureDtos) { |
| | | ProductModel productModel1 = productModelMapper.selectById(productStructureDto.getProductModelId()); |
| | | if(productModel1 == null){ |
| | | continue; |
| | | } |
| | | Product product = productMapper.selectById(productModel1.getProductId()); |
| | | |
| | | // 判断是否为最后一道工序 或者为第一道工序 |
| | | BigDecimal needQuantity = dto.getQuantity().divide(productStructureDto.getUnitQuantity(), 2, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal needQuantity = BigDecimal.ZERO; |
| | | |
| | | if(BigDecimal.ZERO.equals(productStructureDto.getUnitQuantity())){ |
| | | needQuantity = dto.getQuantity().divide(productStructureDto.getUnitQuantity(), 2, RoundingMode.HALF_UP); |
| | | } |
| | | if (lastProcessIds.contains(productStructureDto.getId()) || firstProcessIds.contains(productStructureDto.getId())) { |
| | | needQuantity = dto.getQuantity().multiply(productStructureDto.getUnitQuantity()); |
| | | } |
| | | |
| | | |
| | | // 查询产品库存 |
| | | BigDecimal stockQuantity = stockUtils.getStockQuantity(productModel1.getId()).get("stockQuantity"); |
| | | if (!(stockQuantity.compareTo(BigDecimal.ZERO) > 0)) { |