|
@@ -48,11 +48,32 @@ public class ManualTaskOperatorUtil {
|
|
|
jsonParam.put("port",devicePort);
|
|
|
jsonParam.put("taskId",manualInfo.getManualId());
|
|
|
jsonParam.put("taskNodeId",manualInfo.getManualId());
|
|
|
-
|
|
|
JSONObject data = new JSONObject();
|
|
|
- data.put("location",location);
|
|
|
+ String manualType = manualInfo.getManualIdType();
|
|
|
+
|
|
|
+ if("execProgram".equals(manualType)) {
|
|
|
+ // 执行程序
|
|
|
+ data.put("remotePath",manualInfo.getExecProgram());
|
|
|
+ }else if("clean".equals(manualType)) {
|
|
|
+ // 清洗
|
|
|
+ data.put("workId",manualInfo.getWorkId());
|
|
|
+ data.put("workType",manualInfo.getExecProgram());
|
|
|
+ }else if("print".equals(manualType)) {
|
|
|
+ // 打标
|
|
|
+ data.put("workId",manualInfo.getWorkId());
|
|
|
+ data.put("labelContent",manualInfo.getLabelContent());
|
|
|
+ }else if("measuring".equals(manualType)) {
|
|
|
+ // 测量
|
|
|
+ data.put("remotePath",manualInfo.getWorkpieceId());
|
|
|
+ data.put("remotePath",manualInfo.getExecProgram());
|
|
|
+ }else{
|
|
|
+ // 机器人相关
|
|
|
+ data.put("location",location);
|
|
|
+ }
|
|
|
jsonParam.put("data",data);
|
|
|
+
|
|
|
return jsonParam.toJSONString();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -66,6 +87,19 @@ public class ManualTaskOperatorUtil {
|
|
|
Map<String,Object> processInfo = new HashMap<String,Object>();
|
|
|
String unit = manualInfo.getDeviceUnit();
|
|
|
String manualType = manualInfo.getManualIdType();
|
|
|
+ String deviceUrl = "";
|
|
|
+ String devicePort = "";
|
|
|
+ // Plc地址
|
|
|
+ if("capsule".equals(unit)){
|
|
|
+ deviceUrl = ZK_ip_zndy;
|
|
|
+ devicePort = ZK_ip_zndy_port;
|
|
|
+ }else if("framework".equals(unit)){
|
|
|
+ deviceUrl = ZK_ip_zndy;
|
|
|
+ devicePort = ZK_ip_zndy_port;
|
|
|
+ }else if("safeguard".equals(unit)){
|
|
|
+ deviceUrl = ZK_ip_zndy;
|
|
|
+ devicePort = ZK_ip_zndy_port;
|
|
|
+ }
|
|
|
if("general".equals(manualType)){
|
|
|
if("capsule".equals(unit)){
|
|
|
// 舱体(智能单元) 代码先写死,6个动作,后续根据resource_code表中获取
|
|
@@ -75,21 +109,16 @@ public class ManualTaskOperatorUtil {
|
|
|
int nextTaskNodeIndex = currentIndex +1;
|
|
|
if("get".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_zndy;
|
|
|
- String devicePort = ZK_ip_zndy_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
setProcessInfo(robotNoMoveTaskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
|
manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
|
|
|
-
|
|
|
}else if("framework".equals(unit)){
|
|
|
int currentIndex = 0;
|
|
|
String taskType = robotNoMoveTaskNodes.get(currentIndex);
|
|
|
int nextTaskNodeIndex = currentIndex +1;
|
|
|
if("move".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/MoveRobotPosition";
|
|
|
- String deviceUrl = ZK_ip_zndy;
|
|
|
- String devicePort = ZK_ip_zndy_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
setProcessInfo(robotNoMoveTaskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
@@ -104,8 +133,6 @@ public class ManualTaskOperatorUtil {
|
|
|
int nextTaskNodeIndex = currentIndex +1;
|
|
|
if("get".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_zndy;
|
|
|
- String devicePort = ZK_ip_zndy_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
setProcessInfo(robotTaskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
@@ -113,10 +140,47 @@ public class ManualTaskOperatorUtil {
|
|
|
}
|
|
|
}else{
|
|
|
// 设备相关
|
|
|
+ if("capsule".equals(unit)){
|
|
|
+ processMachineManualType(manualInfo, processInfo, manualType, deviceUrl, devicePort);
|
|
|
+ }else if("framework".equals(unit)){
|
|
|
+ processMachineManualType(manualInfo, processInfo, manualType, deviceUrl, devicePort);
|
|
|
+ }else if("safeguard".equals(unit)){
|
|
|
+ processMachineManualType(manualInfo, processInfo, manualType, deviceUrl, devicePort);
|
|
|
+ }
|
|
|
+ manualInfo.setNextTaskNodeIndex(-1);
|
|
|
}
|
|
|
return processInfo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设备执行程序通用
|
|
|
+ * @param manualInfo
|
|
|
+ * @param processInfo
|
|
|
+ * @param manualType
|
|
|
+ * @param deviceUrl
|
|
|
+ * @param devicePort
|
|
|
+ */
|
|
|
+ private static void processMachineManualType(ManualInfo manualInfo, Map<String, Object> processInfo, String manualType, String deviceUrl, String devicePort) {
|
|
|
+ if("execProgram".equals(manualType)) {
|
|
|
+ String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartNCProgram";
|
|
|
+ String location = manualInfo.getStartpointId();
|
|
|
+ // 查找设备ip及端口
|
|
|
+ setProcessInfo( new LinkedList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
+ }else if("clean".equals(manualType)) {
|
|
|
+ String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartCleanMachine";
|
|
|
+ String location = manualInfo.getStartpointId();
|
|
|
+ setProcessInfo( new LinkedList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
+ }else if("print".equals(manualType)) {
|
|
|
+ String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartLabelMachine";
|
|
|
+ String location = manualInfo.getStartpointId();
|
|
|
+ setProcessInfo( new LinkedList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
+ }else if("measuring".equals(manualType)) {
|
|
|
+ String hostSyetemTaskUrl = hostSyetemUrl + "/api/StartCoordinateMeasuringMachine";
|
|
|
+ String location = manualInfo.getStartpointId();
|
|
|
+ setProcessInfo( new LinkedList(), processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 处理手动模式回调任务结点信息
|
|
|
* @param taskNodes
|
|
@@ -127,6 +191,21 @@ public class ManualTaskOperatorUtil {
|
|
|
String unit = manualInfo.getDeviceUnit();
|
|
|
String manualType = manualInfo.getManualIdType();
|
|
|
Map<String,Object> processInfo = new HashMap<String,Object>();
|
|
|
+
|
|
|
+ String deviceUrl = "";
|
|
|
+ String devicePort = "";
|
|
|
+ // Plc地址
|
|
|
+ if("capsule".equals(unit)){
|
|
|
+ deviceUrl = ZK_ip_zndy;
|
|
|
+ devicePort = ZK_ip_zndy_port;
|
|
|
+ }else if("framework".equals(unit)){
|
|
|
+ deviceUrl = ZK_ip_zndy;
|
|
|
+ devicePort = ZK_ip_zndy_port;
|
|
|
+ }else if("safeguard".equals(unit)){
|
|
|
+ deviceUrl = ZK_ip_zndy;
|
|
|
+ devicePort = ZK_ip_zndy_port;
|
|
|
+ }
|
|
|
+
|
|
|
if("general".equals(manualType)){
|
|
|
if("capsule".equals(unit)){
|
|
|
int currentIndex = manualInfo.getNextTaskNodeIndex();
|
|
@@ -136,16 +215,12 @@ public class ManualTaskOperatorUtil {
|
|
|
// 执行第一个任务
|
|
|
if("get".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_zndy;
|
|
|
- String deviceUrlPort = ZK_ip_zndy_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}else if("put".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_zndy;
|
|
|
- String deviceUrlPort = ZK_ip_zndy_port;
|
|
|
String location = manualInfo.getEndpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
|
manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
|
|
|
}else if("framework".equals(unit)){
|
|
@@ -158,49 +233,35 @@ public class ManualTaskOperatorUtil {
|
|
|
// 执行第一个任务
|
|
|
if("get".equals(taskType) && currentIndex == 1){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}else if("put".equals(taskType) && currentIndex == 2){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}else if("move".equals(taskType) && currentIndex == 3){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/MoveRobotPosition";
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}if("get".equals(taskType) && currentIndex == 4){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}else if("put".equals(taskType) && currentIndex == 5){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
|
manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
|
|
|
}else if(taskNodes.size() == 3){
|
|
|
if("get".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}else if("put".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
|
|
|
String location = manualInfo.getEndpointId();
|
|
|
- String deviceUrl = ZK_ip_rxx;
|
|
|
- String deviceUrlPort = ZK_ip_rxx_port;
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
|
}
|
|
|
}else if("safeguard".equals(unit)){
|
|
@@ -211,21 +272,15 @@ public class ManualTaskOperatorUtil {
|
|
|
// 执行第一个任务
|
|
|
if("get".equals(taskType)){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/GetIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_zlzx;
|
|
|
- String deviceUrlPort = ZK_ip_zlzx_port;
|
|
|
String location = manualInfo.getStartpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}else if("put".equals(taskType) && currentIndex == 2){
|
|
|
String hostSyetemTaskUrl = hostSyetemUrl + "/api/SendIntelligenceUnit";
|
|
|
- String deviceUrl = ZK_ip_zlzx;
|
|
|
- String deviceUrlPort = ZK_ip_zlzx_port;
|
|
|
String location = manualInfo.getEndpointId();
|
|
|
- setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, deviceUrlPort);
|
|
|
+ setProcessInfo(taskNodes, processInfo, hostSyetemTaskUrl, location, deviceUrl, devicePort);
|
|
|
}
|
|
|
manualInfo.setNextTaskNodeIndex(nextTaskNodeIndex);
|
|
|
}
|
|
|
- }else{
|
|
|
- // 设备相关
|
|
|
}
|
|
|
return processInfo;
|
|
|
}
|