| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.wcs.core.domain.dto.RedisMapDto; |
| | | import com.zy.asrs.wcs.core.entity.*; |
| | | import com.zy.asrs.wcs.core.kernel.AnalyzeService; |
| | | import com.zy.asrs.wcs.core.model.MapNode; |
| | |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.entity.DeviceType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.StaProtocol; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceTypeService; |
| | | import com.zy.asrs.wcs.rcs.thread.DevpThread; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import com.zy.asrs.wcs.system.entity.Dict; |
| | |
| | | private MotionService motionService; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | @Autowired |
| | | private DeviceTypeService deviceTypeService; |
| | | @Autowired |
| | | private LocCtgService locCtgService; |
| | | @Autowired |
| | |
| | | mapNode.setRow(object.getInteger("row")); |
| | | mapNode.setBay(object.getInteger("bay")); |
| | | mapNode.setNo(object.getString("row") + "-" + object.getString("bay")); |
| | | mapNode.setXBase(object.getInteger("refx")); |
| | | mapNode.setYBase(object.getInteger("refy")); |
| | | nodes.add(mapNode); |
| | | } |
| | | |
| | |
| | | mapNode.setRow(0); |
| | | mapNode.setBay(0); |
| | | mapNode.setNo("0-0"); |
| | | mapNode.setXBase(0); |
| | | mapNode.setYBase(0); |
| | | |
| | | //获取最长row |
| | | int row = 0; |
| | |
| | | |
| | | Integer lev = entry.getKey(); |
| | | Date now = new Date(); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("data", JSON.toJSONString(lists)); |
| | | map.put("create_time", now); |
| | | map.put("update_time", now); |
| | | map.put("lev", lev); |
| | | RedisMapDto map = new RedisMapDto(); |
| | | map.setData(JSON.toJSONString(lists)); |
| | | map.setCreateTime(now); |
| | | map.setUpdateTime(now); |
| | | map.setLev(lev); |
| | | |
| | | //将地图数据存入redis |
| | | redisUtil.set(DeviceRedisConstant.MAP + lev, JSON.toJSONString(map)); |
| | |
| | | return; |
| | | } |
| | | |
| | | DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() |
| | | .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)) |
| | | .eq(DeviceType::getStatus, 1)); |
| | | if (deviceType == null) { |
| | | return; |
| | | } |
| | | |
| | | List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, deviceType.getId()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getStatus, 1)); |
| | | for (Device device : list) { |
| | | //获取四向穿梭车线程 |
| | |
| | | } |
| | | |
| | | if (!shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.IDLE)) { |
| | | continue; |
| | | } |
| | | |
| | | if (!shuttleThread.isRequireCharge()) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() |
| | | .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)) |
| | | .eq(DeviceType::getStatus, 1)); |
| | | if (deviceType == null) { |
| | | return; |
| | | } |
| | | |
| | | List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceType, deviceType.getId()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getStatus, 1)); |
| | | for (Device device : list) { |
| | | //获取四向穿梭车线程 |
| | |
| | | continue; |
| | | } |
| | | |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (!shuttleThread.isCharging()) { |
| | | continue; |
| | | } |