rev:修改固化室,输送线,涂板线驱动

This commit is contained in:
2023-12-27 17:58:25 +08:00
parent d3a6222845
commit 1e15725d1f
6 changed files with 144 additions and 36 deletions

View File

@@ -151,6 +151,30 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
int last_error_time = 0;
int end_time = 0;
int last_end_time = 0;
int temperature = 0;
int temperature_setting = 0;
int humidity = 0;
int humidity_setting = 0;
int current_stage = 0;
int total_running_time = 0;
int executing_stage_num = 0;
int front_door = 0;
int front_door_off = 0;
int back_door = 0;
int back_door_off = 0;
int device_code = 0;
int device_name = 0;
int last_temperature;
int last_temperature_setting;
int last_humidity;
int last_humidity_setting;
int last_current_stage;
int last_total_running_time;
int last_executing_stage_num;
int last_front_door;
int last_front_door_off;
int last_back_door;
int last_back_door_off;
@Override
@@ -167,14 +191,17 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
status = this.itemProtocol.getStatus();
start_time = this.itemProtocol.getItem_start_time();
stop_time = this.itemProtocol.getItem_stop_time();
open_time = this.itemProtocol.getItem_open_time();
standby_time = this.itemProtocol.getItem_standby_time();
production_time = this.itemProtocol.getItem_production_time();
error_time = this.itemProtocol.getItem_error_time();
end_time = this.itemProtocol.getItem_end_time();
temperature = this.itemProtocol.getTemperature();
temperature_setting = this.itemProtocol.getTemperatureSetting();
humidity = this.itemProtocol.getHumidity();
humidity_setting = this.itemProtocol.getHumiditySetting();
current_stage = this.itemProtocol.getCurrentStage();
total_running_time = this.itemProtocol.getTotalRunningTime();
executing_stage_num = this.itemProtocol.getExecutingStageNum();
front_door = this.itemProtocol.getFrontDoor();
front_door_off = this.itemProtocol.getFrontDoorOff();
back_door = this.itemProtocol.getBackDoor();
back_door_off = this.itemProtocol.getBackDoorOff();
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {
@@ -229,7 +256,6 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
//todo 称重模式带上重量、数量和向lms请求
break;
}
switch (flag) {
//取货完成
case 1:
@@ -241,8 +267,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
return;
}
}
last_mode = mode;
last_error = error;
last_status = status;
@@ -253,7 +279,17 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
last_production_time = production_time;
last_error_time = error_time;
last_end_time = end_time;
last_temperature = temperature;
last_temperature_setting = temperature_setting;
last_humidity = humidity;
last_humidity_setting = humidity_setting;
last_current_stage = current_stage;
last_total_running_time = total_running_time;
last_executing_stage_num = executing_stage_num;
last_front_door = front_door;
last_front_door_off = front_door_off;
last_back_door = back_door;
last_back_door_off = back_door_off;
}
@@ -280,7 +316,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
itemMap.put(to_command, command);
this.control(itemMap);
}
public void writing(String param,int command) {
public void writing(String param, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<>();

View File

@@ -23,6 +23,20 @@ public class ItemProtocol {
public static String item_error_time = "error_time";
public static String item_end_time = "end_time";
public static String item_to_command = "to_command";
public static String item_temperature = "temperature";
public static String item_temperature_setting = "temperature_setting";
public static String item_humidity = "humidity";
public static String item_humidity_setting = "humidity_setting";
public static String item_current_stage = "current_stage";
public static String item_total_running_time = "total_running_time";
public static String item_executing_stage_num = "executing_stage_num";
public static String item_front_door = "front_door";
public static String item_front_door_off = "front_door_off";
public static String item_back_door = "back_door";
public static String item_back_door_off = "back_door_off";
public static String item_device_code = "device_code";
public static String item_device_name = "device_name";
private GuhuashiSiteDeviceDriver driver;
@@ -38,14 +52,69 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_mode);
}
public int getStatus() {
return this.getOpcIntegerValue(item_status);
}
public int getTemperature() {
return this.getOpcIntegerValue(item_temperature);
}
public int getTemperatureSetting() {
return this.getOpcIntegerValue(item_temperature_setting);
}
public int getHumidity() {
return this.getOpcIntegerValue(item_humidity);
}
public int getHumiditySetting() {
return this.getOpcIntegerValue(item_humidity_setting);
}
public int getCurrentStage() {
return this.getOpcIntegerValue(item_current_stage);
}
public int getTotalRunningTime() {
return this.getOpcIntegerValue(item_total_running_time);
}
public int getExecutingStageNum() {
return this.getOpcIntegerValue(item_executing_stage_num);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getFrontDoor() {
return this.getOpcIntegerValue(item_front_door);
}
public int getFrontDoorOff() {
return this.getOpcIntegerValue(item_front_door_off);
}
public int getBackDoor() {
return this.getOpcIntegerValue(item_back_door);
}
public int getBackDoorOff() {
return this.getOpcIntegerValue(item_back_door_off);
}
public int getItem_start_time() {
return this.getOpcIntegerValue(item_start_time);
}
@@ -98,17 +167,22 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_status, "设备状态", "DB600.B3"));
list.add(new ItemDto(item_error, "error", "DB600.B4"));
list.add(new ItemDto(item_start_time, "开始固化时间", "DB600.D6"));
list.add(new ItemDto(item_stop_time, "固化结束时间", "DB600.D6"));
list.add(new ItemDto(item_open_time, "当前开机时间", "DB600.D6"));
list.add(new ItemDto(item_standby_time, "当前待机时间", "DB600.B7"));
list.add(new ItemDto(item_production_time, "当前生产时间", "DB600.D8"));
list.add(new ItemDto(item_error_time, "当前故障时间", "DB600.D8"));
list.add(new ItemDto(item_end_time, "当前故障时间", "DB600.B3"));
list.add(new ItemDto(item_temperature, "温度显示", "DB600.B4"));
list.add(new ItemDto(item_temperature_setting, "温度设定", "DB600.B4"));
list.add(new ItemDto(item_humidity, "湿度显示", "DB600.B4"));
list.add(new ItemDto(item_humidity_setting, "湿度设定", "DB600.B4"));
list.add(new ItemDto(item_current_stage, "当前阶段", "DB600.B4"));
list.add(new ItemDto(item_total_running_time, "阶段累加时", "DB600.B4"));
list.add(new ItemDto(item_executing_stage_num, "正在执行的阶段数", "DB600.B4"));
list.add(new ItemDto(item_front_door, "固化室前门已开信号", "DB600.B4"));
list.add(new ItemDto(item_front_door_off, "固化室前门已关信号", "DB600.B4"));
list.add(new ItemDto(item_back_door, "固化室后门已开信号", "DB600.B4"));
list.add(new ItemDto(item_back_door_off, "固化室后门已关信号", "DB600.B4"));
list.add(new ItemDto(item_device_code, "设备编号", "DB600.B4"));
list.add(new ItemDto(item_device_name, "设备名称", "DB600.B4"));
return list;
}

