LSH
2023-08-14 501012ec218ca5307931eb9c5b28821346b002f0
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -243,10 +243,10 @@
                            }
                        } else if (code == 1000){
                            if (inSta.getStaNo().equals(103)){
                                staProtocol.setWorkNo((short)9999);
                                staProtocol.setWorkNo((short)9996);
                                staProtocol.setStaNo((short)203);
                            }else {
                                staProtocol.setWorkNo((short)9999);
                                staProtocol.setWorkNo((short)9996);
                                staProtocol.setStaNo((short)103);
                            }
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -1369,9 +1369,7 @@
                                        }else {
                                            waitWrkMast.setIoPri(9999d);
                                        }
                                        if(wrkMast.getIoPri()>=9000.0){
                                            wrkMast.setIoPri(9999d);
                                        }else if (wrkMast.getIoPri()>20.0){
                                        if (wrkMast.getIoPri()>23.0){
                                            wrkMast.setIoPri(wrkMast.getIoPri()-10.0);
                                        }else {
                                            wrkMast.setIoPri(13.0d);
@@ -4432,7 +4430,7 @@
            if (null == loc) {
                News.error("深库位出库 --- 浅库位阻塞异常! 待移转浅库位:" + shallowLoc.getLocNo());
//                return;
                return;
//                throw new CoolException("深库位出库 --- 浅库位阻塞异常! 待移转浅库位:" + shallowLoc.getLocNo());
            }
@@ -4563,4 +4561,51 @@
        }
    }
    public synchronized void automaticallyTurnOffCharging() {
        // 获取当前时间戳
        long timestamp = System.currentTimeMillis();
        Date date = new Date(timestamp);
        TimeZone timeZone = TimeZone.getTimeZone("Asia/Shanghai");
        java.util.Calendar calendar = java.util.Calendar.getInstance(timeZone);
        calendar.setTime(date);
        int hour = calendar.get(java.util.Calendar.HOUR_OF_DAY);
        if (hour>8 && hour<18){
            for (SteSlave ste : slaveProperties.getSte()) {
                SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId());
                SteProtocol steProtocol = steThread.getSteProtocol();
                BasSte basSte = basSteService.selectById(ste.getId());
                if (Cools.isEmpty(steProtocol, basSte)) { continue; }
                try{
                    // 在线 空闲   无作业标记   不在充电
                    if (steProtocol.getMode() == 0
                            || !steProtocol.statusType.equals(SteStatusType.IDLE)
                            || basSte.getPakMk().equals("Y")
                            || steProtocol.getChargeStatus() == 0
                    ) {
                        continue;
                    }
                    if (!steProtocol.isEnable()) {
                        continue;
                    }
                    if (steProtocol.getCharge() > Float.parseFloat(basSte.getChargeLine())) {
                        WrkCharge wrkCharge = wrkChargeService.selectWorking(steProtocol.getSteNo().intValue());
                        if (wrkCharge == null) {
                            if (steProtocol.getChargeStatus() == 1){
                                SteCommand steCommand = new SteCommand();
                                steCommand.setSteNo(ste.getId()); // 穿梭车编号
                                steCommand.setTaskNo(9999); // 工作号
                                steCommand.setTaskMode(SteTaskModeType.CLOSE_CHARGE);
                                if (!MessageQueue.offer(SlaveType.Ste, ste.getId(), new Task(2, steCommand))) {
                                    News.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", ste.getId(), JSON.toJSON(steCommand));
                                }
                            }
                        }
                    }
                }catch (Exception e){
                    News.error("自动关闭充电出错,联系管理员!"+hour+"点;"+ste.getId()+"号小车;");
                }
            }
        }
    }
}