#
Junjie
2023-12-08 839b330a81489332300c39d74ba70713b142f80f
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -405,6 +405,7 @@
     */
    @Transactional
    public synchronized void stnToCrnStnPick(){
        try {
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历拣料入库口
            for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
@@ -511,6 +512,9 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
@@ -518,6 +522,7 @@
     */
    @Transactional
    public synchronized void stnToCrnStnPick2(){
        try {
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历拣料入库口
            for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
@@ -614,6 +619,9 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
@@ -621,6 +629,7 @@
     */
    @Transactional
    public synchronized void stnToCrnStnPlate(){
        try {
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历拣料入库口
            for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
@@ -734,6 +743,9 @@
                }
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -975,6 +987,7 @@
     * 初始化实时地图
     */
    public synchronized void initRealtimeBasMap() {
        try {
        for (int i = 1; i <= 10; i++) {//总共四层楼
            Object data = redisUtil.get(RedisKeyType.MAP.key + i);
            if (data == null) {//redis地图数据为空,从数据库中获取
@@ -1000,6 +1013,9 @@
                //将数据库地图数据存入redis
                redisUtil.set(RedisKeyType.MAP.key + i, JSON.toJSONString(basMap));
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -1063,6 +1079,7 @@
     * 入库  ===>>  四向穿梭车入库作业下发
     */
    public synchronized void shuttleInExecute() {
        try {
        List<WrkMast> wrkMasts = wrkMastMapper.selectInStep4();
        for (WrkMast wrkMast : wrkMasts) {
            //获取源站
@@ -1087,6 +1104,9 @@
            if (!step1) {
                continue;
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -1212,11 +1232,15 @@
     * 出库  ===>>  四向穿梭车出库作业下发
     */
    public synchronized void shuttleOutExecute() {
        try {
        for (WrkMast wrkMast : wrkMastMapper.selectBy2125()) {
            boolean step1 = this.shuttleOutExecuteStep1(wrkMast);//小车搬出库中
            if (!step1) {
                continue;
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -1363,6 +1387,7 @@
     * 四向穿梭车任务完成
     */
    public synchronized void shuttleFinished() {
        try {
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
            //获取四向穿梭车信息
            NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
@@ -1464,12 +1489,16 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 提升机任务
     */
    public synchronized void liftIoExecute() {
        try {
        for (LiftSlave liftSlave : slaveProperties.getLift()) {
            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId());
            if (liftThread == null) {
@@ -1516,6 +1545,9 @@
                }
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -1775,6 +1807,7 @@
     * 提升机任务完成
     */
    public synchronized void liftFinished() {
        try {
        for (LiftSlave liftSlave : slaveProperties.getLift()) {
            //获取提升机信息
            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId());
@@ -1855,12 +1888,16 @@
                }
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 库位移转
     */
    public synchronized void locToLocExecute() {
        try {
        //获取出入库工作档
//        List<WrkMast> wrkMasts = wrkMastMapper.selectInOutWrkMast();
//        if (wrkMasts.size() > 0) {
@@ -1895,6 +1932,9 @@
            }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@@ -2407,6 +2447,7 @@
     * 空栈板初始化入库,叉车入库站放货
     */
    public void storeEmptyPlt(){
        try {
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历空板入库口
            for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) {
@@ -2496,12 +2537,16 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * AGV补货 => 生成入库通知档
     */
    public void robotGenerateAgvTask() {
        try {
//检测300站是否自动、有物、工作号
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 获取入库站信息
@@ -2592,12 +2637,16 @@
                }
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * AGV补货 => 机械臂拣料
     */
    public void agvRestockByRobot() {
        try {
        //检测300站是否自动、有物、工作号
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 获取入库站信息
@@ -2647,12 +2696,16 @@
                }
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * AGV补货(通知AGV取货)
     */
    public void agvRestockInto() {
        try {
        //检测309和312站是否自动、有物
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 获取入库站信息
@@ -2691,6 +2744,9 @@
                }
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //通知AGV取货
@@ -2722,6 +2778,7 @@
     * AGV补货(悬挂线通知AGV取货)
     */
    public void agvRestockIntoByHangingWire() {
        try {
        //检测350和351扫码器
        int[] barcodeStaNo = {11, 12};//11 => 350站扫码器,12 => 351站扫码器
        for (int staNo : barcodeStaNo) {
@@ -2750,10 +2807,14 @@
                log.info(barcodeThread.getSlave().getId() + "号扫码器,通知AGV取货,条码号:" + barcode);
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    // 300站拣料
    public void pick300() {
        try {
        //检测300站是否自动、有物、工作号
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 获取入库站信息
@@ -2794,12 +2855,16 @@
                }
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 出库  ===>> 工作档信息写入led显示器
     */
    public void ledExecute() {
        try {
        for (LedSlave led : slaveProperties.getLed()) {
            // 获取输送线plc线程
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
@@ -2817,7 +2882,9 @@
                }
                // 获取工作档数据
                WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
                if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
                    if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) {
                        continue;
                    }
                wrkMasts.add(wrkMast);
                // 组装命令
                LedCommand ledCommand = new LedCommand();
@@ -2930,12 +2997,16 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 其他  ===>> LED显示器复位,显示默认信息
     */
    public void ledReset() {
        try {
//        for (LedSlave led : slaveProperties.getLed()) {
//
//            // 获取输送线plc线程
@@ -2992,12 +3063,16 @@
                }
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 四向穿梭车电量检测 ===>> 发起充电
     */
    public synchronized void loopShuttleCharge() {
        try {
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
            //获取四向穿梭车线程
            NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
@@ -3073,12 +3148,16 @@
            News.info("保存{}号四向穿梭车充电任务成功!!!", shuttle.getId());
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 执行四向穿梭车充电任务
     */
    public synchronized void executeShuttleCharge() {
        try {
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
            WrkCharge wrkCharge = wrkChargeService.selectWorking(shuttle.getId());
            if (wrkCharge == null) {
@@ -3195,13 +3274,16 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 执行小车移库任务
     */
    public synchronized void shuttleMoveExecute() {
        try {
        //查询小车移库任务
        List<WrkMast> wrkMasts = wrkMastMapper.selectShuttleMoveWrk();
        for (WrkMast wrkMast : wrkMasts) {
@@ -3231,6 +3313,9 @@
            }
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**