新锐更新
This commit is contained in:
@@ -5,8 +5,13 @@ import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.jinterop.dcom.common.JIException;
|
||||
import org.jinterop.dcom.core.JIVariant;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.log.service.impl.LogServerImpl;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.opc.OpcUtl;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.openscada.opc.dcom.list.ClassDetails;
|
||||
import org.openscada.opc.lib.common.AlreadyConnectedException;
|
||||
@@ -16,13 +21,16 @@ import org.openscada.opc.lib.da.*;
|
||||
import org.openscada.opc.lib.list.Categories;
|
||||
import org.openscada.opc.lib.list.Category;
|
||||
import org.openscada.opc.lib.list.ServerList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class ReadUtil {
|
||||
|
||||
public static void main(String[] args) throws AlreadyConnectedException, JIException, UnknownHostException, NotConnectedException, DuplicateGroupException, AddFailedException, InterruptedException {
|
||||
|
||||
// 启动服务
|
||||
/* ItemProtocol ipl = new ItemProtocol();
|
||||
List<ItemDto> list = ipl.getReadableItemDtos();
|
||||
@@ -156,7 +164,18 @@ public class ReadUtil {
|
||||
}
|
||||
|
||||
public static void write(Map<String, Object> strings, Server server) {
|
||||
String device_code = "";
|
||||
String param = "";
|
||||
String value = "";
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServerImpl.class);
|
||||
try {
|
||||
Set<String> strs = strings.keySet();
|
||||
for (String str : strs) {
|
||||
String[] split = str.split("\\.");
|
||||
device_code = split[2];
|
||||
param = split[3];
|
||||
value = strings.get(str).toString();
|
||||
}
|
||||
//Group group = this.opcServerService.getServer(opcServiceCode);
|
||||
Group group = server.addGroup();
|
||||
Iterator it = strings.keySet().iterator();
|
||||
@@ -173,7 +192,9 @@ public class ReadUtil {
|
||||
OpcUtl.writeValue(group, (WriteRequest[]) list.toArray(new WriteRequest[0]));
|
||||
}
|
||||
server.disconnect();
|
||||
logServer.log("","","",device_code + "," + param + "," + value + ",下发电气返回值:成功!","","","","");
|
||||
} catch (Exception e) {
|
||||
logServer.log("","","",device_code + "," + param + "," + value + ",下发电气返回值:失败!","","","","");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
try {
|
||||
String device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
hasGoods = this.itemProtocol.getMove();
|
||||
|
||||
@@ -5,11 +5,15 @@ import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
@@ -24,6 +28,9 @@ import java.util.Map;
|
||||
public class BallMillDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean("logServerImpl");
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
@@ -54,7 +61,6 @@ public class BallMillDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
@@ -63,6 +69,8 @@ public class BallMillDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
itemMap.put(to_param, Double.valueOf(value).intValue());
|
||||
|
||||
ReadUtil.write(itemMap, server);
|
||||
// logServer.log("","球磨机","",device_code + "," + param + "," + value,"","","","");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
@@ -24,6 +27,9 @@ import java.util.Map;
|
||||
public class SparyTowerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean("logServerImpl");
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
@@ -63,6 +69,8 @@ public class SparyTowerDeviceDriver extends AbstractOpcDeviceDriver implements D
|
||||
itemMap.put(to_param, Double.valueOf(value).intValue());
|
||||
|
||||
ReadUtil.write(itemMap, server);
|
||||
// logServer.log("","喷雾机","",device_code + "," + param + "," + value,"","","","");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
@@ -45,6 +46,8 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean("logServerImpl");
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
@@ -102,7 +105,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
public void execute() throws Exception {
|
||||
String message = null;
|
||||
try {
|
||||
String device_code = this.getDeviceCode();
|
||||
@@ -275,7 +278,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public synchronized boolean enter(JSONObject json) {
|
||||
public synchronized boolean enter(JSONObject json) throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
@@ -287,11 +290,15 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
JSONObject jsonObject = JSONObject.fromObject(result.body());
|
||||
if (result.getStatus() == 200 && jsonObject.get("status").equals("200")) {
|
||||
// Thread.sleep(300L);
|
||||
// this.writing(0);
|
||||
this.writing(this.mode);
|
||||
} else {
|
||||
// Thread.sleep(300L);
|
||||
this.writing(99);
|
||||
}
|
||||
} else {
|
||||
// Thread.sleep(300L);
|
||||
this.writing(99);
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
@@ -311,6 +318,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
itemMap.put(to_param, value);
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
ReadUtil.write(itemMap, server);
|
||||
// logServer.log("","称重机","",device_code + "," + param + "," + value,"","","","");
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
@@ -326,7 +334,7 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
// logServer.log("","称重机","",this.getDevice().getDevice_code() + ",to_command," + String.valueOf(command),"","","","");
|
||||
}
|
||||
|
||||
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
|
||||
|
||||
@@ -3583,7 +3583,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//反馈故障
|
||||
}
|
||||
dto.setState("ERROR");
|
||||
acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "1", "error");
|
||||
acsToWmsService.feedbackAgvStatus(String.valueOf(carno), String.valueOf(ikey), "error");
|
||||
}
|
||||
}
|
||||
//X坐标
|
||||
|
||||
Reference in New Issue
Block a user