| | |
| | | public ReturnT<String> agvDoOut(Task task) { |
| | | if (task.getIoType().equals(101)) { |
| | | Date now = new Date(); |
| | | |
| | | // 检查sourceLocNo是否为空 |
| | | if (task.getSourceLocNo() == null || task.getSourceLocNo().isEmpty()) { |
| | | // log.warn("任务ID:{}的sourceLocNo为空,跳过库位操作(可能是从站点入库的任务)", task.getId()); |
| | | task.setWrkSts(15L); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | // 查询库位信息 |
| | | LocCache locMast = locCacheService.selectOne(new EntityWrapper<LocCache>().eq("loc_no", task.getSourceLocNo())); |
| | | if (Objects.isNull(locMast)) { |
| | | throw new RuntimeException("数据错误:库位信息不能为空!!"); |
| | | // 如果查询不到库位,可能是sourceLocNo是站点号而不是库位号 |
| | | // 检查BasDevp表中是否存在该站点 |
| | | try { |
| | | Integer siteNo = Integer.parseInt(task.getSourceLocNo()); |
| | | List<BasDevp> basDevpList = basDevpMapper.selectList(new EntityWrapper<BasDevp>().eq("dev_no", siteNo)); |
| | | if (basDevpList != null && !basDevpList.isEmpty()) { |
| | | // sourceLocNo是站点号,这是从站点入库的任务,不需要处理库位 |
| | | // log.info("任务ID:{}的sourceLocNo是站点号:{},跳过库位操作(从站点入库任务)", task.getId(), task.getSourceLocNo()); |
| | | task.setWrkSts(15L); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | // sourceLocNo不是数字,可能是库位号格式错误 |
| | | log.warn("任务ID:{}的sourceLocNo:{}不是有效的数字格式", task.getId(), task.getSourceLocNo()); |
| | | } |
| | | // 既不是库位也不是站点,抛出异常 |
| | | throw new RuntimeException("数据错误:库位信息不能为空!!任务ID:" + task.getId() + ",sourceLocNo:" + task.getSourceLocNo()); |
| | | } |
| | | List<TaskDetl> wrkDetls101 = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo())); |
| | | if (wrkDetls101.isEmpty()) { |
| | |
| | | .eq("barcode", completedTask.getBarcode()) |
| | | .in("io_type", 110, 101) // 空板出库或全板出库 |
| | | .eq("wrk_sts", 7) // 待呼叫AGV状态 |
| | | .andNew("(is_deleted = 0)") |
| | | ); |
| | | if (!existingTasks.isEmpty()) { |
| | | log.info("任务ID:{}的托盘码:{}已存在空托/满托出库任务,跳过生成", completedTask.getId(), completedTask.getBarcode()); |
| | |
| | | .eq("task_type", "agv") |
| | | .eq("wrk_sts", 8L) // 只检查正在搬运状态的任务 |
| | | .in("io_type", 101, 110) // 出库到缓存区的任务类型 |
| | | .andNew("(is_deleted = 0)") |
| | | ); |
| | | |
| | | // 如果有正在搬运的任务,且工作档未完成,则不分配缓存库位 |
| | |
| | | .eq("task_type", "agv") |
| | | .eq("wrk_sts", 8L) // 只检查正在搬运状态的任务 |
| | | .in("io_type", checkIoTypes) |
| | | .andNew("(is_deleted = 0)") |
| | | ); |
| | | |
| | | if (!transportingTasks.isEmpty()) { |
| | |
| | | if (ioType == 1 || ioType == 10 || ioType == 53 || ioType == 57) { |
| | | // ioType == 1 需要处理组托数据 |
| | | if (ioType == 1) { |
| | | // 检查locNo是否为空 |
| | | if (wrkMast.getLocNo() == null || wrkMast.getLocNo().isEmpty()) { |
| | | log.warn("任务ID:{}的locNo为空,跳过库位操作(可能是从站点入库的任务)", wrkMast.getId()); |
| | | // 更新任务状态为5(库存更新完成) |
| | | wrkMast.setWrkSts(5L); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (!taskService.updateById(wrkMast)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>().eq("loc_no", wrkMast.getLocNo())); |
| | | if (Objects.isNull(locCache)) { |
| | | throw new CoolException("数据错误,库位不存在!!"); |
| | | // 如果查询不到库位,可能是locNo是站点号而不是库位号 |
| | | // 检查BasDevp表中是否存在该站点 |
| | | try { |
| | | Integer siteNo = Integer.parseInt(wrkMast.getLocNo()); |
| | | List<BasDevp> basDevpList = basDevpMapper.selectList(new EntityWrapper<BasDevp>().eq("dev_no", siteNo)); |
| | | if (basDevpList != null && !basDevpList.isEmpty()) { |
| | | // locNo是站点号,这是从站点入库的任务,不需要处理库位明细 |
| | | log.info("任务ID:{}的locNo是站点号:{},跳过库位操作(从站点入库任务)", wrkMast.getId(), wrkMast.getLocNo()); |
| | | // 更新任务状态为5(库存更新完成) |
| | | wrkMast.setWrkSts(5L); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (!taskService.updateById(wrkMast)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | // locNo不是数字,可能是库位号格式错误 |
| | | log.warn("任务ID:{}的locNo:{}不是有效的数字格式", wrkMast.getId(), wrkMast.getLocNo()); |
| | | } |
| | | // 既不是库位也不是站点,抛出异常 |
| | | throw new CoolException("数据错误,库位不存在!!任务ID:" + wrkMast.getId() + ",locNo:" + wrkMast.getLocNo()); |
| | | } |
| | | if (!locCache.getLocSts().equals(LocStsType.LOC_STS_TYPE_S.type)) { |
| | | throw new CoolException("当前库位状态为:" + LocStsType.LOC_STS_TYPE_S.type + "." + LocStsType.LOC_STS_TYPE_S.desc + ",不是出库预约状态"); |