Junjie
2023-12-19 5c6978b62f16d7f947b07e287ca9c611ad849ce4
src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -2,7 +2,6 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
@@ -93,13 +92,19 @@
            shuttleData.put("moveAdvancePath", null);//穿梭车预计路径
            if (shuttleProtocol.getTaskNo() != 0) {
                //存在任务,获取指令
                Object object = redisUtil.get("shuttle_wrk_no_" + shuttleProtocol.getTaskNo());
                Object object = redisUtil.get(RedisKeyType.SHUTTLE.key + shuttleProtocol.getTaskNo());
                if (object != null) {
                    ShuttleRedisCommand redisCommand = JSON.parseObject(object.toString(), ShuttleRedisCommand.class);
                    shuttleData.put("moveAdvancePath", redisCommand.getAssignCommand().getNodes());//穿梭车预计路径
                }
            }
            Integer chargeLine = basShuttleService.selectById(slave.getId()).getChargeLine();
            String lowerPower = "N";
            if (chargeLine != null && shuttleProtocol.getPowerPercent() != null) {
                lowerPower = shuttleProtocol.getPowerPercent() <= chargeLine ? "Y" : "N";
            }
            shuttleData.put("lowerPower", lowerPower);//是否低电量
            baseObj.putAll(shuttleData);
        }
        return R.ok().add(list);
@@ -179,7 +184,7 @@
    @RequestMapping(value = "/command/query")
    public R shuttleCommandQuery(@RequestParam("wrkNo") Integer wrkNo) {
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        Object o = redisUtil.get(RedisKeyType.SHUTTLE.key + wrkNo);
        if (o == null) {
            return R.error();
        }
@@ -191,13 +196,13 @@
    @RequestMapping(value = "/command/rollback")
    public R shuttleCommandRollback(@RequestParam("wrkNo") Integer wrkNo
            , @RequestParam("commandStep") Integer commandStep) {
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        Object o = redisUtil.get(RedisKeyType.SHUTTLE.key + wrkNo);
        if (o == null) {
            return R.error();
        }
        ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
        redisCommand.setCommandStep(commandStep);
        redisUtil.set("shuttle_wrk_no_" + wrkNo, JSON.toJSONString(redisCommand));
        redisUtil.set(RedisKeyType.SHUTTLE.key + wrkNo, JSON.toJSONString(redisCommand));
        return R.ok();
    }
@@ -206,7 +211,7 @@
    public R shuttleCommandCompleteSwitch(@RequestParam("wrkNo") Integer wrkNo
            , @RequestParam("commandStep") Integer commandStep
            , @RequestParam("complete") Integer complete) {
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        Object o = redisUtil.get(RedisKeyType.SHUTTLE.key + wrkNo);
        if (o == null) {
            return R.error();
        }
@@ -215,14 +220,14 @@
        List<NyShuttleHttpCommand> commands = assignCommand.getCommands();
        NyShuttleHttpCommand command = commands.get(commandStep);
        command.setComplete(complete != 0);
        redisUtil.set("shuttle_wrk_no_" + wrkNo, JSON.toJSONString(redisCommand));
        redisUtil.set(RedisKeyType.SHUTTLE.key + wrkNo, JSON.toJSONString(redisCommand));
        return R.ok();
    }
    //重启任务(命令)
    @RequestMapping(value = "/command/restart")
    public R shuttleCommandCompleteSwitch(@RequestParam("wrkNo") Integer wrkNo) {
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        Object o = redisUtil.get(RedisKeyType.SHUTTLE.key + wrkNo);
        if (o == null) {
            return R.error();
        }
@@ -248,11 +253,11 @@
    //删除任务(命令)
    @RequestMapping(value = "/command/del")
    public R liftCommandDel(@RequestParam("wrkNo") Integer wrkNo) {
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        Object o = redisUtil.get(RedisKeyType.SHUTTLE.key + wrkNo);
        if (o == null) {
            return R.error();
        }
        redisUtil.del("shuttle_wrk_no_" + wrkNo);
        redisUtil.del(RedisKeyType.SHUTTLE.key + wrkNo);
        return R.ok();
    }