自动化立体仓库 - WCS系统
#
zwl
2023-01-29 6ed70263efe02a6b302d938f5c1502c2fc4a9e28
src/main/java/com/zy/asrs/controller/MonitorController.java
@@ -11,7 +11,10 @@
import com.zy.core.CrnThread;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.LedSlave;
import com.zy.core.model.command.LedCommand;
import com.zy.core.model.protocol.CrnProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.LedThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -33,6 +36,8 @@
    @Autowired
    private ReportQueryMapper reportQueryMapper;
    @Autowired
    private SlaveProperties slaveProperties;
    /**
     * 获取当前时间
@@ -229,46 +234,41 @@
        );
    }
    /**
     * 获取其他信息
     */
    @GetMapping("/led")
    public R monitorLed(@RequestParam("ledId") Integer ledId) {
        String ledContent = "";
        List<LedCommand> commandList = null;
        for (LedSlave slave : slaveProperties.getLed()) {
            if (slave.getStaArr().contains(ledId)) {
                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId());
                if (null != ledThread) {
                    ledContent = ledThread.getStringBuffer().toString();
                    commandList = ledThread.getCommandList();
                }
            }
        }
        return R.ok().add(commandList);
    }
    /**
     * 异常通知
     */
    @GetMapping("/led/error")
    public R monitorLedError(@RequestParam("ledId") Integer ledId) {
        String errorMsg = "";
        for (LedSlave slave : slaveProperties.getLed()) {
            if (slave.getStaArr().contains(ledId)) {
                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId());
                if (null != ledThread) {
                    errorMsg = ledThread.getErrorMsg().toString();
                }
            }
        }
        return R.ok().add(errorMsg);
    }