fix:写入修改
This commit is contained in:
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jinterop.dcom.common.JIException;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
@@ -19,6 +20,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
|||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest;
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest;
|
||||||
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse;
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse;
|
||||||
|
import org.nl.acs.ext.wms.data.JsonUtl;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
@@ -28,9 +30,7 @@ import org.nl.acs.instruction.service.InstructionService;
|
|||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.*;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
|
||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
@@ -38,7 +38,12 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.modules.system.service.ParamService;
|
import org.nl.modules.system.service.ParamService;
|
||||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.modules.wql.exception.WDKException;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.openscada.opc.lib.da.AddFailedException;
|
||||||
|
import org.openscada.opc.lib.da.Group;
|
||||||
|
import org.openscada.opc.lib.da.Item;
|
||||||
|
import org.openscada.opc.lib.da.ItemState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -54,6 +59,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
protected org.nl.acs.device_driver.basedriver.indoor_manipulator.ItemProtocol itemProtocol = new ItemProtocol(this);
|
protected org.nl.acs.device_driver.basedriver.indoor_manipulator.ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
@Autowired
|
@Autowired
|
||||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
private OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService .class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -391,7 +398,11 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||||
this.control(itemMap);
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -436,8 +447,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||||
feedbackSucess = true;
|
feedbackSucess = true;
|
||||||
message = "反馈LMS成功...";
|
message = "反馈尺寸LMS成功...";
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈尺寸成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
String is_bushing = task.getIs_bushing();
|
String is_bushing = task.getIs_bushing();
|
||||||
String version = task.getVersion();
|
String version = task.getVersion();
|
||||||
String bushing_num = task.getBushing_num();
|
String bushing_num = task.getBushing_num();
|
||||||
@@ -450,7 +461,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
} else {
|
} else {
|
||||||
feedbackSucess = false;
|
feedbackSucess = false;
|
||||||
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈尺寸成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,14 +471,22 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
applyManipulatorActionRequest.setType("3");
|
applyManipulatorActionRequest.setType("3");
|
||||||
applyManipulatorActionRequest.setTask_code1(task_code);
|
applyManipulatorActionRequest.setTask_code1(task_code);
|
||||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
if (applyManipulatorActionResponse.getstatus()==200) {
|
||||||
Device device = deviceAppService.findDeviceByCode(put_device_code);
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请放货点请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
String to_putpoint = device.getExtraValue().get("address").toString();
|
String put_device_code = applyManipulatorActionResponse.getPut_device_code();
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Device device = deviceAppService.findDeviceByCode(put_device_code);
|
||||||
map.put("to_command", 3);
|
String to_putpoint = device.getExtraValue().get("address").toString();
|
||||||
map.put("to_putpoint", Integer.parseInt(to_putpoint));
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
this.writing(map);
|
map.put("to_command", 3);
|
||||||
feedbackSucess = true;
|
map.put("to_putpoint", Integer.parseInt(to_putpoint));
|
||||||
|
this.writing(map);
|
||||||
|
feedbackSucess = true;
|
||||||
|
message = "申请新取货点成功";
|
||||||
|
} else {
|
||||||
|
feedbackSucess = false;
|
||||||
|
message = "申请放货点LMS失败," + String.valueOf(applyManipulatorActionResponse);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "反馈尺寸成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//申请新取货点
|
//申请新取货点
|
||||||
@@ -489,8 +508,8 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
message = "申请新取货点成功";
|
message = "申请新取货点成功";
|
||||||
} else {
|
} else {
|
||||||
feedbackSucess = false;
|
feedbackSucess = false;
|
||||||
message = "申请失败";
|
message = "申请新取货点失败";
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请失败,返回参数:" + applyManipulatorActionResponse);
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请新取货点,返回参数:" + applyManipulatorActionResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,12 +528,12 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
map.put("to_two_putpoint", Integer.parseInt(to_two_putpoint));
|
map.put("to_two_putpoint", Integer.parseInt(to_two_putpoint));
|
||||||
this.writing(map);
|
this.writing(map);
|
||||||
feedbackSucess = true;
|
feedbackSucess = true;
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请二次放货点,返回参数:" + applyManipulatorActionResponse);
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请二次放货点成功,返回参数:" + applyManipulatorActionResponse);
|
||||||
message = "申请二次放货点成功";
|
message = "申请二次放货点成功";
|
||||||
} else {
|
} else {
|
||||||
feedbackSucess = false;
|
feedbackSucess = false;
|
||||||
message = "申请失败";
|
message = "申请二次放货点失败";
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请失败,返回参数:" + applyManipulatorActionResponse);
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请二次放货点,返回参数:" + applyManipulatorActionResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,11 +542,19 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
String task_code = inst1.getTask_code();
|
String task_code = inst1.getTask_code();
|
||||||
applyManipulatorActionRequest.setAction("1");
|
applyManipulatorActionRequest.setAction("1");
|
||||||
applyManipulatorActionRequest.setTask_code1(task_code);
|
applyManipulatorActionRequest.setTask_code1(task_code);
|
||||||
acsToWmsService.actionFinishRequest(applyManipulatorActionRequest);
|
ApplyManipulatorActionResponse applyManipulatorActionResponse1 = acsToWmsService.actionFinishRequest(applyManipulatorActionRequest);
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
if (applyManipulatorActionResponse1.getstatus() == 200) {
|
||||||
map.put("to_command", 6);
|
logServer.deviceExecuteLog(this.device_code, "", "", "缓存库取货请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse1));
|
||||||
this.writing(map);
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
feedbackSucess = true;
|
map.put("to_command", 6);
|
||||||
|
this.writing(map);
|
||||||
|
message = "缓存库取货完成";
|
||||||
|
feedbackSucess = true;
|
||||||
|
}else {
|
||||||
|
feedbackSucess = false;
|
||||||
|
message = "缓存库取货失败";
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "缓存库取货失败,返回参数:" + applyManipulatorActionResponse1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//缓存库放货完成
|
//缓存库放货完成
|
||||||
@@ -535,11 +562,20 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
String task_code = inst1.getTask_code();
|
String task_code = inst1.getTask_code();
|
||||||
applyManipulatorActionRequest.setAction("2");
|
applyManipulatorActionRequest.setAction("2");
|
||||||
applyManipulatorActionRequest.setTask_code1(task_code);
|
applyManipulatorActionRequest.setTask_code1(task_code);
|
||||||
acsToWmsService.actionFinishRequest(applyManipulatorActionRequest);
|
ApplyManipulatorActionResponse applyManipulatorActionResponse1 = acsToWmsService.actionFinishRequest(applyManipulatorActionRequest);
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
if (applyManipulatorActionResponse1.getstatus() == 200) {
|
||||||
map.put("to_command", 7);
|
logServer.deviceExecuteLog(this.device_code, "", "", "缓存库放货完成,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse1));
|
||||||
this.writing(map);
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
feedbackSucess = true;
|
map.put("to_command", 7);
|
||||||
|
this.writing(map);
|
||||||
|
feedbackSucess = true;
|
||||||
|
message = "缓存库放货成功";
|
||||||
|
}else {
|
||||||
|
feedbackSucess = false;
|
||||||
|
message = "缓存库放货失败";
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "缓存库放货完成,返回参数:" + applyManipulatorActionResponse1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -552,7 +588,9 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("to_command", 8);
|
map.put("to_command", 8);
|
||||||
this.writing(map);
|
this.writing(map);
|
||||||
|
message = "放货完成";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
message = "放货失败";
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
feedMessage = "";
|
feedMessage = "";
|
||||||
@@ -574,11 +612,11 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}else {
|
||||||
} else {
|
|
||||||
feedMessage = "";
|
feedMessage = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Instruction checkInst() {
|
public Instruction checkInst() {
|
||||||
if (ObjectUtil.isNotEmpty(this.inst)) {
|
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||||
@@ -710,6 +748,95 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkcontrol(Map<String, Object> itemValues) throws JIException, AddFailedException {
|
||||||
|
Group group = opcServerService.getServer(this.getOpcServer());
|
||||||
|
Map<String, Object> write = new HashMap();
|
||||||
|
Map<String, Item> readitems = new LinkedHashMap();
|
||||||
|
List<String> itemsString = new ArrayList();
|
||||||
|
itemsString = new ArrayList<> (itemValues.keySet());
|
||||||
|
Iterator is = itemsString.iterator();
|
||||||
|
|
||||||
|
while (is.hasNext()) {
|
||||||
|
String string = (String) is.next();
|
||||||
|
try {
|
||||||
|
readitems.put(string, group.addItem(string));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
while(true) {
|
||||||
|
//下发信号
|
||||||
|
try{
|
||||||
|
if(i == 0){
|
||||||
|
control( itemValues);
|
||||||
|
} else {
|
||||||
|
controlByNewConn( itemValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Map<String, Object> read = new HashMap();
|
||||||
|
Map<Item, ItemState> itemStatus = null;
|
||||||
|
boolean check = true;
|
||||||
|
try{
|
||||||
|
if(i>0){
|
||||||
|
group = opcServerService.getServer(this.getOpcServer());
|
||||||
|
itemsString = new ArrayList<> (itemValues.keySet());
|
||||||
|
Iterator nis = itemsString.iterator();
|
||||||
|
|
||||||
|
while (nis.hasNext()) {
|
||||||
|
String string = (String) nis.next();
|
||||||
|
try {
|
||||||
|
readitems.put(string, group.addItem(string));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemStatus = group.read(true, (Item[])readitems.values().toArray(new Item[0]));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
itemStatus = group.read(true, (Item[])readitems.values().toArray(new Item[0]));
|
||||||
|
}
|
||||||
|
Set<Item> items = itemStatus.keySet();
|
||||||
|
Iterator var15 = items.iterator();
|
||||||
|
while(var15.hasNext()) {
|
||||||
|
Item item = (Item)var15.next();
|
||||||
|
ItemState itemState = (ItemState)itemStatus.get(item);
|
||||||
|
Object value = OpcUtl.getValue(item, itemState);
|
||||||
|
read.put(item.getId(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator var24 = itemsString.iterator();
|
||||||
|
|
||||||
|
while(var24.hasNext()) {
|
||||||
|
String itemString = (String)var24.next();
|
||||||
|
if (!ObjectUtl.isEquals(itemValues.get(itemString), JsonUtl.parse(read.get(itemString)))) {
|
||||||
|
check = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
check = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
ThreadUtl.sleep(300L);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 3) {
|
||||||
|
log.info("写入次数超过3次而失败");
|
||||||
|
throw new WDKException("写入次数超过3次而失败");
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void writing(String param, String value) {
|
public void writing(String param, String value) {
|
||||||
|
|
||||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||||
this.control(itemMap);
|
this.checkcontrol(itemMap);
|
||||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jinterop.dcom.common.JIException;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device_driver.DeviceDriver;
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
@@ -29,6 +30,7 @@ import org.nl.acs.task.service.TaskService;
|
|||||||
import org.nl.modules.system.service.ParamService;
|
import org.nl.modules.system.service.ParamService;
|
||||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.openscada.opc.lib.da.AddFailedException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -146,11 +148,11 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
// bushingSucess();
|
// bushingSucess();
|
||||||
// }
|
// }
|
||||||
// break;
|
// break;
|
||||||
// case 6:
|
case 6:
|
||||||
// if (task1 > 0 && !requireSucess) {
|
if (task1 > 0 && !requireSucess) {
|
||||||
// pullingSucess();
|
pullingSucess();
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -165,6 +167,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void pullingSucess() {
|
private synchronized void pullingSucess() {
|
||||||
|
List list = new ArrayList();
|
||||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
|
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
|
||||||
@@ -177,7 +180,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
map.put("to_command", 6);
|
map.put("to_command", 6);
|
||||||
this.writing(map);
|
this.writing(map);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyManipulatorActionResponse);
|
logServer.deviceExecuteLog(this.device_code, "", "", "拔轴完成反馈,返回参数:" + applyManipulatorActionResponse);
|
||||||
message = "拔轴完成成功";
|
message = "拔轴完成成功";
|
||||||
}else{
|
}else{
|
||||||
message = applyManipulatorActionResponse.getMessage();
|
message = applyManipulatorActionResponse.getMessage();
|
||||||
@@ -185,12 +188,13 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
map.put("to_command", 99);
|
map.put("to_command", 99);
|
||||||
requireSucess = true;
|
requireSucess = true;
|
||||||
message = "拔轴失败";
|
message = "拔轴失败";
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyManipulatorActionResponse);
|
logServer.deviceExecuteLog(this.device_code, "", "", "拔轴完成反馈,返回参数:" + applyManipulatorActionResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private synchronized void bushingSucess() {
|
private synchronized void bushingSucess() {
|
||||||
|
List list = new ArrayList();
|
||||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
|
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
|
||||||
@@ -221,6 +225,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void applyBushing() {
|
private synchronized void applyBushing() {
|
||||||
|
List list = new ArrayList();
|
||||||
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
|
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
|
||||||
@@ -273,7 +278,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
*
|
*
|
||||||
* @param map
|
* @param map
|
||||||
*/
|
*/
|
||||||
public void writing(Map<String, Object> map) {
|
public void writing(Map<String, Object> map) {
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||||
map.forEach((key, value) -> {
|
map.forEach((key, value) -> {
|
||||||
@@ -282,7 +287,11 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||||
this.control(itemMap);
|
try {
|
||||||
|
this.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user