更新信捷plc驱动
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package org.nl.acs.common;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test.HailiangHailiangxjplcTestDeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author geng by
|
||||
*
|
||||
*/
|
||||
@Service("hailiang_xj_plc_test")
|
||||
public class HailiangxjplcTestDevice extends AbstractDriverService{
|
||||
@Override
|
||||
public JSONObject getDeviceInfo(Device device) {
|
||||
HailiangHailiangxjplcTestDeviceDriver hailiangHailiangxjplcTestDeviceDriver = (HailiangHailiangxjplcTestDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject jo = super.getCommonDeviceInfo(hailiangHailiangxjplcTestDeviceDriver,0);
|
||||
jo.put("mode", hailiangHailiangxjplcTestDeviceDriver.getMode());
|
||||
jo.put("error", hailiangHailiangxjplcTestDeviceDriver.getError());
|
||||
jo.put("error_num", hailiangHailiangxjplcTestDeviceDriver.getError_num());
|
||||
jo.put("open_time", hailiangHailiangxjplcTestDeviceDriver.getOpen_time());
|
||||
jo.put("close_time", hailiangHailiangxjplcTestDeviceDriver.getClose_time());
|
||||
jo.put("feeding_qty", hailiangHailiangxjplcTestDeviceDriver.getFeeding_qty());
|
||||
jo.put("finish", hailiangHailiangxjplcTestDeviceDriver.getFinish());
|
||||
jo.put("task", hailiangHailiangxjplcTestDeviceDriver.getTask());
|
||||
jo.put("qualified_qty", hailiangHailiangxjplcTestDeviceDriver.getQualified_qty());
|
||||
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
@@ -79,20 +79,64 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
|
||||
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; //储料仓物物料号
|
||||
int error =0;
|
||||
int error_num =0;
|
||||
int open_time =0;
|
||||
int close_time =0;
|
||||
int ready_time =0;
|
||||
int running_time =0;
|
||||
int error_time =0;
|
||||
int voltage =0;
|
||||
int temperature =0;
|
||||
int current =0;
|
||||
int material =0;
|
||||
int lack_material =0;
|
||||
int full_material =0;
|
||||
int storage_qty =0;
|
||||
int feeding_qty =0;
|
||||
int blanking_qty =0;
|
||||
int qualified_qty =0;
|
||||
int unqualified_qty =0;
|
||||
int finish =0;
|
||||
int task =0;
|
||||
int noload_electricity_consumption =0;
|
||||
int prod_electricity_consumption =0;
|
||||
int gas_consumption =0;
|
||||
int water_consumption =0;
|
||||
int oil_level =0;
|
||||
int monthly_electricity_consumption =0;
|
||||
int pause =0;
|
||||
|
||||
|
||||
int last_mode =0;
|
||||
int last_error =0;
|
||||
int last_error_num =0;
|
||||
int last_open_time =0;
|
||||
int last_close_time =0;
|
||||
int last_ready_time =0;
|
||||
int last_running_time =0;
|
||||
int last_error_time =0;
|
||||
int last_voltage =0;
|
||||
int last_temperature =0;
|
||||
int last_current =0;
|
||||
int last_material =0;
|
||||
int last_lack_material =0;
|
||||
int last_full_material =0;
|
||||
int last_storage_qty =0;
|
||||
int last_feeding_qty =0;
|
||||
int last_blanking_qty =0;
|
||||
int last_qualified_qty =0;
|
||||
int last_unqualified_qty =0;
|
||||
int last_finish =0;
|
||||
int last_task =0;
|
||||
int last_noload_electricity_consumption =0;
|
||||
int last_prod_electricity_consumption =0;
|
||||
int last_gas_consumption =0;
|
||||
int last_water_consumption =0;
|
||||
int last_oil_level =0;
|
||||
int last_monthly_electricity_consumption =0;
|
||||
int last_pause =0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
@@ -107,9 +151,6 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
|
||||
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();
|
||||
@@ -127,20 +168,12 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
|
||||
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;
|
||||
@@ -159,7 +192,46 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getItem_mode();
|
||||
error = this.itemProtocol.getItem_error();
|
||||
error_num = this.itemProtocol.getItem_error_num();
|
||||
open_time = this.itemProtocol.getItem_open_time();
|
||||
close_time = this.itemProtocol.getItem_close_time();
|
||||
ready_time = this.itemProtocol.getItem_ready_time();
|
||||
running_time = this.itemProtocol.getItem_running_time();
|
||||
error_time = this.itemProtocol.getItem_error_time();
|
||||
voltage = this.itemProtocol.getItem_voltage();
|
||||
temperature = this.itemProtocol.getItem_temperature();
|
||||
current = this.itemProtocol.getItem_current();
|
||||
material = this.itemProtocol.getItem_material();
|
||||
lack_material = this.itemProtocol.getItem_lack_material();
|
||||
full_material = this.itemProtocol.getItem_full_material();
|
||||
storage_qty = this.itemProtocol.getItem_storage_qty();
|
||||
feeding_qty = this.itemProtocol.getItem_feeding_qty();
|
||||
blanking_qty = this.itemProtocol.getItem_blanking_qty();
|
||||
qualified_qty = this.itemProtocol.getItem_qualified_qty();
|
||||
unqualified_qty = this.itemProtocol.getItem_unqualified_qty();
|
||||
finish = this.itemProtocol.getItem_finish();
|
||||
task = this.itemProtocol.getItem_task();
|
||||
noload_electricity_consumption = this.itemProtocol.getItem_noload_electricity_consumption();
|
||||
prod_electricity_consumption = this.itemProtocol.getItem_prod_electricity_consumption();
|
||||
gas_consumption = this.itemProtocol.getItem_gas_consumption();
|
||||
water_consumption = this.itemProtocol.getItem_water_consumption();
|
||||
oil_level = this.itemProtocol.getItem_oil_level();
|
||||
monthly_electricity_consumption = this.itemProtocol.getItem_monthly_electricity_consumption();
|
||||
pause = this.itemProtocol.getItem_pause();
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
logServer.deviceLogToacs(this.device_code,"","","工作模式切换,刷新请求标记:"+this.requireSucess);
|
||||
logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceLog(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceLogToacs(this.device_code,"","","信号error:" + last_error + "->" + error);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
|
||||
@@ -194,51 +194,52 @@ public class ItemProtocol {
|
||||
|
||||
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_storage_qty, "储料斗数量", "45256"));
|
||||
list.add(new ItemDto(item_feeding_qty, "上料数量", "45260"));
|
||||
list.add(new ItemDto(item_blanking_qty, "下料数量", "45264"));
|
||||
list.add(new ItemDto(item_qualified_qty, "当前生产合格品数量", "45268"));
|
||||
list.add(new ItemDto(item_unqualified_qty, "当前生产不合格数量", "45272"));
|
||||
list.add(new ItemDto(item_finish, "生产完成", "45276"));
|
||||
list.add(new ItemDto(item_task, "任务号", "45280"));
|
||||
list.add(new ItemDto(item_noload_electricity_consumption, "空载电能耗(未生产时)", "45284"));
|
||||
list.add(new ItemDto(item_prod_electricity_consumption, "生产电能耗", "45288"));
|
||||
list.add(new ItemDto(item_gas_consumption, "气压能耗", "45292"));
|
||||
list.add(new ItemDto(item_water_consumption, "水流量能耗", "45296"));
|
||||
list.add(new ItemDto(item_oil_level, "当前液压油位", "45300"));
|
||||
list.add(new ItemDto(item_monthly_electricity_consumption, "本月总电能耗", "45304"));
|
||||
list.add(new ItemDto(item_pause, "设备暂停", "45308"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "45203"));
|
||||
list.add(new ItemDto(item_mode, "模式", "45205"));
|
||||
list.add(new ItemDto(item_error, "故障", "45207"));
|
||||
list.add(new ItemDto(item_error_num, "故障次数", "45209"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "45213"));
|
||||
list.add(new ItemDto(item_close_time, "关机时间", "45217"));
|
||||
list.add(new ItemDto(item_ready_time, "待机时间", "45221"));
|
||||
list.add(new ItemDto(item_running_time, "生产时间", "45225"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "45229"));
|
||||
list.add(new ItemDto(item_temperature, "温度", "45233"));
|
||||
list.add(new ItemDto(item_voltage, "电压", "45237"));
|
||||
list.add(new ItemDto(item_current, "电流", "45241"));
|
||||
list.add(new ItemDto(item_material, "当前生产产品编号", "45245"));
|
||||
list.add(new ItemDto(item_lack_material, "生产缺料信号", "45249"));
|
||||
list.add(new ItemDto(item_full_material, "生产满料信号", "45253"));
|
||||
list.add(new ItemDto(item_storage_qty, "储料斗数量", "45257"));
|
||||
list.add(new ItemDto(item_feeding_qty, "上料数量", "45261"));
|
||||
list.add(new ItemDto(item_blanking_qty, "下料数量", "45265"));
|
||||
list.add(new ItemDto(item_qualified_qty, "当前生产合格品数量", "45269"));
|
||||
list.add(new ItemDto(item_unqualified_qty, "当前生产不合格数量", "45273"));
|
||||
list.add(new ItemDto(item_finish, "生产完成", "45277"));
|
||||
list.add(new ItemDto(item_task, "任务号", "45281"));
|
||||
list.add(new ItemDto(item_noload_electricity_consumption, "空载电能耗(未生产时)", "45285"));
|
||||
list.add(new ItemDto(item_prod_electricity_consumption, "生产电能耗", "45289"));
|
||||
list.add(new ItemDto(item_gas_consumption, "气压能耗", "45293"));
|
||||
list.add(new ItemDto(item_water_consumption, "水流量能耗", "452967"));
|
||||
list.add(new ItemDto(item_oil_level, "当前液压油位", "45301"));
|
||||
list.add(new ItemDto(item_monthly_electricity_consumption, "本月总电能耗", "45305"));
|
||||
list.add(new ItemDto(item_pause, "设备暂停", "45309"));
|
||||
|
||||
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"));
|
||||
list.add(new ItemDto(item_to_feeding, "下发命令", "45706"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "45710"));
|
||||
list.add(new ItemDto(item_to_pause, "生产暂停", "45714"));
|
||||
list.add(new ItemDto(item_to_clear, "当前产量清零", "45718"));
|
||||
list.add(new ItemDto(item_to_finish, "强制完成", "45722"));
|
||||
list.add(new ItemDto(item_to_open, "设备开机", "45726"));
|
||||
list.add(new ItemDto(item_to_close, "设备关机", "45730"));
|
||||
list.add(new ItemDto(item_to_material, "当前任务生产物料", "45734"));
|
||||
list.add(new ItemDto(item_to_qty, "当前任务生产数量", "45738"));
|
||||
list.add(new ItemDto(item_to_heartbeat, "心跳", "45703"));
|
||||
list.add(new ItemDto(item_to_command, "下发命令", "45705"));
|
||||
list.add(new ItemDto(item_to_feeding, "下发命令", "45707"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "45711"));
|
||||
list.add(new ItemDto(item_to_pause, "生产暂停", "45715"));
|
||||
list.add(new ItemDto(item_to_clear, "当前产量清零", "45719"));
|
||||
list.add(new ItemDto(item_to_finish, "强制完成", "45723"));
|
||||
list.add(new ItemDto(item_to_open, "设备开机", "45727"));
|
||||
list.add(new ItemDto(item_to_close, "设备关机", "45731"));
|
||||
list.add(new ItemDto(item_to_material, "当前任务生产物料", "45735"));
|
||||
list.add(new ItemDto(item_to_qty, "当前任务生产数量", "45739"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user