#
Junjie
16 小时以前 5e644156839fbb018fe63972ee74be550540a06a
#
9个文件已修改
98 ■■■■ 已修改文件
src/main/java/com/zy/asrs/utils/Utils.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/MainProcess.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/network/ZyCrnConnectDriver.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/network/ZyRgvConnectDriver.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/network/ZyStationConnectDriver.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/network/real/ZyCrnRealConnect.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/ZyRgvThread.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/ZyStationThread.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java
@@ -7,6 +7,7 @@
import com.core.common.Arith;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasCrnpService;
@@ -32,6 +33,8 @@
    private static final String LOC_NO_FLAG = "-";
    private static final DecimalFormat fmt = new DecimalFormat("##0.00");
    private static Integer defaultDeviceLogCollectTime = 200;
    private static Long lastUpdateDeviceLogCollectTime = -1L;
    public static float scale(Float f){
        if (f == null || f == 0f || Float.isNaN(f)) {
@@ -105,29 +108,37 @@
    //获取设备日志采集时间
    public static int getDeviceLogCollectTime() {
        int defaultTime = 200;
        try {
            RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
            if (redisUtil == null) {
                return defaultTime;
            }
        if (defaultDeviceLogCollectTime == null || System.currentTimeMillis() - lastUpdateDeviceLogCollectTime > 60 * 1000) {
            int defaultTime = 200;
            lastUpdateDeviceLogCollectTime = System.currentTimeMillis();
            try {
                RedisUtil redisUtil = null;
                try {
                    redisUtil = SpringUtils.getBean(RedisUtil.class);
                } catch (CoolException coolException) {
            Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
            if (object == null) {
                return defaultTime;
            }
                }
                if (redisUtil == null) {
                    return defaultTime;
                }
            HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
            String deviceLogCollectTime = systemConfigMap.get("deviceLogCollectTime");
            if(deviceLogCollectTime == null){
                return defaultTime;
            }
                Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
                if (object == null) {
                    return defaultTime;
                }
            return Integer.parseInt(deviceLogCollectTime);
        }catch (Exception e){
            e.printStackTrace();
                HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
                String deviceLogCollectTime = systemConfigMap.get("deviceLogCollectTime");
                if(deviceLogCollectTime == null){
                    return defaultTime;
                }
                return Integer.parseInt(deviceLogCollectTime);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return defaultTime;
        return defaultDeviceLogCollectTime;
    }
    //获取入库任务可用排
src/main/java/com/zy/core/MainProcess.java
@@ -1,6 +1,7 @@
package com.zy.core;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.core.plugin.MainProcessPluginApi;
import com.zy.core.properties.SystemProperties;
import lombok.extern.slf4j.Slf4j;
@@ -31,7 +32,11 @@
                    if (mainProcessPluginApi == null) {
                        String className = mainProcessPlugin.contains(".") ? mainProcessPlugin : "com.zy.core.plugin." + mainProcessPlugin;
                        Class<? extends MainProcessPluginApi> clazz = Class.forName(className).asSubclass(MainProcessPluginApi.class);
                        mainProcessPluginApi = SpringUtils.getBean(clazz);
                        try {
                            mainProcessPluginApi = SpringUtils.getBean(clazz);
                        } catch (CoolException coolException) {
                            continue;
                        }
                    }
                    // 系统运行状态判断
src/main/java/com/zy/core/network/ZyCrnConnectDriver.java
@@ -62,6 +62,9 @@
    }
    public ZyCrnStatusEntity getStatus() {
        if (zyCrnConnectApi == null) {
            return null;
        }
        return zyCrnConnectApi.getStatus();
    }
src/main/java/com/zy/core/network/ZyRgvConnectDriver.java
@@ -55,6 +55,9 @@
    }
    public ZyRgvStatusEntity getStatus() {
        if (zyRgvConnectApi == null) {
            return null;
        }
        return zyRgvConnectApi.getStatus();
    }
src/main/java/com/zy/core/network/ZyStationConnectDriver.java
@@ -62,6 +62,9 @@
    }
    public List<ZyStationStatusEntity> getStatus() {
        if (zyStationConnectApi == null) {
            return null;
        }
        return zyStationConnectApi.getStatus();
    }
src/main/java/com/zy/core/network/real/ZyCrnRealConnect.java
@@ -37,10 +37,10 @@
        if(connect.IsSuccess){
            connected = true;
            OutputQueue.CRN.offer(MessageFormat.format( "【{0}】堆垛机plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
            News.info("SiemensCrn"+" - 1"+" - 堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
            News.info("SiemensCrn 堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
        } else {
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】堆垛机plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
            News.error("SiemensCrn"+" - 2"+" - 堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
            News.error("SiemensCrn 堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
        }
//        siemensNet.ConnectClose();
        return connected;
@@ -84,12 +84,12 @@
                return crnStatus;
            } else {
                OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
                News.error("SiemensCrn"+" - 4"+" - 读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
                News.error("SiemensCrn 读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
            }
        } catch (Exception e) {
            e.printStackTrace();
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
            News.error("SiemensCrn"+" - 5"+" - 读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
            News.error("SiemensCrn 读取垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
        }
        return null;
    }
@@ -190,12 +190,12 @@
            }
            if (result != null && result.IsSuccess) {
                News.info("SiemensCrn" + " - 7" + " - 堆垛机命令下发[id:{}] >>>>> {}", command.getCrnNo(), JSON.toJSON(command));
                News.info("SiemensCrn堆垛机命令下发[id:{}] >>>>> {}", command.getCrnNo(), JSON.toJSON(command));
                OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), command.getCrnNo(), JSON.toJSON(command)));
                response.setResult(true);
                response.setMessage("命令下发成功");
            } else {
                News.error("SiemensCrn" + " - 8" + " - 写入堆垛机plc数据失败 ===>> [id:{}]", command.getCrnNo());
                News.error("SiemensCrn写入堆垛机plc数据失败 ===>> [id:{}]", command.getCrnNo());
                OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}]", DateUtils.convert(new Date()), command.getCrnNo()));
                response.setResult(false);
                response.setMessage("命令下发失败");
src/main/java/com/zy/core/thread/impl/ZyRgvThread.java
@@ -131,7 +131,12 @@
            rgvProtocol.setDeviceDataLog(System.currentTimeMillis());
        }
        BasRgvService basRgvService = SpringUtils.getBean(BasRgvService.class);
        BasRgvService basRgvService = null;
        try {
            basRgvService = SpringUtils.getBean(BasRgvService.class);
        } catch (Exception e) {
        }
        if (basRgvService != null) {
            BasRgv basRgv = basRgvService.selectOne(new EntityWrapper<BasRgv>().eq("rgv_no", deviceConfig.getDeviceNo()));
            if(basRgv == null) {
src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java
@@ -188,7 +188,12 @@
            crnProtocol.setDeviceDataLog(System.currentTimeMillis());
        }
        BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
        BasCrnpService basCrnpService = null;
        try {
            basCrnpService = SpringUtils.getBean(BasCrnpService.class);
        }catch (Exception e){
        }
        if (basCrnpService != null) {
            BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", deviceConfig.getDeviceNo()));
            if(basCrnp == null) {
src/main/java/com/zy/core/thread/impl/ZyStationThread.java
@@ -97,7 +97,12 @@
        }
        if(statusList.isEmpty()) {
            BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
            BasDevpService basDevpService = null;
            try {
                basDevpService = SpringUtils.getBean(BasDevpService.class);
            } catch (Exception e) {
            }
            if (basDevpService == null) {
                return;
            }