| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.service.BasMapService; |
| | | import com.zy.asrs.service.DeviceConfigService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.MapNode; |
| | |
| | | import com.zy.core.enums.MapNodeType; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.ForkLiftSlave; |
| | | import com.zy.core.model.protocol.ForkLiftStaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.ForkLiftThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | public class NavigateMapData { |
| | | |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | private DeviceConfigService deviceConfigService; |
| | | @Autowired |
| | | private BasMapService basMapService; |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int[][] parseJsonDataArr(List<List<MapNode>> lists) { |
| | | int[][] map = new int[lists.size()][]; |
| | | int j = 0; |
| | | for (List<MapNode> list : lists) { |
| | | int[] tmp = new int[list.size()]; |
| | | int i = 0; |
| | | for (MapNode mapNode : list) { |
| | | //将数据添加进二维数组 |
| | | tmp[i++] = mapNode.getValue(); |
| | | } |
| | | //数据添加进一维数组 |
| | | map[j++] = tmp; |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | mapNode.setLocSts(locMast.getLocSts()); |
| | | mapNode.setLocNo(locMast.getLocNo()); |
| | | |
| | | //更新list |
| | | list.set(bay, mapNode); |
| | | lists.set(row, list); |
| | |
| | | public List<List<MapNode>> loadForkLift(List<List<MapNode>> lists, Integer mapType, Integer lev) { |
| | | try { |
| | | //加载货叉提升机放货点位数据 |
| | | for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) { |
| | | ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, forkLiftSlave.getId()); |
| | | List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.ForkLift))); |
| | | for (DeviceConfig device : forkliftList) { |
| | | ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo()); |
| | | if (forkLiftThread == null) { |
| | | continue; |
| | | } |