zhoushihao
2025-05-12 1bfc807cb95b415d7e40a0b9cd65ff2d9c2314d0
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java
@@ -302,20 +302,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);
        //获取当前需要走那条线