opt: 行架-agv对接位优化写入信号方法
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station;
|
package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -25,6 +26,8 @@ import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
|||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.config.language.LangProcess;
|
import org.nl.config.language.LangProcess;
|
||||||
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -54,6 +57,8 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
@Autowired
|
@Autowired
|
||||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
|
||||||
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||||
|
|
||||||
private Date instruction_require_time = new Date();
|
private Date instruction_require_time = new Date();
|
||||||
private Date instruction_finished_time = new Date();
|
private Date instruction_finished_time = new Date();
|
||||||
private Date instruction_apply_time = new Date();
|
private Date instruction_apply_time = new Date();
|
||||||
@@ -168,6 +173,39 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
logDto.setLog_level(3);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void thingToNothing() {
|
protected void thingToNothing() {
|
||||||
this.setRequireSucess(false);
|
this.setRequireSucess(false);
|
||||||
}
|
}
|
||||||
@@ -175,11 +213,24 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
public void writing(int command) {
|
public void writing(int command) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command;
|
+ "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command;
|
||||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
|
||||||
//Server server = ReadUtil.getServer(opcservcerid);
|
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
itemMap.put(to_command, command);
|
itemMap.put(to_command, command);
|
||||||
this.control(itemMap);
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("下发电气信号:" + itemMap)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(3);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user