| | |
| | | import com.zy.asrs.common.utils.HttpHandler; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.domain.dto.MatDto; |
| | | import com.zy.asrs.wcs.core.domain.dto.RedisMapDto; |
| | | import com.zy.asrs.wcs.core.domain.dto.StaDto; |
| | |
| | | import com.zy.asrs.wcs.core.model.MapNode; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.service.*; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | |
| | | |
| | | //获取入库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, "IN") |
| | | .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.IN)) |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | |
| | | // 判断重复工作档 |
| | |
| | | for (Dict dict : dicts) { |
| | | String[] split = dict.getFlag().split("-"); |
| | | int lev = Integer.parseInt(split[1]); |
| | | |
| | | Object data = redisUtil.get(DeviceRedisConstant.MAP + lev); |
| | | if (data != null) { |
| | | continue; |
| | | } |
| | | |
| | | TreeMap<Integer, List<JSONObject>> rows = new TreeMap<>(); |
| | | //排序Row |
| | |
| | | map.setUpdateTime(now); |
| | | map.setLev(lev); |
| | | |
| | | Object data = redisUtil.get(DeviceRedisConstant.MAP + lev); |
| | | if (data == null) { |
| | | //将地图数据存入redis |
| | | redisUtil.set(DeviceRedisConstant.MAP + lev, JSON.toJSONString(map)); |
| | | } |
| | | //将地图数据存入redis |
| | | redisUtil.set(DeviceRedisConstant.MAP + lev, JSON.toJSONString(map)); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | /** |
| | | * 出库 ====>> 同一时间一台穿梭车只能有一个出库任务 |
| | | */ |
| | | public synchronized void generateOutboundWrkMast() { |
| | | public synchronized void analyzeOutBoundTask() { |
| | | List<Task> tasks = taskService.selectPakOut(); |
| | | if (tasks.isEmpty()) { |
| | | return; |
| | |
| | | // continue;//浅库位存在未执行任务 |
| | | // } |
| | | |
| | | if (Cools.isEmpty(task.getShuttleNo())) { |
| | | //分配小车 |
| | | //搜索空闲车 |
| | | ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task); |
| | | if (shuttleThread == null) { |
| | | News.info("{}任务未找到空闲穿梭车", task.getTaskNo()); |
| | | continue; |
| | | } |
| | | |
| | | task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//保存穿梭车号 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.info("{}任务更新穿梭车号失败", task.getTaskNo()); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateMotion(task); |
| | | if (Cools.isEmpty(motionList)) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 解析小车移动工作档 |
| | | public synchronized void analyzeMoveTask() { |
| | | for (Task task : taskService.selectWaitAnalyzeMoveTask()) { |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateMotion(task); |
| | | if (motionList.isEmpty()) { |
| | | continue; |
| | | } |
| | | motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo())); |
| | | |
| | | // 更新工作主档 |
| | | task.setTaskSts(TaskStsType.ANALYZE_MOVE.sts); // 工作状态 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 四向穿梭车电量检测 ===>> 发起充电 |
| | | */ |
| | |
| | | |
| | | //获取充电任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, "CHARGE") |
| | | .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.CHARGE)) |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | if (taskCtg == null) { |
| | | return; |
| | |
| | | |
| | | //获取迁移任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, "MOVE") |
| | | .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.MOVE)) |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | if (taskCtg == null) { |
| | | return; |