| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.NavigateNode; |
| | |
| | | import com.zy.core.model.protocol.ForkLiftStaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.ForkLiftThread; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | //获取提升机站点 |
| | | public static ForkLiftStaProtocol getLiftStaByLev(Integer liftNo, Integer lev) { |
| | |
| | | return targetNodes; |
| | | } |
| | | |
| | | //通过输送线站号获取对应提升机号 |
| | | public static Integer getConveyorBindLiftNo(Integer staNo) { |
| | | ConfigService configService = SpringUtils.getBean(ConfigService.class); |
| | | if (configService == null) { |
| | | return null; |
| | | } |
| | | |
| | | Config conveyorLiftBindConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "conveyorLiftBind")); |
| | | if(conveyorLiftBindConfig == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<JSONObject> list = JSON.parseArray(conveyorLiftBindConfig.getValue(), JSONObject.class); |
| | | if (list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | for (JSONObject data : list) { |
| | | if(data.getInteger("staNo") == staNo) { |
| | | return data.getInteger("liftNo"); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | //请求上级系统,是否允许出库 |
| | | //查询是否有出库权限 |
| | | public static boolean queryOutMission(Integer staNo) { |
| | | ConfigService configService = SpringUtils.getBean(ConfigService.class); |
| | | if (configService == null) { |
| | | return false; |
| | | } |
| | | |
| | | Config queryOutMissionPathEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "queryOutMissionPathEnable")); |
| | | if (queryOutMissionPathEnableConfig != null) { |
| | | String queryOutMissionPathEnable = queryOutMissionPathEnableConfig.getValue(); |
| | | if (!queryOutMissionPathEnable.equals("Y")) { |
| | | return true;//关闭查询出库权限功能 |
| | | } |
| | | } |
| | | |
| | | Config superSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "superSystemUri")); |
| | | if (superSystemUriConfig == null) { |
| | | return false; |
| | | } |
| | | String superSystemUri = superSystemUriConfig.getValue(); |
| | | |
| | | Config queryOutMissionPathConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "queryOutMissionPath")); |
| | | if (queryOutMissionPathConfig == null) { |
| | | return false; |
| | | } |
| | | String missionPath = queryOutMissionPathConfig.getValue(); |
| | | |
| | | try { |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | data.put("staNo", staNo); |
| | | |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(superSystemUri) |
| | | .setPath(missionPath) |
| | | .setJson(JSON.toJSONString(data)) |
| | | .build() |
| | | .doPost(); |
| | | if (response.equals("ok")) { |
| | | return true;//有出库权限 |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |