rev 内包间行架
This commit is contained in:
@@ -57,7 +57,9 @@ public enum DriverTypeEnum {
|
||||
|
||||
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.lamp_three_color.LampThreecolorDeviceDriver;
|
||||
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.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
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();
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
if(mode==2){
|
||||
log.info("123");
|
||||
}
|
||||
action = this.itemProtocol.getAction();
|
||||
walk_y = this.itemProtocol.getWalk_y();
|
||||
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.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();
|
||||
} 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) {
|
||||
var17.printStackTrace();
|
||||
feedMessage = var17.getMessage();
|
||||
@@ -367,10 +373,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
this.setNotCreateTaskMessage(remark);
|
||||
}
|
||||
}
|
||||
if (mode == 3 && !feedbackSucess && action > 0) {
|
||||
apply_feedback();
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
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 {
|
||||
instructionService.finish(inst);
|
||||
@@ -515,7 +432,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
} else {
|
||||
this.instruction_update_time = date;
|
||||
//更改任务状态
|
||||
if (task > 0 && action == 2) {
|
||||
if (task > 0) {
|
||||
//inst_message
|
||||
Instruction inst1 = checkInst();
|
||||
if (inst1 != null) {
|
||||
@@ -527,50 +444,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
}
|
||||
|
||||
if (task > 0 && action == 3) {
|
||||
//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 == 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) {
|
||||
//任务完成
|
||||
if (action == 8) {
|
||||
Instruction inst2 = checkInst();
|
||||
if (inst2 != null) {
|
||||
try {
|
||||
finish_instruction(inst2);
|
||||
this.writing("to_command", "6");
|
||||
this.writing("to_command", "8");
|
||||
} catch (Exception e) {
|
||||
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() {
|
||||
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||
if (this.task > 0) {
|
||||
@@ -693,7 +867,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
TaskDto task = null;
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||
//按照优先级排序 优先级相等按照创建时间排序
|
||||
taskDtos = this.sortTask(taskDtos);
|
||||
@@ -734,13 +908,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "1");
|
||||
if (action==2) {
|
||||
if (action == 2) {
|
||||
map.put("inflatableShaftVersion", version);
|
||||
map.put("tube_num", bushing_num);
|
||||
map.put("is_wrapped", is_bushing);
|
||||
}
|
||||
if (action==1||action==5){
|
||||
map.put("to_task_type", String.valueOf(action));
|
||||
if (taskDto.getTruss_type() == "1" || taskDto.getTruss_type() == "5") {
|
||||
map.put("to_task_type", taskDto.getTruss_type());
|
||||
}
|
||||
map.put("to_onset", start_addr);
|
||||
map.put("to_task", instruction.getInstruction_code());
|
||||
@@ -756,7 +930,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
taskDtoList = this.sortTask(taskDtoList);
|
||||
task = taskDtoList.get(j);
|
||||
// 9 行架任务
|
||||
if (!StrUtil.equals(task.getTask_type(), "9")) {
|
||||
if (!StrUtil.equals(task.getTruss_type(), "9")) {
|
||||
task = null;
|
||||
continue;
|
||||
}
|
||||
@@ -841,13 +1015,13 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
String bushing_num = task.getBushing_num();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", "1");
|
||||
if (action==2) {
|
||||
if (action == 2) {
|
||||
map.put("inflatableShaftVersion", version);
|
||||
map.put("tube_num", bushing_num);
|
||||
map.put("is_wrapped", is_bushing);
|
||||
}
|
||||
if (action==1||action==5){
|
||||
map.put("to_task_type", String.valueOf(action));
|
||||
if (task.getTruss_type() == "1" || task.getTruss_type() == "5") {
|
||||
map.put("to_task_type", task.getTruss_type());
|
||||
}
|
||||
map.put("to_onset", start_addr);
|
||||
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-反馈新放货点
|
||||
* 4-反馈新取货点
|
||||
* 5-反馈二次放货点
|
||||
* 6-套轴申请
|
||||
* 7-套轴完成
|
||||
*/
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyLabelingAndBinding");
|
||||
AddressDto addressDto = addressService.findByCode("applyManipulatorAction");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("ApplyManipulatorActionRequest----请求参数{}", param);
|
||||
|
||||
@@ -127,6 +127,13 @@ public interface TaskService {
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||
|
||||
/**
|
||||
* 根据设备号和任务状态查询
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCodeAndStatus2(String device_code);
|
||||
|
||||
/**
|
||||
* 根据任务类型查询
|
||||
* @param task_type
|
||||
|
||||
@@ -402,6 +402,39 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
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
|
||||
public List<TaskDto> queryTaskByType(String task_type) {
|
||||
List<TaskDto> list = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user