pang.jiabao
2025-05-13 e60658fec23ada118080f79b4ba8bc05b733138e
src/main/java/com/zy/asrs/controller/CrnController.java
@@ -13,16 +13,12 @@
import com.zy.asrs.domain.vo.CrnListVo;
import com.zy.asrs.domain.vo.CrnMsgTableVo;
import com.zy.asrs.domain.vo.CrnStateTableVo;
import com.zy.asrs.entity.BasCrnError;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.BasCrnErrorMapper;
import com.zy.asrs.mapper.TaskWrkMapper;
import com.zy.asrs.service.BasCrnpService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.service.impl.MainServiceImpl;
import com.zy.asrs.utils.CommandUtils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.core.CrnThread;
import com.zy.core.cache.MessageQueue;
@@ -39,9 +35,9 @@
import com.zy.core.properties.SystemProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -55,11 +51,6 @@
@RestController
public class CrnController {
    @Value("${wms.url}")
    private String wmsUrl;
    @Value("${wms.movePath}")
    private String movePath;
    @Autowired
    private SlaveProperties slaveProperties;
@@ -70,9 +61,10 @@
    @Autowired
    private BasCrnpService basCrnpService;
    @Autowired
    private MainServiceImpl mainService;
    @Autowired
    private LocMastService locMastService;
    @Resource
    private TaskWrkMapper taskWrkMapper;
    @ManagerAuth(memo = "进行中的命令")
@@ -196,13 +188,14 @@
            vo.setWorkNo(crnProtocol.getTaskNo());  //  任务号
            if (crnProtocol.getTaskNo() > 0) {
                WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
                if (wrkMast != null) {
                    vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc());   //  模式状态
                    vo.setSourceStaNo(wrkMast.getSourceStaNo$());    //  源站
                    vo.setStaNo(wrkMast.getStaNo$());   //  目标站
                    vo.setSourceLocNo(wrkMast.getSourceLocNo());    //  源库位
                    vo.setLocNo(wrkMast.getLocNo());    //  目标库位
//                WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
                TaskWrk taskWrk = taskWrkMapper.selectByWrkNo(Integer.valueOf(crnProtocol.getTaskNo()));
                if (taskWrk != null) {
                    vo.setStatus(CrnStatusType.process(taskWrk.getIoType()).getDesc());   //  模式状态
                    vo.setSourceStaNo(taskWrk.getStartPoint());    //  源站
                    vo.setStaNo(taskWrk.getTargetPoint());   //  目标站
                    vo.setSourceLocNo(taskWrk.getStartPoint());    //  源库位
                    vo.setLocNo(taskWrk.getTargetPoint());    //  目标库位
                }
            } else {
                vo.setStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO.getDesc() : CrnStatusType.MACHINE_UN_AUTO.getDesc());   //  模式状态
@@ -612,7 +605,7 @@
                crnCommand.setCommand((short) 0);  // 任务完成确认位
                // 延时发送
                Thread.sleep(1000L);
                if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand), false)) {
                if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand))) {
                    return R.ok();
                } else {
                    throw new CoolException("命令下发失败");
@@ -771,7 +764,7 @@
                }
                // 空闲判断
//                if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) {
                if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(4, command), false)) {
                if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(4, command))) {
                    return true;
                } else {
                    throw new CoolException("命令下发失败");
@@ -802,7 +795,7 @@
                }
                // 空闲判断
//                if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) {
                if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, command), false)) {
                if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, command))) {
                    return true;
                } else {
                    throw new CoolException("命令下发失败");