zjj
2025-02-17 200a5b4d08215c44fd3fb2d010191e7dedb5e4c5
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/OpenUtils.java
@@ -435,4 +435,52 @@
        return R.ok();
    }
    public R createLadenMoveTakeTask(CreateManualTakeTaskParam param) {
        //获取手动任务类型
        TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
                .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.MOVE))
                .eq(TaskCtg::getStatus, 1));
        if (taskCtg == null) {
            return R.error("任务类型异常");
        }
        Task one = taskService.getOne(new LambdaQueryWrapper<Task>()
                .eq(Task::getTaskCtg, taskCtg.getId())
                .eq(Task::getOriginLoc, param.getOriginLoc())
                .eq(Task::getDestLoc, param.getDestLoc()));
        if (one != null) {
            return R.error("任务已存在");
        }
        //优先级
        Integer priority = 10;
        if (param.getPriority() != null) {
            priority = param.getPriority();
        }
        Task task = new Task();
        task.setUuid(String.valueOf(snowflakeIdWorker.nextId()));
        task.setTaskNo(String.valueOf(Utils.getTaskNo("OUT")));
        task.setWmsTaskNo(param.getTaskNo());
        task.setTaskSts(TaskStsType.NEW_LADEN_MOVE.sts);
        task.setTaskCtg(taskCtg.getId());
        task.setPriority(priority);
        task.setOriginSite(null);
        task.setOriginLoc(param.getOriginLoc());//源库位
        task.setDestSite(null);
        task.setDestLoc(param.getDestLoc());//目标库位
        task.setIoTime(new Date());
        task.setStartTime(new Date());
        task.setStatus(1);
        task.setMemo("");
        task.setShuttleNo(null);//等待主线程分配小车
        task.setRecordLoc(param.getRecord() ? "Y" : "N");//记录库存信息
        task.setHostId(1L);//临时控制只允许host为1
        boolean result = taskService.save(task);
        if (!result) {
            return R.error("生成手动取放货任务失败!");
        }
        return R.ok();
    }
}