更新
This commit is contained in:
@@ -22,6 +22,7 @@ import org.nl.acs.device.service.*;
|
||||
import org.nl.acs.device.service.dto.*;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.device_driver.ScannerDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
@@ -926,9 +927,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
standardInspectSiteDeviceDriver.setBatch(batch);
|
||||
device.setMaterial_type(material_type);
|
||||
device.setBatch(batch);
|
||||
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver){
|
||||
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
|
||||
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);
|
||||
} else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
siemensConveyorDeviceDriver.setDeviceStatus(form);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
private int instruction_require_time_out;
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
//申请成功标记
|
||||
Boolean applySucess = false;
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
@@ -125,6 +123,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
if (mode != last_mode) {
|
||||
if (mode == 2) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
@@ -145,6 +146,40 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task);
|
||||
}
|
||||
|
||||
if (task > 0) {
|
||||
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
|
||||
if (StrUtil.equals(this.getDeviceCode(), instruction.getStart_device_code())) {
|
||||
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), "0")) {
|
||||
instruction.setInstruction_status("1");
|
||||
instructionService.update(instruction);
|
||||
}
|
||||
|
||||
String next_device_code = instruction.getNext_device_code();
|
||||
Device device = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "任务号:" + task + "输送线任务未完成,目标站设备为空!");
|
||||
return;
|
||||
}
|
||||
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
int nextTask = siemensConveyorDeviceDriver.getTask();
|
||||
if (nextTask == task) {
|
||||
inst_message = "指令号:" + instruction.getInstruction_code() + " " + instruction.getStart_point_code() + "->" + instruction.getNext_point_code() + " 载具号:" + instruction.getVehicle_code();
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), instruction.getNext_device_code())) {
|
||||
finish_instruction();
|
||||
this.clearWrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
@@ -173,31 +208,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
List toInstructions;
|
||||
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
if (move != last_move) {
|
||||
if (move == 0 && mode == 2) {
|
||||
thingToNothing();
|
||||
}
|
||||
}
|
||||
if (error != last_error) {
|
||||
}
|
||||
|
||||
if (mode == 2 && move != 0 && task > 0) {
|
||||
//inst_message
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
finish_instruction();
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (mode == 2 && move != 0 && task > 0) {
|
||||
// //inst_message
|
||||
// inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
// if (inst != null) {
|
||||
// inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
// if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
// finish_instruction();
|
||||
// }
|
||||
// if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
// inst.setInstruction_status("1");
|
||||
// instructionService.update(inst);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
switch (mode) {
|
||||
case 1:
|
||||
@@ -228,6 +252,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
|
||||
public void clearWrite() {
|
||||
this.writing("to_command", "0");
|
||||
this.writing("to_target", "0");
|
||||
this.writing("to_container_type", "0");
|
||||
this.writing("to_strap_times", "0");
|
||||
this.writing("to_length", "0");
|
||||
this.writing("to_weight", "0");
|
||||
this.writing("to_height", "0");
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
@@ -240,15 +274,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
protected void thingToNothing() throws Exception {
|
||||
this.setRequireSucess(false);
|
||||
this.setApplySucess(false);
|
||||
this.writing("to_command", "0");
|
||||
this.writing("to_target", "0");
|
||||
this.writing("to_container_type", "0");
|
||||
this.writing("to_task", "0");
|
||||
this.writing("to_strap_times", "0");
|
||||
this.writing("to_length", "0");
|
||||
this.writing("to_weight", "0");
|
||||
this.writing("to_height", "0");
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +288,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
itemMap.put(to_param, value);
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
ReadUtil.write(itemMap, server);
|
||||
logServer.deviceExecuteLog(device_code,"","","下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
@@ -306,6 +331,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
} else if (this.carrier_direction == 2) {
|
||||
carrier_direction = "反转";
|
||||
}
|
||||
String requireSucess = "0";
|
||||
if (this.requireSucess) {
|
||||
requireSucess = "1";
|
||||
}
|
||||
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
@@ -316,12 +345,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
jo.put("error", this.getError());
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("message", this.getMessage());
|
||||
jo.put("is_click", true);
|
||||
jo.put("requireSucess", requireSucess);
|
||||
jo.put("driver_type", "siemens_conveyor");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
String requestSucess = data.getString("requireSucess");
|
||||
if (StrUtil.equals(requestSucess, "0")) {
|
||||
this.setRequireSucess(false);
|
||||
} else {
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
|
||||
// public void writing(int type, int command) {
|
||||
@@ -427,7 +464,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
task.setTask_status("1");
|
||||
taskserver.update(task);
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
this.writing("to_target", next_addr);
|
||||
this.writing("to_task", instdto.getInstruction_code());
|
||||
|
||||
@@ -279,6 +279,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
continue;
|
||||
}
|
||||
if ((task.getStart_device_code().equals(start_device_code) || task.getStart_device_code2().equals(start_device_code)) && StrUtil.equals(task.getTask_status(), "0")) {
|
||||
list.add(task);
|
||||
}
|
||||
@@ -292,6 +295,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
continue;
|
||||
}
|
||||
if (task.getStart_device_code().equals(back_start_device_code) && StrUtil.equals(task.getTask_status(), "0")) {
|
||||
list.add(task);
|
||||
}
|
||||
@@ -321,6 +327,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
continue;
|
||||
}
|
||||
if ((task.getStart_device_code().equals(head_start_device_code) || task.getStart_device_code2().equals(head_start_device_code)) && StrUtil.equals(task.getTask_status(), "1")) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
@@ -336,6 +345,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
continue;
|
||||
}
|
||||
if ((task.getStart_device_code().equals(back_start_device_code)) && StrUtil.equals(task.getTask_status(), "1")) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
@@ -1126,6 +1138,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
while (var3.hasNext()) {
|
||||
TaskDto task = (TaskDto) var3.next();
|
||||
if (!StrUtil.equals(task.getTask_type(), "5")) {
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.equals(task.getStart_device_code(), device_code) && StrUtil.equals(task.getTask_status(), "0")) {
|
||||
return task;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user