|  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 移动端服务核心类 | 
|---|
|  |  |  | 
|---|
|  |  |  | private OrderDetlService orderDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AgvBasDevpService agvBasDevpService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AgvLocDetlService agvLocDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private AgvWrkMastService agvWrkMastService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //检查是否已存在相同的托盘条码,存在则抛出异常 | 
|---|
|  |  |  | if (agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>(). | 
|---|
|  |  |  | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { | 
|---|
|  |  |  | throw new CoolException(param.getBarcode() + "数据正在进行入库"); | 
|---|
|  |  |  | if (agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>().eq("supp_code", param.getBarcode())) > 0) { | 
|---|
|  |  |  | throw new CoolException(param.getBarcode() + "料想码已存在AGV入库通知档中"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //检查库存是否有相同料箱,存在则抛出异常 | 
|---|
|  |  |  | if(!Cools.isEmpty(agvLocDetlService.selectOne(new EntityWrapper<AgvLocDetl>().eq("supp_code",param.getBarcode())))){ | 
|---|
|  |  |  | throw new CoolException(param.getBarcode() + "料箱码已存在AGV库存明细中"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查看工作档是否有相同料箱,存在则抛出异常 | 
|---|
|  |  |  | if(!Cools.isEmpty(agvWrkMastService.selectByContainerCode(param.getBarcode()))){ | 
|---|
|  |  |  | throw new CoolException(param.getBarcode() + "料箱码已存在AGV工作档中"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(param.getOrderNo())) { | 
|---|
|  |  |  | 
|---|
|  |  |  | checkOrderQty(order,combMat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq()); | 
|---|
|  |  |  | DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode()); | 
|---|
|  |  |  | //同一托盘下相同物料信息和批号转为一个入库通知档 | 
|---|
|  |  |  | if (DetlDto.has(detlDtos, detlDto)) { | 
|---|
|  |  |  | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(), detlDto.getCsocode(), detlDto.getIsoseq(),null); | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private void checkOrderQty(Order order, CombParam.CombMat combMat){ | 
|---|
|  |  |  | // 订单明细数量校验,如果作业数量大于单据数量则抛出异常 | 
|---|
|  |  |  | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch()); | 
|---|
|  |  |  | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getCsocode(),combMat.getIsoseq()); | 
|---|
|  |  |  | if(Cools.isEmpty(orderDetl)){ | 
|---|
|  |  |  | throw new CoolException("未匹配到该单据下的物料"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 修改订单明细数量 | 
|---|
|  |  |  | if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) { | 
|---|
|  |  |  | if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(),combMat.getIsoseq())) { | 
|---|
|  |  |  | throw new CoolException("修改单据明细数量失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | waitPakin.sync(mat); | 
|---|
|  |  |  | waitPakin.setOrderNo(orderNo);   // 单据编号 | 
|---|
|  |  |  | waitPakin.setBatch(detlDto.getBatch());     // 序列码 | 
|---|
|  |  |  | waitPakin.setZpallet(zpallet);   // 托盘码 | 
|---|
|  |  |  | //waitPakin.setZpallet(zpallet);   // 托盘码 | 
|---|
|  |  |  | waitPakin.setSuppCode(zpallet);   // 托盘码 | 
|---|
|  |  |  | waitPakin.setIoStatus("N");     // 入出状态 | 
|---|
|  |  |  | waitPakin.setAnfme(detlDto.getAnfme());  // 数量 | 
|---|
|  |  |  | waitPakin.setStatus("Y");    // 状态 | 
|---|
|  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void combBinding(String barcode, String stationCode) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(Cools.isEmpty(agvWaitPakinService.selectByContainerCode(barcode))){ | 
|---|
|  |  |  | throw new CoolException("该料箱未组托,无法绑定站点"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AgvBasDevp agvBasDevp = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", barcode)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(!Cools.isEmpty(agvBasDevp)){ | 
|---|
|  |  |  | 
|---|
|  |  |  | if(!"O".equals(agvBasDevp.getLocSts())){ | 
|---|
|  |  |  | throw new CoolException(stationCode + "该站点货位状态非空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", agvBasDevp.getDevNo())); | 
|---|
|  |  |  | if(!Cools.isEmpty(agvWrkMast)){ | 
|---|
|  |  |  | throw new CoolException(stationCode + "该站点已被工作号为" + agvWrkMast.getWrkNo() + "占用,无法绑定"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | agvBasDevp.setBarcode(barcode); | 
|---|
|  |  |  | agvBasDevp.setLocSts("F"); | 
|---|
|  |  |  | 
|---|
|  |  |  | public List<AgvBasDevp> getAgvBasDevpByFloor(int floor) { | 
|---|
|  |  |  | EntityWrapper<AgvBasDevp> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.eq("floor",floor).eq("cache_shelves","Y").eq("loc_sts","F"); | 
|---|
|  |  |  | return agvBasDevpService.selectList(wrapper); | 
|---|
|  |  |  | List<AgvBasDevp> agvBasDevpList = agvBasDevpService.selectList(wrapper); | 
|---|
|  |  |  | return agvBasDevpList.stream().filter(agvBasDevp -> { | 
|---|
|  |  |  | return !Cools.isEmpty(agvWaitPakinService.selectByContainerCode(agvBasDevp.getBarcode())); | 
|---|
|  |  |  | }).collect(Collectors.toList()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|