rev 堆叠

This commit is contained in:
2023-05-12 09:16:19 +08:00
parent 2746ffdd08
commit 6fb8a1794e
3 changed files with 78 additions and 32 deletions

View File

@@ -205,17 +205,18 @@ public class NDCAgvServiceImpl implements NDCAgvService {
int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height());
int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height());
//默认取货放货高度都为0
int type = Integer.parseInt(inst.getInstruction_type());
// if (startHeight != 0 && nextHeight != 0) {
// //取货放货高度都不为0
// type = 1;
// } else if (startHeight != 0 && nextHeight == 0) {
// //取货高度不为0 放货高度为0
// type = 2;
// } else if (startHeight == 0 && nextHeight != 0) {
// //取货高度为0 放货高度不为0
// type = 3;
// }
//int type = Integer.parseInt(inst.getInstruction_type());
int type = 4;
if (startHeight != 0 && nextHeight != 0) {
//取货放货高度都不为0
type = 1;
} else if (startHeight != 0 && nextHeight == 0) {
//取货高度不为0 放货高度为0
type = 2;
} else if (startHeight == 0 && nextHeight != 0) {
//取货高度为0 放货高度不为0
type = 3;
}
int priority = Integer.parseInt(inst.getPriority()) + 128;
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
@@ -256,37 +257,37 @@ public class NDCAgvServiceImpl implements NDCAgvService {
System.out.println(str);
System.out.println(str1);
// byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
// (byte) 0X00, (byte) 0X08,
// (byte) 0X00, (byte) 0X16,
// (byte) 0X00, (byte) 0X01,
// (byte) 0X00, (byte) 0X71,
// (byte) 0X00, (byte) 0X12,
// (byte) 0X01, prioritylow,
// (byte) 0X00, (byte) 0X01,
// (byte) ikeyhigh, (byte) ikeylow,
// (byte) ikeyhigh, (byte) ikeylow,
// (byte) typehigh, (byte) typelow,
// (byte) qhdhigh, (byte) qhdlow,
// (byte) fhdhigh, (byte) fhdlow,
// (byte) shhigh, (byte) shlow,
// (byte) nhhigh, (byte) nhlow
// };
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X16,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X0E,
(byte) 0X00, (byte) 0X12,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow
(byte) fhdhigh, (byte) fhdlow,
(byte) shhigh, (byte) shlow,
(byte) nhhigh, (byte) nhlow
};
// byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
// (byte) 0X00, (byte) 0X08,
// (byte) 0X00, (byte) 0X12,
// (byte) 0X00, (byte) 0X01,
// (byte) 0X00, (byte) 0X71,
// (byte) 0X00, (byte) 0X0E,
// (byte) 0X01, prioritylow,
// (byte) 0X00, (byte) 0X01,
// (byte) ikeyhigh, (byte) ikeylow,
// (byte) ikeyhigh, (byte) ikeylow,
// (byte) typehigh, (byte) typelow,
// (byte) qhdhigh, (byte) qhdlow,
// (byte) fhdhigh, (byte) fhdlow
// };
log.info("下发AGV作业指令 --{}", str1);
log.info("下发AGV作业指令--{}", str);
log.info("下发agv指令数据--{}", Bytes2HexString(b));
@@ -311,7 +312,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X06,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X12,
(byte) 0X01, (byte) 0X14,
(byte) phasehigh, (byte) phaselow
};

View File

@@ -85,6 +85,22 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_task);
}
public int getTo_strap_times() {
return this.getOpcIntegerValue(item_to_strap_times);
}
public int getTo_length() {
return this.getOpcIntegerValue(item_to_length);
}
public int getTo_weight() {
return this.getOpcIntegerValue(item_to_weight);
}
public int getTo_height() {
return this.getOpcIntegerValue(item_to_height);
}
Boolean isonline;

View File

@@ -111,6 +111,15 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
int to_task = 0;
int last_to_task = 0;
int to_strap_times = 0;
int last_to_strap_times = 0;
int to_length = 0;
int last_to_length = 0;
int to_weight = 0;
int last_to_weight = 0;
int to_height = 0;
int last_to_height = 0;
int phase = 0;
int index = 0;
Boolean isonline = true;
@@ -168,10 +177,26 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task();
heartbeat = this.itemProtocol.getHeartbeat();
to_strap_times = this.itemProtocol.getTo_strap_times();
to_length = this.itemProtocol.getTo_length();
to_weight = this.itemProtocol.getTo_weight();
to_height = this.itemProtocol.getTo_height();
// if(heartbeat != last_heartbeat){
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat" + last_heartbeat + "->" + heartbeat);
// }
if (to_strap_times != last_to_strap_times) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times" + last_to_strap_times + "->" + to_strap_times);
}
if (to_length != last_to_length) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length" + last_to_length + "->" + to_length);
}
if (to_weight != last_to_weight) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_weight" + last_to_weight + "->" + to_weight);
}
if (to_height != last_to_height) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_height" + last_to_height + "->" + to_height);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
@@ -362,6 +387,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
last_to_task = to_task;
last_to_command = to_command;
last_to_target = to_target;
last_to_strap_times = to_strap_times;
last_to_length = to_length;
last_to_weight = to_weight;
last_to_height = to_height;
}
private void shipDeviceUpdate() {