zhoushihao
2025-05-21 ab715ef2873e0841ad3cb6870318d2fb847bc089
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java
@@ -261,11 +261,14 @@
        }
        int firstLength = minTwoFirstLength;
        int secondLength = minTwoSecondLength;
        int fecondMaxLength = 2300;
        if (deviceId == 1) {
            firstLength = minOneFirstLength;
            secondLength = minOneSecondLength;
            fecondMaxLength = 2500;
        }
        if (Math.max(glassInfo.getWidth(), glassInfo.getHeight()) < firstLength || Math.min(glassInfo.getWidth(), glassInfo.getHeight()) < secondLength) {
        if (Math.max(glassInfo.getWidth(), glassInfo.getHeight()) < firstLength || Math.min(glassInfo.getWidth(), glassInfo.getHeight()) < secondLength
                || Math.max(glassInfo.getWidth(), glassInfo.getHeight()) > fecondMaxLength) {
            log.info("进片玻璃尺寸小于{}*{},禁止进笼玻璃id:{},尺寸为{}、{}", firstLength, secondLength, task.getGlassIdIn(), glassInfo.getWidth(), glassInfo.getHeight());
            Date endDate = new Date();
            log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
@@ -302,20 +305,41 @@
        //获取对应的设备状态信息
        ReadWriteEntity oneOutStateEntity = miloService.readFromOpcUa("WL1.WL1.slotState");
        ReadWriteEntity twoOutStateEntity = miloService.readFromOpcUa("WL2.WL2.slotState");
        ReadWriteEntity d06OutStateEntity = miloService.readFromOpcUa("WL2.WL2.d06SlotState");
        //状态有3中情况:0空闲 1忙碌 2禁用
        String oneOutState = "2";
        String twoOutState = "2";
        String oneOutState = Const.OUT_DISABLE;
        String twoOutState = Const.OUT_DISABLE;
        String d06OutState = Const.OUT_DISABLE;
        if (null != oneOutStateEntity && null != oneOutStateEntity.getValue()) {
            oneOutState = oneOutStateEntity.getValue().toString();
        }
        if (null != twoOutStateEntity && null != twoOutStateEntity.getValue()) {
            twoOutState = twoOutStateEntity.getValue().toString();
        }
        if ((cellFlag == 2 && Const.OUT_BUSY.equals(oneOutState) && Const.OUT_BUSY.equals(twoOutState)) || (Const.OUT_DISABLE.equals(oneOutState) && Const.OUT_DISABLE.equals(twoOutState))) {
        //两条线都为禁用则不出玻璃
        if (Const.OUT_DISABLE.equals(oneOutState) && Const.OUT_DISABLE.equals(twoOutState)) {
            log.info("A09、A10为{},{}非自动状态,无法出片", oneOutState, oneOutState);
            return Boolean.FALSE;
        }
        if (null != d06OutStateEntity && null != d06OutStateEntity.getValue()) {
            d06OutState = d06OutStateEntity.getValue().toString();
        }
        //获取d06片台状态
        // 1:一对一的情况下不需要判断d06状态
        // 2:一号线一对多的情况下,获取二号线磨边前片台D07的状态,D07非禁用时,二号线将按照D06片台状态觉得出片
        // 3:二号线一对多的情况下,获取一号线磨边前片台C08的状态,C08非禁用时,一号线将按照D06片台状态觉得出片
        if (cellFlag == 2) {
            if (deviceId == 1) {
                twoOutState = Const.OUT_DISABLE.equals(twoOutState) ? Const.OUT_DISABLE : d06OutState;
            } else {
                oneOutState = Const.OUT_DISABLE.equals(oneOutState) ? Const.OUT_DISABLE : d06OutState;
            }
            if (Const.OUT_BUSY.equals(oneOutState) && Const.OUT_BUSY.equals(twoOutState)) {
                log.info("A09、A10为{},{}非自动状态,无法出片", oneOutState, oneOutState);
                return Boolean.FALSE;
            }
        }
        log.info("开始执行出片/直通任务,任务信息为:{},表名为:{},设备id:{},开始时间:{},一号线状态:{},二号线状态:{}",
                task, tableName, deviceId, startDate, oneOutState, twoOutState);
        //获取当前需要走那条线