| | |
| | | command.setDestinationPosX(param.getRow()); // 目标库位排 |
| | | command.setDestinationPosY(param.getBay()); // 目标库位列 |
| | | command.setDestinationPosZ(param.getLev()); // 目标库位层 |
| | | boolean locSts = isLocSts(param.getRow().toString(), param.getBay().toString(), param.getLev().toString()); |
| | | command.setTraySize(locSts); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | } |
| | | |
| | |
| | | command.setDestinationPosX(param.getRow()); // 目标库位排 |
| | | command.setDestinationPosY(param.getBay()); // 目标库位列 |
| | | command.setDestinationPosZ(param.getLev()); // 目标库位层 |
| | | boolean locSts = isLocSts(param.getSourceRow().toString(), param.getSourceBay().toString(), param.getSourceLev().toString()); |
| | | command.setTraySize(locSts); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | } |
| | | |
| | |
| | | .eq("bay1", command.getSourcePosY()).eq("lev1", command.getSourcePosZ())); |
| | | LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX()) |
| | | .eq("bay1", command.getDestinationPosY()).eq("lev1", command.getDestinationPosZ())); |
| | | VersionUtils.locMoveCheckLocType(sourceLoc, loc); |
| | | if (sourceLoc.getLocType1() != loc.getLocType1()){ |
| | | return R.error("库位类型不一致"); |
| | | } |
| | | // VersionUtils.locMoveCheckLocType(sourceLoc, loc); |
| | | return crnControl(command)?R.ok():R.error(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean isLocSts(String row,String bay,String lev){ |
| | | String loc = String.format("%2d",row)+String.format("%3d",bay)+String.format("%2d",lev); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", loc)); |
| | | if (Cools.isEmpty(locMast)){ |
| | | return false; |
| | | } |
| | | if (locMast.getLocType1() == 2){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | crnCommand.setDestinationPosX(locMast.getRow1().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层 |
| | | crnCommand.setTraySize(locMast.getLocType1() == 2); |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | News.error(""+mark+" - 1"+" - 16"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setTraySize(sourceSta.getLocType1() == 2); //库位类型 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | News.error(""+mark+" - 2"+" - 13"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | News.error(""+mark+" - 3"+" - 2"+" - 工作档库位移转失败,原因:检索目标库位失败!工作号={},源库位={}", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | return; |
| | | } |
| | | if(sta.getLocType1() != sourceSta.getLocType1()){ |
| | | News.error("移库目标库位类型与源库位类型不符"); |
| | | return; |
| | | } |
| | | // 获取堆垛机信息 并 判断是否可入出 |
| | | BasCrnp basCrnp = basCrnpService.selectById(slave.getId()); |
| | | if (!basCrnp.getInEnable().equals("Y") && !basCrnp.getOutEnable().equals("Y")) { |
| | |
| | | crnCommand.setDestinationPosX(sta.getRow1().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(sta.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(sta.getLev1().shortValue()); // 目标库位层 |
| | | crnCommand.setTraySize(sourceSta.getLocType1() == 2); //库位类型 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | News.error(""+mark+" - 3"+" - 4"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | // 任务确认 0:未确认 1:已确认 |
| | | private Short command = 0; |
| | | |
| | | private boolean traySize = false; |
| | | |
| | | public void setTaskMode(Short taskMode){ |
| | | this.taskMode = taskMode; |
| | | this.taskModeType = CrnTaskModeType.get(taskModeType); |
| | |
| | | array[7] = command.getDestinationPosY(); // 目标位置列号 |
| | | array[8] = command.getDestinationPosZ(); // 目标位置层号 |
| | | array[9] = command.getCommand(); |
| | | // array[10] = command.getLocType1(); //新增货物类型下发 |
| | | // array[10] = 0; //备用1 |
| | | |
| | | boolean[] array2 = new boolean[1]; |
| | | array2[0] = command.isTraySize(); |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | OperateResult result2 = siemensNet.Write("DB100.20", array2); |
| | | News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array); |
| | | |
| | | if(!result.IsSuccess){ |
| | | if(!result.IsSuccess || !result2.IsSuccess){ |
| | | News.error("写入堆垛机plc数据失败,重新添加任务到队列 ===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); |
| | | MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | Thread.sleep(100); |
| | |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | Thread.sleep(200); |
| | | try{ |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 18); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20); |
| | | if (resultRead.IsSuccess) { |
| | | CrnCommand one = new CrnCommand(); |
| | | one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2)); |
| | |
| | | one.setDestinationPosX(siemensNet.getByteTransform().TransInt16(resultRead.Content, 12)); |
| | | one.setDestinationPosY(siemensNet.getByteTransform().TransInt16(resultRead.Content, 14)); |
| | | one.setDestinationPosZ(siemensNet.getByteTransform().TransInt16(resultRead.Content, 16)); |
| | | one.setTraySize(siemensNet.getByteTransform().TransBool(resultRead.Content, 20)); |
| | | if (!command.getTaskNo().equals(one.getTaskNo()) || !command.getTaskMode().equals(one.getTaskMode()) |
| | | || !command.getSourcePosX().equals(one.getSourcePosX()) || !command.getSourcePosY().equals(one.getSourcePosY()) |
| | | || !command.getSourcePosZ().equals(one.getSourcePosZ()) || !command.getDestinationPosX().equals(one.getDestinationPosX()) |
| | | || !command.getDestinationPosY().equals(one.getDestinationPosY()) || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) |
| | | || !command.isTraySize() == one.isTraySize() |
| | | ){ |
| | | try{ |
| | | News.error("堆垛机命令地址写入后回读失败[id:{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), JSON.toJSON(command),JSON.toJSON(one)); |