| | |
| | | throw new CoolException("播种数量不等于容器出库数量,请检查"); |
| | | } |
| | | for (AsnOrderItem oldOrderItem : containerWaveDto.getAsnOrderItems()) { |
| | | AsnOrderItem orderItem = asnOrderItemService.getById(oldOrderItem.getId()); |
| | | if (Double.compare(orderItem.getDemandQty(), 0.0) == 0) { |
| | | if (Double.compare(oldOrderItem.getDemandQty(), 0.0) == 0) { |
| | | continue; |
| | | } |
| | | AsnOrderItem orderItem = asnOrderItemService.getById(oldOrderItem.getId()); |
| | | BigDecimal num = new BigDecimal(orderItem.getWorkQty().toString()).subtract(new BigDecimal(orderItem.getQty().toString())); |
| | | BigDecimal orderDemandQty = new BigDecimal(orderItem.getDemandQty().toString()); |
| | | BigDecimal orderDemandQty = new BigDecimal(oldOrderItem.getDemandQty().toString()); |
| | | if (num.compareTo(orderDemandQty) < 0){ |
| | | throw new CoolException("播种数量大于单据出库数量,请检查"); |
| | | } |
| | | AsnOrder asnOrder = asnOrderService.getById(orderItem.getAsnId()); |
| | | if (Cools.isEmpty(asnOrder)){ |
| | | throw new CoolException("出库单主单未找到"); |
| | | } |
| | | asnOrder.setQty(new BigDecimal(asnOrder.getQty().toString()).add(orderDemandQty).doubleValue()); |
| | | if (!asnOrderService.updateById(asnOrder)){ |
| | | throw new CoolException("出库单更新状态失败"); |
| | | } |
| | | orderItem.setQty(new BigDecimal(orderItem.getQty().toString()).add(orderDemandQty).doubleValue()); |
| | | if (!asnOrderItemService.updateById(orderItem)){ |
| | |
| | | //检查单据是否完成 |
| | | Boolean orderChecked = checkOrderComplete(orderItem); |
| | | if (orderChecked){ |
| | | AsnOrder asnOrder = asnOrderService.getById(orderItem.getAsnId()); |
| | | if (Cools.isEmpty(asnOrder)){ |
| | | throw new CoolException("出库单主单未找到"); |
| | | } |
| | | asnOrder.setQty(new BigDecimal(asnOrder.getQty().toString()).add(orderDemandQty).doubleValue()); |
| | | asnOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val); |
| | | if (!asnOrderService.updateById(asnOrder)){ |
| | | throw new CoolException("出库单更新状态失败"); |