opt:内包间行架和插拔轴机驱动代码优化
This commit is contained in:
@@ -264,7 +264,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||
}
|
||||
if (action != last_action) {
|
||||
this.setFeedbackSucess(false);
|
||||
this.setRequireSucess(false);
|
||||
|
||||
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||
}
|
||||
@@ -444,6 +445,41 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
}
|
||||
|
||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||
//反馈尺寸
|
||||
if (action == 2) {
|
||||
Instruction inst2 = checkInst();
|
||||
String task_code = inst2.getTask_code();
|
||||
TaskDto taskDto = taskserver.findByCode(task_code);
|
||||
String truss_type = taskDto.getTruss_type();
|
||||
applyManipulatorActionRequest.setType(truss_type);
|
||||
applyManipulatorActionRequest.setTask_code(task_code);
|
||||
applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size));
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
requireSucess = true;
|
||||
message = "反馈LMS成功...";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||
String version = applyManipulatorActionResponse.getVersion();
|
||||
String bushing_num = applyManipulatorActionResponse.getBushing_num();
|
||||
String is_bushing = applyManipulatorActionResponse.getIs_bushing();
|
||||
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "2");
|
||||
map.put("inflatableShaftVersion", version);
|
||||
map.put("tube_num", bushing_num);
|
||||
map.put("is_wrapped", is_bushing);
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||
}
|
||||
}
|
||||
|
||||
//任务完成
|
||||
if (action == 8) {
|
||||
Instruction inst2 = checkInst();
|
||||
@@ -461,8 +497,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 6) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||
if (action != 8) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为完成状态,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||
@@ -499,7 +535,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||
//反馈气胀轴尺寸
|
||||
if (mode == 3) {
|
||||
if (action == 2) {
|
||||
Instruction inst2 = checkInst();
|
||||
String task_code = inst2.getTask_code();
|
||||
TaskDto taskDto = taskserver.findByCode(task_code);
|
||||
@@ -516,7 +552,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
map.put("to_command", "2");
|
||||
map.put("to_task_type", "2");
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||
@@ -539,7 +574,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
map.put("to_command", "3");
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
requireSucess = true;
|
||||
}
|
||||
|
||||
//任务完成
|
||||
@@ -559,8 +594,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 6) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||
if (action != 8) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为完成状态,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||
@@ -594,7 +629,94 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
}
|
||||
|
||||
//从拔轴机取货的新行架任务
|
||||
if (mode == 3 && action == 1 && move == 0 && task > 0) {
|
||||
Instruction inst2 = checkInst();
|
||||
if (ObjectUtil.isNotEmpty(inst2)) {
|
||||
String start_device_code = inst2.getStart_device_code();
|
||||
Device device = deviceAppService.findDeviceByCode(start_device_code);
|
||||
PluggingUnpluggingMachineDeviceDriver pluggingUnpluggingMachineDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof PluggingUnpluggingMachineDeviceDriver) {
|
||||
pluggingUnpluggingMachineDeviceDriver = (PluggingUnpluggingMachineDeviceDriver) device.getDeviceDriver();
|
||||
int mode = pluggingUnpluggingMachineDeviceDriver.getMode();
|
||||
int error1 = pluggingUnpluggingMachineDeviceDriver.getError();
|
||||
int move = pluggingUnpluggingMachineDeviceDriver.getMove();
|
||||
if (mode == 2 && error1 == 0 && move == 1) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "1");
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 1) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为取货中状态,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
}
|
||||
|
||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||
//反馈尺寸
|
||||
if (action == 2) {
|
||||
Instruction inst2 = checkInst();
|
||||
String task_code = inst2.getTask_code();
|
||||
TaskDto taskDto = taskserver.findByCode(task_code);
|
||||
String truss_type = taskDto.getTruss_type();
|
||||
applyManipulatorActionRequest.setType(truss_type);
|
||||
applyManipulatorActionRequest.setTask_code(task_code);
|
||||
applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size));
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
requireSucess = true;
|
||||
message = "反馈LMS成功...";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||
String version = applyManipulatorActionResponse.getVersion();
|
||||
String bushing_num = applyManipulatorActionResponse.getBushing_num();
|
||||
String is_bushing = applyManipulatorActionResponse.getIs_bushing();
|
||||
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "2");
|
||||
map.put("inflatableShaftVersion", version);
|
||||
map.put("tube_num", bushing_num);
|
||||
map.put("is_wrapped", is_bushing);
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||
}
|
||||
}
|
||||
|
||||
//申请放货点
|
||||
if (action == 3) {
|
||||
Instruction inst2 = checkInst();
|
||||
String task_code = inst2.getTask_code();
|
||||
TaskDto taskDto = taskserver.findByCode(task_code);
|
||||
String truss_type = taskDto.getTruss_type();
|
||||
applyManipulatorActionRequest.setType(truss_type);
|
||||
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "3");
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
}
|
||||
|
||||
|
||||
//任务完成
|
||||
@@ -605,8 +727,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
String task_code = inst2.getTask_code();
|
||||
TaskDto taskDto = taskserver.findByCode(task_code);
|
||||
String truss_type = taskDto.getTruss_type();
|
||||
finish_instruction(inst2);
|
||||
this.writing("to_command", "8");
|
||||
finish_instruction(inst2);
|
||||
this.writing("to_command", "8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -618,7 +740,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 8) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||
feedMessage = feedMessage + "动作信号(action)不为完成状态,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||
@@ -680,7 +802,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
map.put("is_wrapped", is_bushing);
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||
@@ -688,6 +809,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
}
|
||||
|
||||
//申请放货点
|
||||
if (action == 3) {
|
||||
Instruction inst2 = checkInst();
|
||||
String task_code = inst2.getTask_code();
|
||||
@@ -705,33 +827,67 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
}
|
||||
if (mode == 3 && action == 4 && task > 0) {
|
||||
|
||||
//申请新取货点
|
||||
if (action == 4) {
|
||||
applyManipulatorActionRequest.setType("4");
|
||||
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
String get_device_code = applyManipulatorActionResponse.getGet_device_code();
|
||||
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "4");
|
||||
map.put("to_new_getpoint", get_device_code);
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
String get_device_code = applyManipulatorActionResponse.getGet_device_code();
|
||||
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "4");
|
||||
map.put("to_new_getpoint", get_device_code);
|
||||
map.put("to_putpoint", put_device_code);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请新取货点,返回参数:" + applyManipulatorActionResponse);
|
||||
message = "申请新取货点成功";
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "申请失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请失败,返回参数:" + applyManipulatorActionResponse);
|
||||
}
|
||||
}
|
||||
|
||||
//申请二次放货点
|
||||
if (action == 5) {
|
||||
applyManipulatorActionRequest.setType("5");
|
||||
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
String put_device_code2 = applyManipulatorActionResponse.getPut_device_code2();
|
||||
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||
String get_device_code = applyManipulatorActionResponse.getGet_device_code();
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
String put_device_code2 = applyManipulatorActionResponse.getPut_device_code2();
|
||||
String detail_type = applyManipulatorActionResponse.getDetail_type();
|
||||
String get_device_code = applyManipulatorActionResponse.getGet_device_code();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "5");
|
||||
map.put("to_task_type", detail_type);
|
||||
map.put("to_two_putpoint", put_device_code2);
|
||||
map.put("to_new_getpoint", get_device_code);
|
||||
this.writing(map);
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请二次放货点,返回参数:" + applyManipulatorActionResponse);
|
||||
message = "申请二次放货点成功";
|
||||
} else {
|
||||
requireSucess = true;
|
||||
message = "申请失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请失败,返回参数:" + applyManipulatorActionResponse);
|
||||
}
|
||||
}
|
||||
|
||||
//缓存库取货完成
|
||||
if (action == 6) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "5");
|
||||
map.put("to_task_type", detail_type);
|
||||
map.put("to_two_putpoint", put_device_code2);
|
||||
map.put("to_new_getpoint", get_device_code);
|
||||
this.writing(map);
|
||||
this.setFeedbackSucess(true);
|
||||
map.put("to_command", "6");
|
||||
requireSucess = true;
|
||||
}
|
||||
|
||||
//缓存库放货完成
|
||||
if (action == 7) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "7");
|
||||
requireSucess = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -743,8 +899,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
String task_code = inst2.getTask_code();
|
||||
TaskDto taskDto = taskserver.findByCode(task_code);
|
||||
String truss_type = taskDto.getTruss_type();
|
||||
finish_instruction(inst2);
|
||||
this.writing("to_command", "8");
|
||||
finish_instruction(inst2);
|
||||
this.writing("to_command", "8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -138,6 +138,9 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
||||
feedback1();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,14 +156,18 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
||||
applyManipulatorActionRequest.setType("7");
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "5");
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
|
||||
message = "套轴完成成功";
|
||||
} else {
|
||||
message = applyManipulatorActionResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "99");
|
||||
requireSucess = true;
|
||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||
message = "套轴失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,14 +177,18 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
||||
applyManipulatorActionRequest.setType("6");
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "4");
|
||||
requireSucess = true;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
|
||||
message = "套轴申请成功";
|
||||
} else {
|
||||
message = applyManipulatorActionResponse.getMessage();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "99");
|
||||
requireSucess = true;
|
||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||
message = "申请失败";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +236,6 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
@@ -276,5 +286,4 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user