| | |
| | | import com.zy.asrs.entity.DeviceDataLog; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.DeviceDataLogService; |
| | | import com.zy.asrs.service.impl.RcsServiceImpl; |
| | | import com.zy.common.utils.News; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.*; |
| | |
| | | } |
| | | } |
| | | |
| | | //外形检测 |
| | | //外形检测 - 带防抖处理 |
| | | Integer[] arr={401,402}; |
| | | OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.700.0", (short) (arr.length*6)); |
| | | OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.702.0", (short) (arr.length*6)); |
| | | |
| | | for (int i = 0; i < arr.length; i++) { |
| | | StaProtocol staProtocol1 = station.get(arr[i]); |
| | | if(resultErr1.IsSuccess){ |
| | | if(resultErr1.IsSuccess && staProtocol1 != null){ |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, i*6, 1); |
| | | |
| | | // 【新增】保存旧的超高状态 |
| | | boolean oldHighError = staProtocol1.isHighError(); |
| | | |
| | | // 更新所有状态 |
| | | staProtocol1.setFrontError(status1[0]); |
| | | staProtocol1.setBackError(status1[1]); |
| | | staProtocol1.setHighError(status1[2]); |
| | | staProtocol1.setHighError(status1[2]); // 超高状态 |
| | | staProtocol1.setLeftError(status1[3]); |
| | | staProtocol1.setRightError(status1[4]); |
| | | staProtocol1.setWeightError(status1[5]); |
| | | staProtocol1.setBarcodeError(status1[6]); |
| | | |
| | | // 【新增】超高状态变化处理 - 只有变化时才调用 |
| | | if (oldHighError != status1[2]) { |
| | | try { |
| | | RcsServiceImpl rcsService = SpringUtils.getBean(RcsServiceImpl.class); |
| | | if (rcsService != null) { |
| | | rcsService.agvPause(staProtocol1); |
| | | log.info("超高状态变化 - 站点: {}, 状态: {} -> {}, 已调用AGV控制", |
| | | arr[i], oldHighError, status1[2]); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("调用agvPause失败 - 站点: {}, 错误: {}", arr[i], e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |