| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.service.DeviceConfigService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.core.cache.SlaveConnection; |
| | |
| | | */ |
| | | public class ForkLiftUtils { |
| | | |
| | | //获取提升机所有站点 |
| | | public static List<Integer> getLiftAllStaNo(Integer liftNo) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftNo); |
| | | if (forkLiftThread == null) { |
| | | return list; |
| | | } |
| | | |
| | | for (ForkLiftStaProtocol forkLiftStaProtocol : forkLiftThread.getForkLiftStaProtocols()) { |
| | | list.add(forkLiftStaProtocol.getStaNo()); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | //获取提升机所绑定的输送线所有站点 |
| | | public static List<Integer> getConveyorBindLiftAllStaNo(Integer liftNo) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | ConfigService configService = SpringUtils.getBean(ConfigService.class); |
| | | if (configService == null) { |
| | | return list; |
| | | } |
| | | |
| | | Config conveyorLiftBindConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "conveyorLiftBind")); |
| | | if(conveyorLiftBindConfig == null) { |
| | | return list; |
| | | } |
| | | |
| | | List<JSONObject> val = JSON.parseArray(conveyorLiftBindConfig.getValue(), JSONObject.class); |
| | | if (val.isEmpty()) { |
| | | return list; |
| | | } |
| | | |
| | | for (JSONObject data : val) { |
| | | if(data.getInteger("liftNo").equals(liftNo)) { |
| | | list.add(data.getInteger("staNo")); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | //获取提升机站点 |
| | | public static ForkLiftStaProtocol getLiftStaByStaNo(Integer staNo) { |
| | | SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | | for (ForkLiftSlave liftSlave : slaveProperties.getForkLift()) { |
| | | ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftSlave.getId()); |
| | | DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class); |
| | | 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) { |
| | | return null; |
| | | } |