| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.api.enums.MatLocType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.result.*; |
| | |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | |
| | | WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", locDetl.getLocNo())); |
| | | if (!Objects.isNull(wrkMast1)) { |
| | | throw new CoolException("源库位已出库,请等待任务完成后,再执行!!"); |
| | | } |
| | | |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("保存工作档失败,出库库位号:" + locDetl.getLocNo()); |
| | | } |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized R callAgvMove(AgvCallParams params, Long userId) { |
| | | if (Objects.isNull(params.getOrgSite())) { |
| | | throw new CoolException("源站点不能为空!!"); |
| | | } |
| | | BasAreas basAreas = basAreasService |
| | | .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type)); |
| | | LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>() |
| | | .eq("area_id", basAreas.getId()) |
| | | .eq("frozen", 0) |
| | | .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type) |
| | | .orderAsc(Arrays.asList("loc_no")) |
| | | .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY")); |
| | | if (Objects.isNull(locCache)) { |
| | | throw new CoolException("请检查目标库位是否闲置中!!"); |
| | | } |
| | | if (!Objects.isNull(params.getTaskType()) && params.getTaskType().equals("XM1")) { |
| | | String taskType = params.getTaskType(); |
| | | generateXAgvTask(params.getOrgSite(), params.getTarSite(), userId, taskType); |
| | | } else { |
| | | String taskType = "M2"; |
| | | if (!params.getIsNewIn().isEmpty()) { |
| | | taskType = "M1"; |
| | | int cacheCount = locCacheService.selectCount(new EntityWrapper<LocCache>().eq("barcode", params.getBarcode())); |
| | | if (cacheCount > 0) { |
| | | throw new CoolException("台车已入库,不能勾选新台车!!"); |
| | | } |
| | | } |
| | | |
| | | String taskType = "M2"; |
| | | if (!params.getIsNewIn().isEmpty()) { |
| | | taskType = "M1"; |
| | | } |
| | | try { |
| | | generateAgvTask("agv", locCache, params.getOrgSite(), params.getBarcode(), userId, taskType); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | BasAreas basAreas = basAreasService |
| | | .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type)); |
| | | LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>() |
| | | .eq("area_id", basAreas.getId()) |
| | | .eq("frozen", 0) |
| | | .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type) |
| | | .orderAsc(Arrays.asList("loc_no")) |
| | | .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY")); |
| | | if (Objects.isNull(locCache)) { |
| | | throw new CoolException("请检查目标库位是否闲置中!!"); |
| | | } |
| | | |
| | | try { |
| | | generateAgvTask("agv", locCache, params.getOrgSite(), params.getBarcode(), userId, taskType); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateXAgvTask(String orgSite, String tarSite, Long userId, String taskType) { |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(4); |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo) |
| | | .setIoTime(new Date()) |
| | | .setWrkSts(201L) // 工作状态:11.生成出库ID |
| | | .setIoType(1) // 入出库状态: 11.库格移载 |
| | | .setTaskType("agv") |
| | | .setIoPri(10D) |
| | | .setIsNewIn(taskType) |
| | | .setFullPlt("Y") // 满板:Y |
| | | .setPicking("N") // 拣料 |
| | | .setExitMk("N")// 退出 |
| | | .setSourceStaNo(orgSite) |
| | | .setStaNo(tarSite) |
| | | .setLinkMis("N") |
| | | .setAppeUser(userId) |
| | | .setAppeTime(new Date()) |
| | | .setModiUser(userId) |
| | | .setModiTime(new Date()); |
| | | if (!taskService.insert(task)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new CoolException("托盘已在任务执行中.."); |
| | | } |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PICK.type); |
| | | int workNo = commonService.getWorkNo(4); |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo) |
| | |
| | | loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.入库预约 |
| | | loc.setModiTime(new Date()); |
| | | loc.setModiUser(userId); |
| | | if (!locCacheService.updateById(loc)) { |
| | | if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) { |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 缓存区上架组托 |
| | | * 缓存区并板上架组托 |
| | | * |
| | | * @param param |
| | | * @param userId |
| | |
| | | throw new CoolException("组托明细不能为空!!"); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("wrk_sts", 14) |
| | | .eq("io_type", 104) |
| | | .eq("wrk_sts", 14) |
| | | .eq("io_type", 104) |
| | | .eq("barcode", param.getBarcode())); |
| | | if (Objects.isNull(wrkMast)) { |
| | | throw new CoolException("任务档信息不存在!!"); |
| | |
| | | if (Objects.isNull(wrkDetl)) { |
| | | //TODO 新插入 |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", stationDetl.getMatnr()) |
| | | .eq("supp_code", combMat.getSuppCode())); |
| | | .eq("supp_code", combMat.getSuppCode())); |
| | | if (Objects.isNull(mat)) { |
| | | throw new CoolException("物料基础信息已不存在!!"); |
| | | } |
| | |
| | | BeanUtils.copyProperties(stationDetl, detl); |
| | | detl.setAnfme(combMat.getAnfme()); |
| | | detl.setBarcode(wrkMast.getBarcode()); |
| | | detl.setZpallet(param.getBarcode()); |
| | | detl.setBoxType1(combMat.getBoxType1()); |
| | | detl.setStandby1(combMat.getSuppCode()); |
| | | detl.setThreeCode(combMat.getThreeCode()); |
| | | detl.setAdjustQty(combMat.getAdjustQty()); |
| | | detl.setSplusQty(combMat.getSplusQty()); |
| | | detl.setWrkNo(wrkMast.getWrkNo()); |
| | | |
| | | if (!wrkDetlService.insert(detl)) { |
| | | throw new CoolException("任务明细保存失败!!"); |
| | | } |
| | | } else { |
| | | if (Objects.isNull(combMat.getAnfme())) { |
| | | throw new CoolException("数量不能为空!!"); |
| | | } |
| | | double val = Math.round((combMat.getAnfme() + wrkDetl.getAnfme()) * 10000) / 10000.0; |
| | | if (!wrkDetlService.updateAnfme(val, wrkMast.getWrkNo(), wrkDetl.getMatnr(), |
| | | wrkDetl.getSuppCode())) { |
| | | WrkDetl detl = new WrkDetl(); |
| | | detl.setOrderNo(stationDetl.getOrderNo()); |
| | | detl.setBoxType1(combMat.getBoxType1()); |
| | | detl.setZpallet(param.getBarcode()); |
| | | detl.setBarcode(param.getBarcode()); |
| | | detl.setThreeCode(combMat.getThreeCode()); |
| | | detl.setStandby1(combMat.getSuppCode()); |
| | | detl.setAdjustQty(combMat.getAdjustQty()); |
| | | detl.setSplusQty(combMat.getSplusQty()); |
| | | detl.setAnfme(val); |
| | | detl.setModiTime(new Date()); |
| | | if (!wrkDetlService.update(detl, new EntityWrapper<WrkDetl>() |
| | | .eq("wrk_no", wrkMast.getWrkNo()) |
| | | .eq("supp_code", stationDetl.getSuppCode()) |
| | | .eq("matnr", stationDetl.getMatnr()))) { |
| | | throw new CoolException(wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," |
| | | + wrkDetl.getBatch() + "批号修改数量失败"); |
| | | } |
| | | } |
| | | |
| | | BasStationDetl stationDetl1 = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>() |
| | | .eq("zpallet", param.getCarBarcode()) |
| | | .eq("three_code", combMat.getThreeCode())); |
| | | |
| | | if (!Objects.isNull(stationDetl1)) { |
| | | Double v = Math.round((stationDetl1.getAnfme() - combMat.getAnfme()) * 10000) / 10000.0; |
| | | if (v.compareTo(0.0) == 0) { |
| | | if (!basStationDetlService.delete(new EntityWrapper<BasStationDetl>() |
| | | .eq("zpallet", param.getCarBarcode()) |
| | | .eq("three_code", combMat.getThreeCode()))) { |
| | | throw new CoolException("站点信息更新失败!!"); |
| | | } |
| | | } else { |
| | | stationDetl1.setAnfme(v); |
| | | if (!basStationDetlService.update(stationDetl1, new EntityWrapper<BasStationDetl>() |
| | | .eq("zpallet", param.getCarBarcode()) |
| | | .eq("three_code", combMat.getThreeCode()))) { |
| | | throw new CoolException("站点信息更新失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>() |
| | | .eq("order_id", orderPakin.getId()) |
| | | .eq("matnr", combMat.getMatnr()) |
| | | .eq(!Cools.isEmpty(combMat.getBatch()),"batch", combMat.getBatch()) |
| | | .eq(!Cools.isEmpty(combMat.getBatch()), "batch", combMat.getBatch()) |
| | | .eq(!Cools.isEmpty(combMat.getStandby1()), "supp_code", combMat.getStandby1())); |
| | | if (Cools.isEmpty(orderDetlPakin)) { |
| | | throw new CoolException("检索单据明细数据失败"); |
| | |
| | | if (Objects.isNull(locMast)) { |
| | | throw new CoolException("未查询到可用的空板信息!!"); |
| | | } |
| | | CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls); |
| | | CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(new ArrayList<>()); |
| | | locMasts.add(crnTaskDetlDTO); |
| | | |
| | | // 空板出库 |
| | |
| | | if (Objects.isNull(locMast)) { |
| | | throw new CoolException("未查询到可用的空板信息!!"); |
| | | } |
| | | CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls); |
| | | CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(new ArrayList<>()); |
| | | locMasts.add(crnTaskDetlDTO); |
| | | |
| | | // 空板出库 |
| | |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType)); |
| | | if (Cools.isEmpty(wrkMast1)) { |
| | | // Integer outSta = devp.getDevNo(); |
| | | Integer outSta = devp.getDevNo(); |
| | | // 获取路径 |
| | | // StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta); |
| | | StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta); |
| | | |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | wrkMast.setIoPri(13D); // 优先级:13 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | // wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 源站 |
| | | // wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站 |
| | | wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站 |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 |
| | | //小松项目,缓存出库AGV站点,用于清空缓存区库存 |
| | | wrkMast.setPauseMk(station.getDevNo()); |
| | |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(locMast.getLocNo()); |
| | | if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type) |
| | | || locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) { |
| | | // if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type) |
| | | // || locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) { |
| | | locMast.setLocSts(ioType == 101 ? "R" : "P"); |
| | | locMast.setModiUser(userId); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("预约库位状态失败,库位号:" + locMast.getLocNo()); |
| | | } |
| | | } else { |
| | | throw new CoolException(locMast.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | // } else { |
| | | // throw new CoolException(locMast.getLocNo() + "库位不是在库状态"); |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateCacheOutTask(BasStation station, LocCache loc, Long userId) { |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PICK.type); |
| | | int workNo = commonService.getWorkNo(4); |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo) |
| | |
| | | loc.setModiUser(userId); |
| | | loc.setModiTime(new Date()); |
| | | |
| | | if (!locCacheService.updateById(loc)) { |
| | | throw new CoolException("更新库位状态信息!!"); |
| | | } |
| | | // if (!) { |
| | | // throw new CoolException("更新库位状态信息!!"); |
| | | // } |
| | | locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo())); |
| | | |
| | | // 修改目标站点信息 |
| | | if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException("移转失败,目标库位状态:" + station.getLocSts()); |
| | | log.error("移转失败,目标库位状态:" + station.getLocSts()); |
| | | // throw new CoolException("移转失败,目标库位状态:" + station.getLocSts()); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new CoolException("托盘已在任务执行中.."); |
| | | } |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PICK.type); |
| | | int workNo = commonService.getWorkNo(4); |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo) |
| | | .setIoTime(new Date()) |
| | | .setWrkSts(201L) // 工作状态:11.生成出库ID |
| | | .setIoType(1) // 入出库状态: 11.库格移载 |
| | | .setTaskType("agv") |
| | | .setTaskType(type) |
| | | .setIoPri(10D) |
| | | .setIsNewIn(isNewIn) |
| | | .setLocNo(loc.getLocNo()) // 目标库位 |
| | |
| | | .setAppeTime(new Date()) |
| | | .setModiUser(userId) |
| | | .setModiTime(new Date()); |
| | | |
| | | if (!taskService.insert(task)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | |
| | | throw new CoolException("更新组托信息失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 修改目标库位状态 |
| | | if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.入库预约 |
| | | loc.setModiTime(new Date()); |
| | | loc.setModiUser(userId); |
| | | if (!locCacheService.updateById(loc)) { |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | // 修改目标库位状态 |
| | | if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.入库预约 |
| | | loc.setModiTime(new Date()); |
| | | loc.setModiUser(userId); |
| | | |
| | | if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) { |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException("移转失败,目标库位状态:" + loc.getLocSts$()); |
| | | } |
| | | } else { |
| | | throw new CoolException("移转失败,目标库位状态:" + loc.getLocSts$()); |
| | | } |
| | | |
| | | // 修改目标站点信息 |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite)); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | // 修改目标站点信息 |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite)); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | |
| | | if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type) || station.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) { |
| | | station.setLocSts("R"); // S.入库预约 |
| | | station.setLocSts("R"); // R.入库预约 |
| | | station.setBarcode(barcode); |
| | | station.setModiTime(new Date()); |
| | | station.setModiUser(userId); |
| | |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException("移转失败,目标库位状态:" + station.getLocSts()); |
| | | // 修改目标库位状态 |
| | | loc.setLocSts(LocStsType.LOC_STS_TYPE_D.type); // S.入库预约 |
| | | loc.setModiTime(new Date()); |
| | | loc.setModiUser(userId); |
| | | if (!locCacheService.update(loc, new EntityWrapper<LocCache>().eq("loc_no", loc.getLocNo()))) { |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | |
| | | // 修改目标站点信息 |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite)); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | |
| | | station.setLocSts("O"); // S.入库预约 |
| | | station.setBarcode(barcode); |
| | | station.setModiTime(new Date()); |
| | | station.setModiUser(userId); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("更新目标库位状态失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public HIKResultDTO sendAgvTask(HIKApiDTO haiKangApiDTO, String path) { |
| | |
| | | |
| | | /** |
| | | * 获取缓存站点信息 |
| | | * |
| | | * @param type |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取捆包明细信息 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getAllBindInfo(AgvCallParams params) { |
| | | if (Objects.isNull(params.getCarBarcode())) { |
| | | return R.error("台车编码不能为空!"); |
| | | } |
| | | List<TaskDetl> taskDetls = taskDetlService.selectList(new EntityWrapper<TaskDetl>() |
| | | // .eq(!Objects.isNull(params.getMatnr()), "matnr", params.getMatnr()) |
| | | .eq("zpallet", params.getCarBarcode())); |
| | | |
| | | taskDetls.forEach(taskDetl -> { |
| | | OrderPakout orderDetlPakout = orderPakoutService.selectOne(new EntityWrapper<OrderPakout>() |
| | | .eq("order_no", taskDetl.getOrderNo())); |
| | | taskDetl.setMemo(orderDetlPakout.getShipCode()); |
| | | }); |
| | | |
| | | return R.ok("查询成功").add(taskDetls); |
| | | } |
| | | |
| | | /** |
| | | * 确认捆包出库 |
| | | * |
| | | * @param combParam |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R confirmOutstock(CombParam combParam) { |
| | | if (Objects.isNull(combParam.getCombMats()) || combParam.getCombMats().isEmpty()) { |
| | | return R.error("捆包信息不能为空!!"); |
| | | } |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>() |
| | | .eq("wrk_sts", 304) |
| | | .eq("barcode", combParam.getBarcode())); |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("任务信息不存在!!"); |
| | | } |
| | | if (task.getIoType().equals(103)) { |
| | | List<TaskDetl> taskDetls = taskDetlService.selectList(new EntityWrapper<TaskDetl>() |
| | | .eq("wrk_no", task.getWrkNo())); |
| | | |
| | | int workNo = commonService.getWorkNo(4); |
| | | Task task1 = new Task(); |
| | | BeanUtils.copyProperties(task, task1); |
| | | task1.setIoType(53); |
| | | task1.setLocNo(task.getSourceLocNo()); |
| | | task1.setSourceStaNo(task.getStaNo()); |
| | | task1.setWrkNo(workNo); |
| | | task1.setWrkSts(TaskStatusType.AGV_IN_START.type); |
| | | |
| | | if (!taskService.insert(task1)) { |
| | | throw new CoolException("入库任务生成失败!!"); |
| | | } |
| | | if (!Objects.isNull(taskDetls) && !taskDetls.isEmpty()) { |
| | | for (CombParam.CombMat combMat : combParam.getCombMats()) { |
| | | taskDetls.forEach(taskDetl -> { |
| | | if (taskDetl.getMatnr().equals(combMat.getMatnr()) && taskDetl.getSuppCode().equals(combMat.getSuppCode())) { |
| | | //TODO |
| | | if (!taskDetl.getAnfme().equals(combMat.getAnfme())) { |
| | | throw new CoolException("物料--->" + combMat.getMatnr() + "未拣料完成,请确认完成后再尝试!!"); |
| | | } |
| | | List<TaskDetl> taskDetls1 = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo())); |
| | | if (!Objects.isNull(taskDetls1) && !taskDetls1.isEmpty()) { |
| | | taskDetls1.forEach(detl -> { |
| | | detl.setWrkNo(workNo); |
| | | detl.setBoxType1(combMat.getBoxType1()); |
| | | detl.setSupp(combMat.getSuppCode()); |
| | | if (!taskDetlService.update(detl, new EntityWrapper<TaskDetl>() |
| | | .eq("matnr", detl.getMatnr()) |
| | | .eq("supp_code", detl.getSuppCode()) |
| | | .eq("wrk_no", task.getWrkNo()))) { |
| | | throw new CoolException("任务号信息更新失败!!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | task.setWrkSts(TaskStatusType.AGV_INVENTORY_UPDATED_OUT.type); |
| | | if (!taskService.update(task, new EntityWrapper<Task>().eq("wrk_no", taskDetl.getWrkNo()))) { |
| | | throw new CoolException("任务信息更新失败!!"); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | } |
| | | //TODO 比对实际出库数量和任务档数量是否相等,修改原任务档为53,生成新的入库任务 |
| | | |
| | | return R.ok("呼叫成功!!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 空板出库任务 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R getEmptyOutStock(AgvCallParams params) { |
| | | if (Objects.isNull(params.getOrgSite())) { |
| | | return R.error("托盘类型不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getTarSite())) { |
| | | return R.error("目标站点不能为空!!"); |
| | | } |
| | | Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>().eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type); |
| | | if (params.getOrgSite().equals(MatLocType.AUTOMATED.type)) { |
| | | wrapper.like("barcode", "LX80"); |
| | | } else if (params.getOrgSite().equals(MatLocType.SO_HOLDING.type)) { |
| | | wrapper.like("barcode", "TP80"); |
| | | } else { |
| | | wrapper.like("barcode", "TP88"); |
| | | } |
| | | wrapper.orderAsc(Arrays.asList("row1", "lev1")); |
| | | LocMast locMast = locMastService.selectOne(wrapper); |
| | | if (Objects.isNull(locMast)) { |
| | | return R.error("没有可用空板!!"); |
| | | } |
| | | |
| | | //TODO 生成并板出库任务 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setIoType(104); |
| | | wrkMast.setWrkSts(11L); |
| | | wrkMast.setStaNo(params.getTarSite()); |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setIoPri(14.0); |
| | | wrkMast.setAppeTime(new Date()); |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkDate(new Date()); |
| | | wrkMast.setWrkNo(commonService.getWorkNo(0)); |
| | | wrkMast.setTaskType("crn"); |
| | | |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("新建任务失败!!"); |
| | | } |
| | | |
| | | return R.ok().add(wrkMast); |
| | | } |
| | | |
| | | /** |
| | | * 生成移库任务 |
| | | * |
| | | * @param result |