更新
This commit is contained in:
@@ -52,10 +52,17 @@ public enum DriverTypeEnum {
|
||||
HAILIANG_CLEANING_MACHINE(21, "hailiang_cleaning_machine", "海亮-清洗机", "conveyor"),
|
||||
|
||||
HAILIANG_CLEANING_FEEDING_LINE(22, "hailiang_cleaning_feeding_line", "海亮-清洗上料线体", "conveyor"),
|
||||
|
||||
AGV_NDC_ONE(23, "agv_ndc_one", "NDC单工位AGV", "agv"),
|
||||
|
||||
AGV_NDC_TWO(24, "agv_ndc_two", "NDC双工位AGV", "agv"),
|
||||
|
||||
HAILIANG_ENGRAVING_CACHE(25, "hailiang_engraving_cache", "海亮-刻字缓存位", "conveyor"),
|
||||
HAILIANG_PACKER_STATION(26, "hailiang_packer_station", "海亮-包装机工位", "conveyor");
|
||||
|
||||
HAILIANG_PACKER_STATION(26, "hailiang_packer_station", "海亮-包装机工位", "conveyor"),
|
||||
|
||||
HAILIANG_XJ_PLC_TEST(27, "hailiang_xj_plc_test", "海亮-信捷PLC", "conveyor");
|
||||
|
||||
|
||||
//驱动索引
|
||||
private int index;
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
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.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_pour_station.HailiangSpecialPourStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 海亮清洗机储料仓
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
@Autowired
|
||||
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||
@Autowired
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
@Autowired
|
||||
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
|
||||
@Autowired
|
||||
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
|
||||
@Autowired
|
||||
ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderService.class);
|
||||
@Autowired
|
||||
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
|
||||
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
//放货准备锁
|
||||
String putReadyLock = null;
|
||||
//有货标记
|
||||
protected boolean has_goods_tag = false;
|
||||
|
||||
int mode =0;
|
||||
int running = 0; //是否运行
|
||||
int is_open = 0; //是否启动
|
||||
int error = 0; //报警信号
|
||||
int silo_weight = 0; //储料仓重量
|
||||
int full_number = 0; //储料仓总数量
|
||||
int silo_material_no = 0; //储料仓物物料号
|
||||
//出入库模式
|
||||
int operation_type = 0;
|
||||
int last_running = 0; //是否运行
|
||||
int last_is_open = 0; //是否启动
|
||||
int last_error = 0; //报警信号
|
||||
int last_silo_weight = 0; //储料仓重量
|
||||
int last_full_number = 0; //储料仓总数量
|
||||
int last_silo_material_no = 0; //储料仓物物料号
|
||||
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
|
||||
boolean hasVehicle = false;
|
||||
boolean isReady = false;
|
||||
protected int instruction_num = 0;
|
||||
protected int instruction_num_truth = 0;
|
||||
boolean isFold = false;
|
||||
private String assemble_check_tag;
|
||||
|
||||
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 Date instruction_apply_time = new Date();
|
||||
private int instruction_require_time_out = 3000;
|
||||
//请求成功标记
|
||||
Boolean requireSucess = false;
|
||||
//申请指令成功标记
|
||||
Boolean applySucess = false;
|
||||
String inst_message;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
//备注
|
||||
String remark;
|
||||
//数量
|
||||
String qty;
|
||||
//物料
|
||||
String material;
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
//上次指令
|
||||
Instruction last_inst = null;
|
||||
|
||||
//触摸屏手动触发任务
|
||||
private Boolean is_has_task = false;
|
||||
|
||||
//申请搬运任务
|
||||
private Boolean apply_handling = false;
|
||||
//申请物料
|
||||
private Boolean apply_material = false;
|
||||
|
||||
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
|
||||
int flag = 0;
|
||||
|
||||
|
||||
int agvphase=0;
|
||||
int index =0;
|
||||
|
||||
String device_code;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.debug("设备报警");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void thingToNothing() {
|
||||
log.debug("从有货到无货 清理数据");
|
||||
logServer.deviceLogToacs(this.device_code,"","","光电信号切换,刷新请求标记:"+this.requireSucess);
|
||||
|
||||
this.setRequireSucess(false);
|
||||
this.setApplySucess(false);
|
||||
this.set_last_container(container, container_type_desc);
|
||||
}
|
||||
|
||||
public void set_last_container(String barcode, String type_desc) {
|
||||
this.setInst_message(null);
|
||||
this.setContainer(null);
|
||||
this.set_last_container(barcode);
|
||||
this.set_last_container_type_desc(type_desc);
|
||||
}
|
||||
|
||||
public void set_last_container(String barcode) {
|
||||
}
|
||||
|
||||
public void set_last_container_type_desc(String type) {
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void executing(Instruction instruction) {
|
||||
this.executing(1, instruction, "");
|
||||
}
|
||||
|
||||
public void executing(int command, Instruction instruction, String appendMessage) {
|
||||
|
||||
}
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
|
||||
}
|
||||
|
||||
public void writing(String key, String value) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + key;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_command, value);
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_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.opc.Device;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 海亮迅捷plc测试
|
||||
*/
|
||||
@Service
|
||||
public class HailiangxjplcTestDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "hailiang_xj_plc_test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "海亮-海亮迅捷plc测试";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "海亮-海亮迅捷plc测试";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new HailiangHailiangxjplcTestDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return HailiangHailiangxjplcTestDeviceDriver.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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_error = "error";
|
||||
public static String item_error_num = "error_num";
|
||||
public static String item_open_time = "open_time";
|
||||
public static String item_close_time = "close_time"; //
|
||||
public static String item_ready_time = "ready_time"; //
|
||||
public static String item_running_time = "running_time";
|
||||
public static String item_error_time = "error_time";
|
||||
public static String item_voltage = "voltage";
|
||||
public static String item_temperature = "temperature";
|
||||
public static String item_current = "current";
|
||||
public static String item_material = "material";
|
||||
public static String item_lack_material = "lack_material";
|
||||
public static String item_full_material = "full_material";
|
||||
public static String item_storage_qty = "storage_qty";
|
||||
public static String item_feeding_qty = "feeding_qty";
|
||||
public static String item_blanking_qty = "blanking_qty";
|
||||
public static String item_qualified_qty = "qualified_qty";
|
||||
public static String item_unqualified_qty = "unqualified_qty";
|
||||
public static String item_finish = "finish";
|
||||
public static String item_task = "task";
|
||||
public static String item_noload_electricity_consumption = "noload_electricity_consumption";
|
||||
public static String item_prod_electricity_consumption = "prod_electricity_consumption";
|
||||
public static String item_gas_consumption = "gas_consumption";
|
||||
public static String item_water_consumption = "water_consumption";
|
||||
public static String item_oil_level = "oil_level";
|
||||
public static String item_monthly_electricity_consumption = "monthly_electricity_consumption";
|
||||
public static String item_pause = "pause";
|
||||
|
||||
|
||||
|
||||
public static String item_to_heartbeat = "to_heartbeat";//
|
||||
public static String item_to_command = "to_command";//
|
||||
public static String item_to_feeding = "to_feeding";//
|
||||
public static String item_to_task = "to_task";//
|
||||
public static String item_to_pause= "to_pause";//
|
||||
public static String item_to_clear = "to_clear";//
|
||||
public static String item_to_finish = "to_finish";//
|
||||
public static String item_to_open = "to_open";//
|
||||
public static String item_to_close = "to_close";//
|
||||
public static String item_to_material = "to_material";//
|
||||
public static String item_to_qty = "to_qty";//
|
||||
|
||||
|
||||
private HailiangHailiangxjplcTestDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(HailiangHailiangxjplcTestDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getItem_heartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getItem_mode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getItem_error() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getItem_error_num() {
|
||||
return this.getOpcIntegerValue(item_error_num);
|
||||
}
|
||||
|
||||
public int getItem_open_time() {
|
||||
return this.getOpcIntegerValue(item_open_time);
|
||||
}
|
||||
|
||||
public int getItem_close_time() {
|
||||
return this.getOpcIntegerValue(item_close_time);
|
||||
}
|
||||
|
||||
public int getItem_ready_time() {
|
||||
return this.getOpcIntegerValue(item_ready_time);
|
||||
}
|
||||
|
||||
public int getItem_running_time() {
|
||||
return this.getOpcIntegerValue(item_running_time);
|
||||
}
|
||||
|
||||
public int getItem_error_time() {
|
||||
return this.getOpcIntegerValue(item_error_time);
|
||||
}
|
||||
|
||||
public int getItem_voltage() {
|
||||
return this.getOpcIntegerValue(item_voltage);
|
||||
}
|
||||
|
||||
public int getItem_temperature() {
|
||||
return this.getOpcIntegerValue(item_temperature);
|
||||
}
|
||||
|
||||
public int getItem_current() {
|
||||
return this.getOpcIntegerValue(item_current);
|
||||
}
|
||||
|
||||
public int getItem_material() {
|
||||
return this.getOpcIntegerValue(item_material);
|
||||
}
|
||||
|
||||
public int getItem_lack_material() {
|
||||
return this.getOpcIntegerValue(item_lack_material);
|
||||
}
|
||||
|
||||
public int getItem_full_material() {
|
||||
return this.getOpcIntegerValue(item_full_material);
|
||||
}
|
||||
|
||||
public int getItem_storage_qty() {
|
||||
return this.getOpcIntegerValue(item_storage_qty);
|
||||
}
|
||||
|
||||
public int getItem_feeding_qty() {
|
||||
return this.getOpcIntegerValue(item_feeding_qty);
|
||||
}
|
||||
|
||||
public int getItem_blanking_qty() {
|
||||
return this.getOpcIntegerValue(item_blanking_qty);
|
||||
}
|
||||
|
||||
public int getItem_qualified_qty() {
|
||||
return this.getOpcIntegerValue(item_qualified_qty);
|
||||
}
|
||||
|
||||
public int getItem_unqualified_qty() {
|
||||
return this.getOpcIntegerValue(item_unqualified_qty);
|
||||
}
|
||||
|
||||
public int getItem_finish() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getItem_task() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public int getItem_noload_electricity_consumption() {
|
||||
return this.getOpcIntegerValue(item_noload_electricity_consumption);
|
||||
}
|
||||
|
||||
public int getItem_prod_electricity_consumption() {
|
||||
return this.getOpcIntegerValue(item_prod_electricity_consumption);
|
||||
}
|
||||
|
||||
public int getItem_gas_consumption() {
|
||||
return this.getOpcIntegerValue(item_gas_consumption);
|
||||
}
|
||||
|
||||
public int getItem_water_consumption() {
|
||||
return this.getOpcIntegerValue(item_water_consumption);
|
||||
}
|
||||
|
||||
public int getItem_oil_level() {
|
||||
return this.getOpcIntegerValue(item_oil_level);
|
||||
}
|
||||
|
||||
public int getItem_monthly_electricity_consumption() {
|
||||
return this.getOpcIntegerValue(item_monthly_electricity_consumption);
|
||||
}
|
||||
|
||||
public int getItem_pause() {
|
||||
return this.getOpcIntegerValue(item_pause);
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "45202"));
|
||||
list.add(new ItemDto(item_mode, "模式", "45204"));
|
||||
list.add(new ItemDto(item_error, "故障", "45206"));
|
||||
list.add(new ItemDto(item_error_num, "故障次数", "45208"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "45212"));
|
||||
list.add(new ItemDto(item_close_time, "关机时间", "45216"));
|
||||
list.add(new ItemDto(item_ready_time, "待机时间", "45220"));
|
||||
list.add(new ItemDto(item_running_time, "生产时间", "45224"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "45228"));
|
||||
list.add(new ItemDto(item_temperature, "温度", "45232"));
|
||||
list.add(new ItemDto(item_voltage, "电压", "45236"));
|
||||
list.add(new ItemDto(item_current, "电流", "45240"));
|
||||
list.add(new ItemDto(item_material, "当前生产产品编号", "45244"));
|
||||
list.add(new ItemDto(item_lack_material, "生产缺料信号", "45248"));
|
||||
list.add(new ItemDto(item_full_material, "生产满料信号", "45252"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_heartbeat, "心跳", "45702"));
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "45704"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user