#
野心家
2023-03-11 18a81e48e6559009ec39d2c2e28d64312f204189
#
1个文件已修改
104 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -517,8 +517,35 @@
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        for (CrnSlave crnSlave : slaveProperties.getCrn()) {
            // 遍历堆垛机出库站
            for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) {
            //查询工作档
            List<WrkMast> wrkMasts= wrkMastService.selectList(new EntityWrapper<WrkMast>()
                    .eq("crn_no",crnSlave.getCrnOutStn())
                    .and()
                    .gt("io_type",100)
                    .orderBy("appe_time")
            );
            if(Cools.isEmpty(wrkMasts)){
                continue;
            }
            //遍历任务档,按生成时间进行排序
            for (WrkMast wrkMast: wrkMasts) {
                // 判断工作档条件
                if (wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
                    continue;
                }
                CrnSlave.CrnStn crnStn = null;
                for (CrnSlave.CrnStn crnStn1 : crnSlave.getCrnOutStn()) {
                    if (crnStn1.getStaNo() == wrkMast.getSourceStaNo()) {
                        crnStn = crnStn1;
                        break;
                    } else {
                        continue;
                    }
                }
                if (Cools.isEmpty(crnStn)) {
                    continue;
                }
                // 获取堆垛机出库站信息
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
                StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
@@ -528,15 +555,8 @@
                    staProtocol = staProtocol.clone();
                }
                if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
                    // 查询工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId());
                    if (wrkMast == null) {
                        continue;
                    }
                    // 判断工作档条件
                    if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
                        continue;
                    }
                    // 判断吊车是否实际已完成,且电脑状态在move中,以备电脑进行更新工作档
                    CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo());
                    CrnProtocol crnProtocol = crnThread.getCrnProtocol();
@@ -575,6 +595,68 @@
        }
    }
//    public synchronized void crnStnToOutStn1() {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
//
//        for (CrnSlave crnSlave : slaveProperties.getCrn()) {
//            // 遍历堆垛机出库站
//            for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) {
//                // 获取堆垛机出库站信息
//                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
//                StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
//                if (staProtocol == null) {
//                    continue;
//                } else {
//                    staProtocol = staProtocol.clone();
//                }
//                if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
//                    // 查询工作档
//                    WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId());
//                    if (wrkMast == null) {
//                        continue;
//                    }
//                    // 判断工作档条件
//                    if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
//                        continue;
//                    }
//                    // 判断吊车是否实际已完成,且电脑状态在move中,以备电脑进行更新工作档
//                    CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo());
//                    CrnProtocol crnProtocol = crnThread.getCrnProtocol();
//                    if (crnProtocol.statusType == CrnStatusType.FETCHING || crnProtocol.statusType == CrnStatusType.PUTTING) {
//                        // 移动中
//                        continue;
//                    }
//                    //  判断堆垛机状态等待确认
//                    if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue())
//                            && crnProtocol.statusType == CrnStatusType.WAITING
//                            && crnProtocol.forkPosType == CrnForkPosType.HOME) {
//
//                        // 命令下发区 --------------------------------------------------------------------------
//
//                        // 下发站点信息
//                        staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
//                        staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
//                        if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) {
//                            continue;
//                        }
//
//                        // 更新工作档状态为14失败
//                        wrkMast.setWrkSts(14L);
//                        wrkMast.setCrnEndTime(new Date());
//                        if (wrkMastMapper.updateById(wrkMast) != 0) {
//                            // 复位堆垛机
//                            crnThread.setResetFlag(true);
//                        } else {
//                            News.error(methodName + ":更新工作档的工作状态为14失败!!! [工作号:{}]", wrkMast.getWrkNo());
//                        }
//
//                    }
//
//                }
//            }
//        }
//    }
    /**
     * 入出库  ===>>  堆垛机入出库作业下发
     */