|  |  | 
 |  |  | package com.zy.asrs.service.impl; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.core.common.R; | 
 |  |  | import com.core.common.SpringUtils; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | import com.zy.asrs.domain.enums.WmsWrkStatusType; | 
 |  |  | import com.zy.asrs.entity.WmsWrk; | 
 |  |  | import com.zy.asrs.entity.param.WmsWrkCreateParam; | 
 |  |  | import com.zy.asrs.service.OpenService; | 
 |  |  | import com.zy.asrs.service.WmsWrkService; | 
 |  |  | import com.zy.asrs.domain.enums.TaskStatusType; | 
 |  |  | import com.zy.asrs.domain.enums.WorkNoType; | 
 |  |  | import com.zy.asrs.entity.*; | 
 |  |  | import com.zy.asrs.entity.param.TaskOverParam; | 
 |  |  | import com.zy.asrs.entity.param.WMSAndAGVInterfaceParam; | 
 |  |  | import com.zy.asrs.entity.param.TaskCreateParam; | 
 |  |  | import com.zy.asrs.service.*; | 
 |  |  | import com.zy.asrs.utils.Utils; | 
 |  |  | import com.zy.common.service.CommonService; | 
 |  |  | import com.zy.common.utils.HttpHandler; | 
 |  |  | import com.zy.core.DevpThread; | 
 |  |  | import com.zy.core.cache.MessageQueue; | 
 |  |  | import com.zy.core.cache.SlaveConnection; | 
 |  |  | import com.zy.core.enums.SlaveType; | 
 |  |  | import com.zy.core.model.DevpSlave; | 
 |  |  | import com.zy.core.model.Task; | 
 |  |  | import com.zy.core.model.protocol.StaProtocol; | 
 |  |  | import com.zy.core.properties.SlaveProperties; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.beans.factory.annotation.Value; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.Date; | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | @Service | 
 |  |  | public class OpenServiceImpl implements OpenService { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private WmsWrkService wmsWrkService; | 
 |  |  |     private TaskWrkService taskWrkService; | 
 |  |  |     @Autowired | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private ApiLogService apiLogService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private StaDescService staDescService; | 
 |  |  |     @Autowired | 
 |  |  |     private CommonService commonService; | 
 |  |  |     @Autowired | 
 |  |  |     private LocMastService locMastService; | 
 |  |  |     @Autowired | 
 |  |  |     private BasDevpService basDevpService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Value("${wms.url}") | 
 |  |  |     private String wmsUrl; | 
 |  |  |     public ArrayList<String> wharfCode1 = new ArrayList<String>(){{ | 
 |  |  |         add("J-1101"); add("J-1103"); add("J-1105"); add("J-1107"); add("J-1109"); add("J-1111");add("H-1101"); | 
 |  |  |         add("G-1101"); | 
 |  |  |     }}; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void wmsWrkCreate(WmsWrkCreateParam param) { | 
 |  |  |         WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(param.getWmsWrkNo()); | 
 |  |  |         if (wmsWrk != null) { | 
 |  |  |             throw new CoolException(param.getWmsWrkNo() + "任务已存在,请勿重复提交"); | 
 |  |  |     public R taskCreate(TaskCreateParam param) { | 
 |  |  |         TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); | 
 |  |  |         if (taskWrk != null) { | 
 |  |  |             try{ | 
 |  |  |                 DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  |                 deviceErrorService.addDeviceError("wmsErr", 1, "任务已存在,请勿重复提交,taskWrk:"+JSON.toJSONString(taskWrk)); | 
 |  |  |             } catch (Exception e2){ | 
 |  |  | //                    log.error("e2:"+e2.getMessage()); | 
 |  |  |             } | 
 |  |  |             throw new CoolException(param.getTaskNo() + "任务已存在,请勿重复提交"); | 
 |  |  |         } | 
 |  |  |         if (param.getIoType().equals(0)){ | 
 |  |  |             try{ | 
 |  |  |                 DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  |                 deviceErrorService.addDeviceError("wmsErr", 1, "生成任务失败,任务类型不存在!,iotype:"+JSON.toJSONString(param.getIoType())); | 
 |  |  |             } catch (Exception e2){ | 
 |  |  | //                    log.error("e2:"+e2.getMessage()); | 
 |  |  |             } | 
 |  |  |             throw new CoolException("生成任务失败,任务类型不存在!"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Date now = new Date(); | 
 |  |  |         wmsWrk = new WmsWrk(); | 
 |  |  |         wmsWrk.setWmsWrkNo(param.getWmsWrkNo());//WMS任务号 | 
 |  |  |         wmsWrk.setWmsStatus(WmsWrkStatusType.RECEIVE.id);//WMS状态:接收 | 
 |  |  |         wmsWrk.setCreateTime(now); | 
 |  |  |         wmsWrk.setAppeTime(now); | 
 |  |  |         wmsWrk.setAppeUser(9527L); | 
 |  |  |         wmsWrk.setIoType(param.getIoType());//任务类型 | 
 |  |  |         wmsWrk.setIoPri(13D);//优先级 | 
 |  |  |         wmsWrk.setBarcode(param.getBarcode());//条码 | 
 |  |  |         if (!Cools.isEmpty(param.getLocNo())) { | 
 |  |  |             wmsWrk.setLocNo(param.getLocNo());//目标库位 | 
 |  |  |         taskWrk = new TaskWrk(); | 
 |  |  |         int workNo1 = 0;//获取入库工作号 | 
 |  |  |         if (param.getIoType() .equals(1)){ | 
 |  |  |             workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type); | 
 |  |  |         } else if (param.getIoType() .equals(2)){ | 
 |  |  |             workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type); | 
 |  |  |         } else { | 
 |  |  |             workNo1 = commonService.getWorkNo(WorkNoType.PICK.type); | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(param.getSourceLocNo())) { | 
 |  |  |             wmsWrk.setSourceLocNo(param.getSourceLocNo());//源库位 | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(param.getStaNo())) { | 
 |  |  |             wmsWrk.setStaNo(param.getStaNo());//目标站 | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(param.getSourceStaNo())) { | 
 |  |  |             wmsWrk.setSourceStaNo(param.getSourceStaNo());//源站 | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(param.getMemo())) { | 
 |  |  |             wmsWrk.setMemo(param.getMemo());//备注 | 
 |  |  |         taskWrk.setTaskNo(param.getTaskNo());//任务号 | 
 |  |  |         taskWrk.setWrkNo(workNo1); | 
 |  |  |         taskWrk.setStatus(TaskStatusType.RECEIVE.id);//任务状态:接收 | 
 |  |  |         taskWrk.setCreateTime(now); | 
 |  |  |         taskWrk.setModiTime(now); | 
 |  |  |         taskWrk.setAssignTime(new Date()); | 
 |  |  |         taskWrk.setModiUser(6666L); | 
 |  |  | //        try{ | 
 |  |  | //            if (param.getIoType()>1){ | 
 |  |  | //                LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",param.getStartPoint())); | 
 |  |  | //                if (Utils.locNoRowBoolean(locMast.getRow1())){ | 
 |  |  | //                      param.setTaskPriority(11); | 
 |  |  | //                } | 
 |  |  | //            } | 
 |  |  | //        }catch (Exception e){ | 
 |  |  | //        } | 
 |  |  |         taskWrk.setIoPri(param.getTaskPriority()); | 
 |  |  |  | 
 |  |  |         taskWrk.setIoType(param.getIoType());//任务类型 | 
 |  |  |         taskWrk.setIoPri(param.getTaskPriority());//优先级 | 
 |  |  |         taskWrk.setBarcode(param.getBarcode());//条码 | 
 |  |  |         taskWrk.setCrnNo(param.getCrn()); | 
 |  |  |         if(param.getIoType() == 1){ | 
 |  |  |             taskWrk.setWrkSts(1); | 
 |  |  |             if (!Cools.isEmpty(param.getTargetPoint())) { | 
 |  |  | //                taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//终点  转换下 | 
 |  |  |                 taskWrk.setTargetPoint(param.getTargetPoint());//终点 | 
 |  |  |                 taskWrk.setStartPoint(param.getStartPoint()); | 
 |  |  |                 taskWrk.setOriginStartPoint(param.getStartPointSta().toString()); | 
 |  |  |                 taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } else if (param.getIoType() == 2) { | 
 |  |  |             taskWrk.setWrkSts(11); | 
 |  |  |             if (!Cools.isEmpty(param.getStartPoint())) { | 
 |  |  |                 taskWrk.setStartPoint(param.getStartPoint());//起点 | 
 |  |  |                 taskWrk.setTargetPoint(param.getTargetPoint()); | 
 |  |  |             } | 
 |  |  |             taskWrk.setTargetPoint(param.getTargetPoint()); | 
 |  |  |             taskWrk.setOriginStartPoint(param.getStartPointSta().toString()); | 
 |  |  |             taskWrk.setOriginTargetPoint(param.getTargetPointSta().toString()); | 
 |  |  |         }else if (param.getIoType() == 3){ | 
 |  |  |             taskWrk.setWrkSts(11); | 
 |  |  |             if (!Cools.isEmpty(param.getStartPoint())) { | 
 |  |  |                 taskWrk.setStartPoint(param.getStartPoint());//起点 | 
 |  |  |                 taskWrk.setTargetPoint(param.getTargetPoint()); | 
 |  |  |                 taskWrk.setOriginStartPoint("0"); | 
 |  |  |                 taskWrk.setOriginTargetPoint("0"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (!wmsWrkService.insert(wmsWrk)) { | 
 |  |  |             throw new CoolException("生成任务失败,请联系管理员"); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         if (!Cools.isEmpty(param.getMemo())) { | 
 |  |  |             taskWrk.setMemo(param.getMemo());//备注 | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (!taskWrkService.insert(taskWrk)) { | 
 |  |  |             try{ | 
 |  |  |                 DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); | 
 |  |  |                 deviceErrorService.addDeviceError("wmsErr", 1, "创建任务失败!,param:"+JSON.toJSONString(param)); | 
 |  |  |             } catch (Exception e2){ | 
 |  |  | //                    log.error("e2:"+e2.getMessage()); | 
 |  |  |             } | 
 |  |  |             return R.error("创建任务失败"); | 
 |  |  |         } | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public R AgvToWCSToWms(WMSAndAGVInterfaceParam param) throws IOException { | 
 |  |  |         ToWmsDTO toWmsDTO = new ToWmsDTO(); | 
 |  |  |         Map<String, Object> map = new HashMap<>(); | 
 |  |  |         map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2"); | 
 |  |  |         List<Integer> list = new ArrayList<>(); | 
 |  |  |         if (param.getWharfSource().contains("J")){ | 
 |  |  |             list = getInEnableRoadway(); | 
 |  |  |         }else { | 
 |  |  |             list = getInEnableRoadway2(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); | 
 |  |  |         toWmsDTO.setWarehouseId("1688469798893297665"); | 
 |  |  |         toWmsDTO.setContainerCode(param.getContainerCode()); | 
 |  |  |         toWmsDTO.setApplyType("TUNNEL"); | 
 |  |  |         toWmsDTO.setWharfSource(null); | 
 |  |  |         toWmsDTO.setCanInboundTunnels(list); | 
 |  |  |         String response = null; | 
 |  |  |         try { | 
 |  |  |             response = new HttpHandler.Builder() | 
 |  |  |                     .setHeaders(map) | 
 |  |  |                     .setUri(wmsUrl) | 
 |  |  |                     .setPath("wcsManager/wcsInterface/inboundTaskApply") | 
 |  |  |                     .setJson(JSON.toJSONString(toWmsDTO)) | 
 |  |  |                     .build() | 
 |  |  |                     .doPost(); | 
 |  |  |         }catch (Exception e){ | 
 |  |  |             return R.error("wms连接失败"+e.getMessage()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  |  | 
 |  |  |         apiLogService.save("wms请求入库码头接口" | 
 |  |  |                 ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply" | 
 |  |  |                 ,null | 
 |  |  |                 ,"127.0.0.1" | 
 |  |  |                 ,JSON.toJSONString(toWmsDTO) | 
 |  |  |                 ,response | 
 |  |  |                 ,true | 
 |  |  |         ); | 
 |  |  |  | 
 |  |  |         if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) { | 
 |  |  |             //解析 | 
 |  |  |             List<WMSAndAGVInterfaceParam> params = new ArrayList<>(); | 
 |  |  |             params.add(param); | 
 |  |  |             WMSAndAGVInterfaceParam data = JSONObject.parseObject(jsonObject.get("data").toString(), WMSAndAGVInterfaceParam.class); | 
 |  |  |             String msg = null; | 
 |  |  |             try { | 
 |  |  |                 taskCreate(new TaskCreateParam(data)); | 
 |  |  |             }catch (Exception e){ | 
 |  |  |                 msg = e.getMessage(); | 
 |  |  |             } | 
 |  |  |             if (msg != null){ | 
 |  |  |                 return R.error(msg); | 
 |  |  |             } | 
 |  |  |             Map<String,String> map1 = new HashMap<>(); | 
 |  |  |             StaDesc staDesc = new StaDesc(); | 
 |  |  |             if (param.getWharfSource().contains("J")){ | 
 |  |  |                 staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() | 
 |  |  |                         .eq("crn_no",data.getTaskTunnel()) | 
 |  |  |                         .eq("type_no",1) | 
 |  |  |                         .lt("stn_no",200)); | 
 |  |  |             }else if (param.getWharfSource().contains("H")){ | 
 |  |  |                 staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() | 
 |  |  |                         .eq("crn_no",data.getTaskTunnel()) | 
 |  |  |                         .eq("type_no",1) | 
 |  |  |                         .lt("stn_no",400) | 
 |  |  |                         .gt("stn_no",200)); | 
 |  |  |             }else { | 
 |  |  |                 staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() | 
 |  |  |                         .eq("crn_no",data.getTaskTunnel()) | 
 |  |  |                         .eq("type_no",1) | 
 |  |  |                         .lt("stn_no",500) | 
 |  |  |                         .ge("stn_no",400)); | 
 |  |  |             } | 
 |  |  |             map1.put("taskTunnel", staDesc.getStnDesc()); | 
 |  |  |             //map1.put("taskTunnel", "J-1104"); | 
 |  |  |             return R.ok(map1); | 
 |  |  |         } | 
 |  |  |         return R.error((String) jsonObject.get("msg")); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void getAgvTaskOver(TaskOverParam param) { | 
 |  |  |         // 根据输送线plc遍历 | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() | 
 |  |  |                     .eq("stn_desc", param.getWharfCode())); | 
 |  |  |             if (Cools.isEmpty(staDesc)){ | 
 |  |  |                 throw new RuntimeException("未查询到站点信息"); | 
 |  |  |             } | 
 |  |  |             // 获取入库站信息 | 
 |  |  |             DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  |             StaProtocol staProtocol = devpThread.getStation().get(staDesc.getStnNo()); | 
 |  |  |             if (staProtocol == null) { | 
 |  |  |                 continue; | 
 |  |  |             } else { | 
 |  |  |                 staProtocol = staProtocol.clone(); | 
 |  |  |             } | 
 |  |  |             Integer workNo = staProtocol.getWorkNo(); | 
 |  |  |             if (wharfCode1.contains(param.getWharfCode())){ | 
 |  |  |                 if (!staProtocol.isLoading() && staProtocol.getWorkNo() >0){ | 
 |  |  |                     //AGV出库完成以后 | 
 |  |  |                     staProtocol.setWorkNo( 0); | 
 |  |  |                     staProtocol.setStaNo(0); | 
 |  |  |                     boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); | 
 |  |  |                     if (result) { | 
 |  |  |  | 
 |  |  |                     } else { | 
 |  |  |                         throw new RuntimeException("agv返回完成后,命令下发失败"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             }else { | 
 |  |  |                 for (DevpSlave.Sta inSta : devp.getInSta()) { | 
 |  |  |                     if (inSta.getBackSta().equals(staDesc.getStnNo())){ | 
 |  |  |  | 
 |  |  |                         if (staProtocol.isLoading() && workNo == 0){ | 
 |  |  |                             //AGV入库完成以后 | 
 |  |  |                             staProtocol.setWorkNo(9999); | 
 |  |  |                             staProtocol.setStaNo(inSta.getStaNo()); | 
 |  |  |                             boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); | 
 |  |  |                             if (result) { | 
 |  |  |  | 
 |  |  |                             } else { | 
 |  |  |                                 throw new RuntimeException("agv返回完成后,命令下发失败"); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | //    @Override | 
 |  |  | //    public R getAgvPickAndPlaceV1(TaskOverParam param) { | 
 |  |  | //        BasDevp basDevp = basDevpService.selectById(param.getStaNo()); | 
 |  |  | //        if (Cools.isEmpty(basDevp)){ | 
 |  |  | //            return R.error("站点号有误"+param.getStaNo()); | 
 |  |  | //        } | 
 |  |  | //        if (param.getType()==0 && basDevp.getAgvStartPick()==1){ | 
 |  |  | //            return R.ok(); | 
 |  |  | //        }else if (param.getType()==1 && basDevp.getAgvStartPlace()==1){ | 
 |  |  | //            return R.ok(); | 
 |  |  | //        }else { | 
 |  |  | //            return R.error("不允许"); | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  | //    @Override | 
 |  |  | //    public R getAgvPickAndPlaceV2(TaskOverParam param) { | 
 |  |  | //        BasDevp basDevp = basDevpService.selectById(param.getStaNo()); | 
 |  |  | //        if (Cools.isEmpty(basDevp)){ | 
 |  |  | //            return R.error("站点号有误"+param.getStaNo()); | 
 |  |  | //        } | 
 |  |  | //        if (param.getType()==0){ | 
 |  |  | //            basDevp.setAgvTargetPick(1); | 
 |  |  | //            basDevpService.updateById(basDevp); | 
 |  |  | //            return R.ok(); | 
 |  |  | //        }else if (param.getType()==1){ | 
 |  |  | //            basDevp.setAgvTargetPlace(1); | 
 |  |  | //            basDevpService.updateById(basDevp); | 
 |  |  | //            return R.ok(); | 
 |  |  | //        }else { | 
 |  |  | //            return R.error("请求类型异常"+param.getType()); | 
 |  |  | //        } | 
 |  |  | //    } | 
 |  |  |  | 
 |  |  |     public List<Integer> getInEnableRoadway(){ | 
 |  |  |         int[] roadway = null; | 
 |  |  |         List<Integer> list = new ArrayList<>(); | 
 |  |  |         Map<Integer,Integer> map = new HashMap<>(); | 
 |  |  |         map.put(103,1); | 
 |  |  |         map.put(107,2); | 
 |  |  |         map.put(111,3); | 
 |  |  |         map.put(115,4); | 
 |  |  |         map.put(119,5); | 
 |  |  |         map.put(123,6); | 
 |  |  |         //put(301,7); | 
 |  |  |         // 根据输送线plc遍历 | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             // 遍历入库口 | 
 |  |  |             for (DevpSlave.Sta inSta : devp.getInSta()) { | 
 |  |  |                 // 获取入库站信息 | 
 |  |  |                 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  |                 StaProtocol staProtocol = devpThread.getStation().get(inSta.getBackSta()); | 
 |  |  |                 if (staProtocol == null) { | 
 |  |  |                     continue; | 
 |  |  |                 } else { | 
 |  |  |                     staProtocol = staProtocol.clone(); | 
 |  |  |                 } | 
 |  |  |                 Integer workNo = staProtocol.getWorkNo(); | 
 |  |  |                 if (workNo == 0 && !staProtocol.isLoading()){ | 
 |  |  |                     if (Cools.isEmpty( map.get(inSta.getStaNo()))){ | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     list.add( map.get(inSta.getStaNo())); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         //roadway = list.stream().mapToInt(Integer::intValue).toArray(); | 
 |  |  |         return list; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public List<Integer> getInEnableRoadway2(){ | 
 |  |  |         int[] roadway = null; | 
 |  |  |         List<Integer> list = new ArrayList<>(); | 
 |  |  |         Map<Integer,Integer> map = new HashMap<>(); | 
 |  |  |         map.put(205,1); | 
 |  |  |         map.put(211,2); | 
 |  |  |         map.put(217,3); | 
 |  |  |         map.put(223,4); | 
 |  |  |         map.put(229,5); | 
 |  |  |         map.put(235,6); | 
 |  |  |         //put(301,7); | 
 |  |  |         // 根据输送线plc遍历 | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             // 遍历入库口 | 
 |  |  |             for (DevpSlave.Sta inSta : devp.getInSta()) { | 
 |  |  |                 // 获取入库站信息 | 
 |  |  |                 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  |                 StaProtocol staProtocol = devpThread.getStation().get(inSta.getBackSta()); | 
 |  |  |                 if (staProtocol == null) { | 
 |  |  |                     continue; | 
 |  |  |                 } else { | 
 |  |  |                     staProtocol = staProtocol.clone(); | 
 |  |  |                 } | 
 |  |  |                 Integer workNo = staProtocol.getWorkNo(); | 
 |  |  |                 if (workNo == 0 && !staProtocol.isLoading()){ | 
 |  |  |                     if (Cools.isEmpty( map.get(inSta.getStaNo()))){ | 
 |  |  |                         continue; | 
 |  |  |                     } | 
 |  |  |                     list.add( map.get(inSta.getStaNo())); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         //roadway = list.stream().mapToInt(Integer::intValue).toArray(); | 
 |  |  |         return list; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |