| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | // 盘点单出库 |
| | | if (orderPakOut.getDocType() == 8) { |
| | | for (OrderDetlPakout orderDetl : orderDetlPakouts) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | BigDecimal issuedBigDecimal = Optional.of(BigDecimal.valueOf(orderDetl.getAnfme()).subtract(BigDecimal.valueOf(orderDetl.getWorkQty()))).orElse(new BigDecimal(0)); |
| | | double issued = issuedBigDecimal.doubleValue(); |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | |
| | | locDto.setStaNos(staNos); |
| | | locDtos.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | issuedBigDecimal = issuedBigDecimal.subtract(BigDecimal.valueOf(locDetl.getAnfme())); |
| | | issued = issuedBigDecimal.doubleValue(); |
| | | } else { |
| | | break; |
| | | } |
| | |
| | | } |
| | | } else { |
| | | for (OrderDetlPakout orderDetl : orderDetlPakouts) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | BigDecimal issuedBigDecimal = Optional.of(BigDecimal.valueOf(orderDetl.getAnfme()).subtract(BigDecimal.valueOf(orderDetl.getWorkQty()))).orElse(new BigDecimal(0)); |
| | | double issued = issuedBigDecimal.doubleValue(); |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | locDto.setFrozen(locDetl.getFrozen()); |
| | | locDto.setFrozenLoc(locMast.getFrozen()); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | int ioType = (issued >= locDetl.getAnfme() && locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())) == 1) ? 101 : 103; |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); |
| | | locDto.setStaNos(staNos); |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | |
| | |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | issuedBigDecimal = issuedBigDecimal.subtract(BigDecimal.valueOf(locDetl.getAnfme())); |
| | | issued = issuedBigDecimal.doubleValue(); |
| | | } else { |
| | | break; |
| | | } |