add 标准电梯驱动

This commit is contained in:
张江玮
2023-10-12 16:46:15 +08:00
parent 445510b81a
commit f134c395d9
48 changed files with 689 additions and 300 deletions

View File

@@ -1,19 +1,19 @@
package org.nl.acs.device.service;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.DeviceType;
import java.util.List;
public interface DeviceDriverDefinationAppService {
public interface DeviceDriverDefinitionAppService {
List<String> getDeviceDriverCodes();
DeviceDriverDefination getDeviceDriverDefination(String driverCode);
DeviceDriverDefinition getDeviceDriverDefinition(String driverCode);
List<DeviceDriverDefination> getDeviceDriverDefinations();
List<DeviceDriverDefinition> getDeviceDriverDefinitions();
List<DeviceDriverDefination> getDeviceDriverDefinations(DeviceType var1);
List<DeviceDriverDefinition> getDeviceDriverDefinitions(DeviceType var1);
boolean isRoute(Class<? extends DeviceDriver> var1);

View File

@@ -20,7 +20,7 @@ import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.*;
import org.nl.acs.device.service.dto.*;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.oven_manipulator.OvenGantryManipulatorDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
@@ -31,7 +31,7 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
@@ -73,7 +73,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
private final OpcService opcService;
private final RedisUtils redisUtils;
private final OpcPlcService opcPlcService;
private final DeviceDriverDefinationAppService deviceDriverDefinationAppService;
private final DeviceDriverDefinitionAppService deviceDriverDefinitionAppService;
private final DeviceAppService deviceAppService;
private final ParamService paramService;
List<StorageCellDto> storageCells = new ArrayList<>();
@@ -260,7 +260,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
log.info("设备删除成功!");
if (deviceByCode != null) {
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefination().getFitDeviceTypes().get(0).name())) {
if (StrUtil.equals("storage", deviceByCode.getDeviceDriverDefinition().getFitDeviceTypes().get(0).name())) {
storageTab.delete("substring_index( storage_code,'-',1)= '" + device_code + "'");
} else {
@@ -1140,13 +1140,13 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
JSONObject result = new JSONObject();
//根据设备驱动定义获取OPC读写数据
DeviceDriverDefination deviceDriverDefination = deviceDriverDefinationAppService.getDeviceDriverDefination(driver_code);
OpcDeviceDriverDefination opcDeviceDriverDefination = null;
if (deviceDriverDefination instanceof OpcDeviceDriverDefination) {
opcDeviceDriverDefination = (OpcDeviceDriverDefination) deviceDriverDefination;
DeviceDriverDefinition deviceDriverDefinition = deviceDriverDefinitionAppService.getDeviceDriverDefinition(driver_code);
OpcDeviceDriverDefinition opcDeviceDriverDefinition = null;
if (deviceDriverDefinition instanceof OpcDeviceDriverDefinition) {
opcDeviceDriverDefinition = (OpcDeviceDriverDefinition) deviceDriverDefinition;
//处理DB读和写属性
result.put("rs", opcDeviceDriverDefination.getReadableItemDtos());
result.put("ws", opcDeviceDriverDefination.getWriteableItemDtos());
result.put("rs", opcDeviceDriverDefinition.getReadableItemDTOs());
result.put("ws", opcDeviceDriverDefinition.getWriteableItemDTOs());
}
@@ -1204,8 +1204,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
JSONArray rs = WQLObject.getWQLObject("acs_device_extra").query("filed_type='02' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0);
JSONArray r_arry = new JSONArray();
//先获取模板
if (ObjectUtil.isNotEmpty(opcDeviceDriverDefination)) {
List<ItemDto> readableItemDtos = opcDeviceDriverDefination.getReadableItemDtos();
if (ObjectUtil.isNotEmpty(opcDeviceDriverDefinition)) {
List<ItemDto> readableItemDtos = opcDeviceDriverDefinition.getReadableItemDTOs();
List<JSONObject> readableItemJsons = new ArrayList<>();
for (int i = 0; i < readableItemDtos.size(); i++) {
ItemDto itemDto = readableItemDtos.get(i);
@@ -1251,7 +1251,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
JSONArray ws = WQLObject.getWQLObject("acs_device_extra").query("filed_type='03' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0);
JSONArray w_arry = new JSONArray();
List<ItemDto> writeableItemDtos = opcDeviceDriverDefination.getWriteableItemDtos();
List<ItemDto> writeableItemDtos = opcDeviceDriverDefinition.getWriteableItemDTOs();
List<JSONObject> writeableItemJsons = new ArrayList<>();
for (int i = 0; i < writeableItemDtos.size(); i++) {
ItemDto itemDto = writeableItemDtos.get(i);
@@ -1593,12 +1593,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
//处理设备扩展属性
JSONObject result = new JSONObject();
//根据设备驱动定义获取OPC读写数据
DeviceDriverDefination deviceDriverDefination = deviceDriverDefinationAppService.getDeviceDriverDefination(driver_code);
if (deviceDriverDefination instanceof OpcDeviceDriverDefination) {
OpcDeviceDriverDefination opcDeviceDriverDefination = (OpcDeviceDriverDefination) deviceDriverDefination;
DeviceDriverDefinition deviceDriverDefinition = deviceDriverDefinitionAppService.getDeviceDriverDefinition(driver_code);
if (deviceDriverDefinition instanceof OpcDeviceDriverDefinition) {
OpcDeviceDriverDefinition opcDeviceDriverDefinition = (OpcDeviceDriverDefinition) deviceDriverDefinition;
//处理DB读和写属性
result.put("rs", opcDeviceDriverDefination.getReadableItemDtos());
result.put("ws", opcDeviceDriverDefination.getWriteableItemDtos());
result.put("rs", opcDeviceDriverDefinition.getReadableItemDTOs());
result.put("ws", opcDeviceDriverDefinition.getWriteableItemDTOs());
}
return result;
}

View File

@@ -2,8 +2,6 @@ package org.nl.acs.device_driver;
import org.nl.acs.opc.Device;
import java.util.List;
public interface DeviceDriver {
default String getDeviceCode() {
return this.getDevice().getDevice_code();
@@ -11,12 +9,12 @@ public interface DeviceDriver {
Device getDevice();
DeviceDriverDefination getDriverDefination();
DeviceDriverDefinition getDriverDefinition();
DeviceDriver setDriverDefination(DeviceDriverDefination var1);
DeviceDriver setDriverDefinition(DeviceDriverDefinition var1);
default String getDriverDefinationCode() {
return this.getDriverDefination().getDriverCode();
default String getDriverDefinitionCode() {
return this.getDriverDefinition().getDriverCode();
}

View File

@@ -5,7 +5,7 @@ import org.nl.acs.opc.DeviceType;
import java.util.List;
public interface DeviceDriverDefination {
public interface DeviceDriverDefinition {
String getDriverCode();
String getDriverName();

View File

@@ -1,7 +1,7 @@
package org.nl.acs.device_driver.basedriver.agv.magic_agv;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import java.util.List;
* 普通站点定义
*/
@Service
public class MagicAgvDefination implements DeviceDriverDefination {
public class MagicAgvDefinition implements DeviceDriverDefinition {
@Override
public String getDriverCode() {
return "magic_agv";
@@ -31,7 +31,7 @@ public class MagicAgvDefination implements DeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new MagicAgvDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new MagicAgvDeviceDriver()).setDevice(device).setDriverDefinition(this);
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.agv.magic_agv;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
@@ -19,12 +19,12 @@ public class MagicAgvDeviceDriver extends AbstractDeviceDriver implements Device
}
@Override
public DeviceDriverDefination getDriverDefination() {
public DeviceDriverDefinition getDriverDefinition() {
return null;
}
@Override
public DeviceDriver setDriverDefination(DeviceDriverDefination var1) {
public DeviceDriver setDriverDefinition(DeviceDriverDefinition var1) {
return null;
}

View File

@@ -1,7 +1,7 @@
package org.nl.acs.device_driver.basedriver.agv.ndcone;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import java.util.List;
* NDC单工位AGV
*/
@Service
public class AgvNdcOneDefination implements DeviceDriverDefination {
public class AgvNdcOneDefinition implements DeviceDriverDefinition {
@Override
public String getDriverCode() {
return "agv_ndc_one";
@@ -31,7 +31,7 @@ public class AgvNdcOneDefination implements DeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new AgvNdcOneDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new AgvNdcOneDeviceDriver()).setDevice(device).setDriverDefinition(this);
}

View File

@@ -17,6 +17,7 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.agv.utils.ErrorUtil;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutoDoorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_elevator.StandardElevatorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
@@ -912,6 +913,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (driver.getAction() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) {
StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver();
}
} else if (phase == 0x51) {//离开区域
if (agvaddr == 0) {
@@ -982,6 +987,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (driver.getAction() == 2) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) {
StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver();
}
} else if (phase == 0x67) {//agv异常
if (ikey == 0) {

View File

@@ -1,7 +1,7 @@
package org.nl.acs.device_driver.basedriver.agv.ndctwo;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import java.util.List;
* NDC双工位AGV
*/
@Service
public class AgvNdcTwoDefination implements DeviceDriverDefination {
public class AgvNdcTwoDefinition implements DeviceDriverDefinition {
@Override
public String getDriverCode() {
return "agv_ndc_two";
@@ -31,7 +31,7 @@ public class AgvNdcTwoDefination implements DeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new AgvNdcTwoDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new AgvNdcTwoDeviceDriver()).setDevice(device).setDriverDefinition(this);
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.box_palletizing_manipulator;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -15,7 +15,7 @@ import java.util.List;
*
*/
@Service
public class BoxPalletizingManipulatorDefination implements OpcDeviceDriverDefination {
public class BoxPalletizingManipulatorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "box_palletizing_manipulator";
@@ -33,7 +33,7 @@ public class BoxPalletizingManipulatorDefination implements OpcDeviceDriverDefin
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new BoxPalletizingManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new BoxPalletizingManipulatorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,14 +50,14 @@ public class BoxPalletizingManipulatorDefination implements OpcDeviceDriverDefin
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 货梯对接线
*/
@Service
public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination {
public class CargoLiftConveyorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "cargo_lift_conveyor";
@@ -32,7 +32,7 @@ public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new CargoLiftConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new CargoLiftConveyorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@Override
@@ -48,12 +48,12 @@ public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 空托盘叠盘位
*/
@Service
public class EmptyVehicleStackingPositionDefination implements OpcDeviceDriverDefination {
public class EmptyVehicleStackingPositionDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "empty_vehicle_stacking_position";
@@ -32,7 +32,7 @@ public class EmptyVehicleStackingPositionDefination implements OpcDeviceDriverDe
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new EmptyVehicleStackingPositionDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new EmptyVehicleStackingPositionDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@Override
@@ -48,12 +48,12 @@ public class EmptyVehicleStackingPositionDefination implements OpcDeviceDriverDe
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 三工位
*/
@Service
public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination {
public class HailiangSmartplcTestDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "hailiang_smart_plc_test";
@@ -32,7 +32,7 @@ public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HailiangSmartplcTestDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new HailiangSmartplcTestDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -49,12 +49,12 @@ public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.hongxiang_conveyor;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 烘箱设备对接位
*/
@Service
public class HongXiangStationDefination implements OpcDeviceDriverDefination {
public class HongXiangStationDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "hongxiang_conveyor";
@@ -32,7 +32,7 @@ public class HongXiangStationDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HongXiangStationDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new HongXiangStationDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@Override
@@ -48,12 +48,12 @@ public class HongXiangStationDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.hongxiang_device;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 烘箱工位
*/
@Service
public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
public class HongXiangConveyorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "hongxiang_device";
@@ -32,7 +32,7 @@ public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new HongXiangConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new HongXiangConveyorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@Override
@@ -48,12 +48,12 @@ public class HongXiangConveyorDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.oven_manipulator;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -15,7 +15,7 @@ import java.util.List;
*
*/
@Service
public class OvenGantryManipulatorDefination implements OpcDeviceDriverDefination {
public class OvenGantryManipulatorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "oven_manipulator";
@@ -33,7 +33,7 @@ public class OvenGantryManipulatorDefination implements OpcDeviceDriverDefinatio
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new OvenGantryManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new OvenGantryManipulatorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,14 +50,14 @@ public class OvenGantryManipulatorDefination implements OpcDeviceDriverDefinatio
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.paint_conveyor;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 油漆线
*/
@Service
public class PaintConveyorDefination implements OpcDeviceDriverDefination {
public class PaintConveyorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "paint_conveyor";
@@ -32,7 +32,7 @@ public class PaintConveyorDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new PaintConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new PaintConveyorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -49,12 +49,12 @@ public class PaintConveyorDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.plug_pull_device_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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 插拔轴工位
*/
@Service
public class PlugPullDeviceSiteDefination implements OpcDeviceDriverDefination {
public class PlugPullDeviceSiteDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "plug_pull_device_site";
@@ -32,7 +32,7 @@ public class PlugPullDeviceSiteDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new PlugPullDeviceSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new PlugPullDeviceSiteDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@Override
@@ -48,12 +48,12 @@ public class PlugPullDeviceSiteDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.siemens_conveyor;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -15,7 +15,7 @@ import java.util.List;
*
*/
@Service
public class SiemensConveyorDefination implements OpcDeviceDriverDefination {
public class SiemensConveyorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "siemens_conveyor";
@@ -33,7 +33,7 @@ public class SiemensConveyorDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new SiemensConveyorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new SiemensConveyorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,14 +50,14 @@ public class SiemensConveyorDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -15,7 +15,7 @@ import java.util.List;
*
*/
@Service
public class SiemensConveyorCkkDefination implements OpcDeviceDriverDefination {
public class SiemensConveyorCkkDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "siemens_conveyor_ckk";
@@ -33,7 +33,7 @@ public class SiemensConveyorCkkDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new SiemensConveyorCkkDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new SiemensConveyorCkkDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,14 +50,14 @@ public class SiemensConveyorCkkDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -15,7 +15,7 @@ import java.util.List;
*
*/
@Service
public class SiemensConveyorLabelingDefination implements OpcDeviceDriverDefination {
public class SiemensConveyorLabelingDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "siemens_conveyor_labeling";
@@ -33,7 +33,7 @@ public class SiemensConveyorLabelingDefination implements OpcDeviceDriverDefinat
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new SiemensConveyorLabelingDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new SiemensConveyorLabelingDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,14 +50,14 @@ public class SiemensConveyorLabelingDefination implements OpcDeviceDriverDefinat
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.slit_two_manipulator;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -15,7 +15,7 @@ import java.util.List;
*
*/
@Service
public class SlitTwoManipulatorDefination implements OpcDeviceDriverDefination {
public class SlitTwoManipulatorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "slit_two_manipulator";
@@ -33,7 +33,7 @@ public class SlitTwoManipulatorDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new SlitTwoManipulatorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new SlitTwoManipulatorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,12 +50,12 @@ public class SlitTwoManipulatorDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.standard_autodoor;
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 自动门驱动定义
*/
@Service
public class StandardAutoDoorDefinition implements OpcDeviceDriverDefination {
public class StandardAutoDoorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_autodoor";
@@ -32,7 +32,7 @@ public class StandardAutoDoorDefinition implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardAutoDoorDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardAutoDoorDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -49,7 +49,7 @@ public class StandardAutoDoorDefinition implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return getReadableItemDtos2();
}
@@ -58,7 +58,7 @@ public class StandardAutoDoorDefinition implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,12 +2,11 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control;
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.device_driver.defination.OpcDeviceDriverDefinition;
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;
@@ -16,7 +15,7 @@ import java.util.List;
* 说明该站点为普通带光电检测站点
*/
@Service
public class StandardConveyorControlDefination implements OpcDeviceDriverDefination {
public class StandardConveyorControlDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_conveyor_control";
@@ -34,7 +33,7 @@ public class StandardConveyorControlDefination implements OpcDeviceDriverDefinat
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardCoveyorControlDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardCoveyorControlDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -51,13 +50,13 @@ public class StandardConveyorControlDefination implements OpcDeviceDriverDefinat
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,12 +2,11 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcsc
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.device_driver.defination.OpcDeviceDriverDefinition;
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;
@@ -15,7 +14,7 @@ import java.util.List;
* 输送机-控制点-PLC扫码器驱动定义
*/
@Service
public class StandardConveyorControlWithPlcScannerDefination implements OpcDeviceDriverDefination {
public class StandardConveyorControlWithPlcScannerDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_conveyor_control_with_plcscanner";
@@ -33,7 +32,7 @@ public class StandardConveyorControlWithPlcScannerDefination implements OpcDevic
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardCoveyorControlWithPlcScannerDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardCoveyorControlWithPlcScannerDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -50,13 +49,13 @@ public class StandardConveyorControlWithPlcScannerDefination implements OpcDevic
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scann
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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -14,7 +14,7 @@ import java.util.List;
* 说明该站点为输送机-控制点-关联扫码
*/
@Service
public class StandardConveyorControlWithScannerDefination implements OpcDeviceDriverDefination {
public class StandardConveyorControlWithScannerDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_conveyor_control_with_scanner";
@@ -32,7 +32,7 @@ public class StandardConveyorControlWithScannerDefination implements OpcDeviceDr
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardCoveyorControlWithScannerDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardCoveyorControlWithScannerDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -49,13 +49,13 @@ public class StandardConveyorControlWithScannerDefination implements OpcDeviceDr
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -0,0 +1,115 @@
package org.nl.acs.device_driver.basedriver.standard_elevator;
import lombok.Data;
import org.jetbrains.annotations.NotNull;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
/**
* @author zhangjiangwei
*/
@Data
public class ItemProtocol {
// 心跳
public static final String ITEM_HEARTBEAT = "heartbeat";
// 工作模式
public static final String ITEM_MODE = "mode";
// 楼层
public static final String ITEM_FLOOR = "floor";
// 前门信号
public static final String ITEM_DOOR1 = "door1";
// 后门信号
public static final String ITEM_DOOR2 = "door2";
// error
public static final String ITEM_ERROR = "error";
// 下发命令
public static final String ITEM_TO_COMMAND = "to_command";
// 前门
public static final String ITEM_TO_DOOR1 = "to_door1";
// 后门
public static final String ITEM_TO_DOOR2 = "to_door2";
// 前往楼层
public static final String ITEM_TO_FLOOR = "to_floor";
private boolean isOnline;
private final StandardElevatorDeviceDriver driver;
public ItemProtocol(StandardElevatorDeviceDriver driver) {
this.driver = driver;
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
this.isOnline = false;
return 0;
} else {
this.isOnline = true;
return value;
}
}
public int getMode() {
return this.getOpcIntegerValue(ITEM_MODE);
}
public int getFloor() {
return this.getOpcIntegerValue(ITEM_FLOOR);
}
public int getDoor1() {
return this.getOpcIntegerValue(ITEM_DOOR1);
}
public int getDoor2() {
return this.getOpcIntegerValue(ITEM_DOOR2);
}
public int getError() {
return this.getOpcIntegerValue(ITEM_ERROR);
}
public int getToCommand() {
return this.getOpcIntegerValue(ITEM_TO_COMMAND);
}
public int getToDoor1() {
return this.getOpcIntegerValue(ITEM_TO_DOOR1);
}
public int getToDoor2() {
return this.getOpcIntegerValue(ITEM_TO_DOOR2);
}
public int getToFloor() {
return this.getOpcIntegerValue(ITEM_TO_FLOOR);
}
@NotNull
public static List<ItemDto> getReadableItemDTOs() {
ArrayList<ItemDto> itemDTOs = new ArrayList<>();
itemDTOs.add(new ItemDto(ITEM_HEARTBEAT, "心跳", "DB600.B0"));
itemDTOs.add(new ItemDto(ITEM_MODE, "工作模式", "DB600.B2"));
itemDTOs.add(new ItemDto(ITEM_FLOOR, "楼层", "DB600.B3"));
itemDTOs.add(new ItemDto(ITEM_DOOR1, "前门信号", "DB600.B4"));
itemDTOs.add(new ItemDto(ITEM_DOOR2, "后门信号", "DB600.B5"));
itemDTOs.add(new ItemDto(ITEM_ERROR, "error", "DB600.B6"));
return itemDTOs;
}
@NotNull
public static List<ItemDto> getWriteableItemDTOs() {
ArrayList<ItemDto> itemDTOs = new ArrayList<>();
itemDTOs.add(new ItemDto(ITEM_TO_COMMAND, "下发命令", "DB610.W2"));
itemDTOs.add(new ItemDto(ITEM_TO_DOOR1, "前门", "DB610.W4"));
itemDTOs.add(new ItemDto(ITEM_TO_DOOR2, "后门", "DB610.W6"));
itemDTOs.add(new ItemDto(ITEM_TO_FLOOR, "前往楼层", "DB610.W8"));
return itemDTOs;
}
}

View File

@@ -0,0 +1,61 @@
package org.nl.acs.device_driver.basedriver.standard_elevator;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefinition;
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;
/**
* @author zhangjiangwei
*/
@Service
public class StandardElevatorDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_elevator";
}
@Override
public String getDriverName() {
return "标准版-电梯";
}
@Override
public String getDriverDescription() {
return "标准版-电梯";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return new StandardElevatorDeviceDriver().setDevice(device).setDriverDefinition(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return StandardElevatorDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList<>();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDTOs() {
return ItemProtocol.getReadableItemDTOs();
}
@Override
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDTOs();
}
}

View File

@@ -0,0 +1,216 @@
package org.nl.acs.device_driver.basedriver.standard_elevator;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
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.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author zhangjiangwei
*/
@Slf4j
@Getter
@Setter
public class StandardElevatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
private final ItemProtocol itemProtocol = new ItemProtocol(this);
DeviceExecuteLogService deviceLog = SpringContextHolder.getBean(DeviceExecuteLogService.class);
// 工作模式
private int mode = 0;
private int lastMode = this.mode;
// 楼层
private int floor = 0;
private int lastFloor = this.floor;
// 前门信号
private int door1 = 0;
private int lastDoor1 = this.door1;
// 后门信号
private int door2 = 0;
private int lastDoor2 = this.door2;
// error
private int error = 0;
private int lastError = this.error;
// 下发命令
private int toCommand = 0;
private int lastToCommand = this.toCommand;
// 前门
private int toDoor1 = 0;
private int lastToDoor1 = this.toDoor1;
// 后门
private int toDoor2 = 0;
private int lastToDoor2 = this.toDoor2;
// 前往楼层
private int toFloor = 0;
private int lastToFloor = this.toFloor;
// 设备编码
private String deviceCode;
// 是否在线
private boolean isOnline;
// 是否报错
private boolean isError;
// 信息
private String message;
@Override
public void execute() {
try {
this.deviceCode = this.getDevice().getDevice_code();
this.mode = this.itemProtocol.getMode();
this.floor = this.itemProtocol.getFloor();
this.door1 = this.itemProtocol.getDoor1();
this.door2 = this.itemProtocol.getDoor2();
this.error = this.itemProtocol.getError();
this.toCommand = this.itemProtocol.getToCommand();
this.toDoor1 = this.itemProtocol.getToDoor1();
this.toDoor2 = this.itemProtocol.getToDoor2();
this.toFloor = this.itemProtocol.getToFloor();
if (this.mode != this.lastMode) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_MODE, String.valueOf(this.mode));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_MODE + " " + this.lastMode + " -> " + this.mode);
}
if (this.floor != this.lastFloor) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_FLOOR, String.valueOf(this.floor));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_FLOOR + " " + this.lastFloor + " -> " + this.floor);
}
if (this.door1 != this.lastDoor1) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_DOOR1, String.valueOf(this.door1));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_DOOR1 + " " + this.lastDoor1 + " -> " + this.door1);
}
if (this.door2 != this.lastDoor2) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_DOOR2, String.valueOf(this.door2));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_DOOR2 + " " + this.lastDoor2 + " -> " + this.door2);
}
if (this.error != this.lastError) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_ERROR, String.valueOf(this.error));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_ERROR + " " + this.lastError + " -> " + this.error);
}
if (this.toCommand != this.lastToCommand) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_COMMAND, String.valueOf(this.toCommand));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_COMMAND + " " + this.lastToCommand + " -> " + this.toCommand);
}
if (this.toDoor1 != this.lastToDoor1) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_DOOR1, String.valueOf(this.toDoor1));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_DOOR1 + " " + this.lastToDoor1 + " -> " + this.toDoor1);
}
if (this.toDoor2 != this.lastToDoor2) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_DOOR2, String.valueOf(this.toDoor2));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_DOOR2 + " " + this.lastToDoor2 + " -> " + this.toDoor2);
}
if (this.toFloor != this.lastToFloor) {
deviceLog.deviceItemValue(this.deviceCode, ItemProtocol.ITEM_TO_FLOOR, String.valueOf(this.toFloor));
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_FLOOR + " " + this.lastToFloor + " -> " + this.toFloor);
}
} catch (Exception e) {
log.error("StandardElevatorDeviceDriver execute error!", e);
return;
}
if (!this.itemProtocol.isOnline()) {
// 信号量同步异常
this.isOnline = false;
this.isError = true;
message = "信号量同步异常。";
} else if (mode == 0) {
// 脱机
this.isOnline = false;
this.isError = true;
message = "脱机。";
} else if (error != 0) {
// 报警
this.isOnline = false;
this.isError = true;
message = "有报警。";
} else {
// 正常
this.isOnline = true;
this.isError = false;
message = "";
}
this.lastMode = this.mode;
this.lastFloor = this.floor;
this.lastDoor1 = this.door1;
this.lastDoor2 = this.door2;
this.lastError = this.error;
}
public void writing(int command) {
Map<String, Object> itemMap = new HashMap<>();
itemMap.put(this.getToParam() + ItemProtocol.ITEM_TO_COMMAND, command);
this.control(itemMap);
deviceLog.deviceExecuteLog(this.deviceCode, "", "", ItemProtocol.ITEM_TO_COMMAND + " 写入 " + command);
}
public void writing(Map<String, Object> map) {
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (value != null) {
itemMap.put(getToParam() + key, value);
deviceLog.deviceExecuteLog(this.deviceCode, "", "", key + " 写入 " + value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
}
}
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
@Override
public JSONObject getDeviceStatusName() throws Exception {
String mode;
switch (this.mode) {
case 0:
mode = "脱机";
break;
case 2:
mode = "待机";
break;
case 3:
mode = "运行中";
break;
default:
mode = String.valueOf(this.mode);
}
JSONObject result = new JSONObject();
result.put("device_name", this.getDevice().getDevice_name());
result.put(ItemProtocol.ITEM_MODE, mode);
result.put(ItemProtocol.ITEM_FLOOR, this.floor);
result.put(ItemProtocol.ITEM_DOOR1, this.door1);
result.put(ItemProtocol.ITEM_DOOR2, this.door2);
result.put(ItemProtocol.ITEM_ERROR, this.error);
result.put("isOnline", this.isOnline);
result.put("isError", this.isError);
result.put("message", message);
return result;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -2,7 +2,7 @@ package org.nl.acs.device_driver.basedriver.standard_inspect_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.device_driver.defination.OpcDeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -16,7 +16,7 @@ import java.util.List;
* 说明该站点为普通带光电检测站点
*/
@Service
public class StandardInspectSiteDefination implements OpcDeviceDriverDefination {
public class StandardInspectSiteDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_inspect_site";
@@ -34,7 +34,7 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardInspectSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardInspectSiteDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@@ -51,7 +51,7 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return getReadableItemDtos2();
}
@@ -66,7 +66,7 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -257,7 +257,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//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<>();
itemMap.put(to_command, command);
this.control(itemMap);

View File

@@ -1,7 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_ordinary_site;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import java.util.List;
* 普通站点定义
*/
@Service
public class StandardOrdinarySiteDefination implements DeviceDriverDefination {
public class StandardOrdinarySiteDefinition implements DeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_ordinary_site";
@@ -31,7 +31,7 @@ public class StandardOrdinarySiteDefination implements DeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardOrdinarySiteDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardOrdinarySiteDeviceDriver()).setDevice(device).setDriverDefinition(this);
}

View File

@@ -1,7 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_scanner;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import java.util.List;
* 扫码器
*/
@Service
public class StandardScannerDefination implements DeviceDriverDefination {
public class StandardScannerDefinition implements DeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_scanner";
@@ -31,7 +31,7 @@ public class StandardScannerDefination implements DeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardScannerDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardScannerDeviceDriver()).setDevice(device).setDriverDefinition(this);
}

View File

@@ -1,7 +1,7 @@
package org.nl.acs.device_driver.basedriver.standard_storage;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
@@ -13,7 +13,7 @@ import java.util.List;
* 货架
*/
@Service
public class StandardStorageDefination implements DeviceDriverDefination {
public class StandardStorageDefinition implements DeviceDriverDefinition {
@Override
public String getDriverCode() {
return "standard_storage";
@@ -31,7 +31,7 @@ public class StandardStorageDefination implements DeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardStorageDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new StandardStorageDeviceDriver()).setDevice(device).setDriverDefinition(this);
}

View File

@@ -1,12 +0,0 @@
package org.nl.acs.device_driver.defination;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriverDefination;
import java.util.List;
public interface OpcDeviceDriverDefination extends DeviceDriverDefination {
List<ItemDto> getReadableItemDtos();
List<ItemDto> getWriteableItemDtos();
}

View File

@@ -0,0 +1,12 @@
package org.nl.acs.device_driver.defination;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import java.util.List;
public interface OpcDeviceDriverDefinition extends DeviceDriverDefinition {
List<ItemDto> getReadableItemDTOs();
List<ItemDto> getWriteableItemDTOs();
}

View File

@@ -2,14 +2,14 @@ package org.nl.acs.device_driver.driver;
import lombok.Data;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.opc.Device;
@Data
public class AbstractDeviceDriver implements DeviceDriver {
public Device device;
private DeviceDriverDefination driverDefination;
private DeviceDriverDefinition driverDefinition;
private boolean stop = false;
@@ -26,13 +26,13 @@ public class AbstractDeviceDriver implements DeviceDriver {
@Override
public DeviceDriverDefination getDriverDefination() {
return this.driverDefination;
public DeviceDriverDefinition getDriverDefinition() {
return this.driverDefinition;
}
@Override
public DeviceDriver setDriverDefination(DeviceDriverDefination var1) {
this.driverDefination = driverDefination;
public DeviceDriver setDriverDefinition(DeviceDriverDefinition var1) {
this.driverDefinition = var1;
return this;
}

View File

@@ -2,12 +2,11 @@ package org.nl.acs.device_driver.fold_disc_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.device_driver.defination.OpcDeviceDriverDefinition;
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;
@@ -15,7 +14,7 @@ import java.util.List;
* 晟华叠盘机
*/
@Service
public class FoldDiscSiteDefination implements OpcDeviceDriverDefination {
public class FoldDiscSiteDefinition implements OpcDeviceDriverDefinition {
@Override
public String getDriverCode() {
return "fold_disc_site";
@@ -33,7 +32,7 @@ public class FoldDiscSiteDefination implements OpcDeviceDriverDefination {
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new FoldDiscSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
return (new FoldDiscSiteDeviceDriver()).setDevice(device).setDriverDefinition(this);
}
@Override
@@ -49,7 +48,7 @@ public class FoldDiscSiteDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getReadableItemDtos() {
public List<ItemDto> getReadableItemDTOs() {
return getReadableItemDtos2();
}
@@ -58,7 +57,7 @@ public class FoldDiscSiteDefination implements OpcDeviceDriverDefination {
}
@Override
public List<ItemDto> getWriteableItemDtos() {
public List<ItemDto> getWriteableItemDTOs() {
return ItemProtocol.getWriteableItemDtos();
}

View File

@@ -3,7 +3,6 @@ package org.nl.acs.ext.wms.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONString;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -12,14 +11,11 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.common.IDriverService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.liKuData.Resp;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.acs.instruction.service.InstructionService;
@@ -279,7 +275,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String[] split = extra_code.split("\\.");
extra_code = split[split.length - 1];
extra_code = extra_code.substring(0, 1).toUpperCase() + extra_code.substring(1);
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefinition().getDriverCode(), IDriverService.class);
Integer dbValue = driverService.getDbValue(device, extra_code);
map.put(dbName, dbValue);
break;

View File

@@ -53,7 +53,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -805,14 +804,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String start_device =
deviceAppService
.findDeviceByCode(start_device_code)
.getDeviceDriverDefination()
.getDeviceDriverDefinition()
.getFitDeviceTypes()
.get(0)
.name();
String next_device =
deviceAppService
.findDeviceByCode(next_device_code)
.getDeviceDriverDefination()
.getDeviceDriverDefinition()
.getFitDeviceTypes()
.get(0)
.name();
@@ -1175,7 +1174,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String start_device =
deviceAppService
.findDeviceByCode(start_device_code)
.getDeviceDriverDefination()
.getDeviceDriverDefinition()
.getFitDeviceTypes()
.get(0)
.name();
@@ -1201,7 +1200,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String next_device =
deviceAppService
.findDeviceByCode(next_device_code)
.getDeviceDriverDefination()
.getDeviceDriverDefinition()
.getFitDeviceTypes()
.get(0)
.name();

View File

@@ -2,7 +2,7 @@ package org.nl.acs.opc;
import lombok.Data;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
@Data
public class Device extends DeviceManageDto {
@@ -11,7 +11,7 @@ public class Device extends DeviceManageDto {
private int status_code = 0;
private String status_message = "";
private DeviceDriver deviceDriver;
private DeviceDriverDefination deviceDriverDefination;
private DeviceDriverDefinition deviceDriverDefinition;
@Override
public String toString() {

View File

@@ -5,9 +5,9 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.service.DeviceDriverDefinationAppService;
import org.nl.acs.device.service.DeviceDriverDefinitionAppService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.acs.device_driver.LinewayDeviceDriver;
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,7 +23,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
@Autowired
private DeviceManageService deviceManageService;
@Autowired
private DeviceDriverDefinationAppService deviceDriverDefinationAppService;
private DeviceDriverDefinitionAppService deviceDriverDefinitionAppService;
@Override
public List<Device> findAllDevice() {
@@ -296,7 +296,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
while (var3.hasNext()) {
Device device = (Device) var3.next();
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)) {
return device.getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
return device.getDeviceDriverDefinition().getFitDeviceTypes().get(0).name();
}
}
return null;
@@ -328,9 +328,9 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
this.code_indexs.add(device.getDevice_code());
if (!StrUtil.isEmpty(device.getDriver_code())) {
DeviceDriverDefination defination = this.deviceDriverDefinationAppService.getDeviceDriverDefination(deviceManage.getDriver_code());
DeviceDriverDefinition defination = this.deviceDriverDefinitionAppService.getDeviceDriverDefinition(deviceManage.getDriver_code());
if (defination != null) {
device.setDeviceDriverDefination(defination);
device.setDeviceDriverDefinition(defination);
DeviceDriver driver = defination.getDriverInstance(device);
device.setDeviceDriver(driver);

View File

@@ -1,106 +0,0 @@
package org.nl.acs.opc;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.service.DeviceDriverDefinationAppService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.modules.common.exception.BadRequestException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@Slf4j
public class DeviceDriverDefinationAppServiceImpl implements DeviceDriverDefinationAppService, InitializingBean, ApplicationContextAware {
@Autowired
private Map<String, DeviceDriverDefination> deviceDriverDefinations = new HashMap();
@Autowired(
required = false
)
List<DeviceDriverDefination> deviceDriverDefinationsx;
public DeviceDriverDefinationAppServiceImpl() {
this.deviceDriverDefinations = Collections.synchronizedMap(this.deviceDriverDefinations);
}
@Override
public List<String> getDeviceDriverCodes() {
return null;
}
@Override
public DeviceDriverDefination getDeviceDriverDefination(String driverCode) {
return (DeviceDriverDefination) this.deviceDriverDefinations.get(driverCode);
}
@Override
public List<DeviceDriverDefination> getDeviceDriverDefinations() {
return new LinkedList(this.deviceDriverDefinations.values());
}
@Override
public List<DeviceDriverDefination> getDeviceDriverDefinations(DeviceType deviceType) {
Collection<DeviceDriverDefination> definations = this.deviceDriverDefinations.values();
List<DeviceDriverDefination> deviceTypeDefinations = new LinkedList();
Iterator var4 = definations.iterator();
while (var4.hasNext()) {
DeviceDriverDefination defination = (DeviceDriverDefination) var4.next();
if (defination.getFitDeviceTypes() == null || defination.getDriverCode() == null || defination.getDeviceDriverType() == null) {
throw new BadRequestException("当前驱动defination定义异常" + defination.getClass());
}
if (defination.getFitDeviceTypes().contains(deviceType)) {
deviceTypeDefinations.add(defination);
}
}
return deviceTypeDefinations;
}
@Override
public boolean isRoute(Class<? extends DeviceDriver> var1) {
return false;
}
@Override
public boolean isOpc(Class<? extends DeviceDriver> var1) {
return false;
}
@Override
public void afterPropertiesSet() throws Exception {
this.initial();
}
public void initial() {
if (this.deviceDriverDefinationsx != null) {
Iterator var1 = this.deviceDriverDefinationsx.iterator();
DeviceDriverDefination deviceDriverDefination;
while (var1.hasNext()) {
deviceDriverDefination = (DeviceDriverDefination) var1.next();
if (deviceDriverDefination.getDriverCode() != null && deviceDriverDefination.getFitDeviceTypes() != null && deviceDriverDefination.getFitDeviceTypes() != null) {
this.addDeviceDriverDefination(deviceDriverDefination.getDriverCode(), deviceDriverDefination);
}
//log.warn("{}驱动定义异常", deviceDriverDefination.getClass());
}
}
}
private void addDeviceDriverDefination(String driverCode, DeviceDriverDefination deviceDriverDefination) {
this.deviceDriverDefinations.put(driverCode, deviceDriverDefination);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
}
}

View File

@@ -0,0 +1,106 @@
package org.nl.acs.opc;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.service.DeviceDriverDefinitionAppService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefinition;
import org.nl.modules.common.exception.BadRequestException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@Slf4j
public class DeviceDriverDefinitionAppServiceImpl implements DeviceDriverDefinitionAppService, InitializingBean, ApplicationContextAware {
@Autowired
private Map<String, DeviceDriverDefinition> deviceDriverDefinitions = new HashMap();
@Autowired(
required = false
)
List<DeviceDriverDefinition> deviceDriverDefinitionsxes;
public DeviceDriverDefinitionAppServiceImpl() {
this.deviceDriverDefinitions = Collections.synchronizedMap(this.deviceDriverDefinitions);
}
@Override
public List<String> getDeviceDriverCodes() {
return null;
}
@Override
public DeviceDriverDefinition getDeviceDriverDefinition(String driverCode) {
return (DeviceDriverDefinition) this.deviceDriverDefinitions.get(driverCode);
}
@Override
public List<DeviceDriverDefinition> getDeviceDriverDefinitions() {
return new LinkedList(this.deviceDriverDefinitions.values());
}
@Override
public List<DeviceDriverDefinition> getDeviceDriverDefinitions(DeviceType deviceType) {
Collection<DeviceDriverDefinition> definations = this.deviceDriverDefinitions.values();
List<DeviceDriverDefinition> deviceTypeDefinitions = new LinkedList();
Iterator var4 = definations.iterator();
while (var4.hasNext()) {
DeviceDriverDefinition defination = (DeviceDriverDefinition) var4.next();
if (defination.getFitDeviceTypes() == null || defination.getDriverCode() == null || defination.getDeviceDriverType() == null) {
throw new BadRequestException("当前驱动defination定义异常" + defination.getClass());
}
if (defination.getFitDeviceTypes().contains(deviceType)) {
deviceTypeDefinitions.add(defination);
}
}
return deviceTypeDefinitions;
}
@Override
public boolean isRoute(Class<? extends DeviceDriver> var1) {
return false;
}
@Override
public boolean isOpc(Class<? extends DeviceDriver> var1) {
return false;
}
@Override
public void afterPropertiesSet() throws Exception {
this.initial();
}
public void initial() {
if (this.deviceDriverDefinitionsxes != null) {
Iterator var1 = this.deviceDriverDefinitionsxes.iterator();
DeviceDriverDefinition deviceDriverDefinition;
while (var1.hasNext()) {
deviceDriverDefinition = (DeviceDriverDefinition) var1.next();
if (deviceDriverDefinition.getDriverCode() != null && deviceDriverDefinition.getFitDeviceTypes() != null && deviceDriverDefinition.getFitDeviceTypes() != null) {
this.addDeviceDriverDefinition(deviceDriverDefinition.getDriverCode(), deviceDriverDefinition);
}
//log.warn("{}驱动定义异常", deviceDriverDefinition.getClass());
}
}
}
private void addDeviceDriverDefinition(String driverCode, DeviceDriverDefinition deviceDriverDefinition) {
this.deviceDriverDefinitions.put(driverCode, deviceDriverDefinition);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
}
}

View File

@@ -10,7 +10,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.XianGongAgvService;
@@ -54,7 +53,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -1440,7 +1438,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String start_device =
deviceAppService
.findDeviceByCode(start_point_code)
.getDeviceDriverDefination()
.getDeviceDriverDefinition()
.getFitDeviceTypes()
.get(0)
.name();
@@ -1504,7 +1502,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String next_device =
deviceAppService
.findDeviceByCode(next_point_code)
.getDeviceDriverDefination()
.getDeviceDriverDefinition()
.getFitDeviceTypes()
.get(0)
.name();

View File

@@ -11,7 +11,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:wzgj_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:bjsz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# 初始连接数

View File

@@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data: