| | |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private ManPakOutService manPakOutService; |
| | | @Autowired |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private PlaService plaService; |
| | | @Autowired |
| | | private PlaQtyService plaQtyService; |
| | | |
| | | |
| | | @PostMapping("/out/pakout/orderDetlIds/auth") |
| | |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | for (OrderDetl o: orderDetls) { |
| | | if (o.getAnfme().equals(o.getWorkQty())){ |
| | | return R.error("出库的明细中有已出库物料"); |
| | | } |
| | | } |
| | | |
| | | List<PlaQty> plaQties = new ArrayList<>(); |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | plaService.queryStock(orderDetl,plaQties); |
| | | } |
| | | |
| | | return R.ok(plaQties); |
| | | |
| | | /* |
| | | 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()).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal b1 = new BigDecimal(orderDetl.getQty()).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | List<LocDetl> locDetls = locDetlService.queryStock2(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getOwner()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | List<ManLocDetl> manLocDetls = manLocDetlService.queryStock(orderDetl.getMatnr(),orderDetl.getBatch()); |
| | | for (ManLocDetl locDetl : manLocDetls) { |
| | | if (issued > 0) { |
| | | 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); |
| | | boolean sign = false; |
| | | if (issued > locDetl.getAnfme() || locDetl.getAnfme().equals(issued)){ |
| | | sign=true; |
| | | } |
| | | LocDto locDto = new LocDto(locDetl.getHostId(),locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | sign ? locDetl.getAnfme() : issued,"平库"); |
| | | 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全板出库 |
| | | // List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), 101); |
| | | locDto.setStaNos(staNos); |
| | | locDto.setManu(locDetl.getManu()); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | BigDecimal iss=new BigDecimal(Double.toString(issued)).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal an=new BigDecimal(Double.toString(locDetl.getAnfme())).setScale(2,BigDecimal.ROUND_HALF_UP); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | issued=iss.subtract(an).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued,orderDetl.getOwner(),1); |
| | | LocDto locDto = new LocDto(null,null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued,"平库"); |
| | | // LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), 0.0,issued); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtos.add(locDto); |
| | | } |
| | | } |
| | | return R.ok().add(locDtos); |
| | | return R.ok().add(locDtos); */ |
| | | } |
| | | |
| | | @PostMapping("/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | |
| | | int[][] is=new int[locDtos.size()][2]; |
| | | for (int i=0;i<locDtos.size();i++){ |
| | | LocDto locDto=locDtos.get(locDtos.size()-1-i); |
| | |
| | | |
| | | @PostMapping("/out/pakout2/auth") |
| | | @ManagerAuth(memo = "生成拣货单") |
| | | public synchronized R pakout2(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | int[][] is = new int[locDtos.size()][2]; |
| | | @Transactional |
| | | public synchronized R pakout2(@RequestBody List<PlaQty> plaQties) throws InterruptedException { |
| | | |
| | | for (PlaQty plaQty : plaQties){ |
| | | if(Cools.isEmpty(plaQty.getLocNo())){ |
| | | continue; |
| | | } |
| | | //插入一条pla的拣货信息 |
| | | plaQtyService.insert(plaQty); |
| | | addPakOUT(plaQty); |
| | | |
| | | Pla pla = plaService.selectByBatchAndPackageNo(plaQty.getBatch(), plaQty.getPackageNo()); |
| | | //pla明细中修改锁定出库的重量 |
| | | pla.setQtyAnfme(pla.getQtyAnfme() + plaQty.getQtyAnfme()); |
| | | plaService.updateById(pla); |
| | | |
| | | OrderDetl orderDetl = orderDetlService.selectById(plaQty.getOrderDetlId()); |
| | | orderDetl.setWorkQty(orderDetl.getWorkQty() + plaQty.getQtyAnfme()); |
| | | orderDetlService.updateById(orderDetl); |
| | | orderService.updateSettle(plaQty.getOrderId(),2L,null); |
| | | } |
| | | |
| | | return R.ok(); |
| | | |
| | | /* int[][] is = new int[locDtos.size()][2]; |
| | | List<String> matnrs=new ArrayList<>(); |
| | | for (int i = 0; i < locDtos.size(); i++) { |
| | | LocDto locDto = locDtos.get(locDtos.size() - 1 - i); |
| | | if (locDto.getLocNo() == null) { |
| | | is[i][0] = 1; |
| | | } else if (locDto.getManu().equals("立库")){ |
| | | is[i][0] = 2; |
| | | } else { |
| | | is[i][0] = 0; |
| | | } |
| | |
| | | addPakOUT(locDto,uuid).equals(R.ok()); |
| | | } |
| | | } |
| | | return R.ok(); */ |
| | | } |
| | | |
| | | private R addPakOUT(PlaQty plaQty){ |
| | | ManPakOut manPakOut=new ManPakOut(); |
| | | manPakOut.setWrkNo(plaQty.getOrderNo()+"-"+System.currentTimeMillis()); |
| | | manPakOut.setWrkSts((long)1); |
| | | manPakOut.setAnfme(plaQty.getQtyAnfme()); |
| | | manPakOut.setLocNo(plaQty.getLocNo()); |
| | | manPakOut.setBatch(plaQty.getBatch()); |
| | | manPakOut.setBarcode(plaQty.getPackageNo()); |
| | | manPakOut.setUuid(String.valueOf(System.currentTimeMillis())); |
| | | manPakOut.setCreateTime(new Date()); |
| | | manPakOut.setUpdateTime(new Date()); |
| | | manPakOut.setCount(0.0); |
| | | manPakOut.setDocNum(plaQty.getOrderNo()); |
| | | manPakOut.setNodeId(plaQty.getOrderDetlId()); |
| | | manPakOut.setStatus(0); |
| | | manPakOutService.insert(manPakOut); |
| | | return R.ok(); |
| | | } |
| | | |
| | | private R addPakOUT(LocDto locDto,String uuid){ |
| | | ManPakOut manPakOut=new ManPakOut(); |
| | | manPakOut.setDocId(locDto.getHostId()); |
| | | manPakOut.setWrkNo(locDto.getOrderNo()+"-"+System.currentTimeMillis()); |
| | | manPakOut.setWrkSts((long)1); |
| | | manPakOut.setAnfme(locDto.getAnfme()); |
| | |
| | | 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()); |
| | | manPakOut.setUpdateTime(new Date()); |
| | | manPakOut.setPayment(locDto.getPayment()); |
| | | manPakOut.setOwner(locDto.getOwner()); |
| | | manPakOut.setUuid(uuid); |
| | | if (Cools.isEmpty(manPakOutService.selectOne(new EntityWrapper<ManPakOut>().eq("doc_num",locDto.getOrderNo())))){ |
| | | manPakOut.setName(locDto.getMaktx()); |