| | |
| | | issuedPut.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedPut.setTaskStatus(3); |
| | | issuedPut.setTargetPositionStaNo(basDevpPosition.getDevNo()); |
| | | issuedPut.setTargetPositionStaNoEnd(basDevpPosition.getDevNo$()); |
| | | issuedPut.setTargetPositionStaNoPlcId(basDevpPosition.getPlcId()); |
| | | issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus())); |
| | | issuedPut.setTargetPosition(basDevpPosition.getPlcPosition()); |
| | |
| | | issuedPut.setTaskNo(Long.valueOf(taskNo)); |
| | | issuedPut.setTaskStatus(3); |
| | | issuedPut.setTargetPositionStaNo(basDevpPositionPut.getDevNo()); |
| | | issuedPut.setTargetPositionStaNoEnd(basDevpPositionPut.getDevNo$()); |
| | | issuedPut.setTargetPositionStaNoPlcId(basDevpPositionPut.getPlcId()); |
| | | issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus())); |
| | | issuedPut.setTargetPosition(basDevpPositionPut.getPlcPosition()); |
| | |
| | | // ); |
| | | |
| | | |
| | | public Integer getDevNo$() { |
| | | switch (devNo){ |
| | | case 102: |
| | | case 106: |
| | | case 110: |
| | | case 116: |
| | | case 202: |
| | | case 206: |
| | | case 210: |
| | | case 216: |
| | | return devNo-1; |
| | | case 117: |
| | | case 120: |
| | | case 123: |
| | | case 217: |
| | | case 220: |
| | | case 223: |
| | | return devNo+2; |
| | | } |
| | | return devNo; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | public static Short CrnStaEnd(Integer endSta,Integer souSta) { |
| | | switch (endSta) { |
| | | case 100: |
| | | case 102: |
| | | case 103: |
| | | case 107: |
| | | case 111: |
| | | if (souSta == 118 || souSta == 127){ |
| | | return (short)119; |
| | | } |
| | | return 149; |
| | | case 113: |
| | | case 203: |
| | | case 207: |
| | | case 211: |
| | | case 213: |
| | | return (short)(endSta+1); |
| | | default: |
| | | return endSta.shortValue(); |
| | | } |
| | |
| | | public TaskProtocol(TaskProtocol taskProtocol) { |
| | | this.taskNo = taskProtocol.getTaskNo(); |
| | | this.targetPosition = taskProtocol.getTargetPosition(); |
| | | this.targetPositionStaNo = taskProtocol.getTargetPositionStaNo(); |
| | | this.targetPositionStaNoEnd = taskProtocol.getTargetPositionStaNoEnd(); |
| | | this.taskStatus = taskProtocol.getTaskStatus(); |
| | | this.direction = taskProtocol.direction; |
| | | } |
| | |
| | | public TaskProtocol(TaskProtocol taskProtocol, boolean direction) { |
| | | this.taskNo = taskProtocol.getTaskNo(); |
| | | this.targetPosition = taskProtocol.getTargetPosition(); |
| | | this.targetPositionStaNo = taskProtocol.getTargetPositionStaNo(); |
| | | this.targetPositionStaNoEnd = taskProtocol.getTargetPositionStaNoEnd(); |
| | | this.taskStatus = 1; |
| | | this.direction = taskProtocol.direction; |
| | | } |
| | |
| | | // private RgvProtocol rgvProtocol; |
| | | private TaskProtocolCache taskProtocolCache = new TaskProtocolCache(); |
| | | // # 轨道总长 |
| | | private Long trackEntireLength = 246600L; |
| | | private Long trackEntireLength = 240000L; |
| | | //# 轨道基准点 |
| | | private Long trackBenchmark = 1L; |
| | | // # 避让距离 |
| | |
| | | if (rgvProtocol == null) { |
| | | rgvProtocol = new RgvProtocol(); |
| | | } |
| | | if (rgvProtocol.getStatusType().equals(RgvStatusType.WAITING)){ |
| | | if (rgvProtocol.getStatusType().equals(RgvStatusType.WAITING) || rgvProtocol.getStatusType().equals(RgvStatusType.FETCHWAITING)){ |
| | | OperateResult result2 = siemensNet.Write("DB100.2",(int) 0); |
| | | OperateResult result = siemensNet.Write("DB100.14", (int) 0); |
| | | OperateResult result1 = siemensNet.Write("DB100.6", (short) 0); |
| | | OperateResult result4 = siemensNet.Write("DB100.0", (short) 1); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | //任务下发成功标识 |
| | | boolean writeFlag = false; |
| | | while(writeCount < 5){ |
| | | OperateResult writeResult1 = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo()); // 工作号 |
| | | OperateResult writeResult2 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo().shortValue()); // 目标站 |
| | | OperateResult writeResult1 = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo()); // 工作号 |
| | | if(writeResult1.IsSuccess && writeResult2.IsSuccess){ |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100.0" + index*6, (short)4); |
| | |
| | | |
| | | constant-parameters: |
| | | # 轨道总长 |
| | | trackEntireLength: 246600 |
| | | trackEntireLength: 240000 |
| | | # 轨道基准点 |
| | | trackBenchmark: 1 |
| | | # 轨道转换为米比例 |