#
Junjie
3 天以前 ce9c9af4a3710d17e17814bab629ab4ef474f3f1
#
12个文件已修改
361 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/ConsoleController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ForkLiftController.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OpenController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/NotifyScheduler.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/ForkLiftUtils.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/NavigateMapData.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/console.html 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ConsoleController.java
@@ -7,24 +7,13 @@
import com.core.common.R;
import com.zy.asrs.domain.param.SystemSwitchParam;
import com.zy.asrs.entity.BasMap;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasMapService;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.model.MapNode;
import com.zy.common.model.enums.NavigationMapType;
import com.zy.common.utils.NavigateMapData;
import com.zy.common.utils.RedisUtil;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.ForkLiftSlave;
import com.zy.core.model.ShuttleSlave;
import com.zy.core.model.protocol.ForkLiftProtocol;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.properties.SystemProperties;
import com.zy.core.thread.ForkLiftThread;
import com.zy.core.thread.ShuttleThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -47,10 +36,6 @@
    private RedisUtil redisUtil;
    @Autowired
    private NavigateMapData navigateMapData;
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private SlaveProperties slaveProperties;
    @PostMapping("/system/running/status")
    @ManagerAuth(memo = "系统运行状态")
@@ -128,50 +113,6 @@
    @ManagerAuth(memo = "重置Redis地图")
    public R resetMapToRedisByLev(@PathVariable Integer lev, HttpServletRequest request) {
        redisUtil.del(RedisKeyType.MAP.key + lev);
        return R.ok();
    }
    /**
     * 任务检测
     */
    @GetMapping("/checkTask")
    @ManagerAuth(memo = "任务检测")
    public R checkTask() {
        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>());
        if (!wrkMasts.isEmpty()) {
            return R.error("存在未结束任务");
        }
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
            if (shuttleThread == null) {
                continue;
            }
            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
            if (shuttleProtocol == null) {
                continue;
            }
            if (shuttleProtocol.getTaskNo() > 0) {
                return R.error(slave.getId() + "号小车存在工作号");
            }
        }
        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
            if (forkLiftThread == null) {
                continue;
            }
            ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
            if (forkLiftProtocol == null) {
                continue;
            }
            if (forkLiftProtocol.getTaskNo() > 0) {
                return R.error(slave.getId() + "号货叉提升机存在工作号");
            }
        }
        return R.ok();
    }
