| | |
| | | if (item.getFutureTicketsAmount() == null || item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) { |
| | | item.setFutureTicketsAmount(BigDecimal.ZERO); |
| | | } |
| | | if (item.getApproveStatus() == null || item.getApproveStatus() != 2) { |
| | | Integer hasSufficientStock = item.getHasSufficientStock(); |
| | | if (hasSufficientStock != null && hasSufficientStock == 0) { |
| | | item.setApproveStatus(0); |
| | | } else { |
| | | item.setApproveStatus(1); |
| | | } |
| | | } |
| | | BigDecimal returnQuality = finalReturnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO); |
| | | item.setReturnQuality(returnQuality); |
| | | BigDecimal quantity = item.getQuantity() == null ? BigDecimal.ZERO : item.getQuantity(); |
| | | item.setAvailableQuality(quantity.subtract(returnQuality)); |
| | | BigDecimal shipped = item.getShippedQuantity() == null ? BigDecimal.ZERO : item.getShippedQuantity(); |
| | | BigDecimal available = quantity.subtract(returnQuality).subtract(shipped); |
| | | item.setAvailableQuality(available.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : available); |
| | | item.fillRemainingQuantity(); |
| | | if (item.getApproveStatus() == null || item.getApproveStatus() != 2) { |
| | | BigDecimal remainingShipped = item.getRemainingShippedQuantity() == null ? BigDecimal.ZERO : item.getRemainingShippedQuantity(); |
| | | boolean hasOutbound = shipped.compareTo(BigDecimal.ZERO) > 0; |
| | | if (hasOutbound && remainingShipped.compareTo(BigDecimal.ZERO) <= 0) { |
| | | item.setApproveStatus(0); |
| | | } else { |
| | | Integer hasSufficientStock = item.getHasSufficientStock(); |
| | | if (hasSufficientStock != null && hasSufficientStock == 0) { |
| | | item.setApproveStatus(0); |
| | | } else { |
| | | item.setApproveStatus(1); |
| | | } |
| | | } |
| | | } |
| | | ProductModel productModel = finalProductModelMap.get(item.getProductModelId()); |
| | | if (productModel != null) { |
| | | item.setThickness(productModel.getThickness()); |