| | |
| | | |
| | | // // 入出库模式判断 |
| | | // if ( inSta.getStaNo()==180 && devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; } |
| | | |
| | | staProtocol.setPakMk(true); |
| | | // 判断是否满足入库条件 |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | |
| | | // } |
| | | |
| | | try { |
| | | |
| | | String pack =null;//pack码 |
| | | if(barcode.length()>6){ |
| | | pack=barcode.substring(6); |
| | | } |
| | | //String pack="MJY0136 0400"; |
| | | barcode=barcode.substring(0,6);//托盘码 |
| | | LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | | locTypeDto.setLocType1((short)1); |
| | | SearchLocParam param = new SearchLocParam(); |
| | |
| | | param.setIoType(1); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | param.setPackNo(pack); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | staProtocol.setWorkNo(dto.getWorkNo().shortValue()); |
| | | staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | |
| | | crnCommand.setSourcePosZ(crnStn.getLev().shortValue()); // 源库位层 |
| | | crnCommand.setDestinationPosX(locMast.getRow1().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层\ |
| | | crnCommand.setBarcode(wrkMast.getBarcode());//托盘码 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setBarcode(wrkMast.getBarcode()); |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | crnCommand.setDestinationPosX(sta.getRow1().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(sta.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(sta.getLev1().shortValue()); // 目标库位层 |
| | | crnCommand.setBarcode(wrkMast.getBarcode());//托盘码 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | devpThread.startSignal[i][0] = newSingle; |
| | | } |
| | | } |
| | | try{ |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("channel",(i+1))); |
| | | messageQueueOffer2(i,(short)((int)locMast.getFireStatus()),SlaveType.Devp, devp.getId()); |
| | | }catch (Exception e){ |
| | | log.error("火警 ===>> 给输送线发送警报失败,通道号:", i+1); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | staProtocol.setSiteId(i*2);//寄存器地址 |
| | | staProtocol.setStaNo(newSingle);//修改PLC寄存器地址值,8==>0 |
| | | return MessageQueue.offer(devp, id, new Task(3, staProtocol)); |
| | | } |
| | | |
| | | public boolean messageQueueOffer2(int i ,short newSingle,SlaveType devp,Integer id){ |
| | | //复位PLC信号,借用输送站点实体类 |
| | | StaProtocol staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(i*2);//寄存器地址 |
| | | staProtocol.setStaNo(newSingle);//修改PLC寄存器地址值,8==>0 |
| | | return MessageQueue.offer(devp, id, new Task(5, staProtocol)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 103站点有物下发pack码 |
| | | */ |
| | | @Transactional |
| | | public void packDevp() { |
| | | try { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("bas_devp",103)); |
| | | if (Cools.isEmpty(basDevp)){ |
| | | log.error("103站点查询失败-MainServiceImpl.java-2255行"); |
| | | } |
| | | if (basDevp.getAutoing().equals("Y") && basDevp.getWrkNo()>0 && basDevp.getLoading().equals("Y") ){ |
| | | WrkDetl wrkDetl = wrkDetlService.devpPackNo(basDevp.getWrkNo()); |
| | | if (Cools.isEmpty(wrkDetl)){ |
| | | log.error("103站点查询失败-MainServiceImpl.java-2255行"); |
| | | } |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4,wrkDetl.getMatnr())); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("103 ===>> 给输送线发送Pack码失败", e); |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | } |