| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | for (OrderDetl o: orderDetls) { |
| | | if (o.getAnfme().equals(o.getWorkQty())){ |
| | | return R.error("出库的明细中有已出库物料"); |
| | | } |
| | | } |
| | | |
| | | Set<String> exist = new HashSet<>(); |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D); |
| | | BigDecimal a1 = new BigDecimal(orderDetl.getAnfme()); |
| | | BigDecimal b1 = new BigDecimal(orderDetl.getQty()); |
| | | Double c1 = a1.subtract(b1).doubleValue(); |
| | | double issued = Optional.of( c1 ).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | List<LocDetl> locDetls = locDetlService.queryStock2(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getOwner()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | boolean sign = false; |
| | | if (issued > locDetl.getAnfme() || locDetl.getAnfme().equals(issued)){ |
| | | sign=true; |
| | | } |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued,locDetl.getOwner(),locDetl.getPayment()); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | sign ? locDetl.getAnfme() : issued,locDetl.getOwner(),locDetl.getPayment()); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), sign? 101 : 103); |
| | | // LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | // locDetl.getAnfme(), issued < locDetl.getAnfme()? issued : locDetl.getAnfme()); |
| | | // //速腾只有全板,所以只能101全板出库 |
| | |
| | | locDto.setManu(locDetl.getManu()); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | BigDecimal iss=new BigDecimal(Double.toString(issued)); |
| | | BigDecimal an=new BigDecimal(Double.toString(locDetl.getAnfme())); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | issued=iss.subtract(an).doubleValue(); |
| | | } else { |
| | | break; |
| | | } |
| | |
| | | ManLocDetl manLocDetl = manLocDetlService.selectItem(locDto.getLocNo(), locDto.getMatnr(), locDto.getBatch()); |
| | | if (!Cools.isEmpty(manLocDetl) && !(locDto.getAnfme()>manLocDetl.getAnfme())) { |
| | | manLocDetl.setStatus(0); |
| | | if (manLocDetlService.update(manLocDetl, new EntityWrapper<ManLocDetl>().eq("uuid", manLocDetl.getUuid()))) { |
| | | if (manLocDetlService.update(manLocDetl, new EntityWrapper<ManLocDetl>().eq("loc_no", manLocDetl.getLocNo()).eq("matnr",manLocDetl.getMatnr()))) { |
| | | if (addPakOUT(locDto,uuid).equals(R.ok())) { |
| | | Order order = orderService.selectByNo(locDto.getOrderNo()); |
| | | if (Cools.isEmpty(order)){ |
| | |
| | | manPakOut.setMatnr(locDto.getMatnr()); |
| | | manPakOut.setMaktx(locDto.getMaktx()); |
| | | manPakOut.setDocNum(locDto.getOrderNo()); |
| | | manPakOut.setCount(0); |
| | | manPakOut.setCount(0.0); |
| | | manPakOut.setStatus(0); |
| | | manPakOut.setCreateTime(new Date()); |
| | | manPakOut.setBatch(locDto.getBatch()); |