#
zjj
2023-12-14 45a87642e46c746802af13bf47bcd70e3b69277a
src/main/java/com/zy/asrs/controller/SiteController.java
@@ -37,6 +37,7 @@
    @Autowired
    private BasDevpService basDevpService;
    @GetMapping("/io/mode/info/site")
    @ManagerAuth(memo = "入出库模式")
    public R ioMode(){
@@ -125,76 +126,12 @@
            Map<Integer, StaProtocol> station = devpThread.getStation();
            for(Map.Entry<Integer, StaProtocol> entry : station.entrySet()) {
                StaProtocol staProtocol = entry.getValue();
                    if (staProtocol.getBreakerErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                if (!Cools.isEmpty(staPlcErr(entry))){
                    list.add(staPlcErr(entry).get(0)) ;
                }
                        vo.setPlcDesc("断路器故障");  //  todo:luxiaotao plc错误描述
                        vo.setError("断路器故障");    //  todo:luxiaotao 异常信息
                        list.add(vo);
                    }
                    if (staProtocol.getInfraredErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("光电异常");
                        vo.setError("光电异常");
                        list.add(vo);
                    }
                    if (staProtocol.getOutTimeErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("运行超时");
                        vo.setError("运行超时");
                        list.add(vo);
                    }
                    if (staProtocol.getSeizeSeatErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("占位超时");
                        vo.setError("占位超时");
                        list.add(vo);
                    }
                    if (staProtocol.getWrkYgoodsN()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("有任务无货故障");
                        vo.setError("有任务无货故障");
                        list.add(vo);
                    }
                    if (staProtocol.getInverterErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("变频器故障");
                        vo.setError("变频器故障");
                        list.add(vo);
                    }
                    if (staProtocol.getContactErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("电机接触器故障");
                        vo.setError("电机接触器故障");
                        list.add(vo);
                    }
                    if (staProtocol.getUpcontactErr()){
                        PlcErrorTableVo vo = new PlcErrorTableVo();
                        vo.setNo(entry.getKey());   //  序号
                        vo.setPlcDesc("顶升电机接触器故障");
                        vo.setError("顶升电机接触器故障");
                        list.add(vo);
                    }
            }
        }
        return R.ok().add(list);
    }
@@ -296,5 +233,116 @@
        return R.error("更新失败");
    }
    public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){
        List<PlcErrorTableVo> list = new ArrayList<>();
        StaProtocol staProtocol = entry.getValue();
        if (staProtocol.getBreakerErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("断路器故障");
            vo.setError("断路器故障");
            list.add(vo);
        }
        if (staProtocol.getInfraredErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("光电异常");
            vo.setError("光电异常");
            list.add(vo);
        }
        if (staProtocol.getOutTimeErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("运行超时");
            vo.setError("运行超时");
            list.add(vo);
        }
        if (staProtocol.getSeizeSeatErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("占位超时");
            vo.setError("占位超时");
            list.add(vo);
        }
        if (staProtocol.getWrkYgoodsN()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("有任务无货故障");
            vo.setError("有任务无货故障");
            list.add(vo);
        }
        if (staProtocol.getInverterErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("变频器故障");
            vo.setError("变频器故障");
            list.add(vo);
        }
        if (staProtocol.getContactErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("电机接触器故障");
            vo.setError("电机接触器故障");
            list.add(vo);
        }
        if (staProtocol.getUpcontactErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("顶升电机接触器故障");
            vo.setError("顶升电机接触器故障");
            list.add(vo);
        }
        if (staProtocol.isFrontErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("前超限");
            vo.setError("前超限");
            list.add(vo);
        }
        if (staProtocol.isBackErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("后超限");
            vo.setError("后超限");
            list.add(vo);
        }
        if (staProtocol.isHighErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("高超限");
            vo.setError("高超限");
            list.add(vo);
        }
        if (staProtocol.isLeftErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("左超限");
            vo.setError("左超限");
            list.add(vo);
        }
        if (staProtocol.isRightErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("右超限");
            vo.setError("右超限");
            list.add(vo);
        }
        if (staProtocol.isBarcodeErr()){
            PlcErrorTableVo vo = new PlcErrorTableVo();
            vo.setNo(entry.getKey());   //  序号
            vo.setPlcDesc("扫码失败");
            vo.setError("扫码失败");
            list.add(vo);
        }
        return list;
    }
}