Browse Source

更新驱动

master
汪菘 3 years ago
parent
commit
a0a043d122
  1. 99
      nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
  2. 8
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDefination.java
  3. 113
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDeviceDriver.java
  4. 71
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDefination.java
  5. 44
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java
  6. 6
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/ItemProtocol.java
  7. 71
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDefination.java
  8. 31
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java
  9. 72
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java
  10. 6
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDefination.java
  11. 59
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java
  12. 6
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDefination.java
  13. 87
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java
  14. 67
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/ItemProtocol.java
  15. 155
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_packing/HaiLiangPackingDeviceDriver.java
  16. 16
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDefination.java
  17. 31
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDeviceDriver.java
  18. 72
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/ItemProtocol.java
  19. 71
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDefination.java
  20. 44
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java
  21. 72
      nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/ItemProtocol.java

99
nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java

@ -9,105 +9,20 @@ import com.alibaba.fastjson.JSONObject;
* https://blog.csdn.net/moneyshi/article/details/82978073
*/
public enum DriverTypeEnum {
ORDINARY_SITE(1, "standard_ordinary_site", "普通站点", "station"),
WEIGHING_SITE(2, "weighing_site", "称重站点", "station"),
HAILIANG_FEEDING_TRRUNK(1, "hailiang_feeding_trunk", "海亮包装项目-上料总线体", "conveyor"),
INSPECT_SITE(3, "standard_inspect_site", "检测站点", "station"),
HAILIANG_FEEDING(2, "hailiang_feeding", "海亮包装项目-上料线体", "conveyor"),
NON_LINE_INSPECT_SITE(4, "non_line_inspect_site", "检测站点-无PLC", "station"),
HAILIANG_LEETERING(3, "hailiang_lettering", "海亮包装项目-刻字线体", "conveyor"),
MACHINES_SITE(5, "machines_site", "机台设备-无光电", "station"),
HAILIANG_RISKING(4, "hailiang_risking", "海亮包装项目-套冒线体", "conveyor"),
SPECIAL_SITE(6, "standard_special_inspect_site", "专机设备交互站点", "station"),
HAILIANG_STRAPPING(5, "hailiang_strapping", "海亮包装项目-捆扎线体", "conveyor"),
MANIPULATOR_SITE(7, "standard_manipulator_inspect_site", "区域管制设备交互站点", "station"),
HAILIANG_COATING(6, "hailiang_coating", "海亮包装项目-裹膜线体", "conveyor"),
NON_LINE_MANIPULATOR_SITE(8, "non_line_manipulator_inspect_site", "区域管制设备交互站点-无PLC", "station"),
AUTODOOR(9, "standard_autodoor", "标准版-自动门", "autodoor"),
STACK_EMPUYPALLET_SITE(10, "standard_emptypallet_site", "标准版-空盘叠盘站点", "station"),
LAMP_THREE_COLOR(11, "lamp_three_color", "标准版-三色灯", "alarmLamp"),
SPECIAL_ORDINARY_SITE(12, "special_ordinary_site", "特殊版-普通站点-关联锁定", "station"),
STORAGE(13, "standard_storage", "标准版-货架", "storage"),
SCANNER(14, "standard_scanner", "标准版-扫码器", "scanner"),
INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(15, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "station"),
INSPECT_CONVEYOR_CONTROL(16, "standard_conveyor_control", "标准版-输送机-控制点", "conveyor"),
INSPECT_CONVEYOR_MONITOR(17, "standard_conveyor_monitor", "标准版-输送机-监控点", "conveyor"),
MANIPULATOR_INSPECT_SITE_NDC(18, "manipulator_inspect_site_NDC", "区域管制设备交互站点-NDC", "station"),
FEEDBACK_AGV_STATUS_SITE(19, "feedback_agv_status_site", "上报AGV状态站点", "station"),
MANIPULATOR_STACKING_SITE(20, "standard_manipulator_stacking_site", "机械手码垛驱动(区分托盘类型)", "conveyor"),
PHOTOELECTRIC_INSPECT_SITE(21, "standard_photoelectric_inspect_site", "光电检测站点(优先出库)", "station"),
HAILIANG_PACKING(22, "hailiang_packing", "海亮项目-包装机", "conveyor"),
HAILIANG_LABELING(23, "hailiang_labeling", "海亮项目-贴标机", "conveyor"),
HAILIANG_COATING(24, "hailiang_coating", "海亮项目-裹膜机", "conveyor"),
NDXY_SPECIAL(25, "ndxy_special", "纽迪希亚专用", "station"),
NDXY_SPECIAL_TWO(26, "ndxy_special_two", "纽迪希亚专用2", "station"),
INSPECT_CONVEYOR_CONTROL_WITH_PLCSCANNER(27, "standard_conveyor_control_with_plcscanner", "标准版-输送机-控制点-PLC扫码", "conveyor"),
WHXR_STORAGE_CONVEYOR(28, "whxr_storage_conveyor", "武汉新锐-立库对接位", "conveyor"),
WHXR_BALL_MILL_DEVICE(29, "whxr_ball_mill", "武汉新锐-球磨机", "conveyor"),
WHXR_SPRAY_TOWER_DEVICE(30, "whxr_spary_tower", "武汉新锐-喷雾塔", "conveyor"),
WHXR_WEIGHT_DEVICE(31, "whxr_weight", "武汉新锐-称重设备", "conveyor"),
ELECTRIC_FENCE(32, "electric_fence", "标准版-电子围栏", "safetydoor"),
OUMULONGPLC(33, "oumulong_plc", "标准版-自动门-欧姆龙plc", "autodoor"),
TRAFFIC_LIGHT(34, "traffic_light", "标准版-交通灯-欧姆龙plc", "alarmLamp"),
STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"),
YKBK_SPECIAL(36, "ykbk_special", "伊科拜克默认物料", "station"),
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", "station"),
LNSH_PACKAGE_LINE(49, "lnsh_package_line", "晟华-包装线", "station"),
LNSH_STATION(50, "lnsh_station", "晟华-工位(交互模板)", "station");
HAILIANG_LABELING(7, "hailiang_labeling", "海亮包装项目-贴标线体", "conveyor");
//驱动索引

8
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDefination.java

@ -12,23 +12,23 @@ import java.util.LinkedList;
import java.util.List;
/**
* 海亮裹膜
* 海亮裹膜线体
*/
@Service
public class HaiLiangCoatingDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "lamp_three_color";
return "hailiang_coating";
}
@Override
public String getDriverName() {
return "标准版-三色灯";
return "海亮包装项目-裹膜线体";
}
@Override
public String getDriverDescription() {
return "标准版-三色灯";
return "海亮包装项目-裹膜线体";
}
@Override

