opt: 行架联调优化
This commit is contained in:
@@ -421,7 +421,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
|
||||
if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
|
||||
@@ -748,6 +748,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
if (this.move == 1) {
|
||||
move = "有货";
|
||||
}
|
||||
String container_type = "";
|
||||
if(this.container_type == 1){
|
||||
container_type = "小托盘";
|
||||
}else if (this.container_type == 2){
|
||||
container_type = "大托盘";
|
||||
}
|
||||
jo.put("move", move);
|
||||
jo.put("task", task);
|
||||
jo.put("type", container_type);
|
||||
|
||||
@@ -513,7 +513,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
log.error("指令创建失败!", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(taskdto.getNext_device_code());
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(instdto.getNext_device_code());
|
||||
|
||||
//创建指令后修改任务状态
|
||||
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
|
||||
@@ -979,8 +979,31 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
if (this.requireSucess) {
|
||||
requireSucess = "1";
|
||||
}
|
||||
String command = "";
|
||||
if(this.command == 0){
|
||||
command = "待机";
|
||||
}else if(this.command == 1){
|
||||
command = "取货中";
|
||||
}else if(this.command == 2){
|
||||
command = "取货完成";
|
||||
}else if(this.command == 3){
|
||||
command = "放货中";
|
||||
}else if(this.command == 4){
|
||||
command = "请求卸货(申请卸货)";
|
||||
}else if(this.command == 5){
|
||||
command = "放货完成";
|
||||
}else if(this.command == 6){
|
||||
command = "取货准备(回库台)";
|
||||
}else if(this.command == 7){
|
||||
command = "召回";
|
||||
}else if(this.command == 8){
|
||||
command = "急停";
|
||||
}else if(this.command == 9){
|
||||
command = "未知";
|
||||
}
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
jo.put("command", command);
|
||||
jo.put("action", action);
|
||||
jo.put("task", task);
|
||||
jo.put("error", this.getError());
|
||||
|
||||
@@ -282,6 +282,37 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void writing(List list) {
|
||||
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"));
|
||||
}
|
||||
}
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发电气信号:" + itemMap)
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//将扩展表中的字符串数据转换成集合
|
||||
@Override
|
||||
public List<String> getExtraDeviceCodes(String extraName) {
|
||||
|
||||
@@ -128,6 +128,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
private int instruction_require_time_out = 3000;
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
//行架机械手申请动作成功标识
|
||||
boolean requireActionSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
@@ -179,12 +181,16 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
y_position = this.itemProtocol.getY_position();
|
||||
iserror = this.itemProtocol.device_status;
|
||||
|
||||
if(mode != last_mode){
|
||||
if (mode != last_mode) {
|
||||
requireSucess = false;
|
||||
}
|
||||
if (action != last_action) {
|
||||
requireActionSucess = false;
|
||||
}
|
||||
|
||||
|
||||
update_instruction_status();
|
||||
if (!requireActionSucess) {
|
||||
update_instruction_status();
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
@@ -219,7 +225,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
} else {
|
||||
if (mode == 2) {
|
||||
//if (!requireSucess) {
|
||||
String remark = "";;
|
||||
String remark = "";
|
||||
if (mode != 2) {
|
||||
remark = remark + "工作模式(mode)不是待机状态,";
|
||||
}
|
||||
@@ -293,7 +299,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (ObjectUtil.isEmpty(putDeviceCodeList)) {
|
||||
putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
|
||||
}
|
||||
|
||||
if(CollUtil.isEmpty(getDeviceCodeList) || getDeviceCodeList.size() == 0){
|
||||
notCreateInstMessage = "未设置取货点";
|
||||
}
|
||||
TaskDto task = null;
|
||||
for (int i = 0; i < getDeviceCodeList.size(); i++) {
|
||||
String startDeviceCode = getDeviceCodeList.get(i);
|
||||
@@ -431,7 +439,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
|
||||
}
|
||||
this.setNow_steps_type(2);
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
} else {
|
||||
@@ -593,7 +600,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
String start_addr = startDevice.getExtraValue().get("address").toString();
|
||||
String next_addr = nextDevice.getExtraValue().get("address").toString();
|
||||
if(ObjectUtil.isEmpty(start_addr) || ObjectUtil.isEmpty(next_addr)){
|
||||
if (ObjectUtil.isEmpty(start_addr) || ObjectUtil.isEmpty(next_addr)) {
|
||||
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "或设备:" + nextDevice.getDevice_code() + "地址值!");
|
||||
}
|
||||
String msg = "当前设备:" + device_code + ",下发指令:"
|
||||
@@ -633,7 +640,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
|
||||
hongXiangConveyorDeviceDriver.writing("to_open_door", "1");
|
||||
}
|
||||
this.setNow_steps_type(2);
|
||||
this.setRequireSucess(true);
|
||||
notCreateInstMessage = "";
|
||||
notCreateTaskMessage = "";
|
||||
@@ -822,45 +828,38 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int error = hongXiangConveyorDeviceDriver.getError();
|
||||
int move = hongXiangConveyorDeviceDriver.getMove();
|
||||
if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 1) {
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "2");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setNow_steps_type(3);
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
|
||||
if (mode != 1) {
|
||||
feedMessage = feedMessage + "工作模式(mode)信号未联机,";
|
||||
}
|
||||
if (door != 1) {
|
||||
feedMessage = feedMessage + "门状态(door)信号未开门,";
|
||||
}
|
||||
if (action != 1) {
|
||||
feedMessage = feedMessage + "允许取放(action)信号未允许取放,";
|
||||
}
|
||||
if (move != 1) {
|
||||
feedMessage = feedMessage + "取货位光电信号(move)不应该为无货状态,";
|
||||
}
|
||||
if (error1 != 0) {
|
||||
feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + "。";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "2");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setNow_steps_type(3);
|
||||
this.setRequireActionSucess(true);
|
||||
} else {
|
||||
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
|
||||
if (mode != 1) {
|
||||
feedMessage = feedMessage + "工作模式(mode)信号未联机,";
|
||||
}
|
||||
if (door != 1) {
|
||||
feedMessage = feedMessage + "门状态(door)信号未开门,";
|
||||
}
|
||||
if (action != 1) {
|
||||
feedMessage = feedMessage + "允许取放(action)信号未允许取放,";
|
||||
}
|
||||
if (move != 1) {
|
||||
feedMessage = feedMessage + "取货位光电信号(move)不应该为无货状态,";
|
||||
}
|
||||
if (error1 != 0) {
|
||||
feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + "。";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "2");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setRequireActionSucess(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 2) {
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
@@ -874,7 +873,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//取货完成关闭烘箱门
|
||||
@@ -886,32 +884,32 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||
map.put("to_close_door", "1");
|
||||
hongXiangConveyorDeviceDriver.writing(map);
|
||||
}
|
||||
if (this.getNow_steps_type() == 3) {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "3");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setNow_steps_type(4);
|
||||
Map map1 = new HashMap();
|
||||
ArrayList list1 = new ArrayList();
|
||||
map1.put("code", "to_close_door");
|
||||
map1.put("value", "1");
|
||||
list1.add(map1);
|
||||
hongXiangConveyorDeviceDriver.writing(list1);
|
||||
}
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "3");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setRequireActionSucess(true);
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 3) {
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 2) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为取货完成状态,";
|
||||
}
|
||||
if (move != 1) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为有货状态,";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 2) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为取货完成状态,";
|
||||
}
|
||||
if (move != 1) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为有货状态,";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,59 +929,49 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int error = hongXiangConveyorDeviceDriver.getError();
|
||||
int move = hongXiangConveyorDeviceDriver.getMove();
|
||||
if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 0) {
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "4");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setNow_steps_type(5);
|
||||
} else {
|
||||
feedMessage = "未反馈电气信号原因:当前步骤不为允许放货(now_steps_type!=4)";
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
|
||||
if (mode != 1) {
|
||||
feedMessage = feedMessage + "工作模式(mode)信号未联机,";
|
||||
}
|
||||
if (door != 1) {
|
||||
feedMessage = feedMessage + "门状态(door)信号未开门,";
|
||||
}
|
||||
if (action != 1) {
|
||||
feedMessage = feedMessage + "允许取放(action)信号未允许取放,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "放货位光电信号不应该为有货状态";
|
||||
}
|
||||
if (error1 != 0) {
|
||||
feedMessage = feedMessage + "故障(error1)信号出现故障。";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "4");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setNow_steps_type(5);
|
||||
this.setRequireActionSucess(true);
|
||||
} else {
|
||||
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
|
||||
if (mode != 1) {
|
||||
feedMessage = feedMessage + "工作模式(mode)信号未联机,";
|
||||
}
|
||||
if (door != 1) {
|
||||
feedMessage = feedMessage + "门状态(door)信号未开门,";
|
||||
}
|
||||
if (action != 1) {
|
||||
feedMessage = feedMessage + "允许取放(action)信号未允许取放,";
|
||||
}
|
||||
if (move != 0) {
|
||||
feedMessage = feedMessage + "放货位光电信号不应该为有货状态";
|
||||
}
|
||||
if (error1 != 0) {
|
||||
feedMessage = feedMessage + "故障(error1)信号出现故障。";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "4");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setRequireActionSucess(true);
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 4) {
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 3) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为放货中状态,";
|
||||
}
|
||||
if (move != 1) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为有货状态,";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
}
|
||||
if (action != 3) {
|
||||
feedMessage = feedMessage + "动作信号(action)不为放货中状态,";
|
||||
}
|
||||
if (move != 1) {
|
||||
feedMessage = feedMessage + "光电信号(move)不为有货状态,";
|
||||
}
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1000,7 +988,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||
Map map1 = new HashMap();
|
||||
ArrayList list1 = new ArrayList();
|
||||
map1.put("code", "to_close_door");
|
||||
map1.put("value", "1");
|
||||
list1.add(map1);
|
||||
hongXiangConveyorDeviceDriver.writing(list1);
|
||||
if (StrUtil.isNotEmpty(taskDto.getOven_time())) {
|
||||
//下发烘箱时间
|
||||
int time = Integer.parseInt(taskDto.getOven_time());
|
||||
@@ -1038,8 +1031,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
map.put("value", "5");
|
||||
list.add(map);
|
||||
this.writing(list);
|
||||
this.setNow_steps_type(6);
|
||||
this.setNow_steps_type(0);
|
||||
this.setRequireActionSucess(true);
|
||||
try {
|
||||
finish_instruction(inst2);
|
||||
} catch (Exception e) {
|
||||
@@ -1049,7 +1041,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.getNow_steps_type() == 5) {
|
||||
feedMessage = "行架机械手:";
|
||||
if (mode != 3) {
|
||||
feedMessage = feedMessage + "工作模式(mode)不为运行中状态,";
|
||||
@@ -1063,7 +1054,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (task == 0) {
|
||||
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1113,6 +1103,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (error == 0 && iserror) {
|
||||
this.setMessage(LangProcess.msg("universal_message4"));
|
||||
}
|
||||
String requireActionSucess = "请求动作已复位";
|
||||
if(this.requireActionSucess){
|
||||
requireActionSucess = "请求动作未复位";
|
||||
}
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("mode", mode);
|
||||
jo.put("move", move);
|
||||
@@ -1126,6 +1120,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
||||
jo.put("feedMessage", feedMessage);
|
||||
jo.put("requireActionSucess", requireActionSucess);
|
||||
jo.put("driver_type", "siemens_conveyor");
|
||||
jo.put("is_click", true);
|
||||
jo.put("x", x_position);
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "dev")
|
||||
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "prod")
|
||||
public class JobRunner implements ApplicationRunner {
|
||||
private static final Logger log = LoggerFactory.getLogger(JobRunner.class);
|
||||
private final ISysQuartzJobService quartzJobService;
|
||||
|
||||
Reference in New Issue
Block a user