| | |
| | | import com.zy.core.enums.StationCommandType; |
| | | import com.zy.core.model.CommandResponse; |
| | | import com.zy.core.model.command.StationCommand; |
| | | import com.zy.core.model.protocol.StationTaskBufferItem; |
| | | import com.zy.core.network.api.ZyStationConnectApi; |
| | | import com.zy.core.network.entity.ZyStationStatusEntity; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse clearTaskBufferSlot(Integer deviceNo, Integer stationId, Integer slotIdx) { |
| | | if (deviceNo == null || stationId == null || slotIdx == null || slotIdx <= 0) { |
| | | return new CommandResponse(false, "清理缓存区槽位参数无效"); |
| | | } |
| | | List<ZyStationStatusEntity> statusList = deviceStatusMap.get(deviceNo); |
| | | if (statusList == null) { |
| | | return new CommandResponse(false, "未找到设备状态"); |
| | | } |
| | | for (ZyStationStatusEntity status : statusList) { |
| | | if (status == null || !stationId.equals(status.getStationId())) { |
| | | continue; |
| | | } |
| | | List<StationTaskBufferItem> taskBufferItems = status.getTaskBufferItems(); |
| | | if (taskBufferItems == null || taskBufferItems.isEmpty()) { |
| | | return new CommandResponse(true, "缓存区槽位已为空"); |
| | | } |
| | | for (StationTaskBufferItem item : taskBufferItems) { |
| | | if (item != null && slotIdx.equals(item.getSlotIdx())) { |
| | | item.setTaskNo(0); |
| | | item.setTargetStaNo(0); |
| | | return new CommandResponse(true, "缓存区槽位清理成功"); |
| | | } |
| | | } |
| | | return new CommandResponse(false, "未找到缓存区槽位"); |
| | | } |
| | | return new CommandResponse(false, "未找到站点状态"); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] readOriginCommand(String address, int length) { |
| | | return new byte[0]; |
| | | } |