1
zhangc
2025-03-24 e45c5845cb3fcc31aff6cdfacdad3445e708e500
1
1个文件已修改
171 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 171 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -266,7 +266,8 @@
                            if (inSta.getStaNo().equals(203)){
                                staProtocol.setWorkNo((short)9996);
                                staProtocol.setStaNo((short)103);
                            }if (inSta.getStaNo().equals(113)){
                            }
                            if (inSta.getStaNo().equals(113)) {
                                staProtocol.setWorkNo((short)9995);
                                staProtocol.setStaNo((short)114);
                            }else if (inSta.getStaNo().equals(213)){
@@ -326,7 +327,9 @@
                        && staProtocol.isPakMk()) {
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo());
                    if (wrkMast == null) { continue; }
                    if (wrkMast == null) {
                        continue;
                    }
                    // 命令下发区 --------------------------------------------------------------------------
@@ -422,7 +425,7 @@
                                        break;
                                    }
                                }
                                if (flag)  {
                                if (flag && devpThread.getStation().get(204).isLoading()) {
                                    News.error("MainServiceImpl  346行"+"204站点存在货物,捡料盘点货物暂时不重新入库!!!");
                                    continue;
                                }
@@ -554,7 +557,9 @@
                        } else {
                            errorMsg = "当前拣料任务请移动至103站";
                        }
                        if (ledThread != null) {MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));}
                        if (ledThread != null) {
                            MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
                        }
                        News.error("入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
                        continue;
                    }
@@ -823,7 +828,9 @@
                        News.error("拣料/盘点转全板,任务号工作档不存在===>>[任务号:{}]", staProtocol.getWorkNo());
                        continue;
                    }
                    if (wrkMast.getIoType() != 101) { continue; }
                    if (wrkMast.getIoType() != 101) {
                        continue;
                    }
                    //拣料转全板默认出库站100站,当100站有物时,目标改200站
                    Integer staNo = 100;
