rev 内包间行架
This commit is contained in:
@@ -57,7 +57,9 @@ public enum DriverTypeEnum {
|
|||||||
|
|
||||||
DEVICE_STATUS(23,"device_status","立库设备状态","conveyor"),
|
DEVICE_STATUS(23,"device_status","立库设备状态","conveyor"),
|
||||||
|
|
||||||
INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station");
|
INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station"),
|
||||||
|
|
||||||
|
PLUGGING_UNPLUGGING_MACHINE(25,"plugging_unplugging_machine","插拔轴机","station");
|
||||||
|
|
||||||
|
|
||||||
//驱动索引
|
//驱动索引
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
|
|||||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
@@ -199,9 +200,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
device_code = this.getDeviceCode();
|
device_code = this.getDeviceCode();
|
||||||
mode = this.itemProtocol.getMode();
|
mode = this.itemProtocol.getMode();
|
||||||
move = this.itemProtocol.getMove();
|
move = this.itemProtocol.getMove();
|
||||||
if(mode==2){
|
|
||||||
log.info("123");
|
|
||||||
}
|
|
||||||
action = this.itemProtocol.getAction();
|
action = this.itemProtocol.getAction();
|
||||||
walk_y = this.itemProtocol.getWalk_y();
|
walk_y = this.itemProtocol.getWalk_y();
|
||||||
error = this.itemProtocol.getError();
|
error = this.itemProtocol.getError();
|
||||||
@@ -312,10 +310,18 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
logServer.deviceItemValue(this.device_code, "inflatable_shaft_size", String.valueOf(inflatable_shaft_size));
|
logServer.deviceItemValue(this.device_code, "inflatable_shaft_size", String.valueOf(inflatable_shaft_size));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号inflatable_shaft_size:" + last_inflatable_shaft_size + "->" + inflatable_shaft_size);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号inflatable_shaft_size:" + last_inflatable_shaft_size + "->" + inflatable_shaft_size);
|
||||||
}
|
}
|
||||||
if (task > 0) {
|
|
||||||
|
if (task > 0 && getTo_task_type() == 1) {
|
||||||
update_instruction_status();
|
update_instruction_status();
|
||||||
|
} else if (task > 0 && getTo_task_type() == 2) {//
|
||||||
|
update_instruction_status2();
|
||||||
|
} else if (task > 0 && getTo_task_type() == 6) {
|
||||||
|
update_instruction_status3();
|
||||||
|
} else if (task > 0 && getTo_task_type() == 7) {
|
||||||
|
update_instruction_status4();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
feedMessage = var17.getMessage();
|
feedMessage = var17.getMessage();
|
||||||
@@ -367,10 +373,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
this.setNotCreateTaskMessage(remark);
|
this.setNotCreateTaskMessage(remark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mode == 3 && !feedbackSucess && action > 0) {
|
|
||||||
apply_feedback();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
last_move = move;
|
last_move = move;
|
||||||
@@ -416,91 +418,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean apply_feedback() {
|
|
||||||
Date date = new Date();
|
|
||||||
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
|
||||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
|
||||||
if (action == 2) {
|
|
||||||
this.instruction_apply_time = date;
|
|
||||||
message = "完成反馈LMS...";
|
|
||||||
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
|
|
||||||
String start_point_code = null;
|
|
||||||
if (!ObjectUtil.isEmpty(device_json)) {
|
|
||||||
start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code");
|
|
||||||
}
|
|
||||||
applyManipulatorActionRequest.setDevice_code(start_point_code);
|
|
||||||
applyManipulatorActionRequest.setType("2");
|
|
||||||
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
|
||||||
applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size));
|
|
||||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈请求参数:" + JSON.toJSONString(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();
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("to_command", "2");
|
|
||||||
map.put("to_task_type", detail_type);
|
|
||||||
map.put("inflatableShaftVersion", version);
|
|
||||||
map.put("tube_num", bushing_num);
|
|
||||||
map.put("is_wrapped", is_bushing);
|
|
||||||
this.writing(map);
|
|
||||||
this.setFeedbackSucess(true);
|
|
||||||
} else {
|
|
||||||
requireSucess = true;
|
|
||||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (action == 3) {
|
|
||||||
applyManipulatorActionRequest.setType("3");
|
|
||||||
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_task_type", detail_type);
|
|
||||||
map.put("to_putpoint", put_device_code);
|
|
||||||
this.writing(map);
|
|
||||||
this.setFeedbackSucess(true);
|
|
||||||
}
|
|
||||||
if (action == 4) {
|
|
||||||
applyManipulatorActionRequest.setType("4");
|
|
||||||
applyManipulatorActionRequest.setTask_code(String.valueOf(task));
|
|
||||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
|
||||||
String get_device_code = applyManipulatorActionResponse.getGet_device_code();
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("to_command", "4");
|
|
||||||
map.put("to_new_getpoint", get_device_code);
|
|
||||||
this.writing(map);
|
|
||||||
this.setFeedbackSucess(true);
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
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);
|
|
||||||
this.writing(map);
|
|
||||||
this.setFeedbackSucess(true);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
|
||||||
instructionService.finish(inst);
|
instructionService.finish(inst);
|
||||||
@@ -515,7 +432,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_update_time = date;
|
this.instruction_update_time = date;
|
||||||
//更改任务状态
|
//更改任务状态
|
||||||
if (task > 0 && action == 2) {
|
if (task > 0) {
|
||||||
//inst_message
|
//inst_message
|
||||||
Instruction inst1 = checkInst();
|
Instruction inst1 = checkInst();
|
||||||
if (inst1 != null) {
|
if (inst1 != null) {
|
||||||
@@ -527,50 +444,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (task > 0 && action == 3) {
|
//任务完成
|
||||||
//inst_message
|
if (action == 8) {
|
||||||
Instruction inst1 = checkInst();
|
|
||||||
if (inst1 != null) {
|
|
||||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
|
||||||
inst1.setInstruction_status("1");
|
|
||||||
inst1.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (task > 0 && action == 4) {
|
|
||||||
//inst_message
|
|
||||||
Instruction inst1 = checkInst();
|
|
||||||
if (inst1 != null) {
|
|
||||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
|
||||||
inst1.setInstruction_status("1");
|
|
||||||
inst1.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (task > 0 && action == 5) {
|
|
||||||
//inst_message
|
|
||||||
Instruction inst1 = checkInst();
|
|
||||||
if (inst1 != null) {
|
|
||||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
|
||||||
inst1.setInstruction_status("1");
|
|
||||||
inst1.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//放货完成
|
|
||||||
if (mode == 3 && action == 6 && move == 0 && task > 0) {
|
|
||||||
Instruction inst2 = checkInst();
|
Instruction inst2 = checkInst();
|
||||||
if (inst2 != null) {
|
if (inst2 != null) {
|
||||||
try {
|
try {
|
||||||
finish_instruction(inst2);
|
finish_instruction(inst2);
|
||||||
this.writing("to_command", "6");
|
this.writing("to_command", "8");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -596,6 +476,300 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void update_instruction_status2() {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改任务状态
|
||||||
|
if (task > 0) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
|
//反馈气胀轴尺寸
|
||||||
|
if (mode == 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(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));
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//任务完成
|
||||||
|
if (action == 8) {
|
||||||
|
Instruction inst2 = checkInst();
|
||||||
|
if (inst2 != null) {
|
||||||
|
try {
|
||||||
|
finish_instruction(inst2);
|
||||||
|
this.writing("to_command", "8");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
feedMessage = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 6) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void update_instruction_status3() {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改任务状态
|
||||||
|
if (task > 0) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//任务完成
|
||||||
|
if (action == 8) {
|
||||||
|
Instruction inst2 = checkInst();
|
||||||
|
if (inst2 != null) {
|
||||||
|
try {
|
||||||
|
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");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
feedMessage = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 8) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void update_instruction_status4() {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改任务状态
|
||||||
|
if (task > 0) {
|
||||||
|
//inst_message
|
||||||
|
Instruction inst1 = checkInst();
|
||||||
|
if (inst1 != null) {
|
||||||
|
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||||
|
inst1.setInstruction_status("1");
|
||||||
|
inst1.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
this.setFeedbackSucess(true);
|
||||||
|
} 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_task_type", detail_type);
|
||||||
|
map.put("to_putpoint", put_device_code);
|
||||||
|
this.writing(map);
|
||||||
|
this.setFeedbackSucess(true);
|
||||||
|
}
|
||||||
|
if (mode == 3 && action == 4 && task > 0) {
|
||||||
|
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 (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();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//放货完成
|
||||||
|
if (action == 8) {
|
||||||
|
Instruction inst2 = checkInst();
|
||||||
|
if (inst2 != null) {
|
||||||
|
try {
|
||||||
|
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");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
feedMessage = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
feedMessage = "行架机械手:";
|
||||||
|
if (mode != 3) {
|
||||||
|
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||||
|
}
|
||||||
|
if (action != 8) {
|
||||||
|
feedMessage = feedMessage + "动作信号(action)不为放货完成状态,";
|
||||||
|
}
|
||||||
|
if (move != 0) {
|
||||||
|
feedMessage = feedMessage + "光电信号(move)不为无货状态,";
|
||||||
|
}
|
||||||
|
if (task == 0) {
|
||||||
|
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Instruction checkInst() {
|
public Instruction checkInst() {
|
||||||
if (ObjectUtil.isNotEmpty(this.inst)) {
|
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||||
if (this.task > 0) {
|
if (this.task > 0) {
|
||||||
@@ -693,7 +867,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
TaskDto task = null;
|
TaskDto task = null;
|
||||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||||
String startDeviceCode = getDeviceCodeList.get(i);
|
String startDeviceCode = getDeviceCodeList.get(i);
|
||||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
|
||||||
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||||
//按照优先级排序 优先级相等按照创建时间排序
|
//按照优先级排序 优先级相等按照创建时间排序
|
||||||
taskDtos = this.sortTask(taskDtos);
|
taskDtos = this.sortTask(taskDtos);
|
||||||
@@ -734,13 +908,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("to_command", "1");
|
map.put("to_command", "1");
|
||||||
if (action==2) {
|
if (action == 2) {
|
||||||
map.put("inflatableShaftVersion", version);
|
map.put("inflatableShaftVersion", version);
|
||||||
map.put("tube_num", bushing_num);
|
map.put("tube_num", bushing_num);
|
||||||
map.put("is_wrapped", is_bushing);
|
map.put("is_wrapped", is_bushing);
|
||||||
}
|
}
|
||||||
if (action==1||action==5){
|
if (taskDto.getTruss_type() == "1" || taskDto.getTruss_type() == "5") {
|
||||||
map.put("to_task_type", String.valueOf(action));
|
map.put("to_task_type", taskDto.getTruss_type());
|
||||||
}
|
}
|
||||||
map.put("to_onset", start_addr);
|
map.put("to_onset", start_addr);
|
||||||
map.put("to_task", instruction.getInstruction_code());
|
map.put("to_task", instruction.getInstruction_code());
|
||||||
@@ -756,7 +930,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
taskDtoList = this.sortTask(taskDtoList);
|
taskDtoList = this.sortTask(taskDtoList);
|
||||||
task = taskDtoList.get(j);
|
task = taskDtoList.get(j);
|
||||||
// 9 行架任务
|
// 9 行架任务
|
||||||
if (!StrUtil.equals(task.getTask_type(), "9")) {
|
if (!StrUtil.equals(task.getTruss_type(), "9")) {
|
||||||
task = null;
|
task = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -841,13 +1015,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
String bushing_num = task.getBushing_num();
|
String bushing_num = task.getBushing_num();
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("to_command", "1");
|
map.put("to_command", "1");
|
||||||
if (action==2) {
|
if (action == 2) {
|
||||||
map.put("inflatableShaftVersion", version);
|
map.put("inflatableShaftVersion", version);
|
||||||
map.put("tube_num", bushing_num);
|
map.put("tube_num", bushing_num);
|
||||||
map.put("is_wrapped", is_bushing);
|
map.put("is_wrapped", is_bushing);
|
||||||
}
|
}
|
||||||
if (action==1||action==5){
|
if (task.getTruss_type() == "1" || task.getTruss_type() == "5") {
|
||||||
map.put("to_task_type", String.valueOf(action));
|
map.put("to_task_type", task.getTruss_type());
|
||||||
}
|
}
|
||||||
map.put("to_onset", start_addr);
|
map.put("to_onset", start_addr);
|
||||||
map.put("to_task", instdto.getInstruction_code());
|
map.put("to_task", instdto.getInstruction_code());
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.plugging_unplugging_machine;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class ItemProtocol {
|
||||||
|
|
||||||
|
public static String item_heartbeat = "heartbeat";
|
||||||
|
public static String item_mode = "mode";
|
||||||
|
public static String item_move = "move";
|
||||||
|
public static String item_error = "error";
|
||||||
|
public static String item_task = "task";
|
||||||
|
public static String item_to_command = "to_command";
|
||||||
|
|
||||||
|
private PluggingUnpluggingMachineDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(PluggingUnpluggingMachineDeviceDriver driver){
|
||||||
|
this.driver=driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeartbeat() {
|
||||||
|
return this.getOpcIntegerValue(item_heartbeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMode() {
|
||||||
|
return this.getOpcIntegerValue(item_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMove() {
|
||||||
|
return this.getOpcIntegerValue(item_move);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getError() {
|
||||||
|
return this.getOpcIntegerValue(item_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTask() {
|
||||||
|
return this.getOpcIntegerValue(item_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getToCommand() {
|
||||||
|
return this.getOpcIntegerValue(item_to_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//是否有货
|
||||||
|
public int hasGoods(int move) {
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isonline;
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
setIsonline(false);
|
||||||
|
} else {
|
||||||
|
setIsonline(true);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||||
|
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2"));
|
||||||
|
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
|
||||||
|
list.add(new ItemDto(item_error, "报警信号", "DB600.B5"));
|
||||||
|
list.add(new ItemDto(item_task, "任务号", "DB600.D6"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.plugging_unplugging_machine;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.ItemProtocol;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插拔轴机驱动定义
|
||||||
|
* 说明:该站点为插拔轴机
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PluggingUnpluggingMachineDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "plugging_unplugging_machine";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "插拔轴机";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "插拔轴机";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new PluggingUnpluggingMachineDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return PluggingUnpluggingMachineDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.conveyor);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return org.nl.acs.device_driver.basedriver.standard_inspect_site.ItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return ItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.plugging_unplugging_machine;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.modules.system.service.ParamService;
|
||||||
|
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
|
int mode = 0;
|
||||||
|
int error = 0;
|
||||||
|
int move = 0;
|
||||||
|
int task = 0;
|
||||||
|
int last_mode = 0;
|
||||||
|
int last_error = 0;
|
||||||
|
int last_move = 0;
|
||||||
|
int last_task = 0;
|
||||||
|
Boolean isonline = true;
|
||||||
|
|
||||||
|
Boolean iserror = false;
|
||||||
|
//行架机械手申请任务成功标识
|
||||||
|
boolean requireSucess = false;
|
||||||
|
|
||||||
|
//1-执行任务;2-取货完成;3-放货完成;
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
String device_code;
|
||||||
|
|
||||||
|
String message = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
try {
|
||||||
|
device_code = this.getDeviceCode();
|
||||||
|
mode = this.itemProtocol.getMode();
|
||||||
|
error = this.itemProtocol.getError();
|
||||||
|
move = this.itemProtocol.getMove();
|
||||||
|
task = this.itemProtocol.getTask();
|
||||||
|
|
||||||
|
if (mode != last_mode) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记");
|
||||||
|
}
|
||||||
|
if (move != last_move) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception var17) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == 0) {
|
||||||
|
this.setIsonline(false);
|
||||||
|
message = "未联机";
|
||||||
|
//有报警
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.setIsonline(true);
|
||||||
|
this.setIserror(false);
|
||||||
|
if (error != 0) {
|
||||||
|
this.setIserror(true);
|
||||||
|
message = "有报警";
|
||||||
|
}
|
||||||
|
message = "";
|
||||||
|
Instruction instruction = null;
|
||||||
|
List toInstructions;
|
||||||
|
switch (mode) {
|
||||||
|
case 1:
|
||||||
|
log.debug("设备运转模式:等待工作");
|
||||||
|
return;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (!requireSucess) {
|
||||||
|
feedback();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
if (!requireSucess) {
|
||||||
|
feedback1();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mode = mode;
|
||||||
|
last_error = error;
|
||||||
|
last_move = move;
|
||||||
|
last_task = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void feedback1() {
|
||||||
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
|
applyManipulatorActionRequest.setType("7");
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||||
|
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "5");
|
||||||
|
requireSucess = true;
|
||||||
|
} else {
|
||||||
|
requireSucess = true;
|
||||||
|
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void feedback() {
|
||||||
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
|
applyManipulatorActionRequest.setType("6");
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||||
|
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("to_command", "4");
|
||||||
|
requireSucess = true;
|
||||||
|
} else {
|
||||||
|
requireSucess = true;
|
||||||
|
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean exe_error() {
|
||||||
|
if (this.error == 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
log.debug("设备报警");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(List list) {
|
||||||
|
|
||||||
|
//String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
|
//Server server = ReadUtil.getServer(opcservcerid);
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
Object ob = list.get(i);
|
||||||
|
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||||
|
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||||
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + json.getString("code");
|
||||||
|
itemMap.put(to_param, json.getString("value"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||||
|
this.control(itemMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
//将扩展表中的字符串数据转换成集合
|
||||||
|
public List<String> getExtraDeviceCodes(String extraName) {
|
||||||
|
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
|
||||||
|
if (StrUtil.isEmpty(extraValue)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
String devicesString = extraValue.substring(1, extraValue.length() - 1);
|
||||||
|
List<String> devicesList = new ArrayList<>();
|
||||||
|
String[] devices = devicesString.split(",");
|
||||||
|
for (int i = 0; i < devices.length; i++) {
|
||||||
|
String s = devices[i].replace("\"", "").replace("\"", "");
|
||||||
|
devicesList.add(s);
|
||||||
|
}
|
||||||
|
return devicesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
String mode = "";
|
||||||
|
String action = "";
|
||||||
|
String move = "";
|
||||||
|
if (this.getMode() == 0) {
|
||||||
|
mode = "未联机";
|
||||||
|
} else if (this.getMode() == 1) {
|
||||||
|
mode = "单机";
|
||||||
|
} else if (this.getMode() == 2) {
|
||||||
|
mode = "联机";
|
||||||
|
} else if (this.getMode() == 3) {
|
||||||
|
mode = "运行中";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getMove() == 0) {
|
||||||
|
move = "无货";
|
||||||
|
jo.put("hasGoods", false);
|
||||||
|
} else if (this.getMove() == 1) {
|
||||||
|
move = "有货";
|
||||||
|
jo.put("hasGoods", true);
|
||||||
|
} else if (this.getMove() == 2) {
|
||||||
|
move = "有托盘有货";
|
||||||
|
jo.put("hasGoods", true);
|
||||||
|
}
|
||||||
|
jo.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
jo.put("mode", mode);
|
||||||
|
jo.put("move", move);
|
||||||
|
jo.put("isOnline", this.getIsonline());
|
||||||
|
jo.put("isError", this.getIserror());
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(String param, String value) {
|
||||||
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + param;
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
|
||||||
|
this.control(itemMap);
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,8 @@ public class ApplyManipulatorActionRequest extends BaseRequest {
|
|||||||
* 3-反馈新放货点
|
* 3-反馈新放货点
|
||||||
* 4-反馈新取货点
|
* 4-反馈新取货点
|
||||||
* 5-反馈二次放货点
|
* 5-反馈二次放货点
|
||||||
|
* 6-套轴申请
|
||||||
|
* 7-套轴完成
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
AddressDto addressDto = addressService.findByCode("applyLabelingAndBinding");
|
AddressDto addressDto = addressService.findByCode("applyManipulatorAction");
|
||||||
String methods_url = addressDto.getMethods_url();
|
String methods_url = addressDto.getMethods_url();
|
||||||
String url = wmsUrl + methods_url;
|
String url = wmsUrl + methods_url;
|
||||||
log.info("ApplyManipulatorActionRequest----请求参数{}", param);
|
log.info("ApplyManipulatorActionRequest----请求参数{}", param);
|
||||||
|
|||||||
@@ -127,6 +127,13 @@ public interface TaskService {
|
|||||||
*/
|
*/
|
||||||
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备号和任务状态查询
|
||||||
|
* @param device_code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TaskDto> queryTaskByDeviceCodeAndStatus2(String device_code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据任务类型查询
|
* 根据任务类型查询
|
||||||
* @param task_type
|
* @param task_type
|
||||||
|
|||||||
@@ -402,6 +402,39 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskDto> queryTaskByDeviceCodeAndStatus2(String device_code) {
|
||||||
|
List<TaskDto> list = new ArrayList<>();
|
||||||
|
Iterator<TaskDto> iterator = tasks.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
TaskDto task = iterator.next();
|
||||||
|
if (task.getStart_device_code().equals(device_code)
|
||||||
|
&& StrUtil.equals(task.getTask_status(), "1")) {
|
||||||
|
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||||
|
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||||
|
list.add(task);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (StrUtil.equals(task.getTask_type(), "9") && StrUtil.isNotEmpty(task.getPut_device_code())) {
|
||||||
|
// if(task.getNext_device_code().equals(device_code)
|
||||||
|
// && StrUtil.equals(task.getTask_status(), "1")){
|
||||||
|
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||||
|
// if (ObjectUtil.isNotEmpty(instruction)) {
|
||||||
|
// list.add(task);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
Instruction instruction = instructionService.findByDeviceCodeFromCache(task.getNext_device_code());
|
||||||
|
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||||
|
if (StrUtil.equals(instruction.getStart_device_code(), device_code)) {
|
||||||
|
list.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TaskDto> queryTaskByType(String task_type) {
|
public List<TaskDto> queryTaskByType(String task_type) {
|
||||||
List<TaskDto> list = new ArrayList<>();
|
List<TaskDto> list = new ArrayList<>();
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ import lamp_three_color from '@/views/acs/device/driver/lamp_three_color'
|
|||||||
import paper_tube_conveyor from '@/views/acs/device/driver/paper_tube_conveyor'
|
import paper_tube_conveyor from '@/views/acs/device/driver/paper_tube_conveyor'
|
||||||
import device_status from '@/views/acs/device/driver/device_status'
|
import device_status from '@/views/acs/device/driver/device_status'
|
||||||
import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator'
|
import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator'
|
||||||
|
import plugging_unplugging_machine from '@/views/acs/device/driver/plugging_unplugging_machine'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
@@ -134,7 +135,8 @@ export default {
|
|||||||
lamp_three_color,
|
lamp_three_color,
|
||||||
paper_tube_conveyor,
|
paper_tube_conveyor,
|
||||||
device_status,
|
device_status,
|
||||||
indoor_manipulator
|
indoor_manipulator,
|
||||||
|
plugging_unplugging_machine
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
|
|||||||
@@ -0,0 +1,507 @@
|
|||||||
|
<template>
|
||||||
|
<!--插拔轴站点-->
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">设备协议:</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
OpcServer:
|
||||||
|
<el-select
|
||||||
|
v-model="opc_id"
|
||||||
|
placeholder="无"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="changeOpc"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dataOpcservers"
|
||||||
|
:key="item.opc_id"
|
||||||
|
:label="item.opc_name"
|
||||||
|
:value="item.opc_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
PLC:
|
||||||
|
<el-select
|
||||||
|
v-model="plc_id"
|
||||||
|
placeholder="无"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="changePlc"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dataOpcPlcs"
|
||||||
|
:key="item.plc_id"
|
||||||
|
:label="item.plc_name"
|
||||||
|
:value="item.plc_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">输送系统:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
|
<el-input v-model="form.address" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">指令相关:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="检验有货">
|
||||||
|
<el-switch v-model="form.inspect_in_stocck" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="忽视取货校验" label-width="150px">
|
||||||
|
<el-switch v-model="form.ignore_pickup_check" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="忽视放货校验" label-width="150px">
|
||||||
|
<el-switch v-model="form.ignore_release_check" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="呼叫">
|
||||||
|
<el-switch v-model="form.apply_task" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="响应" label-width="150px">
|
||||||
|
<el-switch v-model="form.manual_create_task" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联设备" prop="device_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_device_code"
|
||||||
|
filterable
|
||||||
|
multiple
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
||||||
|
<el-select
|
||||||
|
v-model="form.link_three_lamp"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.device_code"
|
||||||
|
:label="item.device_name"
|
||||||
|
:value="item.device_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="是否输入物料" label-width="150px">
|
||||||
|
<el-switch v-model="form.input_material" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">AGV相关:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="取货">
|
||||||
|
<el-switch v-model="form.is_pickup" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="放货">
|
||||||
|
<el-switch v-model="form.is_release" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC读取字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data1"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data1[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishReadEdit(data1[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC写入字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data2"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data2[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishWriteEdit(data2[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value2">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbw_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span" />
|
||||||
|
<el-button
|
||||||
|
:loading="false"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
style="float: right; padding: 6px 9px"
|
||||||
|
type="primary"
|
||||||
|
@click="doSubmit"
|
||||||
|
>保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
queryDriverConfig,
|
||||||
|
updateConfig,
|
||||||
|
testRead,
|
||||||
|
testwrite
|
||||||
|
} from '@/api/acs/device/driverConfig'
|
||||||
|
import { selectOpcList } from '@/api/acs/device/opc'
|
||||||
|
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||||
|
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PluggingUnpluggingMachine',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
require: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
opc_id: '',
|
||||||
|
opc_code: '',
|
||||||
|
configLoading: false,
|
||||||
|
dataOpcservers: [],
|
||||||
|
dataOpcPlcs: [],
|
||||||
|
deviceList: [],
|
||||||
|
data1: [],
|
||||||
|
data2: [],
|
||||||
|
form: {
|
||||||
|
inspect_in_stocck: true,
|
||||||
|
ignore_pickup_check: true,
|
||||||
|
ignore_release_check: true,
|
||||||
|
apply_task: true,
|
||||||
|
link_three_lamp: '',
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true,
|
||||||
|
link_device_code: [],
|
||||||
|
address: ''
|
||||||
|
},
|
||||||
|
rules: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// 从父表单获取设备编码
|
||||||
|
this.device_id = this.$props.parentForm.device_id
|
||||||
|
this.device_code = this.$props.parentForm.device_code
|
||||||
|
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||||
|
// 给表单赋值,并且属性不能为空
|
||||||
|
if (data.form) {
|
||||||
|
const arr = Object.keys(data.form)
|
||||||
|
// 不为空
|
||||||
|
if (arr.length > 0) {
|
||||||
|
this.form = data.form
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 给表单赋值,并且属性不能为空
|
||||||
|
if (data.parentForm) {
|
||||||
|
const arr = Object.keys(data.parentForm)
|
||||||
|
// 不为空
|
||||||
|
if (arr.length > 0) {
|
||||||
|
this.opc_code = data.parentForm.opc_code
|
||||||
|
this.plc_code = data.parentForm.plc_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data1 = data.rs
|
||||||
|
this.data2 = data.ws
|
||||||
|
this.sliceItem()
|
||||||
|
})
|
||||||
|
selectPlcList().then(data => {
|
||||||
|
this.dataOpcPlcs = data
|
||||||
|
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||||
|
})
|
||||||
|
selectOpcList().then(data => {
|
||||||
|
this.dataOpcservers = data
|
||||||
|
this.opc_id = this.$props.parentForm.opc_server_id
|
||||||
|
})
|
||||||
|
deviceCrud.selectDeviceList().then(data => {
|
||||||
|
this.deviceList = data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
finishReadEdit(data) {
|
||||||
|
// 编辑的是code列,并且值包含mode
|
||||||
|
if (data.code.indexOf('mode') !== -1) {
|
||||||
|
debugger
|
||||||
|
const dbValue = data.db
|
||||||
|
// .之前的字符串
|
||||||
|
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||||
|
// .之后的字符串
|
||||||
|
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||||
|
// 取最后数字
|
||||||
|
const endNumber = afterStr.substring(1)
|
||||||
|
// 最后为非数字
|
||||||
|
if (isNaN(parseInt(endNumber))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (const val in this.data1) {
|
||||||
|
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
finishWriteEdit(data) {
|
||||||
|
// 编辑的是code列,并且值包含mode
|
||||||
|
if (data.code.indexOf('to_command') !== -1) {
|
||||||
|
const dbValue = data.db
|
||||||
|
// .之前的字符串
|
||||||
|
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||||
|
// .之后的字符串
|
||||||
|
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||||
|
// 取最后数字
|
||||||
|
const endNumber = afterStr.substring(1)
|
||||||
|
// 最后为非数字
|
||||||
|
if (isNaN(parseInt(endNumber))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (const val in this.data2) {
|
||||||
|
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||||
|
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||||
|
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeOpc(val) {
|
||||||
|
this.dataOpcservers.forEach(item => {
|
||||||
|
if (item.opc_id === val) {
|
||||||
|
this.opc_code = item.opc_code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
selectListByOpcID(val).then(data => {
|
||||||
|
this.dataOpcPlcs = data
|
||||||
|
this.plc_id = ''
|
||||||
|
this.plc_code = ''
|
||||||
|
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||||
|
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||||
|
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||||
|
}
|
||||||
|
this.sliceItem()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changePlc(val) {
|
||||||
|
this.dataOpcPlcs.forEach(item => {
|
||||||
|
if (item.plc_id === val) {
|
||||||
|
this.plc_code = item.plc_code
|
||||||
|
this.sliceItem()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_read1() {
|
||||||
|
testRead(this.data1, this.opc_id).then(data => {
|
||||||
|
this.data1 = data
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_read2() {
|
||||||
|
testRead(this.data2, this.opc_id).then(data => {
|
||||||
|
this.data2 = data
|
||||||
|
console.log(this.data2)
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_write1() {
|
||||||
|
testwrite(this.data2, this.opc_id).then(data => {
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doSubmit() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.configLoading = true
|
||||||
|
// 根据驱动类型判断是否为路由设备
|
||||||
|
const parentForm = this.parentForm
|
||||||
|
parentForm.is_route = true
|
||||||
|
parentForm.plc_id = this.plc_id
|
||||||
|
parentForm.opc_id = this.opc_id
|
||||||
|
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||||
|
this.notify('保存成功', 'success')
|
||||||
|
this.configLoading = false
|
||||||
|
}).catch(err => {
|
||||||
|
this.configLoading = false
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sliceItem() { // 拼接DB的Item值
|
||||||
|
this.data1.forEach(item => {
|
||||||
|
const str = item.code
|
||||||
|
// 是否包含.
|
||||||
|
if (str.search('.') !== -1) {
|
||||||
|
// 截取最后一位
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||||
|
} else {
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.data2.forEach(item => {
|
||||||
|
const str = item.code
|
||||||
|
// 是否包含.
|
||||||
|
if (str.search('.') !== -1) {
|
||||||
|
// 截取最后一位
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||||
|
} else {
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user