| | |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历入库口 |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); |
| | | BarcodeThread barcodeThreadMat = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcodeMat()); |
| | | |
| | | LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed()); |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (barcodeThreadMat == null) { |
| | | continue; |
| | | } |
| | | |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.stateType == DevpStateType.AUTO //自动 |
| | | && staProtocol.workType == DevpWorkType.BUSY //忙碌 |
| | |
| | | } |
| | | continue; |
| | | } |
| | | barcodeThread.setBarcode(""); |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo()); |
| | | staProtocol.setStaNo(RouteUtils.SouStaEnd(null,wrkMast.getSourceStaNo())); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | barcodeThread.setBarcode(""); |
| | | staProtocol.setWorkNo(dto.getWorkNo()); |
| | | staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo())); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | }else { |
| | | staProtocol.setWorkNo(wrkNo); |
| | | wrkNo++; |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // |
| | | // if (ledThread != null) { |
| | | String errorMsg = jsonObject.getString("msg"); |
| | | if (!Cools.isEmpty(errorMsg)) { |
| | |
| | | |
| | | // 更新站点信息 且 下发plc命令 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo()); |
| | | staProtocol.setStaNo((short) 161); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | log.error("输送线下发5:"+wrkMast.getWrkNo()+","+wrkMast.getStaNo()); |
| | |
| | | } |
| | | |
| | | // 更新工作档状态为14失败 |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMast.setWrkSts(13L); |
| | | wrkMast.setCrnEndTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) != 0) { |
| | | // 复位堆垛机 |
| | |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (!(staProtocol.stateType == DevpStateType.AUTO && staProtocol.workType == DevpWorkType.BUSY && staProtocol.requestType == DevpRequestType.OUT)){ |
| | | if (!(staProtocol.stateType == DevpStateType.AUTO)){ |
| | | continue; |
| | | } |
| | | if (staProtocol.getWorkNo() != 0){ |
| | | if (staProtocol.getWorkNo() == 0){ |
| | | continue; |
| | | } |
| | | WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", staProtocol.getWorkNo()).eq("wrk_sts", 101)); |
| | |
| | | getAgvTaskParam(forwardAGVTaskParam,wrkMast,staProtocol.getSiteId()); |
| | | String request = forwardAGVHttpRequest(forwardAGVTaskParam, "10.0.100.110:8182", "/rcms/services/rest/hikRpcService/genAgvSchedulingTask"); |
| | | if ("SUCCESS".equals(request)) { |
| | | wrkMast.setWrkSts(101L); |
| | | wrkMast.setWrkSts(14L); |
| | | boolean update = wrkMastService.updateById(wrkMast); |
| | | if (update){ |
| | | log.info("入库转发AGV任务完成,任务号:"+wrkMast.getWrkNo()); |
| | |
| | | } |
| | | |
| | | private void getAgvTaskParam(ForwardAGVTaskParam agvTaskCreateParam,WrkMast param,Integer staNo){ |
| | | String sourceSite = ""; |
| | | if (staNo == 1040 || staNo == 1042) { |
| | | sourceSite = "a"; |
| | | } else if (staNo == 2010 || staNo == 2012) { |
| | | sourceSite = "b"; |
| | | } else if(staNo == 3010 || staNo ==3012) { |
| | | sourceSite = "c"; |
| | | } else if(staNo == 2000 || staNo ==2002) { |
| | | sourceSite = "d"; |
| | | } |
| | | List<ForwardAGVTaskParam.PositionCodePaths> agvTaskParamList = Arrays.asList( |
| | | //起始位 |
| | | new ForwardAGVTaskParam.PositionCodePaths(staNo.toString(),"05"), |
| | | //目标位 |
| | | new ForwardAGVTaskParam.PositionCodePaths("a3","05") |
| | | new ForwardAGVTaskParam.PositionCodePaths(sourceSite,"04") |
| | | ); |
| | | Date date = new Date(); |
| | | DecimalFormat df = new DecimalFormat("0000"); |