| | |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | if (productOrder != null) { |
| | | BigDecimal orderCompleteQty = productOrder.getCompleteQuantity() == null ? BigDecimal.ZERO : productOrder.getCompleteQuantity(); |
| | | BigDecimal outputQty = productionProductOutput.getQuantity() != null |
| | | ? productionProductOutput.getQuantity() : BigDecimal.ZERO; |
| | | BigDecimal totalQty = productionProductOutput.getQuantity() != null ? productionProductOutput.getQuantity() : BigDecimal.ZERO; |
| | | BigDecimal scrapQty = productionProductOutput.getScrapQty() != null ? productionProductOutput.getScrapQty() : BigDecimal.ZERO; |
| | | |
| | | productOrder.setCompleteQuantity(orderCompleteQty.subtract(outputQty)); |
| | | BigDecimal actualQualifiedQty = totalQty.subtract(scrapQty); |
| | | |
| | | BigDecimal newCompleteQty = orderCompleteQty.subtract(actualQualifiedQty); |
| | | |
| | | productOrder.setCompleteQuantity(newCompleteQty.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : newCompleteQty); |
| | | |
| | | productOrder.setEndTime(null); |
| | | |
| | | productOrderMapper.updateById(productOrder); |
| | | } else { |
| | | throw new ServiceException("关联的生产订单不存在"); |