src/main/java/com/zy/asrs/controller/ForkLiftController.java
@@ -2,6 +2,7 @@
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;
@@ -10,7 +11,9 @@
import com.zy.asrs.domain.param.LiftOperatorParam;
import com.zy.asrs.domain.vo.*;
import com.zy.asrs.entity.BasLift;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.BasLiftService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.common.service.CommonService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.action.ForkLiftAction;
@@ -41,25 +44,27 @@
    @Autowired
    private CommonService commonService;
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private BasLiftService basLiftService;
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private ForkLiftAction forkLiftAction;
    @Autowired
    private DeviceConfigService deviceConfigService;
    @PostMapping("/table/lift/state")
    @ManagerAuth(memo = "提升机信息表")
    public R liftStateTable(){
        ArrayList<JSONObject> list = new ArrayList<>();
        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            // 表格行
            JSONObject baseObj = new JSONObject();
            baseObj.put("shuttleNo", slave.getId());
            baseObj.put("shuttleNo", device.getDeviceNo());
            list.add(baseObj);
            // 获取提升机信息
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
            if (forkLiftThread == null) {
                continue;
            }
@@ -79,13 +84,15 @@
    @ManagerAuth(memo = "提升机数据表")
    public R liftMsgTable(){
        List<LiftMsgTableVo> list = new ArrayList<>();
        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            // 表格行
            LiftMsgTableVo vo = new LiftMsgTableVo();
            vo.setLiftNo(slave.getId());   //  提升机号
            vo.setLiftNo(device.getDeviceNo());   //  提升机号
            list.add(vo);
            // 获取提升机信息
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
            if (forkLiftThread == null) {
                continue;
            }
@@ -117,10 +124,12 @@
    @GetMapping("/detl/{liftNo}")
    public R liftDetl(@PathVariable("liftNo") Integer liftNo){
        LiftDataVo vo = new LiftDataVo();
        for (ForkLiftSlave liftSlave : slaveProperties.getForkLift()) {
            if (liftNo.equals(liftSlave.getId())) {
                vo.setLiftNo(liftSlave.getId());
                BasLift basLift = basLiftService.selectById(liftSlave.getId());
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            if (liftNo.equals(device.getDeviceNo())) {
                vo.setLiftNo(device.getDeviceNo());
                BasLift basLift = basLiftService.selectById(device.getDeviceNo());
                if (!Cools.isEmpty(basLift)) {
                    vo.setWorkNo(basLift.getWrkNo());
                    vo.setPakMk(basLift.getPakMk());
@@ -134,11 +143,13 @@
    @GetMapping("/sensor/detl/{liftNo}")
    public R liftSensorDetl(@PathVariable("liftNo") Integer liftNo){
        LiftSensorDataVo vo = new LiftSensorDataVo();
        for (ForkLiftSlave liftSlave : slaveProperties.getForkLift()) {
            if (liftNo.equals(liftSlave.getId())) {
                vo.setLiftNo(liftSlave.getId());
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            if (liftNo.equals(device.getDeviceNo())) {
                vo.setLiftNo(device.getDeviceNo());
                // 获取提升机信息
                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftSlave.getId());
                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
                if (forkLiftThread == null) {
                    return R.error("设备不在线");
                }
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -7,9 +7,11 @@
import com.zy.asrs.domain.enums.NotifyMsgType;
import com.zy.asrs.domain.param.*;
import com.zy.asrs.entity.ApiLog;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.NotifyUtils;
@@ -19,11 +21,8 @@
import com.zy.core.dispatcher.ShuttleDispatchUtils;
import com.zy.core.enums.SlaveType;
import com.zy.core.enums.WrkIoType;
import com.zy.core.model.ForkLiftSlave;
import com.zy.core.model.ShuttleSlave;
import com.zy.core.model.protocol.ForkLiftProtocol;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ForkLiftThread;
import com.zy.core.thread.ShuttleThread;
import lombok.extern.slf4j.Slf4j;
@@ -47,13 +46,13 @@
    @Autowired
    private NotifyUtils notifyUtils;
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private ApiLogService apiLogService;
    @Autowired
    private LocMastService locMastService;
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private DeviceConfigService deviceConfigService;
    @PostMapping("/createMoveTask")
    @OpenApiLog(memo = "小车移动任务")
@@ -238,8 +237,10 @@
        HashMap<String, Object> map = new HashMap<>();
        //获取小车数据
        ArrayList<ShuttleProtocol> shuttleProtocols = new ArrayList<>();
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
@@ -253,8 +254,10 @@
        //获取货叉提升机数据
        ArrayList<ForkLiftProtocol> forkLiftProtocols = new ArrayList<>();
        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
        List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkLiftList) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
            if (forkLiftThread == null) {
                continue;
            }
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -76,6 +76,8 @@
    private NotifyUtils notifyUtils;
    @Autowired
    private BasShuttleChargeService basShuttleChargeService;
    @Autowired
    private DeviceConfigService deviceConfigService;
    /**
     * 初始化实时地图
@@ -438,9 +440,11 @@
     */
    public synchronized void shuttleFinished() {
        try {
            for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
            List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                    .eq("device_type", String.valueOf(SlaveType.Shuttle)));
            for (DeviceConfig device : shuttleList) {
                //获取四向穿梭车信息
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
                ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
                if (shuttleProtocol == null) {
                    continue;
@@ -919,9 +923,11 @@
     */
    public synchronized void forkLiftFinished() {
        try {
            for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
            List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                    .eq("device_type", String.valueOf(SlaveType.ForkLift)));
            for (DeviceConfig device : forkliftList) {
                //获取提升机信息
                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, forkLiftSlave.getId());
                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
                ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
                if (forkLiftProtocol == null) {
                    continue;
@@ -991,9 +997,11 @@
     */
    private void recShuttleErr() {
        Date now = new Date();
        for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            // 获取四向穿梭车信息
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
@@ -1004,7 +1012,7 @@
            if (shuttleProtocol.getTaskNo() != 0) {
                //有任务
                BasShuttleErrLog latest = basShuttleErrLogService.findLatestByTaskNo(shuttleSlave.getId(), shuttleProtocol.getTaskNo());
                BasShuttleErrLog latest = basShuttleErrLogService.findLatestByTaskNo(device.getDeviceNo(), shuttleProtocol.getTaskNo());
                // 有异常
                if (latest == null) {
                    if (shuttleProtocol.getErrorCode() != null && Integer.parseInt(shuttleProtocol.getErrorCode()) != 0) {
@@ -1022,7 +1030,7 @@
                                null,    // 结束时间
                                wrkMast.getWrkSts(),    // 工作状态
                                wrkMast.getIoType(),    // 入出库类型
                                shuttleSlave.getId(),    // 四向穿梭车
                                device.getDeviceNo(),    // 四向穿梭车
                                null,    // plc
                                wrkMast.getLocNo(),    // 目标库位
                                wrkMast.getStaNo(),    // 目标站
@@ -1040,7 +1048,7 @@
                                JSON.toJSONString(shuttleProtocol)    // 系统状态数据
                        );
                        if (!basShuttleErrLogService.insert(basShuttleErrLog)) {
                            News.error("四向穿梭车plc异常记录失败 ===>> [id:{}] [error:{}]", shuttleSlave.getId(), errName);
                            News.error("四向穿梭车plc异常记录失败 ===>> [id:{}] [error:{}]", device.getDeviceNo(), errName);
                        }
                    }
                } else {
@@ -1050,7 +1058,7 @@
                        latest.setUpdateTime(now);
                        latest.setStatus(2);
                        if (!basShuttleErrLogService.updateById(latest)) {
                            News.error("四向穿梭车plc异常记录修复失败 ===>> [id:{}] [errLogId:{}]", shuttleSlave.getId(), latest.getId());
                            News.error("四向穿梭车plc异常记录修复失败 ===>> [id:{}] [errLogId:{}]", device.getDeviceNo(), latest.getId());
                        }
                    }
                }
@@ -1063,9 +1071,11 @@
     */
    private void recLiftErr() {
        Date now = new Date();
        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            // 获取提升机信息
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, forkLiftSlave.getId());
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
            if (forkLiftThread == null) {
                continue;
            }
@@ -1076,7 +1086,7 @@
            if (forkLiftProtocol.getTaskNo() != 0) {
                //有任务
                BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(forkLiftSlave.getId(), forkLiftProtocol.getTaskNo());
                BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(device.getDeviceNo(), forkLiftProtocol.getTaskNo());
                // 有异常
                if (latest == null) {
                    if (forkLiftProtocol.getErrorCode() != null && forkLiftProtocol.getErrorCode() != 0) {
@@ -1095,7 +1105,7 @@
                                null,    // 结束时间
                                wrkMast.getWrkSts(),    // 工作状态
                                wrkMast.getIoType(),    // 入出库类型
                                forkLiftSlave.getId(),    // 提升机
                                device.getDeviceNo(),    // 提升机
                                null,    // plc
                                wrkMast.getLocNo(),    // 目标库位
                                wrkMast.getStaNo(),    // 目标站
@@ -1113,7 +1123,7 @@
                                JSON.toJSONString(forkLiftProtocol)    // 系统状态数据
                        );
                        if (!basLiftErrLogService.insert(basLiftErrLog)) {
                            News.error("提升机plc异常记录失败 ===>> [id:{}] [error:{}]", forkLiftSlave.getId(), errName);
                            News.error("提升机plc异常记录失败 ===>> [id:{}] [error:{}]", device.getDeviceNo(), errName);
                        }
                    }
                } else {
@@ -1123,7 +1133,7 @@
                        latest.setUpdateTime(now);
                        latest.setStatus(2);
                        if (!basLiftErrLogService.updateById(latest)) {
                            News.error("提升机plc异常记录修复失败 ===>> [id:{}] [errLogId:{}]", forkLiftSlave.getId(), latest.getId());
                            News.error("提升机plc异常记录修复失败 ===>> [id:{}] [errLogId:{}]", device.getDeviceNo(), latest.getId());
                        }
                    }
                }
@@ -1142,9 +1152,11 @@
                return;//无充电桩
            }
            for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
            List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                    .eq("device_type", String.valueOf(SlaveType.Shuttle)));
            for (DeviceConfig device : shuttleList) {
                //获取四向穿梭车线程
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
                ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
                if (shuttleProtocol == null) {
                    continue;
@@ -1217,15 +1229,15 @@
                wrkMast.setIoType(WrkIoType.SHUTTLE_CHARGE.id);//300.充电
                wrkMast.setIoPri((double) 999);
                wrkMast.setLocNo(chargeLocNo);
                wrkMast.setShuttleNo(shuttle.getId());
                wrkMast.setShuttleNo(device.getDeviceNo());
                wrkMast.setMemo("charge");
                wrkMast.setAppeTime(new Date());
                if (!wrkMastService.insert(wrkMast)) {
                    News.error("保存{}号四向穿梭车充电任务失败!!!", shuttle.getId());
                    News.error("保存{}号四向穿梭车充电任务失败!!!", device.getDeviceNo());
                    continue;
                }
                News.info("保存{}号四向穿梭车充电任务成功!!!", shuttle.getId());
                News.info("保存{}号四向穿梭车充电任务成功!!!", device.getDeviceNo());
            }
        } catch (Exception e) {
            e.printStackTrace();
@@ -1238,8 +1250,10 @@
    public synchronized void executeShuttleCharge() {
        try {
            //查询小车充电任务
            for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
                WrkMast wrkMast = wrkMastService.selectChargeWorking(shuttle.getId());
            List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                    .eq("device_type", String.valueOf(SlaveType.Shuttle)));
            for (DeviceConfig device : shuttleList) {
                WrkMast wrkMast = wrkMastService.selectChargeWorking(device.getDeviceNo());
                if(wrkMast == null) {
                    continue;
                }
@@ -1909,8 +1923,10 @@
    //自动切换出入库模式
    public void autoSwitchForkLiftIOMode() {
        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
            Integer liftNo = forkLiftSlave.getId();
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            Integer liftNo = device.getDeviceNo();
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftNo);
            if (forkLiftThread == null) {
                continue;
src/main/java/com/zy/asrs/task/NotifyScheduler.java
@@ -4,7 +4,9 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.domain.NotifyDto;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.HttpRequestLog;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.service.HttpRequestLogService;
import com.zy.asrs.utils.NotifyUtils;
import com.zy.common.utils.HttpHandler;
@@ -32,23 +34,27 @@
    @Autowired
    private NotifyUtils notifyUtils;
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private ConfigService configService;
    @Autowired
    private HttpRequestLogService httpRequestLogService;
    @Autowired
    private DeviceConfigService deviceConfigService;
    @Scheduled(cron = "0/3 * * * * ? ")
    public synchronized void notifyShuttle(){
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            notifyMsg(String.valueOf(SlaveType.Shuttle), slave.getId());
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            notifyMsg(String.valueOf(SlaveType.Shuttle), device.getDeviceNo());
        }
    }
    @Scheduled(cron = "0/3 * * * * ? ")
    public synchronized void notifyForkLift(){
        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
            notifyMsg(String.valueOf(SlaveType.ForkLift), slave.getId());
        List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkLiftList) {
            notifyMsg(String.valueOf(SlaveType.ForkLift), device.getDeviceNo());
        }
    }
src/main/java/com/zy/asrs/task/ShuttlePowerEarlyWarning.java
@@ -3,12 +3,13 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.common.utils.HttpHandler;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.ShuttleSlave;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ShuttleThread;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
@@ -18,6 +19,7 @@
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
/**
 * 小车电量预警检测 => 强制预警
@@ -29,7 +31,7 @@
    @Autowired
    private ConfigService configService;
    @Autowired
    private SlaveProperties slaveProperties;
    private DeviceConfigService deviceConfigService;
    /**
     * 小车电量预警检测 => 强制预警
@@ -57,8 +59,10 @@
        buffer.append("【通知】四向库\n");//消息标题
        boolean hasReport = false;//是否有需要报告的数据
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
src/main/java/com/zy/asrs/utils/Utils.java
@@ -4,8 +4,10 @@
import com.core.common.Arith;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.model.NavigateNode;
@@ -109,15 +111,18 @@
    //获取除白名单外的指定楼层全部穿梭车xy坐标点
    public static List<int[]> getShuttlePoints(Integer whiteShuttle, Integer lev) {
        SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
        DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
        ArrayList<int[]> list = new ArrayList<>();
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            if (slave.getId().intValue() == whiteShuttle) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            if (device.getDeviceNo().intValue() == whiteShuttle) {
                continue;//跳过白名单
            }
            //获取穿梭车所在节点位置
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
@@ -146,11 +151,14 @@
    //检测楼层是否有可用穿梭车
    public static boolean checkLevHasShuttle(Integer lev) {
        SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
        DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
        WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            //获取四向穿梭车线程
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
@@ -197,14 +205,17 @@
            return null;
        }
        SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
        if (slaveProperties == null) {
        DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
        if (deviceConfigService == null) {
            return null;
        }
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (String loc : groupLoc) {
            for (ShuttleSlave slave : slaveProperties.getShuttle()) {
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
            for (DeviceConfig device : shuttleList) {
                ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
                if (shuttleThread == null) {
                    continue;
                }
@@ -220,7 +231,7 @@
                if (shuttleProtocol.getCurrentLocNo().equals(loc)) {
                    //存在小车
                    return slave.getId();
                    return device.getDeviceNo();
                }
            }
        }
src/main/java/com/zy/common/utils/ForkLiftUtils.java
@@ -4,6 +4,8 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
import com.zy.core.cache.SlaveConnection;
@@ -68,9 +70,11 @@
    //获取提升机站点
    public static ForkLiftStaProtocol getLiftStaByStaNo(Integer staNo) {
        SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
        for (ForkLiftSlave liftSlave : slaveProperties.getForkLift()) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftSlave.getId());
        DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        for (DeviceConfig device : forkliftList) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
            if (forkLiftThread == null) {
                return null;
            }
src/main/java/com/zy/common/utils/NavigateMapData.java
@@ -1,10 +1,13 @@
package com.zy.common.utils;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasMap;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.BasMapService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.MapNode;
@@ -13,14 +16,11 @@
import com.zy.core.enums.MapNodeType;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.ForkLiftSlave;
import com.zy.core.model.protocol.ForkLiftStaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ForkLiftThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@@ -31,7 +31,7 @@
public class NavigateMapData {
    @Autowired
    private SlaveProperties slaveProperties;
    private DeviceConfigService deviceConfigService;
    @Autowired
    private BasMapService basMapService;
@@ -286,8 +286,10 @@
    public List<List<MapNode>> loadForkLift(List<List<MapNode>> lists, Integer mapType, Integer lev) {
        try {
            //加载货叉提升机放货点位数据
            for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, forkLiftSlave.getId());
            List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                    .eq("device_type", String.valueOf(SlaveType.ForkLift)));
            for (DeviceConfig device : forkliftList) {
                ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
                if (forkLiftThread == null) {
                    continue;
                }
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -4,7 +4,9 @@
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.MapNode;
import com.zy.common.model.NavigateNode;
@@ -18,7 +20,6 @@
import com.zy.core.model.command.ShuttleAssignCommand;
import com.zy.core.model.command.ShuttleCommand;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ShuttleThread;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
@@ -45,9 +46,9 @@
    @Autowired
    private ConfigService configService;
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private ShuttleDispatchUtils shuttleDispatchUtils;
    @Autowired
    private DeviceConfigService deviceConfigService;
    public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
        return getStartToTargetCommands(startLocNo, endLocNo, mapType, null, assignCommand, shuttleThread);
@@ -285,8 +286,11 @@
    private HashMap<String, Integer> findCarMap() {
        HashMap<String, Integer> carMap = new HashMap<>();
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
@@ -299,7 +303,7 @@
                continue;
            }
            carMap.put(currentLocNo, slave.getId());
            carMap.put(currentLocNo, device.getDeviceNo());
        }
        return carMap;
    }
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -7,8 +7,10 @@
import com.zy.asrs.domain.ShuttleGatherResult;
import com.zy.asrs.domain.param.ShuttleGatherParam;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NavigateNode;
@@ -24,7 +26,6 @@
import com.zy.core.model.ForkLiftSlave;
import com.zy.core.model.ShuttleSlave;
import com.zy.core.model.protocol.*;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ForkLiftThread;
import com.zy.core.thread.ShuttleThread;
import com.zy.system.entity.Config;
@@ -42,8 +43,6 @@
public class ShuttleDispatchUtils {
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private CommonService commonService;
@@ -53,6 +52,8 @@
    private ConfigService configService;
    @Autowired
    private BasShuttleService basShuttleService;
    @Autowired
    private DeviceConfigService deviceConfigService;
    /**
     * 调度车辆-调度指定穿梭车
@@ -68,15 +69,17 @@
        ArrayList<ShuttleThread> sameLev = new ArrayList<>();//相同楼层的穿梭车
        ArrayList<ShuttleThread> diffLev = new ArrayList<>();//不同楼层的穿梭车
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        for (DeviceConfig device : shuttleList) {
            //获取四向穿梭车线程
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
                continue;
            }
            if (checkChargeWrk(shuttle.getId())) {
            if (checkChargeWrk(device.getDeviceNo())) {
                continue;//存在充电任务,过滤小车
            }
@@ -84,7 +87,7 @@
                continue;//小车忙碌中
            }
            BasShuttle basShuttle = basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", shuttle.getId()));
            BasShuttle basShuttle = basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", device.getDeviceNo()));
            if (basShuttle != null) {
                if (basShuttle.getStatus() == 0) {
                    continue;//小车被禁用
@@ -341,10 +344,12 @@
            return false;
        }
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        int levCount = 0;//目标楼层车辆数量
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
        for (DeviceConfig device : shuttleList) {
            //获取四向穿梭车线程
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
                continue;
@@ -410,11 +415,14 @@
            return null;
        }
        List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.ForkLift)));
        //获取小车同一楼层的站点
        ArrayList<ForkLiftStaProtocol> list = new ArrayList<>();
        int lev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//小车楼层
        for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
        for (DeviceConfig device : forkliftList) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo());
            if (forkLiftThread == null) {
                continue;
            }
@@ -426,7 +434,7 @@
                continue;
            }
            ForkLiftStaProtocol forkLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(slave.getId(), lev);
            ForkLiftStaProtocol forkLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(device.getDeviceNo(), lev);
            if (forkLiftStaProtocol == null) {
                continue;
            }
@@ -441,7 +449,7 @@
            }
            //判断目标楼层站点是否无托盘
            ForkLiftStaProtocol targetLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(slave.getId(), targetLev);
            ForkLiftStaProtocol targetLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(device.getDeviceNo(), targetLev);
            if (targetLiftStaProtocol == null) {
                continue;
            }
@@ -501,10 +509,12 @@
     * 获取楼层可用小车数量
     */
    public int getShuttleCountByLev(int lev) {
        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
        int count = 0;
        for (ShuttleSlave slave : slaveProperties.getShuttle()) {
        for (DeviceConfig device : shuttleList) {
            //获取四向穿梭车线程
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId());
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
            if (shuttleThread == null) {
                continue;
            }
@@ -514,7 +524,7 @@
                continue;
            }
            if (checkChargeWrk(slave.getId())) {
            if (checkChargeWrk(device.getDeviceNo())) {
                continue;//存在充电任务,过滤小车
            }
src/main/webapp/views/console.html
@@ -78,7 +78,6 @@
                    <div>
<!--                        <el-button @click="testMove()">测试移动车</el-button>-->
                        <el-button @click="resetMap()">重置地图</el-button>
                        <el-button @click="checkTask()">任务检测</el-button>
<!--                        <el-button @click="initLoc()">初始化库位</el-button>-->
                    </div>
                </div>
@@ -662,30 +661,6 @@
                                    message: that.currentLev + '层地图重置完成',
                                    type: 'success'
                                });
                            }
                        })
                    },
                    checkTask() {
                        let that = this
                        $.ajax({
                            url:baseUrl+"/console/checkTask",
                            headers:{
                                'token': localStorage.getItem('token')
                            },
                            data:{},
                            method:'get',
                            success:function (res) {
                                if (res.code === 200) {
                                    that.$message({
                                        message: res.msg,
                                        type: 'success'
                                    });
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        })
                    },