@@ -995,7 +1002,9 @@
            // 获取堆垛机信息
            CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
            CrnProtocol crnProtocol = crnThread.getCrnProtocol();
            if (crnProtocol == null) { continue; }
            if (crnProtocol == null) {
                continue;
            }
            BasCrnp basCrnp = basCrnpService.selectById(crn.getId());
            if (basCrnp == null) {
                News.error("{}号堆垛机尚未在数据库进行维护!", crn.getId());
@@ -1145,7 +1154,12 @@
            if (wrkMastMapper.selectShallowLoc(Integer.parseInt(wrkMast.getLocNo().substring(0, 2)),Integer.parseInt(wrkMast.getLocNo().substring(2, 5)),Integer.parseInt(wrkMast.getLocNo().substring(5, 7)))!=null){
                //检查入库库位是否是在堆垛机边库位
                ArrayList<Integer> outLoc = new ArrayList<>();
                outLoc.add(3);outLoc.add(4);outLoc.add(11);outLoc.add(12);outLoc.add(18);outLoc.add(19);
                outLoc.add(3);
                outLoc.add(4);
                outLoc.add(11);
                outLoc.add(12);
                outLoc.add(18);
                outLoc.add(19);
                if (!outLoc.contains(Integer.parseInt(wrkMast.getLocNo().substring(0, 2)))) {
                    continue;
                }
@@ -1356,7 +1370,9 @@
                        // 小车处于空闲
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { continue; }
                        if (steProtocol == null) {
                            continue;
                        }
                        if (steProtocol.loca==0) continue;
                        if (steProtocol.isIdle()) {
@@ -1704,7 +1720,9 @@
                            // 给穿梭车下发命令 让其将货物挪至堆垛机搬运点
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { continue; }
                            if (steProtocol == null) {
                                continue;
                            }
                            if (steProtocol.loca==0) continue;
                            if (steProtocol.isIdle()) {
@@ -1924,7 +1942,9 @@
                    // 给穿梭车下发命令 让其将货物挪至堆垛机搬运点
                    SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                    SteProtocol steProtocol = steThread.getSteProtocol();
                    if (steProtocol == null) { return; }
                    if (steProtocol == null) {
                        return;
                    }
                    if (steProtocol.isIdle()) {
                        //小车只能绑定一笔作业中任务
@@ -2271,7 +2291,9 @@
                        if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) {
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { return; }
                            if (steProtocol == null) {
                                return;
                            }
                            this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo());
//                            if(steProtocol.getLoca()==3 || steProtocol.getLoca()==4){
//                                //小车已经在待机位时,无需下发到待机位任务,直接更新状态微3,同时绑定小车
@@ -2291,7 +2313,9 @@
                        // 小车处于空闲
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { return; }
                        if (steProtocol == null) {
                            return;
                        }
                        if (steProtocol.isIdle()) {
                            // 已经存在吊车执行任务时,则过滤
@@ -2506,7 +2530,9 @@
                        // 小车处于空闲
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { return; }
                        if (steProtocol == null) {
                            return;
                        }
                        if (steProtocol.isIdle()) {
                            // 已经存在吊车执行任务时,则过滤
@@ -2572,7 +2598,9 @@
                    // 给穿梭车下发命令 让其将货物挪至堆垛机搬运点
                    SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                    SteProtocol steProtocol = steThread.getSteProtocol();
                    if (steProtocol == null) { return; }
                    if (steProtocol == null) {
                        return;
                    }
                    if (steProtocol.isIdle()) {
                        //小车只能绑定一笔作业中任务
@@ -2654,7 +2682,9 @@
                            // 小车处于空闲
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { return; }
                            if (steProtocol == null) {
                                return;
                            }
                            if (steProtocol.isIdle()) {
                                // 已经存在吊车执行任务时,则过滤
@@ -2726,7 +2756,9 @@
            // 获取堆垛机信息
            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId());
            SteProtocol steProtocol = steThread.getSteProtocol();
            if (steProtocol == null) { continue; }
            if (steProtocol == null) {
                continue;
            }
            if (Cools.isEmpty(steProtocol.loca))  continue;
            if (steProtocol.loca==0) continue;
            if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) {
@@ -2744,7 +2776,9 @@
            // 获取堆垛机信息
            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId());
            SteProtocol steProtocol = steThread.getSteProtocol();
            if (steProtocol == null) { continue; }
            if (steProtocol == null) {
                continue;
            }
            if (Cools.isEmpty(steProtocol.loca)) continue;
            if (steProtocol.loca==0) continue;
            if (steProtocol.isIdle()) {
@@ -2781,7 +2815,9 @@
        // 获取穿梭车信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol == null) {
            return;
        }
        if (steProtocol.isIdle()) {
            //小车只能绑定一笔作业中任务
@@ -2818,7 +2854,9 @@
        // 获取穿梭车信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol == null) {
            return;
        }
        if (!basSteService.updatePakMk(steNo, "Y")) {
            News.error("修改穿梭车作业状态 失败!!,穿梭车={}", steNo);
@@ -2861,7 +2899,9 @@
        // 获取穿梭车信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol == null) {
            return;
        }
        if (steProtocol.isIdle()) {
            //小车只能绑定一笔作业中任务
@@ -2903,7 +2943,9 @@
        // 获取穿梭车信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol == null) {
            return;
        }
        if (steProtocol.isIdle()) {
            //小车只能绑定一笔作业中任务
@@ -2942,7 +2984,9 @@
        // 获取堆垛机信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol == null) {
            return;
        }
        if(steProtocol.getLoad() == 1){
            News.error("小车上方有货,无法下发任务===>>{}", steNo);
            return;
@@ -3041,7 +3085,9 @@
        // 获取穿梭车信息
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (steProtocol == null) { return; }
        if (steProtocol == null) {
            return;
        }
        // 穿梭车空闲
        if (steProtocol.isIdle() && steProtocol.getLoad() == 0) {
            // 堆垛机空闲
@@ -3095,7 +3141,9 @@
            // 获取堆垛机信息
            CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
            CrnProtocol crnProtocol = crnThread.getCrnProtocol();
            if (crnProtocol == null) { continue; }
            if (crnProtocol == null) {
                continue;
            }
            //  状态:等待确认 并且  任务完成位 = 1
            if (crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) {
                // 获取入库待确认工作档
@@ -3141,7 +3189,9 @@
                    }
                }
                if (wrkMast == null) { continue; }
                if (wrkMast == null) {
                    continue;
                }
                if (wrkMast.getIoType() != 11 && wrkMast.getIoType() != 111) {
                    // 入库 ==>> 货物搬入库
                    if (wrkMast.getWrkSts() == 7){
@@ -3164,7 +3214,9 @@
                            Integer steNo = wrkMast.getSteNo();
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { continue; }
                            if (steProtocol == null) {
                                continue;
                            }
//                            if (steProtocol.loca==0) continue;
                            if (steProtocol.isIdle()) {
                                // 命令下发区 --------------------------------------------------------------------------
@@ -3257,7 +3309,9 @@
                        Integer steNo = wrkMast.getSteNo();
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { continue; }
                        if (steProtocol == null) {
                            continue;
                        }
//                        if (steProtocol.loca==0) continue;
                        // 穿梭车重新定位排列层
                        if (!steThread.confirmPos()) {
@@ -3330,7 +3384,9 @@
                            Integer steNo = wrkMast.getSteNo();
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { continue; }
                            if (steProtocol == null) {
                                continue;
                            }
//                            if (steProtocol.loca==0) continue;
                            if (steProtocol.isIdle()) {
                                // 命令下发区 --------------------------------------------------------------------------
@@ -3527,7 +3583,9 @@
                            Integer steNo = wrkMast.getSteNo();
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { continue; }
                            if (steProtocol == null) {
                                continue;
                            }
                            if (steProtocol.loca==0) continue;
                            if (steProtocol.isIdle()) {
                                // 命令下发区 --------------------------------------------------------------------------
@@ -3557,7 +3615,9 @@
                        Integer steNo = wrkMast.getSteNo();
                        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                        SteProtocol steProtocol = steThread.getSteProtocol();
                        if (steProtocol == null) { continue; }
                        if (steProtocol == null) {
                            continue;
                        }
                        if (steProtocol.loca==0) continue;
                        // 穿梭车重新定位排列层
                        if (!steThread.confirmPos()) {
@@ -3599,7 +3659,9 @@
            // 获取穿梭车信息
            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId());
            SteProtocol steProtocol = steThread.getSteProtocol();
            if (steProtocol == null) { continue; }
            if (steProtocol == null) {
                continue;
            }
            if (Cools.isEmpty(steProtocol.loca)) continue;
            if (steProtocol.loca==0) continue;
            if (steProtocol.getWaiting() && steProtocol.getTaskNo() == 0){
@@ -3663,7 +3725,9 @@
                                steProtocol.getSteNo(), steProtocol.getTaskNo(), steProtocol.getStatus(), wrkMast.getWrkSts());
                    }
                    if (wrkMast == null) { continue; }
                    if (wrkMast == null) {
                        continue;
                    }
                    switch (wrkMast.getWrkSts().intValue()) {
                        case 2:
                            // 修改工作档状态 2.设备上走 => 3.小车待搬
@@ -4135,7 +4199,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();
@@ -4246,7 +4312,9 @@
                for (Integer staNo : led.getStaArr()) {
                    // 获取叉车站点
                    StaProtocol staProtocol = devpThread.getStation().get(staNo);
                    if (staProtocol == null) { continue; }
                    if (staProtocol == null) {
                        continue;
                    }
                    if (staProtocol.getWorkNo() != 0) {
                        reset = false;
                        break;
@@ -4276,7 +4344,9 @@
            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; }
            if (Cools.isEmpty(steProtocol, basSte)) {
                continue;
            }
            try {
                // 在线 空闲   无作业标记   不在充电
                if (steProtocol.getMode() == 0
@@ -4363,7 +4433,9 @@
                    } else if (wrkCharge.getWrkSts() == 24L) {
                        // 小车行驶至充电位
                        if (steProtocol.statusType.equals(SteStatusType.IDLE) && steProtocol.getPakMk().equals("N")) {
                            if (steProtocol.getChargeStatus() == 1) { continue; }
                            if (steProtocol.getChargeStatus() == 1) {
                                continue;
                            }
                            // 命令下发区 --------------------------------------------------------------------------
                            SteCommand steCommand = new SteCommand();
                            steCommand.setSteNo(wrkCharge.getSteNo()); // 穿梭车编号
@@ -4383,7 +4455,9 @@
                            }
                        }
                    } else if (wrkCharge.getWrkSts() == 26) {
                        if (steProtocol.getChargeStatus() == 0) { continue; }
                        if (steProtocol.getChargeStatus() == 0) {
                            continue;
                        }
                        // 给输送线下发充电任务
                        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
                        SteChargeType steChargeType = SteChargeType.get(wrkCharge.getLocNo());
@@ -4410,9 +4484,13 @@
    }
    public List<String> crn1DemoLocs = new ArrayList<String>(); public String crn1LastLoc = "";
    public List<String> crn2DemoLocs = new ArrayList<String>(); public String crn2LastLoc = "";
    public List<String> crn3DemoLocs = new ArrayList<String>(); public String crn3LastLoc = "";
    public List<String> crn1DemoLocs = new ArrayList<String>();
    public String crn1LastLoc = "";
    public List<String> crn2DemoLocs = new ArrayList<String>();
    public String crn2LastLoc = "";
    public List<String> crn3DemoLocs = new ArrayList<String>();
    public String crn3LastLoc = "";
    public synchronized void demo() {
        if (Cools.isEmpty(crn1DemoLocs)) {
            crn1DemoLocs = locMastService.getDemoNextLoc(1);
@@ -4447,7 +4525,9 @@
                SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                SteProtocol steProtocol = steThread.getSteProtocol();
                BasSte basSte = basSteService.selectById(steNo);
                if (Cools.isEmpty(steProtocol, basSte)) { continue; }
                if (Cools.isEmpty(steProtocol, basSte)) {
                    continue;
                }
                // 只有当穿梭车空闲 并且 无任务时才继续执行
                if (steProtocol.isIdle()) {
@@ -4529,7 +4609,9 @@
        }
        SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, wrkCharge.getSteNo());
        SteProtocol steProtocol = steThread.getSteProtocol();
        if (null == steProtocol) { return; }
        if (null == steProtocol) {
            return;
        }
        if (steProtocol.isIdle()) {
            // 31.生成演示ID
            if (wrkCharge.getWrkSts() == 31L) {
@@ -4907,6 +4989,7 @@
            e.printStackTrace();
        }
    }
    public synchronized void ioConvert2F() {
        try {
            // 根据输送线plc遍历
@@ -5037,7 +5120,9 @@
                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; }
                if (Cools.isEmpty(steProtocol, basSte)) {
                    continue;
                }
                try{
                    // 在线 空闲   无作业标记   不在充电
                    if (steProtocol.getMode() == 0