| | |
| | | import com.zy.core.network.entity.ZyCrnStatusEntity; |
| | | import com.zy.core.service.WrkCommandRollbackService; |
| | | import com.zy.core.thread.CrnThread; |
| | | import com.zy.core.task.DeviceAsyncLogPublisher; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | private ZyCrnConnectDriver zyCrnConnectDriver; |
| | | private CrnProtocol crnProtocol; |
| | | private int deviceLogCollectTime = 200; |
| | | private final DeviceAsyncLogPublisher deviceAsyncLogPublisher; |
| | | |
| | | public ZySiemensCrnThread(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | | this.redisUtil = redisUtil; |
| | | this.deviceAsyncLogPublisher = SpringUtils.getBean(DeviceAsyncLogPublisher.class); |
| | | } |
| | | |
| | | @Override |
| | |
| | | deviceDataLog.setDeviceNo(crnProtocol.getCrnNo()); |
| | | deviceDataLog.setCreateTime(new Date()); |
| | | |
| | | redisUtil.set(RedisKeyType.DEVICE_LOG_KEY.key + System.currentTimeMillis(), deviceDataLog, 60 * 60 * 24); |
| | | deviceAsyncLogPublisher.publishLatest(deviceDataLog); |
| | | //更新采集时间 |
| | | crnProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setAckFinish(0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.CRN_MOVE.id); // 任务模式: 堆垛机移动 |
| | | crnCommand.setSourcePosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setSourcePosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setSourcePosZ(Utils.getLev(targetLocNo)); // 目标库位层 |
| | | crnCommand.setDestinationPosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setDestinationPosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(Utils.getLev(targetLocNo)); // 目标库位层 |