| | |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | import com.zy.core.utils.WmsOperateUtils; |
| | | import com.zy.asrs.entity.BasCrnpErrLog; |
| | | import com.zy.asrs.service.BasCrnpErrLogService; |
| | | |
| | |
| | | private ZyCrnConnectDriver zyCrnConnectDriver; |
| | | private CrnProtocol crnProtocol; |
| | | private int deviceLogCollectTime = 200; |
| | | private List<Integer> lastReportedIndices = new ArrayList<>(); |
| | | |
| | | public ZySiemensCrnThread(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | |
| | | crnProtocol.setYDuration(crnStatus.getYDuration()); |
| | | crnProtocol.setWeight(crnStatus.getWeight()); |
| | | crnProtocol.setDb110Data(crnStatus.getDb110Data()); |
| | | |
| | | // 上报堆垛机DB110状态数据 |
| | | short[] db110Data = crnProtocol.getDb110Data(); |
| | | List<Integer> currentIndices = new ArrayList<>(); |
| | | if (db110Data != null) { |
| | | for (int i = 0; i < db110Data.length; i++) { |
| | | if (db110Data[i] == 1) { |
| | | currentIndices.add(i); |
| | | } |
| | | } |
| | | } |
| | | //!currentIndices.equals(lastReportedIndices) |
| | | boolean changed = true; |
| | | |
| | | if (changed) { |
| | | try { |
| | | WmsOperateUtils wmsOperateUtils = SpringUtils.getBean(WmsOperateUtils.class); |
| | | if (wmsOperateUtils != null) { |
| | | wmsOperateUtils.reportCrnDb110Status(crnProtocol.getCrnNo(), currentIndices); |
| | | lastReportedIndices = new ArrayList<>(currentIndices); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("Report Crn Db110 Status Fail", e); |
| | | } |
| | | } |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), deviceConfig.getDeviceNo())); |
| | | |