rev 下发信号

This commit is contained in:
2023-05-08 11:01:05 +08:00
parent ba3aa5a6c9
commit 20af7e5b14
5 changed files with 48 additions and 108 deletions

View File

@@ -348,9 +348,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
// jo.put("isOnline", this.getIsonline());
// jo.put("error", this.getError());
// jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}

View File

@@ -406,11 +406,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
try {
finish_instruction(inst2);
} catch (Exception e) {
e.printStackTrace();
}
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
String next_device_code = inst2.getNext_device_code();
@@ -457,18 +453,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
if (this.getNow_steps_type() == 5) {
this.writing("to_command", "5");
this.setNow_steps_type(6);
this.setNow_steps_type(0);
feedMessage = "";
} else {
//logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为放货完成now_steps_type=5");
this.writing("to_command", "5");
this.setNow_steps_type(6);
this.setNow_steps_type(0);
try {
finish_instruction(inst2);
} catch (Exception e) {
e.printStackTrace();
}
// this.writing("to_onset", "0");
// this.writing("to_target", "0");
// this.writing("to_task", "0");
feedMessage = "";
}
}
} else {
@@ -1022,11 +1015,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
@Override
public JSONObject feedLmsRealFailedInfo() {
JSONObject jo = new JSONObject();
jo.put("device_code",this.getDevice().getDevice_code());
jo.put("device_name",this.getDevice().getDevice_name());
jo.put("fault_code",String.valueOf(error));
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
jo.put("fault_type",error_type);
jo.put("device_code", this.getDevice().getDevice_code());
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("fault_code", String.valueOf(error));
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
jo.put("fault_type", error_type);
return jo;
}

View File

@@ -130,10 +130,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
boolean requireApplyLabelingSuccess = false;
boolean requireApplyLaStrangulationSuccess = false;
boolean requireEmptyInSuccess = false;
boolean requireEmptyOutSuccess = false;
boolean requiresShipDeviceUpdate = true;
private int instruction_finished_time_out;
@@ -185,11 +182,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
requireSucess = false;
requireApplyLabelingSuccess = false;
requireApplyLaStrangulationSuccess = false;
requireEmptyInSuccess = false;
requireEmptyOutSuccess = false;
//Boolean flag = ObjectUtil.isEmpty(this.device.getExtraValue().get("special_flag")) ? false : Boolean.valueOf(this.device.getExtraValue().get("special_flag").toString());
//暂时这样写 后续通过配置判断
if (StrUtil.equals(this.device_code, "1018")) {
if (mode == 6 && last_mode == 2) {
requireSucess = false;
requireEmptyInSuccess = false;
}
} else {
requireSucess = false;
requireEmptyInSuccess = false;
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -316,8 +320,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
case 5:
//申请贴标
if (move > 0 && !requireSucess) {
applyLabeling();
//applyLabeling();
}
break;
case 6:
@@ -756,61 +759,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
//申请贴标
public synchronized void applyLabeling() {
Date date = new Date();
if (date.getTime() - this.require_apply_labeling_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
this.require_apply_labeling_time = date;
String vehicle_code = "";
if (task > 0) {
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
vehicle_code = instruction.getVehicle_code();
} else {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常");
message = "申请贴标电气设备任务号:" + task + "异常";
throw new RuntimeException("任务号为空!");
}
if (StrUtil.isEmpty(vehicle_code)) {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "未找到载具号");
message = "申请贴标电气设备任务号:" + task + "未找到载具号";
throw new RuntimeException("载具号为空!");
}
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
new ApplyLabelingAndBindingRequest();
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");
}
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
applyLabelingAndBindingRequest.setType("1");
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + applyLabelingAndBindingRequest);
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
if (applyLabelingAndBindingResponse.getstatus() == 200) {
message = "申请贴标成功";
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", "5");
list.add(map);
this.writing(list);
this.writing(list);
message = "申请贴标下发电气信号成功";
requireApplyLabelingSuccess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + applyLabelingAndBindingResponse);
} else {
message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + applyLabelingAndBindingResponse);
}
}
}
//申请捆扎
@SneakyThrows
public synchronized void applyLaStrangulation(String mode) {
@@ -891,7 +839,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
// this.writing(list);
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse);
message = "申请捆扎成功";
requireSucess = true;
//requireSucess = true;
} else {
message = "未返回尺寸信息";
logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse);

View File

@@ -232,13 +232,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为:" + requireSucess);
requireSucess = false;
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为:" + requireSucess);
// if (task1 == 0 && task2 == 0 && type == 0) {
// logServer.deviceExecuteLog(device_code, "", "", "开始复位当前执行步骤");
// this.setNow_steps_type1(0);
// this.setNow_steps_type2(0);
// this.setNow_steps_type3(0);
// logServer.deviceExecuteLog(device_code, "", "", "复位当前执行步骤成功");
// }
feedMessage = "";
notCreateTaskMessage = "";
notCreateInstMessage = "";
@@ -512,12 +505,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
finish_instruction(inst2);
if (to_command2 != 5) {
this.writing("to_command2", "5");
}
this.setNow_steps_type2(6);
this.setNow_steps_type2(0);
finish_instruction(inst2);
}
}
} else {
@@ -637,12 +630,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
this.finish_instruction(inst1);
if (to_command1 != 5) {
this.writing("to_command1", "5");
}
this.setNow_steps_type1(6);
this.setNow_steps_type1(0);
this.finish_instruction(inst1);
}
}
} else {
@@ -673,12 +666,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) {
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
this.finish_instruction(inst1);
if (to_command1 != 5) {
this.writing("to_command1", "5");
}
this.setNow_steps_type3(10);
this.setNow_steps_type3(0);
this.finish_instruction(inst1);
}
}
} else {
@@ -821,8 +814,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_write_time);
return false;
} else {
if(ObjectUtil.isNotEmpty(cache_inst)) {
logServer.deviceExecuteLog(this.device_code, "", "", "程序逻辑校验,下发指令信号后电气任务号未变化,再次下发指令号:"+cache_inst.getInstruction_code() +",行架指令类型:"+type );
if (ObjectUtil.isNotEmpty(cache_inst)) {
logServer.deviceExecuteLog(this.device_code, "", "", "程序逻辑校验,下发指令信号后电气任务号未变化,再次下发指令号:" + cache_inst.getInstruction_code() + ",行架指令类型:" + type);
//前工位任务
if (StrUtil.equals(inst_type, "1")) {
@@ -1601,11 +1594,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
@Override
public JSONObject feedLmsRealFailedInfo() {
JSONObject jo = new JSONObject();
jo.put("device_code",this.getDevice().getDevice_code());
jo.put("device_name",this.getDevice().getDevice_name());
jo.put("fault_code",String.valueOf(error));
jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
jo.put("fault_type",error_type);
jo.put("device_code", this.getDevice().getDevice_code());
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("fault_code", String.valueOf(error));
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
jo.put("fault_type", error_type);
return jo;
}
}