优化
This commit is contained in:
@@ -41,42 +41,7 @@ public enum DriverTypeEnum {
|
||||
|
||||
TRAFFIC_LIGHT(34, "traffic_light", "标准版-交通灯-欧姆龙plc", "alarmLamp"),
|
||||
|
||||
STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"),
|
||||
|
||||
LNSH_MIXING_MILL(37, "lnsh_mixing_mill", "晟华-混碾机", "station"),
|
||||
|
||||
LNSH_PRESS(38, "lnsh_press", "晟华-压力机", "station"),
|
||||
|
||||
LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "晟华-码垛机械手", "station"),
|
||||
|
||||
LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "晟华-入出窑桁架", "station"),
|
||||
|
||||
LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "晟华-出窑桁架", "station"),
|
||||
|
||||
LNSH_KILN_LANE(42, "lnsh_kiln_lane", "晟华-窑车道", "station"),
|
||||
|
||||
LNSH_FOLD_DISC_SITE(43, "lnsh_fold_disc_site", "晟华-叠盘机", "station"),
|
||||
|
||||
LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "晟华-托盘存储线", "station"),
|
||||
|
||||
LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "晟华-包装码垛机械手", "station"),
|
||||
|
||||
LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "晟华-贴标机", "station"),
|
||||
|
||||
LNSH_SPLIT_MANIPULATOR(47, "lnsh_split_manipulator", "晟华-拆垛机械手", "station"),
|
||||
|
||||
LNSH_RGV(48, "lnsh_rgv", "晟华-RGV", "rgv"),
|
||||
|
||||
LNSH_PACKAGE_LINE(49, "lnsh_package_line", "晟华-包装机", "station"),
|
||||
|
||||
LNSH_STATION(50, "lnsh_station", "晟华-工位(交互模板)", "station"),
|
||||
|
||||
LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "晟华-覆膜机", "station"),
|
||||
|
||||
LNSH_PACKAGE_SITE(52, "lnsh_package_site", "晟华-包装线工位", "station"),
|
||||
|
||||
LNSH_CRUSHER(52, "lnsh_crusher", "晟华-破碎机", "station");
|
||||
|
||||
STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv");
|
||||
|
||||
//驱动索引
|
||||
private int index;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
package org.nl.acs.device_driver.feedback_agv_status_site;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 上报AGV状态站点
|
||||
*/
|
||||
@Service
|
||||
public class FeedbackAGVStatusSiteDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "feedback_agv_status_site";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "上报AGV状态站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "上报AGV状态站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new FeedbackAGVStatusSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return FeedbackAGVStatusSiteDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package org.nl.acs.device_driver.feedback_agv_status_site;
|
||||
|
||||
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_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 上报AGV状态站点
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class FeedbackAGVStatusSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_status;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package org.nl.acs.device_driver.feedback_agv_status_site;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_to_status = "to_status";
|
||||
|
||||
private FeedbackAGVStatusSiteDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(FeedbackAGVStatusSiteDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getToStatus() {
|
||||
return this.getOpcIntegerValue(item_to_status);
|
||||
}
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_status, "agv状态", "DB608.B0", Boolean.valueOf(true)));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user