| | |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getDevpNo(), true); |
| | | // 检索库位 |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); |
| | | // List<String> matnrs = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatnr).distinct().collect(Collectors.toList()); |
| | | // List<String> batchs = param.getList().stream().map(FullStoreParam.MatCodeStore::getBatch).distinct().collect(Collectors.toList()); |
| | | FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(matnrs.get(0)); |
| | | FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(param.getList().get(0)); |
| | | StartupDto dto = commonService.getLocNo(1, param.getDevpNo(), findLocNoAttributeVo,locTypeDto); |
| | | if (Cools.isEmpty(dto)){ |
| | | throw new CoolException("查询库位失败!!==》startupFullPutStore ==》 commonService.getLocNo"); |
| | |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setPdcType(dto.getLocDetlDtos().get(0).getLocDetl().getModel()); |
| | | wrkMast.setAppeUser(userId); // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setIoType(110); // 入出库状态 |
| | | wrkMast.setIoPri(14D); |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(param.getOutSite()); // 目标站 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(1L); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setMemo("生成自动空板出库"); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 更新库位状态 D.空板 -> R.出库预约 |
| | | if (locMast.getLocSts().equals("D")){ |
| | | if (locMast.getLocSts().equals("M") || locMast.getLocSts().equals("Z")){ |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiUser(1L); |
| | | locMast.setModiTime(now); |
| | |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException(workNo+"工作档不存在"); |
| | | } |
| | | if (wrkMast.getStaNo() == 1090 && wrkMast.getLocNo() == null) { |
| | | throw new CoolException(workNo+"工作档无法完成,库位号为空!"); |
| | | } |
| | | if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { |
| | | throw new CoolException("当前工作档已完成"); |
| | | } |
| | | // 完成空桶库入出库任务另一个任务 |
| | | int workNoOther = 0; |
| | | // 入库 + 库位转移 |
| | | if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) { |
| | | if ((wrkMast.getWrkSts() < 4 && wrkMast.getIoType() != 101 && wrkMast.getIoType() != 110) || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) { |
| | | wrkMast.setWrkSts(4L); |
| | | workNoOther = wrkMast.getWorkNoOther(); |
| | | // 出库 |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | wrkMast.setWrkSts(14L); |
| | | } else if (wrkMast.getIoType() == 101 || wrkMast.getIoType() == 110) { |
| | | if(wrkMast.getWrkSts() == 2) { |
| | | wrkMast.setWrkSts(15L); |
| | | } else { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | workNoOther = wrkMast.getWorkNoOther(); |
| | | } |
| | | Date now = new Date(); |
| | | wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); |
| | |
| | | wrkMast.setManuType("手动完成"); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("修改工作档失败"); |
| | | } |
| | | if(workNoOther != 0) { |
| | | WrkMast wrkMast1 = wrkMastService.selectById(workNoOther); |
| | | wrkMast1.setWrkSts(wrkMast.getWrkSts()); |
| | | wrkMast1.setCrnStrTime(wrkMast.getCrnStrTime()); |
| | | wrkMast1.setCrnEndTime(now); |
| | | wrkMast1.setModiTime(now); |
| | | wrkMast1.setModiUser(userId); |
| | | wrkMast1.setManuType("手动完成"); |
| | | wrkMastService.updateById(wrkMast1); |
| | | } |
| | | } |
| | | |
| | |
| | | String locNo = ""; // 待修改目标库位 |
| | | String locSts = ""; // 待修改目标库位状态 |
| | | // 入库取消(修改目标库位) |
| | | if (wrkMast.getWrkSts() < 4) { |
| | | if (wrkMast.getWrkSts() <= 10) { |
| | | locNo = wrkMast.getLocNo(); |
| | | locSts = "O"; |
| | | |
| | |
| | | // 出库取消(修改源库位) |
| | | } else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14) { |
| | | locNo = wrkMast.getSourceLocNo(); |
| | | // 出库 ===>> F.在库 |
| | | if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { |
| | | if (wrkMast.getIoType() == 110) { |
| | | if(wrkMast.getStaNo() == 1035) { // 子拆盘机站点 |
| | | locSts = "Z"; |
| | | }else { |
| | | locSts = "M"; |
| | | } |
| | | // locSts = "D"; |
| | | } else if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { |
| | | // 出库 ===>> F.在库 |
| | | locSts = "F"; |
| | | // 空板出库 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 110) { |
| | | locSts = "D"; |
| | | // 库位转移 ===>> D.空桶/空栈板 |
| | | // 空板出库 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"; |
| | | // 库位转移:目标库位 |
| | |
| | | throw new CoolException("当前工作状态无法取消"); |
| | | } |
| | | |
| | | //取消入库工作档时,查询组托表,如果有将状态改为待处理 |
| | | if(wrkMast.getIoType() == 1) { |
| | | List<WaitPakin> waitPakins=waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | for (WaitPakin waitPakin:waitPakins){ |
| | | if (!Cools.isEmpty(waitPakin)) { |
| | | waitPakin.setIoStatus("N"); |
| | | waitPakin.setLocNo(""); |
| | | waitPakinService.update(waitPakin, new EntityWrapper<WaitPakin>() |
| | | // .eq("order_no", waitPakin.getOrderNo()) |
| | | .eq("zpallet",waitPakin.getZpallet()) |
| | | .eq("matnr", waitPakin.getMatnr()) |
| | | .eq("batch", waitPakin.getBatch())); |
| | | } |
| | | } |
| | | } |
| | | // 删除组托通知档 |
| | | waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet",wrkMast.getBarcode())); |
| | | |
| | | |
| | | //取消出库工作档时,查询单据管理表,回滚作业中数量 |
| | | if(wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103) { |
| | |
| | | } |
| | | // 删除工作主档 |
| | | boolean wrkMastRes = wrkMastService.deleteById(wrkMast); |
| | | // 保存明细 |
| | | wrkDetlLogService.save(wrkMast.getWrkNo()); |
| | | // 删除工作档明细 |
| | | boolean wrkDetlRes = wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo)); |
| | | |
| | | if (wrkMast.getIoType() != 10 && wrkMast.getIoType() != 110) { |
| | | // 保存工作明细档历史档 |
| | | if (!wrkDetlLogService.save(wrkMast.getWrkNo())) { |
| | | // throw new CoolException("保存工作明细历史档失败, workNo = " + wrkMast.getWrkNo()); |
| | | // 空桶库任务 |
| | | if(wrkMast.getWorkNoOther() != null && wrkMast.getWorkNoOther() != 0) { |
| | | WrkMast wrkMast1 = wrkMastService.selectById(wrkMast.getWorkNoOther()); |
| | | if (wrkMast1 != null) { |
| | | if(wrkMast1.getIoType() == 1) { |
| | | wrkMast1.setLocSts("O"); |
| | | } else { |
| | | wrkMast1.setLocSts("F"); |
| | | } |
| | | // 取消操作人员记录 |
| | | wrkMast1.setManuType("手动取消"); |
| | | wrkMast1.setModiUser(userId); |
| | | wrkMast1.setModiTime(now); |
| | | |
| | | // 删除组托通知档 |
| | | waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet",wrkMast1.getBarcode())); |
| | | // 删除工作主档 |
| | | wrkMastService.deleteById(wrkMast1); |
| | | // 保存工作明细 |
| | | wrkDetlLogService.save(wrkMast1.getWrkNo()); |
| | | // 删除工作明细 |
| | | wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast1.getWrkNo())); |
| | | // 修改库位状态 |
| | | LocMast locMast = locMastService.selectById(wrkMast1.getIoType() == 1 ? wrkMast1.getLocNo() : wrkMast1.getSourceLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消工作档失败,库位不存在:" + locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | // 删除工作档明细 |
| | | boolean wrkDetlRes = wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo)); |
| | | } |
| | | |
| | | |
| | | // 修改库位状态 |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消工作档失败,库位不存在:"+ locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | if(locNo != null) { |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消工作档失败,库位不存在:"+ locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | LocTypeDto locTypeDto = new LocTypeDto(); |
| | | locTypeDto.setLocType1((short) 1); |
| | | return wcsController.startupFullPutStore(301, list.get(0).getZpallet(), locTypeDto, list); |
| | | return wcsController.startupFullPutStore(301, list.get(0).getZpallet(), locTypeDto, list.get(0),false); |
| | | } |
| | | |
| | | @Override |