View File

@@ -16,7 +16,7 @@ public class ItemProtocol {
public static String item_move = "move";
public static String item_action = "action";
public static String item_error = "error";
public static String item_material_type = "material_type";
public static String item_pallet_type = "pallet_type";
public static String item_to_command = "to_command";
private SiteDeviceDriver driver;
@@ -45,8 +45,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_error);
}
public int getMaterialType() {
return this.getOpcIntegerValue(item_material_type);
public int getPalletType() {
return this.getOpcIntegerValue(item_pallet_type);
}
public int getToCommand() {
@@ -80,7 +80,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_move, "光电信号", "DB600.B3"));
list.add(new ItemDto(item_action, "取放信号", "DB600.B3"));
list.add(new ItemDto(item_error, "error", "DB600.B4"));
list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));
list.add(new ItemDto(item_pallet_type, "托盘类型", "DB600.D6"));
return list;
}

View File

@@ -3,7 +3,6 @@ package org.nl.acs.device_driver.tianneng.site;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -31,9 +30,6 @@ import org.nl.acs.task.service.mapper.TaskMapper;
import org.nl.acs.utils.ConvertUtil;
import org.nl.common.utils.CodeUtil;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.lucene.dto.LuceneLogDto;
import org.openscada.opc.lib.da.Server;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -87,8 +83,10 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
int io_action = 0;
int last_io_action = 0;
int material_type = 0;
int last_material_type = 0;
int pallet_type = 0;
int last_pallet_type = 0;
int barcode = 0;
int last_barcode = 0;
@@ -152,7 +150,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
move = this.itemProtocol.getMove();
hasGoods = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
material_type = this.itemProtocol.getMaterialType();
pallet_type = this.itemProtocol.getPalletType();
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {
@@ -244,7 +242,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
last_error = error;
last_move = move;
last_task = task;
last_material_type = material_type;
last_pallet_type = pallet_type;
last_barcode = barcode;
}

View File

@@ -75,10 +75,10 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
@Override
public void autoRun() throws Exception {
for (int i = 0; !OpcStartTag.is_run; ++i) {
log.info("设备执行线程等待opc同步线程...");
//log.info("设备执行线程等待opc同步线程...");
Thread.sleep(1000L);
if (i > 60) {
log.info("设备执行线程放弃等待opc同步线程...");
//log.info("设备执行线程放弃等待opc同步线程...");
break;
}
}
@@ -109,7 +109,6 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
this.runs.put(deviceDriver.getDeviceCode(), runnable);
}
runnable.setIndex(this.runs);
this.executorService.submit(runnable);
}

View File

@@ -98,7 +98,7 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="opc_code" label="OPC编码" width="100" />
<el-table-column prop="opc_code" label="OPC编码" width="120" />
<el-table-column prop="opc_name" label="OPC名称" />
<el-table-column prop="opc_host" label="OPC地址" min-width="130" />
<el-table-column prop="type" label="类型" />