113
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_coating/HaiLiangCoatingDeviceDriver.java

@ -22,67 +22,13 @@ import java.util.HashMap;
import java.util.Map;
/**
* 海亮-裹膜机驱动
* 海亮-裹膜机线体
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
String putReadyLock = null;
//有货标记
protected boolean has_goods_tag = false;
String devicecode;
int mode = 0;
int action = 0;
int error = 0;
int move = 0;
int task = 0;
int last_action = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
boolean hasVehicle = false;
boolean isReady = false;
protected int instruction_num = 0;
protected int instruction_num_truth = 0;
protected boolean hasGoods = false;
boolean isFold = false;
private String assemble_check_tag;
private Boolean sampleMode0;
private Boolean sampleMode3;
private Integer sampleError;
private Boolean sampleOnline;
protected String displayMessage = null;
public int display_message_time_out = 30000;
public Date display_message_time;
protected String current_stage_instruction_message;
protected String last_stage_instruction_message;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private int instruction_require_time_out;
boolean requireSucess = false;
private int instruction_finished_time_out;
int branchProtocol = 0;
@Override
public Device getDevice() {
@ -92,63 +38,6 @@ public class HaiLiangCoatingDeviceDriver extends AbstractOpcDeviceDriver impleme
@Override
public void execute() {
String message = null;
String device_code = this.getDevice().getDevice_code();
mode = this.itemProtocol.getMode();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
if (mode != last_mode) {
}
if (action != last_action) {
}
if (error != last_error) {
}
last_action = action;
last_mode = mode;
last_error = error;
//message = StringFormatUtl.format("设备报警:{}", new Object[]{});
// String manual_create_task = this.getDevice().getExtraValue().get("manual_create_task").toString();
}
public synchronized String getStatus() {
JSONObject jo = new JSONObject();
if (action == 1) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "OPEN");
} else if (action == 2) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "CLOSE");
} else {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "ERROR");
}
return jo.toString();
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command;
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);
log.info("下发PLC信号:{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
}
public synchronized void OpenOrClose(String type) {
writing(Integer.parseInt(type));
}

71
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDefination.java

@ -0,0 +1,71 @@
package org.nl.acs.device_driver.hailiang.hailiang_feeding;
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.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* 海亮上料线体
*/
@Service
public class HaiLiangFeedingDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_feeding";
}
@Override
public String getDriverName() {
return "海亮包装项目-上料线体";
}
@Override
public String getDriverDescription() {
return "海亮包装项目-上料线体";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HaiLiangFeedingDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HaiLiangFeedingDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

44
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java

@ -0,0 +1,44 @@
package org.nl.acs.device_driver.hailiang.hailiang_feeding;
import com.alibaba.fastjson.JSONObject;
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.instruction.service.InstructionService;
import org.nl.acs.opc.Device;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.utils.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮-上料线体
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
}
}

