#
zjj
2024-07-19 5d0f7a5aa4ee994782f3f3bcc66e23653a6ac40a
src/main/java/com/zy/asrs/controller/CommandInfoController.java
@@ -8,11 +8,13 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.asrs.entity.CommandInfo;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.service.CommandInfoService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.service.TaskWrkService;
import com.zy.common.web.BaseController;
import com.zy.core.cache.MessageQueue;
import com.zy.core.enums.CommandStatusType;
@@ -31,6 +33,9 @@
    @Autowired
    private CommandInfoService commandInfoService;
    @Autowired
    private TaskWrkService taskWrkService;
    @RequestMapping(value = "/commandInfo/{id}/auth")
    @ManagerAuth
@@ -150,6 +155,14 @@
            return R.error("指令不存在");
        }
        TaskWrk taskWrk = taskWrkService.selectByWrkNo(commandInfo.getWrkNo());
        if (Cools.isEmpty(taskWrk)){
            return R.error("任务不存在");
        }
        if (taskWrk.getWrkSts() !=3 && taskWrk.getWrkSts() !=12 ){
            return R.error("任务未处于执行状态");
        }
        commandInfo.setCommandStatus(CommandStatusType.EXECUTE.id);//执行状态
        commandInfo.setExecuteTime(new Date());
        if (commandInfoService.updateById(commandInfo)) {
@@ -163,11 +176,11 @@
            switch (type) {
                case Crn:
                    CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class);
                    MessageQueue.offer(type, crnCommand.getCrnNo(), new Task(2, crnCommand));
                    MessageQueue.offer(type, crnCommand.getCrnNo(), new Task(5, crnCommand));
                    break;
                case Devp:
                    StaProtocol staProtocol = JSON.parseObject(commandPackage.getCommand().toString(), StaProtocol.class);
                    MessageQueue.offer(type, staProtocol.getSiteId(), new Task(2, staProtocol));
                    MessageQueue.offer(type, staProtocol.getSiteId(), new Task(3, staProtocol));
                    break;
            }
        }