| | |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private ManPakOutService manPakOutService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | @Autowired |
| | | private AgvLocDetlService agvLocDetlService; |
| | |
| | | @ManagerAuth |
| | | public R pakoutPreview(@RequestBody List<Long> ids) { |
| | | |
| | | // Order order = orderService.selectById(ids.get(0)); |
| | | // |
| | | // DocType docType = docTypeService.selectById(order.getDocType()); |
| | | // |
| | | // if("人工补货单".equals(docType.getDocName())){ |
| | | // List<OrderDetl> orderDetlList = orderDetlService.selectBatchIds(ids); |
| | | // //返回给前端的库位以及站点信息 |
| | | // List<LocDto> locDtoList = new ArrayList<>(); |
| | | // |
| | | // for (OrderDetl orderDetl : orderDetlList) { |
| | | // |
| | | // double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D); |
| | | // if (issued <= 0.0D) { continue; } |
| | | // |
| | | // //从平库寻找 |
| | | // //issued = manLocDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | // |
| | | // //先找AGV的库存,如果返回的issued大于0,则去四项库找 |
| | | // //issued = agvLocDetlService.queryStockAndSetLocDto(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | // |
| | | // //从四项库的库存里面找, |
| | | // issued = locDetlService.queryStockAndSetLocDto1(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | // |
| | | // if (issued > 0) { |
| | | // LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | // locDto.setLack(Boolean.TRUE); |
| | | // locDtoList.add(locDto); |
| | | // } |
| | | // } |
| | | // return R.ok().add(locDtoList); |
| | | // } |
| | | |
| | | List<OrderDetl> orderDetlList = orderDetlService.selectBatchIds(ids); |
| | | //返回给前端的库位以及站点信息 |
| | | List<LocDto> locDtoList = new ArrayList<>(); |
| | | |
| | | for (OrderDetl orderDetl : orderDetlList) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D); |
| | | Order order = orderService.selectByNo(orderDetl.getOrderNo()); |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if("人工补货单".equals(docType.getDocName())){ |
| | | if (issued <= 0.0D) { continue; } |
| | | issued = locDetlService.queryStockAndSetLocDto1(orderDetl.getMatnr(),orderDetl.getBatch(),orderDetl.getOrderNo(),locDtoList,issued,orderDetl.getThreeCode(),orderDetl.getDeadTime()); |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtoList.add(locDto); |
| | | } |
| | | }else { |
| | | //double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | |
| | | //从平库寻找 |
| | |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtoList.add(locDto); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | return R.ok().add(locDtoList); |
| | | |
| | |
| | | }else{ |
| | | manPakOut.setUuid(manPakOutExist.getUuid()); |
| | | } |
| | | try{ |
| | | if (!manPakOutService.insert(manPakOut)){ |
| | | return R.error("添加拣货明细失败,请联系管理员"); |
| | | } |
| | | }catch (Exception e){ |
| | | return R.error("添加拣货明细失败,请联系管理员"); |
| | | } |
| | | manPakOutService.insert(manPakOut); |
| | | // try{ |
| | | // if (!manPakOutService.insert(manPakOut)){ |
| | | // return R.error("添加拣货明细失败,请联系管理员"); |
| | | // } |
| | | // }catch (Exception e){ |
| | | // return R.error("添加拣货明细失败,请联系管理员"); |
| | | // } |
| | | return R.ok(); |
| | | |
| | | } |
| | |
| | | |
| | | double queryStockAndSetLocDto(String matnr, String batch, String orderNo, List<LocDto> locDtoList, double issued, String csocode, String isoseq); |
| | | |
| | | double queryStockAndSetLocDto1(String matnr, String batch, String orderNo, List<LocDto> locDtoList, double issued, String csocode, String isoseq); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | | List<StockVo> queryStockTotal(); |
| | |
| | | return issued; |
| | | } |
| | | |
| | | //补货出库 |
| | | public double queryStockAndSetLocDto1(String matnr, String batch, String orderNo, List<LocDto> locDtoList, double issued, String csocode, String isoseq) { |
| | | Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq("matnr", matnr).orderBy("modi_time"); |
| | | wapperSetCondition(wrapper,"batch",batch); |
| | | wapperSetCondition(wrapper,"three_code",csocode); |
| | | wapperSetCondition(wrapper,"dead_time",isoseq); |
| | | // if(Cools.isEmpty(batch)){ |
| | | // wrapper.isNull("batch"); |
| | | // }else { |
| | | // wrapper.eq("batch",batch); |
| | | // } |
| | | |
| | | List<LocDetl> locDetlList = this.selectList(wrapper); |
| | | for (LocDetl locDetl : locDetlList) { |
| | | //判断当前库位货物是否F在库 |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if(!"F".equals(locMast.getLocSts())){ |
| | | continue; |
| | | } |
| | | if (issued > 0) { |
| | | double anfme = locDetl.getAnfme(); |
| | | int ioType = anfme > issued ? 103 : 101; |
| | | //anfme = anfme > issued ? issued : anfme; |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderNo, anfme); |
| | | //List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); |
| | | List<Integer> outSite = basDevpService.getAvailableOutSite(101); |
| | | |
| | | locDto.setStaNos(outSite); |
| | | locDto.setCsocode(csocode); |
| | | locDto.setIsoseq(isoseq); |
| | | locDto.setContainerCode(locDetl.getSuppCode()); |
| | | locDtoList.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } |
| | | } |
| | | return issued; |
| | | } |
| | | |
| | | @Override |
| | | public Double queryStockAnfme(String matnr, String batch) { |
| | | return this.baseMapper.queryStockAnfme(matnr, batch); |
| | |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.common.web.WcsController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private RowLastnoService rowLastnoService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private AgvWaitPakinService agvWaitPakinService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | //补货单则生成AGV入库通知档 |
| | | generateAgvWaitpakin(wrkDetl); |
| | | |
| | | // 修改订单明细 |
| | | if (!BaseController.isJSON(locDto.getOrderNo())) { |
| | | OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); |
| | |
| | | return ""; |
| | | } |
| | | |
| | | private void generateAgvWaitpakin(WrkDetl wrkDetl){ |
| | | Order order = orderService.selectByNo(wrkDetl.getOrderNo()); |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if("人工补货单".equals(docType.getDocName())){ |
| | | AgvWaitPakin agvWaitPakin = new AgvWaitPakin(); |
| | | BeanUtils.copyProperties(wrkDetl,agvWaitPakin); |
| | | agvWaitPakinService.insert(agvWaitPakin); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | public static void wapperSetCondition(Wrapper wrapper, String column, String condition){ |
| | | if(Cools.isEmpty(condition)){ |
| | | if(Cools.isEmpty(condition) || "null".equals(condition)){ |
| | | wrapper.andNew().eq(column,"").or().isNull(column); |
| | | }else { |
| | | wrapper.eq(column,condition); |