6
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_packing/ItemProtocol.java → nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/ItemProtocol.java

@ -1,4 +1,4 @@
package org.nl.acs.device_driver.hailiang.hailiang_packing;
package org.nl.acs.device_driver.hailiang.hailiang_feeding;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@ -15,9 +15,9 @@ public class ItemProtocol {
public static String item_to_command = "to_command";
private HaiLiangPackingDeviceDriver driver;
private HaiLiangFeedingDeviceDriver driver;
public ItemProtocol(HaiLiangPackingDeviceDriver driver) {
public ItemProtocol(HaiLiangFeedingDeviceDriver driver) {
this.driver = driver;
}

71
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDefination.java

@ -0,0 +1,71 @@
package org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk;
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.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* 海亮裹膜机
*/
@Service
public class HaiLiangFeedingTrunkDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_feeding_trunk";
}
@Override
public String getDriverName() {
return "海亮包装项目-上料总线体";
}
@Override
public String getDriverDescription() {
return "海亮包装项目-上料总线体";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HaiLiangFeedingTrunkDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HaiLiangFeedingTrunkDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

31
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java

@ -0,0 +1,31 @@
package org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.opc.Device;
/**
* 海亮-上料总线体
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
}
}

72
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java

@ -0,0 +1,72 @@
package org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
private HaiLiangFeedingTrunkDeviceDriver driver;
public ItemProtocol(HaiLiangFeedingTrunkDeviceDriver driver) {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
//log.error("读取错误!");
} else {
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB51.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_action, "动作信号", "DB51.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB51.B4"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB52.W2", Boolean.valueOf(true)));
return list;
}
}

6
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDefination.java

@ -12,7 +12,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 海亮贴标机驱动
* 海亮贴标线体
*/
@Service
public class HaiLiangLabelingDefination implements OpcDeviceDriverDefination {
@ -23,12 +23,12 @@ public class HaiLiangLabelingDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverName() {
return "海亮-贴标机";
return "海亮包装项目-贴标线体";
}
@Override
public String getDriverDescription() {
return "海亮-贴标机";
return "海亮包装项目-贴标线体";
}
@Override

59
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java

@ -3,18 +3,13 @@ package org.nl.acs.device_driver.hailiang.hailiang_labeling;
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.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;
/**
* 海亮贴标机驱动
* 海亮贴标线体
*/
@Slf4j
@Data
@ -22,17 +17,6 @@ import java.util.Map;
public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
String devicecode;
int mode = 0;
int action = 0;
int error = 0;
int move = 0;
int last_action = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int branchProtocol = 0;
@Override
public Device getDevice() {
return this.device;
@ -40,48 +24,7 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
@Override
public void execute() {
String message = null;
String device_code = this.getDevice().getDevice_code();
mode = this.itemProtocol.getMode();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
if (mode != last_mode) {
}
if (action != last_action) {
}
if (error != last_error) {
}
// 打印就绪
if (mode == 1 && error == 0) {
}
//打印完成
if (action == 1) {
}
last_action = action;
last_mode = mode;
last_error = error;
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command;
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);
log.info("下发PLC信号:{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
}
public synchronized void OpenOrClose(String type) {
writing(Integer.parseInt(type));
}
}

6
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDefination.java

@ -10,7 +10,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* 海亮刻字机驱动
* 海亮刻字线体
*/
@Service
public class HaiLiangLetteringDefination implements DeviceDriverDefination {
@ -21,12 +21,12 @@ public class HaiLiangLetteringDefination implements DeviceDriverDefination {
@Override
public String getDriverName() {
return "海亮-激光刻字机";
return "海亮包装项目-刻字线体";
}
@Override
public String getDriverDescription() {
return "海亮-激光刻字机";
return "海亮包装项目-刻字线体";
}
@Override

87
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/HaiLiangLetteringDeviceDriver.java

@ -23,97 +23,10 @@ import java.util.Date;
@Data
@RequiredArgsConstructor
public class HaiLiangLetteringDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
Integer hasGoods = 0;
int error = 0;
Boolean iserror = false;
Boolean islock = false;
int branchProtocol = 0;
int last_branchProtocol = 0;
//是否需要输入物料
String input_material = "0";
//备注
String remark = "";
//数量
String qty = "";
//是否在线
Boolean is_online = true;
//批次
String batch = "";
//物料
String material = "";
//目标点位
String purpose = "";
//当前指令
Instruction inst = null;
//上次指令
Instruction last_inst = null;
boolean requireSucess = false;
//触摸屏手动触发任务
private Boolean is_has_task = false;
//申请搬运任务
private Boolean apply_handling = false;
//申请物料
private Boolean apply_material = false;
// 1取货完成 2放货完成 3进入区域 4离开区域
private int flag;
//人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
private int manua_confirm = 0;
String devicecode;
String container;
String container_type_desc;
String last_container_type_desc;
String last_container;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private int instruction_require_time_out;
String message;
// 1就绪 2下发刻字 3 刻字完成
int status;
int mode = 2;
int move;
int action;
int ioaction;
@Override
public void execute() {
hasGoods = this.getDevice().getHas_goods();
material = this.getDevice().getMaterial_type();
batch = this.getDevice().getBatch();
devicecode = this.getDeviceCode();
if (branchProtocol != last_branchProtocol) {
requireSucess = false;
}
switch (branchProtocol) {
case 1:
break;
//呼叫请求
case 2:
break;
//响应生成任务
case 3:
break;
}
}

67
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_lettering/ItemProtocol.java

@ -0,0 +1,67 @@
package org.nl.acs.device_driver.hailiang.hailiang_lettering;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.hailiang.hailiang_labeling.HaiLiangLabelingDeviceDriver;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_mode = "mode";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
private HaiLiangLabelingDeviceDriver driver;
public ItemProtocol(HaiLiangLabelingDeviceDriver driver) {
this.driver = driver;
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
//log.error("读取错误!");
} else {
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_mode, "工作状态", "V100.1", Boolean.valueOf(true)));
list.add(new ItemDto(item_action, "动作信号", "V100.0"));
list.add(new ItemDto(item_error, "报警信号", "VB101"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "V102.0", Boolean.valueOf(true)));
return list;
}
}

155
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_packing/HaiLiangPackingDeviceDriver.java

@ -1,155 +0,0 @@
package org.nl.acs.device_driver.hailiang.hailiang_packing;
import com.alibaba.fastjson.JSONObject;
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.instruction.service.InstructionService;
import org.nl.acs.opc.Device;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.utils.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮-包装机驱动
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HaiLiangPackingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
String putReadyLock = null;
//有货标记
protected boolean has_goods_tag = false;
String devicecode;
int mode = 0;
int action = 0;
int error = 0;
int move = 0;
int task = 0;
int last_action = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
boolean hasVehicle = false;
boolean isReady = false;
protected int instruction_num = 0;
protected int instruction_num_truth = 0;
protected boolean hasGoods = false;
boolean isFold = false;
private String assemble_check_tag;
private Boolean sampleMode0;
private Boolean sampleMode3;
private Integer sampleError;
private Boolean sampleOnline;
protected String displayMessage = null;
public int display_message_time_out = 30000;
public Date display_message_time;
protected String current_stage_instruction_message;
protected String last_stage_instruction_message;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private int instruction_require_time_out;
boolean requireSucess = false;
private int instruction_finished_time_out;
int branchProtocol = 0;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
String message = null;
String device_code = this.getDevice().getDevice_code();
mode = this.itemProtocol.getMode();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
if (mode != last_mode) {
}
if (action != last_action) {
}
if (error != last_error) {
}
last_action = action;
last_mode = mode;
last_error = error;
//message = StringFormatUtl.format("设备报警:{}", new Object[]{});
// String manual_create_task = this.getDevice().getExtraValue().get("manual_create_task").toString();
}
public synchronized String getStatus() {
JSONObject jo = new JSONObject();
if (action == 1) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "OPEN");
} else if (action == 2) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "CLOSE");
} else {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "ERROR");
}
return jo.toString();
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command;
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);
log.info("下发PLC信号:{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
}
public synchronized void OpenOrClose(String type) {
writing(Integer.parseInt(type));
}
}

