| | |
| | | salesLedgerWorkLambdaQueryWrapper.in(SalesLedgerWork::getSalesLedgerProductId, collect) |
| | | .ne(SalesLedgerWork::getStatus, 1); |
| | | List<SalesLedgerWork> salesLedgerWorks = salesLedgerWorkMapper.selectList(salesLedgerWorkLambdaQueryWrapper); |
| | | List<SalesLedgerSchedulingDto> list1 = new ArrayList<>(); |
| | | list.getRecords().forEach(i -> { |
| | | // 获取完成数量 |
| | | i.setSuccessNum(salesLedgerWorks |
| | |
| | | .filter(j -> j.getSalesLedgerProductId().equals(i.getSalesLedgerProductId())) |
| | | .map(SalesLedgerWork::getFinishedNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | // 状态 = 数量和完工数量比较 |
| | | if(i.getSchedulingNum().compareTo(new BigDecimal(0)) == 0){ |
| | | i.setStatus("未完成"); |
| | | } else if(i.getSchedulingNum().compareTo(i.getSuccessNum()) == 0){ |
| | | i.setStatus("已完成"); |
| | | }else{ |
| | | i.setStatus("生产中"); |
| | | } |
| | | |
| | | // 计算生产总量 = 规格 * 数量 / 1000 |
| | | String[] split = i.getSpecificationModel().split("\\*"); |
| | | if(split.length == 2 && isNumeric(split[0]) && isNumeric(split[1])){ |
| | |
| | | .multiply(new BigDecimal(split[1]) |
| | | .multiply(i.getQuantity()).divide(new BigDecimal(1000),2, RoundingMode.CEILING)); |
| | | i.setTotalProduction(multiply); |
| | | } |
| | | |
| | | // 状态 = 数量和完工数量比较 |
| | | if(i.getSchedulingNum().compareTo(new BigDecimal(0)) == 0){ |
| | | i.setStatus("未完成"); |
| | | } else if(i.getQuantity().compareTo(i.getSchedulingNum()) <= 0){ |
| | | i.setStatus("已完成"); |
| | | }else{ |
| | | i.setStatus("生产中"); |
| | | } |
| | | |
| | | }); |
| | |
| | | .salesLedgerSchedulingId(salesLedgerScheduling.getId()) |
| | | .salesLedgerId(salesLedgerScheduling.getSalesLedgerId()) |
| | | .remark(processSchedulingDto.getRemark()) |
| | | .productionLine(processSchedulingDto.getProductionLine()) |
| | | .type(processSchedulingDto.getType()) |
| | | .loss(processSchedulingDto.getLoss()) |
| | | .receive(processSchedulingDto.getReceive()) |