Junjie
2024-04-12 89e6e823e4eeed9c08ac612d8089678ad24b4ef2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -1,10 +1,9 @@
package com.zy.asrs.wcs.core.action;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.wcs.common.ExecuteSupport;
import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.entity.Task;
import com.zy.asrs.wcs.core.model.NavigateNode;
@@ -27,6 +26,7 @@
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
import org.aspectj.apache.bcel.generic.RET;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -46,6 +46,8 @@
    private LocService locService;
    @Autowired
    private ShuttleDispatcher shuttleDispatcher;
    @Autowired
    private ObjectMapper objectMapper;
    public synchronized boolean assignWork(Device device, ShuttleAssignCommand assignCommand) {
        ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
@@ -88,10 +90,13 @@
            return false;
        }
        JSONObject jsonObject = JSON.parseObject(String.valueOf(obj));
        System.out.println(JSON.parseObject(String.valueOf(obj)));
        ShuttleRedisCommand redisCommand = JSON.parseObject(String.valueOf(obj), ShuttleRedisCommand.class);
        System.out.println(JSON.toJSONString(redisCommand));
        ShuttleRedisCommand redisCommand = null;
        try {
            redisCommand = objectMapper.readValue(String.valueOf(obj), ShuttleRedisCommand.class);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        if (redisCommand == null) {
            return false;
        }
@@ -386,12 +391,6 @@
            result = shuttleThread.reset(command);
        }
        return result;
    }
    public static void main(String[] args) {
        String s = "{\"commandStep\":0,\"liftSecurityMk\":false,\"shuttleNo\":6,\"wrkNo\":30095,\"assignCommand\":{\"sourceLocNo\":\"3-1-1\",\"auto\":true,\"shuttleNo\":6,\"taskMode\":19,\"charge\":false,\"nodes\":[{\"isInflectionPoint\":false,\"f\":0,\"g\":0,\"h\":0,\"x\":3,\"y\":1,\"nodeZ\":1,\"z\":1,\"direction\":\"top\"},{\"isInflectionPoint\":false,\"f\":1,\"g\":0,\"h\":1,\"x\":2,\"y\":1,\"nodeZ\":1,\"z\":1},{\"isInflectionPoint\":false,\"f\":1,\"g\":1,\"h\":0,\"x\":1,\"y\":1,\"nodeZ\":1,\"z\":1}],\"locNo\":\"1-1-1\",\"taskNo\":30095,\"deviceId\":6,\"commands\":[{\"mode\":1,\"targetLocNo\":\"1-1-1\",\"shuttleNo\":78,\"nodes\":[{\"isInflectionPoint\":false,\"moveDistance\":1000,\"f\":0,\"g\":0,\"h\":0,\"x\":3,\"y\":1,\"nodeZ\":1,\"z\":1,\"direction\":\"top\"},{\"isInflectionPoint\":false,\"moveDistance\":1000,\"f\":1,\"g\":0,\"h\":1,\"x\":2,\"y\":1,\"nodeZ\":1,\"z\":1,\"direction\":\"top\"},{\"isInflectionPoint\":false,\"moveDistance\":1000,\"f\":1,\"g\":1,\"h\":0,\"x\":1,\"y\":1,\"nodeZ\":1,\"z\":1,\"direction\":\"top\"}],\"taskNo\":0,\"body\":\"{\\\"messageName\\\":\\\"runOrder\\\",\\\"nodeX\\\":1,\\\"nodeY\\\":1,\\\"msgTime\\\":\\\"2024-04-12 17:39:16\\\",\\\"nodeZ\\\":1,\\\"deviceNo\\\":78,\\\"taskId\\\":5}\",\"complete\":false}]}}";
        ShuttleRedisCommand shuttleRedisCommand = JSON.parseObject(s, ShuttleRedisCommand.class);
        System.out.println(shuttleRedisCommand);
    }
}