| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | |
| | | private RedisUtil redisUtil; |
| | | private ZyStationConnectDriver zyStationConnectDriver; |
| | | private int deviceLogCollectTime = 200; |
| | | private boolean initStatus = false; |
| | | private long deviceDataLogTime = System.currentTimeMillis(); |
| | | private ExecutorService executor = Executors.newFixedThreadPool(9999); |
| | | |
| | |
| | | Thread readThread = new Thread(() -> { |
| | | while (true) { |
| | | try { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | if (initStatus) { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | } |
| | | readStatus(); |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | | log.error("StationV4Thread Fail", e); |
| | | } |
| | | } |
| | | }); |
| | | }, "DevpRead-" + deviceConfig.getDeviceNo()); |
| | | readThread.start(); |
| | | |
| | | Thread processThread = new Thread(() -> { |
| | |
| | | log.error("StationV4Process Fail", e); |
| | | } |
| | | } |
| | | }); |
| | | }, "DevpProcess-" + deviceConfig.getDeviceNo()); |
| | | processThread.start(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | BasDevp basDevp = basDevpService |
| | | .selectOne(new EntityWrapper<BasDevp>().eq("devp_no", deviceConfig.getDeviceNo())); |
| | | .getOne(new QueryWrapper<BasDevp>().eq("devp_no", deviceConfig.getDeviceNo())); |
| | | if (basDevp == null) { |
| | | return; |
| | | } |
| | |
| | | stationProtocol.setStationId(entity.getStationId()); |
| | | statusList.add(stationProtocol); |
| | | } |
| | | initStatus = true; |
| | | } |
| | | |
| | | List<ZyStationStatusEntity> zyStationStatusEntities = zyStationConnectDriver.getStatus(); |
| | |
| | | stationProtocol.setRunBlock(statusEntity.isRunBlock()); |
| | | stationProtocol.setEnableIn(statusEntity.isEnableIn()); |
| | | stationProtocol.setWeight(statusEntity.getWeight()); |
| | | stationProtocol.setTaskWriteIdx(statusEntity.getTaskWriteIdx()); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(stationProtocol.getSystemWarning())) { |
| | |
| | | JSON.toJSONString(commandResponse) |
| | | ); |
| | | if (optService != null) { |
| | | optService.insert(basStationOpt); |
| | | optService.save(basStationOpt); |
| | | } |
| | | } |
| | | return commandResponse; |
| | |
| | | List<Integer> path = JSON.parseArray(JSON.toJSONString(original.getNavigatePath(), SerializerFeature.DisableCircularReferenceDetect), Integer.class); |
| | | List<Integer> liftTransferPath = JSON.parseArray(JSON.toJSONString(original.getLiftTransferPath(), SerializerFeature.DisableCircularReferenceDetect), Integer.class); |
| | | if (path == null || path.isEmpty()) { |
| | | // 同站点任务不会生成路径,但仍需下发命令写入任务数据 |
| | | if (Objects.equals(original.getStationId(), original.getTargetStaNo())) { |
| | | while (true) { |
| | | CommandResponse commandResponse = sendCommand(original); |
| | | if (commandResponse != null && commandResponse.getResult()) { |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(200); |
| | | } catch (Exception ignore) {} |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | if (deviceConfigService == null) { |
| | | return null; |
| | | } |
| | | List<DeviceConfig> devpList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | List<DeviceConfig> devpList = deviceConfigService.list(new QueryWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.Devp))); |
| | | for (DeviceConfig dc : devpList) { |
| | | com.zy.core.thread.StationThread t = (com.zy.core.thread.StationThread) SlaveConnection.get(SlaveType.Devp, dc.getDeviceNo()); |