16
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_packing/HaiLiangPackingDefination.java → nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDefination.java

@ -1,4 +1,4 @@
package org.nl.acs.device_driver.hailiang.hailiang_packing;
package org.nl.acs.device_driver.hailiang.hailiang_risking;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
@ -12,34 +12,34 @@ import java.util.LinkedList;
import java.util.List;
/**
* 包装机驱动
* 海亮裹膜机
*/
@Service
public class HaiLiangPackingDefination implements OpcDeviceDriverDefination {
public class HaiLiangRiskingDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "lamp_three_color";
return "hailiang_risking";
}
@Override
public String getDriverName() {
return "标准版-三色灯";
return "海亮包装项目-套冒线体";
}
@Override
public String getDriverDescription() {
return "标准版-三色灯";
return "海亮包装项目-套冒线体";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HaiLiangPackingDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new HaiLiangRiskingDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HaiLiangPackingDeviceDriver.class;
return HaiLiangRiskingDeviceDriver.class;
}
@Override

31
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/HaiLiangRiskingDeviceDriver.java

@ -0,0 +1,31 @@
package org.nl.acs.device_driver.hailiang.hailiang_risking;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.opc.Device;
/**
* 海亮-裹膜线体
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HaiLiangRiskingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
}
}

72
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_risking/ItemProtocol.java

@ -0,0 +1,72 @@
package org.nl.acs.device_driver.hailiang.hailiang_risking;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
private HaiLiangRiskingDeviceDriver driver;
public ItemProtocol(HaiLiangRiskingDeviceDriver driver) {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
//log.error("读取错误!");
} else {
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB51.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_action, "动作信号", "DB51.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB51.B4"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB52.W2", Boolean.valueOf(true)));
return list;
}
}

71
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDefination.java

@ -0,0 +1,71 @@
package org.nl.acs.device_driver.hailiang.hailiang_strapping;
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.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* 海亮包装项目-捆扎线体
*/
@Service
public class HaiLiangStrappingDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "hailiang_strapping";
}
@Override
public String getDriverName() {
return "海亮包装项目-捆扎线体";
}
@Override
public String getDriverDescription() {
return "海亮包装项目-捆扎线体";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HaiLiangStrappingDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return HaiLiangStrappingDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_action, "动作信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B4"));
return list;
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

44
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java

@ -0,0 +1,44 @@
package org.nl.acs.device_driver.hailiang.hailiang_strapping;
import com.alibaba.fastjson.JSONObject;
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.instruction.service.InstructionService;
import org.nl.acs.opc.Device;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.utils.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 海亮-捆扎线体
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
}
}

72
nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/ItemProtocol.java

@ -0,0 +1,72 @@
package org.nl.acs.device_driver.hailiang.hailiang_strapping;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_action = "action";
public static String item_error = "error";
public static String item_to_command = "to_command";
private HaiLiangStrappingDeviceDriver driver;
public ItemProtocol(HaiLiangStrappingDeviceDriver driver) {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
//log.error("读取错误!");
} else {
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB51.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_action, "动作信号", "DB51.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB51.B4"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB52.W2", Boolean.valueOf(true)));
return list;
}
}
Loading…
Cancel
Save