| | |
| | | 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 { |
| | |
| | | // 任务确认 0:未确认 1:已确认 |
| | | private Short command = 0; |
| | | |
| | | private String barcode= ""; |
| | | |
| | | public void setTaskMode(Short taskMode){ |
| | | this.taskMode = taskMode; |
| | | this.taskModeType = CrnTaskModeType.get(taskModeType); |
| | |
| | | |
| | | public CrnModeType modeType; |
| | | |
| | | private String Barcode; |
| | | |
| | | private boolean BarcodeResult; |
| | | |
| | | /** |
| | | * 1 = 急停 |
| | | */ |
| | |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 50); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 65); |
| | | if (result.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | |
| | | crnProtocol.setTemp3(siemensNet.getByteTransform().TransInt16(result.Content, 24)); |
| | | crnProtocol.setTemp4(siemensNet.getByteTransform().TransInt16(result.Content, 26)); |
| | | crnProtocol.setxSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 28)); |
| | | crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 30)); |
| | | crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32)); |
| | | crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 34)); |
| | | crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 36)); |
| | | crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 38)); |
| | | crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 40)); |
| | | crnProtocol.setySpeed(siemensNet.getByteTransform().TransInt16(result.Content, 32)); |
| | | crnProtocol.setzSpeed(siemensNet.getByteTransform().TransInt16(result.Content, 36)); |
| | | crnProtocol.setxDistance(siemensNet.getByteTransform().TransInt16(result.Content, 40)); |
| | | crnProtocol.setyDistance(siemensNet.getByteTransform().TransInt16(result.Content, 44)); |
| | | crnProtocol.setxDuration(siemensNet.getByteTransform().TransInt16(result.Content, 48)); |
| | | crnProtocol.setyDuration(siemensNet.getByteTransform().TransInt16(result.Content, 52)); |
| | | crnProtocol.setBarcodeResult(siemensNet.getByteTransform().TransBool(result.Content, 56)); |
| | | crnProtocol.setBarcode(siemensNet.getByteTransform().TransString(result.Content, 58,6,"UTF-8")); |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | array[10] = command.getDestinationStaNo(); |
| | | array[11] = command.getCommand(); |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | OperateResult result2 = siemensNet.Write("DB100.20", command.getBarcode()); |
| | | |
| | | |
| | | if (command.getAckFinish() == 0) { |
| | | short commandFinish = 1; |
| | |
| | | } |
| | | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.190",(short)(barcodeSize*12)); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.190",(short)(barcodeSize*6)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*12,12, "UTF-8"); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*6,6, "UTF-8"); |
| | | // String barcode=new String(result2.Content,i*12,12); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |