rev 封箱拆箱
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_auto_cache_line;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -8,6 +9,7 @@ import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.acsEnum.InstActionEnum;
|
||||
import org.nl.acs.acsEnum.StatusEnum;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
|
||||
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
|
||||
@@ -125,8 +127,10 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
//任务类型
|
||||
int last_task_type = 0;
|
||||
|
||||
|
||||
//反馈设备状态请求标记
|
||||
Boolean feedDeviceStatusFlag = false;
|
||||
Boolean isonline = false;
|
||||
Boolean last_isonline = false;
|
||||
Boolean iserror = false;
|
||||
String material_spec = null;
|
||||
String last_material_spec = null;
|
||||
@@ -169,8 +173,8 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
public synchronized void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
error = this.itemProtocol.getError();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getItem_move();
|
||||
task = this.itemProtocol.getTask();
|
||||
matching_barcode = this.itemProtocol.getItem_matching_barcode();
|
||||
@@ -229,6 +233,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
three_barcode8 = this.itemProtocol.getItem_three_floor_barcode8();
|
||||
three_barcode9 = this.itemProtocol.getItem_three_floor_barcode9();
|
||||
three_barcode10 = this.itemProtocol.getItem_three_floor_barcode10();
|
||||
isonline = this.itemProtocol.getIsonline();
|
||||
|
||||
material_spec = stringToascii(material_spec1) + stringToascii(material_spec2) + stringToascii(material_spec3)
|
||||
+ stringToascii(material_spec4) + stringToascii(material_spec5) + stringToascii(material_spec6) +
|
||||
@@ -256,6 +261,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcodes:" + last_barcodes + "->" + barcodes);
|
||||
}
|
||||
if (mode != last_mode) {
|
||||
feedDeviceStatusFlag = false;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
if (move != last_move) {
|
||||
@@ -269,6 +275,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
dto.setError_info(ErrorUtil.getDictDetail("cache_line_error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
feedDeviceStatusFlag = false;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||
}
|
||||
if (task_finish != last_task_finish) {
|
||||
@@ -320,6 +327,60 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (task_type != last_task_type) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task_type:" + last_task_type + "->" + task_type);
|
||||
}
|
||||
if (isonline != last_isonline) {
|
||||
feedDeviceStatusFlag = false;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号isonline:" + last_isonline + "->" + isonline);
|
||||
}
|
||||
|
||||
|
||||
if (!this.itemProtocol.getIsonline() && !feedDeviceStatusFlag) {
|
||||
JSONObject chm = new JSONObject();
|
||||
chm.put("device_code", this.getDevice_code());
|
||||
//设备关机
|
||||
chm.put("status_type", StatusEnum.DEVICE_STATUS_CLOSE.getCode());
|
||||
chm.put("start_time", DateUtil.now());
|
||||
chm.put("error_code", "0");
|
||||
acsToWmsService.feedDeviceStatusType(chm);
|
||||
feedDeviceStatusFlag = true;
|
||||
} else if (this.itemProtocol.getIsonline() && (error == 1 || error == 51) && !feedDeviceStatusFlag) {
|
||||
JSONObject chm = new JSONObject();
|
||||
chm.put("device_code", this.getDevice_code());
|
||||
//设备报警
|
||||
chm.put("status_type", StatusEnum.DEVICE_STATUS_ERROR.getCode());
|
||||
chm.put("start_time", DateUtil.now());
|
||||
chm.put("error_code", String.valueOf(error));
|
||||
acsToWmsService.feedDeviceStatusType(chm);
|
||||
feedDeviceStatusFlag = true;
|
||||
} else if (this.itemProtocol.getIsonline() && mode == 1 && task > 0 && !feedDeviceStatusFlag) {
|
||||
JSONObject chm = new JSONObject();
|
||||
chm.put("device_code", this.getDevice_code());
|
||||
//设备生产中
|
||||
chm.put("status_type", StatusEnum.DEVICE_STATUS_PRODUCING.getCode());
|
||||
chm.put("start_time", DateUtil.now());
|
||||
chm.put("error_code", "0");
|
||||
acsToWmsService.feedDeviceStatusType(chm);
|
||||
feedDeviceStatusFlag = true;
|
||||
} else if (this.itemProtocol.getIsonline() && mode == 0 && task > 0 && !feedDeviceStatusFlag) {
|
||||
JSONObject chm = new JSONObject();
|
||||
chm.put("device_code", this.getDevice_code());
|
||||
//设备待生产
|
||||
chm.put("status_type", StatusEnum.DEVICE_STATUS_WAIT_PRODUCE.getCode());
|
||||
chm.put("start_time", DateUtil.now());
|
||||
chm.put("error_code", "0");
|
||||
acsToWmsService.feedDeviceStatusType(chm);
|
||||
feedDeviceStatusFlag = true;
|
||||
} else if (this.itemProtocol.getIsonline() && !feedDeviceStatusFlag) {
|
||||
JSONObject chm = new JSONObject();
|
||||
chm.put("device_code", this.getDevice_code());
|
||||
//设备开机
|
||||
chm.put("status_type", StatusEnum.DEVICE_STATUS_OPEN.getCode());
|
||||
chm.put("start_time", DateUtil.now());
|
||||
chm.put("error_code", "0");
|
||||
acsToWmsService.feedDeviceStatusType(chm);
|
||||
feedDeviceStatusFlag = true;
|
||||
}
|
||||
|
||||
|
||||
if (mode == 1 && prepare_ready == 1 && move == 0 && in_ready == 0 && task != 0 && prepare_barcode != 99999 && (agvphase == 0x0A || agvphase == 0x21)) {
|
||||
this.writing("to_agv_put_ready", "1");
|
||||
}
|
||||
@@ -640,6 +701,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
last_hoist_target_layer = hoist_target_layer;
|
||||
last_task_type = task_type;
|
||||
last_barcodes = barcodes;
|
||||
last_isonline = isonline;
|
||||
}
|
||||
|
||||
|
||||
@@ -942,4 +1004,8 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
return noFeedAgvMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HailiangAutoCacheLineDeviceDriver{}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_ealing_machine;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 海亮封箱机
|
||||
*/
|
||||
@Service
|
||||
public class EalingMachineDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "hailiang_ealing_machine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "海亮-封箱机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "海亮-拆箱机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new EalingMachineDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return EalingMachineDeviceDriver.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,262 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_ealing_machine;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
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 EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
|
||||
int heartbeat = 0;
|
||||
int status = 0;
|
||||
int ealing_error = 0;
|
||||
int ealing_running = 0;
|
||||
int order_finish = 0;
|
||||
int ealing_shape = 0;
|
||||
int ealing_ready = 0;
|
||||
int all_ready = 0;
|
||||
int order_compel_finish = 0;
|
||||
int error = 0;
|
||||
int now_order_box_num = 0;
|
||||
int now_order_bag_num = 0;
|
||||
int task = 0;
|
||||
int now_one_bag_of_box = 0;
|
||||
int now_bag_weight = 0;
|
||||
int now_box_weight = 0;
|
||||
int open_ready_time = 0;
|
||||
int device_running_time = 0;
|
||||
int await_time = 0;
|
||||
int pass_box_num = 0;
|
||||
int no_pass_box_num = 0;
|
||||
int pass_bag_num = 0;
|
||||
int no_pass_bag_num = 0;
|
||||
int order = 0;
|
||||
|
||||
int last_heartbeat = 0;
|
||||
int last_status = 0;
|
||||
int last_ealing_error = 0;
|
||||
int last_ealing_running = 0;
|
||||
int last_order_finish = 0;
|
||||
int last_ealing_shape = 0;
|
||||
int last_ealing_ready = 0;
|
||||
int last_all_ready = 0;
|
||||
int last_order_compel_finish = 0;
|
||||
int last_error = 0;
|
||||
int last_now_order_box_num = 0;
|
||||
int last_now_order_bag_num = 0;
|
||||
int last_task = 0;
|
||||
int last_now_one_bag_of_box = 0;
|
||||
int last_now_bag_weight = 0;
|
||||
int last_now_box_weight = 0;
|
||||
int last_open_ready_time = 0;
|
||||
int last_device_running_time = 0;
|
||||
int last_await_time = 0;
|
||||
int last_pass_box_num = 0;
|
||||
int last_no_pass_box_num = 0;
|
||||
int last_pass_bag_num = 0;
|
||||
int last_no_pass_bag_num = 0;
|
||||
int last_order = 0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
boolean requireSucess = false;
|
||||
|
||||
|
||||
String device_code = null;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
status = this.itemProtocol.getItem_status();
|
||||
ealing_error = this.itemProtocol.getItem_ealing_error();
|
||||
ealing_running = this.itemProtocol.getItem_ealing_running();
|
||||
order_finish = this.itemProtocol.getItem_order_finish();
|
||||
ealing_shape = this.itemProtocol.getItem_ealing_shape();
|
||||
ealing_ready = this.itemProtocol.getItem_ealing_ready();
|
||||
all_ready = this.itemProtocol.getItem_all_ready();
|
||||
order_compel_finish = this.itemProtocol.getItem_order_compel_finish();
|
||||
error = this.itemProtocol.getItem_error();
|
||||
now_order_box_num = this.itemProtocol.getItem_now_order_box_num();
|
||||
now_order_bag_num = this.itemProtocol.getItem_now_order_bag_num();
|
||||
task = this.itemProtocol.getItem_task();
|
||||
now_one_bag_of_box = this.itemProtocol.getItem_now_one_bag_of_box();
|
||||
now_bag_weight = this.itemProtocol.getItem_now_bag_weight();
|
||||
now_box_weight = this.itemProtocol.getItem_now_bag_weight();
|
||||
pass_box_num = this.itemProtocol.getItem_pass_box_num();
|
||||
no_pass_box_num = this.itemProtocol.getItem_no_pass_box_num();
|
||||
pass_bag_num = this.itemProtocol.getItem_pass_bag_num();
|
||||
no_pass_bag_num = this.itemProtocol.getItem_no_pass_bag_num();
|
||||
order = this.itemProtocol.getItem_order();
|
||||
|
||||
if (status != last_status) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + "->" + status + "复位请求标记");
|
||||
}
|
||||
if (ealing_error != last_ealing_error) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号ealing_error:" + last_ealing_error + "->" + ealing_error + "复位请求标记");
|
||||
}
|
||||
if (ealing_running != last_ealing_running) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号ealing_running:" + last_ealing_running + "->" + ealing_running + "复位请求标记");
|
||||
}
|
||||
if (order_finish != last_order_finish) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_finish:" + last_order_finish + "->" + order_finish + "复位请求标记");
|
||||
}
|
||||
if (ealing_shape != last_ealing_shape) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号ealing_shape:" + last_ealing_shape + "->" + ealing_shape + "复位请求标记");
|
||||
}
|
||||
if (ealing_ready != last_ealing_ready) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号ealing_ready:" + last_ealing_ready + "->" + ealing_ready + "复位请求标记");
|
||||
}
|
||||
if (all_ready != last_all_ready) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号all_ready:" + last_all_ready + "->" + all_ready + "复位请求标记");
|
||||
}
|
||||
if (order_compel_finish != last_order_compel_finish) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_compel_finish:" + last_order_compel_finish + "->" + order_compel_finish + "复位请求标记");
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error + "复位请求标记");
|
||||
}
|
||||
if (now_order_box_num != last_now_order_box_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_order_box_num:" + last_now_order_box_num + "->" + now_order_box_num + "复位请求标记");
|
||||
}
|
||||
if (now_order_bag_num != last_now_order_bag_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_order_bag_num:" + last_now_order_bag_num + "->" + now_order_bag_num + "复位请求标记");
|
||||
}
|
||||
if (task != last_task) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task + "复位请求标记");
|
||||
}
|
||||
if (now_one_bag_of_box != last_now_one_bag_of_box) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_one_bag_of_box:" + last_now_one_bag_of_box + "->" + now_one_bag_of_box + "复位请求标记");
|
||||
}
|
||||
if (now_bag_weight != last_now_bag_weight) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_bag_weight:" + last_now_bag_weight + "->" + now_bag_weight + "复位请求标记");
|
||||
}
|
||||
if (now_box_weight != last_now_box_weight) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_box_weight:" + last_now_box_weight + "->" + now_box_weight + "复位请求标记");
|
||||
}
|
||||
if (pass_box_num != last_pass_box_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号pass_box_num:" + last_pass_box_num + "->" + pass_box_num + "复位请求标记");
|
||||
}
|
||||
if (no_pass_box_num != last_no_pass_box_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号no_pass_box_num:" + last_no_pass_box_num + "->" + no_pass_box_num + "复位请求标记");
|
||||
}
|
||||
if (pass_bag_num != last_pass_bag_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号pass_bag_num:" + last_pass_bag_num + "->" + pass_bag_num + "复位请求标记");
|
||||
}
|
||||
if (no_pass_bag_num != last_no_pass_bag_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号no_pass_bag_num:" + last_no_pass_bag_num + "->" + no_pass_bag_num + "复位请求标记");
|
||||
}
|
||||
if (order != last_order) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order:" + last_order + "->" + order + "复位请求标记");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (1 == 2) {
|
||||
this.setIsonline(false);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
|
||||
|
||||
}
|
||||
last_status = status;
|
||||
last_ealing_error = ealing_error;
|
||||
last_ealing_running = ealing_running;
|
||||
last_order_finish = order_finish;
|
||||
last_ealing_shape = ealing_shape;
|
||||
last_ealing_ready = ealing_ready;
|
||||
last_all_ready = all_ready;
|
||||
last_order_compel_finish = order_compel_finish;
|
||||
last_error = error;
|
||||
last_now_order_box_num = now_order_box_num;
|
||||
last_now_order_bag_num = now_order_bag_num;
|
||||
last_task = task;
|
||||
last_now_one_bag_of_box = now_one_bag_of_box;
|
||||
last_now_bag_weight = now_bag_weight;
|
||||
last_now_box_weight = now_box_weight;
|
||||
last_open_ready_time = open_ready_time;
|
||||
last_device_running_time = device_running_time;
|
||||
last_await_time = await_time;
|
||||
last_pass_box_num = pass_box_num;
|
||||
last_no_pass_box_num = no_pass_box_num;
|
||||
last_pass_bag_num = pass_bag_num;
|
||||
last_no_pass_bag_num = no_pass_bag_num;
|
||||
last_order = order;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("isOnline", this.getIsonline());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
|
||||
this.control(itemMap);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_ealing_machine;
|
||||
|
||||
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_status = "status";
|
||||
//装箱机故障
|
||||
public static String item_ealing_error = "ealing_error";
|
||||
//装箱机运行状态
|
||||
public static String item_ealing_running = "ealing_running";
|
||||
//订单完成
|
||||
public static String item_order_finish = "order_finish";
|
||||
//装箱机准备中
|
||||
public static String item_ealing_shape = "ealing_shape";
|
||||
//装箱机就绪
|
||||
public static String item_ealing_ready = "ealing_ready";
|
||||
//所有设备就绪
|
||||
public static String item_all_ready = "all_ready";
|
||||
//订单强制完成
|
||||
public static String item_order_compel_finish = "order_compel_finish";
|
||||
//error
|
||||
public static String item_error = "error";
|
||||
//订单实时箱数
|
||||
public static String item_now_order_box_num = "now_order_box_num";
|
||||
//订单实时袋数
|
||||
public static String item_now_order_bag_num = "now_order_bag_num";
|
||||
//jobNo
|
||||
public static String item_task = "task";
|
||||
//当前箱袋数
|
||||
public static String item_now_one_bag_of_box = "now_one_bag_of_box";
|
||||
//当前袋重量
|
||||
public static String item_now_bag_weight = "now_bag_weight";
|
||||
//当前箱重量
|
||||
public static String item_now_box_weight = "now_box_weight";
|
||||
//开机准备时间
|
||||
public static String item_open_ready_time = "open_ready_time";
|
||||
//设备运转时间
|
||||
public static String item_device_running_time = "device_running_time";
|
||||
//待机时间
|
||||
public static String item_await_time = "await_time";
|
||||
//合格箱数
|
||||
public static String item_pass_box_num = "pass_box_num";
|
||||
//不合格箱数
|
||||
public static String item_no_pass_box_num = "no_pass_box_num";
|
||||
//合格袋数
|
||||
public static String item_pass_bag_num = "pass_bag_num";
|
||||
//不合格袋数
|
||||
public static String item_no_pass_bag_num = "no_pass_bag_num";
|
||||
//专机工单号
|
||||
public static String item_order = "order";
|
||||
|
||||
|
||||
//设备开关
|
||||
public static String item_to_open = "to_open";
|
||||
//当前产量清零
|
||||
public static String item_to_clear = "to_clear";
|
||||
//订单确认完成
|
||||
public static String item_to_confirm_finished = "to_confirm_finished";
|
||||
//专机暂停
|
||||
public static String item_to_pause = "to_pause";
|
||||
//每袋重量上限重量
|
||||
public static String item_to_one_bag_up_weight = "to_one_bag_up_weight";
|
||||
//每袋重量下限重量
|
||||
public static String item_to_one_bag_down_weight = "to_one_bag_down_weight";
|
||||
//袋长
|
||||
public static String item_to_bag_length = "to_bag_length";
|
||||
//袋宽
|
||||
public static String item_to_bag_width = "to_bag_width";
|
||||
//箱内每层码袋数量
|
||||
public static String item_to_bag_num_of_one_floor_box = "to_bag_num_of_one_floor_box";
|
||||
//码袋点位X1
|
||||
public static String item_to_x1 = "to_x1";
|
||||
public static String item_to_x2 = "to_x2";
|
||||
public static String item_to_x3 = "to_x3";
|
||||
public static String item_to_x4 = "to_x4";
|
||||
public static String item_to_x5 = "to_x5";
|
||||
public static String item_to_x6 = "to_x6";
|
||||
public static String item_to_x7 = "to_x7";
|
||||
public static String item_to_x8 = "to_x8";
|
||||
public static String item_to_x9 = "to_x9";
|
||||
public static String item_to_x10 = "to_x10";
|
||||
public static String item_to_x11 = "to_x11";
|
||||
public static String item_to_x12 = "to_x12";
|
||||
public static String item_to_x13 = "to_x13";
|
||||
public static String item_to_x14 = "to_x14";
|
||||
public static String item_to_x15 = "to_x15";
|
||||
public static String item_to_x16 = "to_x16";
|
||||
public static String item_to_x17 = "to_x17";
|
||||
public static String item_to_x18 = "to_x18";
|
||||
public static String item_to_x19 = "to_x19";
|
||||
public static String item_to_x20 = "to_x20";
|
||||
//码袋点位Y1
|
||||
public static String item_to_y1 = "to_y1";
|
||||
public static String item_to_y2 = "to_y2";
|
||||
public static String item_to_y3 = "to_y3";
|
||||
public static String item_to_y4 = "to_y4";
|
||||
public static String item_to_y5 = "to_y5";
|
||||
public static String item_to_y6 = "to_y6";
|
||||
public static String item_to_y7 = "to_y7";
|
||||
public static String item_to_y8 = "to_y8";
|
||||
public static String item_to_y9 = "to_y9";
|
||||
public static String item_to_y10 = "to_y10";
|
||||
public static String item_to_y11 = "to_y11";
|
||||
public static String item_to_y12 = "to_y12";
|
||||
public static String item_to_y13 = "to_y13";
|
||||
public static String item_to_y14 = "to_y14";
|
||||
public static String item_to_y15 = "to_y15";
|
||||
public static String item_to_y16 = "to_y16";
|
||||
public static String item_to_y17 = "to_y17";
|
||||
public static String item_to_y18 = "to_y18";
|
||||
public static String item_to_y19 = "to_y19";
|
||||
public static String item_to_y20 = "to_y20";
|
||||
//工单强制完成
|
||||
public static String item_to_order_compel_finished = "to_order_compel_finished";
|
||||
//订单总箱数
|
||||
public static String item_to_order_box_num = "to_order_box_num";
|
||||
//订单总袋数
|
||||
public static String item_to_order_bag_num = "to_order_bag_num";
|
||||
//任务号
|
||||
public static String item_to_task = "to_task";
|
||||
//每箱袋数
|
||||
public static String item_to_bag_num_of_box = "to_bag_num_of_box";
|
||||
//每箱重量
|
||||
public static String item_to_one_box_weight = "to_one_box_weight";
|
||||
//每袋重量
|
||||
public static String item_to_one_bag_weight = "to_one_bag_weight";
|
||||
//模板号
|
||||
public static String item_to_template_no = "to_template_no";
|
||||
//每箱重量上限重量
|
||||
public static String item_to_one_box_up_weight = "to_one_box_up_weight";
|
||||
//每箱重量下限重量
|
||||
public static String item_to_one_box_down_weight = "to_one_box_down_weight";
|
||||
//空纸箱重量
|
||||
public static String item_to_empty_box_weight = "to_empty_box_weight";
|
||||
//工单号
|
||||
public static String item_to_order = "to_order";
|
||||
//是否自动确认
|
||||
public static String item_to_is_auto_confirm = "to_is_auto_confirm";
|
||||
//封箱确认时间秒数
|
||||
public static String item_to_time = "to_time";
|
||||
|
||||
private EalingMachineDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(EalingMachineDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
|
||||
public int getItem_status() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
public int getItem_ealing_error() {
|
||||
return this.getOpcIntegerValue(item_ealing_error);
|
||||
}
|
||||
|
||||
public int getItem_ealing_running() {
|
||||
return this.getOpcIntegerValue(item_ealing_running);
|
||||
}
|
||||
|
||||
public int getItem_order_finish() {
|
||||
return this.getOpcIntegerValue(item_order_finish);
|
||||
}
|
||||
|
||||
public int getItem_ealing_shape() {
|
||||
return this.getOpcIntegerValue(item_ealing_shape);
|
||||
}
|
||||
|
||||
public int getItem_ealing_ready() {
|
||||
return this.getOpcIntegerValue(item_ealing_ready);
|
||||
}
|
||||
|
||||
public int getItem_all_ready() {
|
||||
return this.getOpcIntegerValue(item_all_ready);
|
||||
}
|
||||
|
||||
public int getItem_order_compel_finish() {
|
||||
return this.getOpcIntegerValue(item_order_compel_finish);
|
||||
}
|
||||
|
||||
public int getItem_error() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getItem_now_order_box_num() {
|
||||
return this.getOpcIntegerValue(item_now_order_box_num);
|
||||
}
|
||||
|
||||
public int getItem_now_order_bag_num() {
|
||||
return this.getOpcIntegerValue(item_now_order_bag_num);
|
||||
}
|
||||
|
||||
public int getItem_task() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
public int getItem_now_one_bag_of_box() {
|
||||
return this.getOpcIntegerValue(item_now_one_bag_of_box);
|
||||
}
|
||||
|
||||
public int getItem_now_bag_weight() {
|
||||
return this.getOpcIntegerValue(item_now_bag_weight);
|
||||
}
|
||||
|
||||
public int getItem_now_box_weight() {
|
||||
return this.getOpcIntegerValue(item_now_box_weight);
|
||||
}
|
||||
|
||||
public int getItem_open_ready_time() {
|
||||
return this.getOpcIntegerValue(item_open_ready_time);
|
||||
}
|
||||
|
||||
public int getItem_device_running_time() {
|
||||
return this.getOpcIntegerValue(item_device_running_time);
|
||||
}
|
||||
|
||||
public int getItem_await_time() {
|
||||
return this.getOpcIntegerValue(item_await_time);
|
||||
}
|
||||
|
||||
public int getItem_pass_box_num() {
|
||||
return this.getOpcIntegerValue(item_pass_box_num);
|
||||
}
|
||||
|
||||
public int getItem_no_pass_box_num() {
|
||||
return this.getOpcIntegerValue(item_no_pass_box_num);
|
||||
}
|
||||
|
||||
public int getItem_pass_bag_num() {
|
||||
return this.getOpcIntegerValue(item_pass_bag_num);
|
||||
}
|
||||
|
||||
public int getItem_no_pass_bag_num() {
|
||||
return this.getOpcIntegerValue(item_no_pass_bag_num);
|
||||
}
|
||||
|
||||
public int getItem_order() {
|
||||
return this.getOpcIntegerValue(item_order);
|
||||
}
|
||||
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
}
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.W82"));
|
||||
list.add(new ItemDto(item_status, "装箱机状态", "DB1.B0.0"));
|
||||
list.add(new ItemDto(item_ealing_error, "装箱机故障", "DB1.B0.2"));
|
||||
list.add(new ItemDto(item_ealing_running, "装箱机运行状态", "DB1.B0.3"));
|
||||
list.add(new ItemDto(item_order_finish, "订单完成", "DB1.B1.2"));
|
||||
list.add(new ItemDto(item_ealing_shape, "装箱机准备中", "DB1.B1.3"));
|
||||
list.add(new ItemDto(item_ealing_ready, "装箱机就绪", "DB1.B1.4"));
|
||||
list.add(new ItemDto(item_all_ready, "所有设备就绪", "DB1.B1.6"));
|
||||
list.add(new ItemDto(item_order_compel_finish, "订单强制完成", "DB1.B2.0"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_now_order_box_num, "订单实时箱数", "DB1.D84"));
|
||||
list.add(new ItemDto(item_now_order_bag_num, "订单实时袋数", "DB1.D88"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D92"));
|
||||
list.add(new ItemDto(item_now_one_bag_of_box, "当前箱袋数", "DB1.D96"));
|
||||
list.add(new ItemDto(item_now_bag_weight, "当前袋重量", "DB1.D100"));
|
||||
list.add(new ItemDto(item_now_box_weight, "当前箱重量", "DB1.D104"));
|
||||
list.add(new ItemDto(item_open_ready_time, "开机准备时间", "DB1.D108"));
|
||||
list.add(new ItemDto(item_device_running_time, "设备运转时间", "DB1.D112"));
|
||||
list.add(new ItemDto(item_await_time, "待机时间", "DB1.D116"));
|
||||
list.add(new ItemDto(item_pass_box_num, "合格箱数", "DB1.D120"));
|
||||
list.add(new ItemDto(item_no_pass_box_num, "不合格箱数", "DB1.D124"));
|
||||
list.add(new ItemDto(item_pass_bag_num, "合格袋数", "DB1.D128"));
|
||||
list.add(new ItemDto(item_no_pass_bag_num, "不合格袋数", "DB1.D132"));
|
||||
list.add(new ItemDto(item_order, "专机工单号", "DB1.D160"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_open, "设备开关", "DB2.W4"));
|
||||
list.add(new ItemDto(item_to_clear, "当前产量清零", "DB2.W12"));
|
||||
list.add(new ItemDto(item_to_confirm_finished, "订单确认完成", "DB2.W14"));
|
||||
list.add(new ItemDto(item_to_pause, "专机暂停", "DB2.W16"));
|
||||
list.add(new ItemDto(item_to_one_bag_up_weight, "每袋重量上限重量", "DB2.W20"));
|
||||
list.add(new ItemDto(item_to_one_bag_down_weight, "每袋重量下限重量", "DB2.W22"));
|
||||
list.add(new ItemDto(item_to_bag_length, "袋长", "DB2.W28"));
|
||||
list.add(new ItemDto(item_to_bag_width, "袋宽", "DB2.W30"));
|
||||
list.add(new ItemDto(item_to_bag_num_of_one_floor_box, "箱内每层码袋数量", "DB2.W32"));
|
||||
list.add(new ItemDto(item_to_x1, "码袋点位X1", "DB2.W38"));
|
||||
list.add(new ItemDto(item_to_x2, "码袋点位X2", "DB2.W40"));
|
||||
list.add(new ItemDto(item_to_x3, "码袋点位X3", "DB2.W42"));
|
||||
list.add(new ItemDto(item_to_x4, "码袋点位X4", "DB2.W44"));
|
||||
list.add(new ItemDto(item_to_x5, "码袋点位X5", "DB2.W46"));
|
||||
list.add(new ItemDto(item_to_x6, "码袋点位X6", "DB2.W48"));
|
||||
list.add(new ItemDto(item_to_x7, "码袋点位X7", "DB2.W50"));
|
||||
list.add(new ItemDto(item_to_x8, "码袋点位X8", "DB2.W52"));
|
||||
list.add(new ItemDto(item_to_x9, "码袋点位X9", "DB2.W54"));
|
||||
list.add(new ItemDto(item_to_x10, "码袋点位X10", "DB2.W56"));
|
||||
list.add(new ItemDto(item_to_x11, "码袋点位X11", "DB2.W58"));
|
||||
list.add(new ItemDto(item_to_x12, "码袋点位X12", "DB2.W60"));
|
||||
list.add(new ItemDto(item_to_x13, "码袋点位X13", "DB2.W62"));
|
||||
list.add(new ItemDto(item_to_x14, "码袋点位X14", "DB2.W64"));
|
||||
list.add(new ItemDto(item_to_x15, "码袋点位X15", "DB2.W66"));
|
||||
list.add(new ItemDto(item_to_x16, "码袋点位X16", "DB2.W68"));
|
||||
list.add(new ItemDto(item_to_x17, "码袋点位X17", "DB2.W70"));
|
||||
list.add(new ItemDto(item_to_x18, "码袋点位X18", "DB2.W72"));
|
||||
list.add(new ItemDto(item_to_x19, "码袋点位X19", "DB2.W74"));
|
||||
list.add(new ItemDto(item_to_x20, "码袋点位X20", "DB2.W76"));
|
||||
list.add(new ItemDto(item_to_y1, "码袋点位Y1", "DB2.W78"));
|
||||
list.add(new ItemDto(item_to_y2, "码袋点位Y2", "DB2.W80"));
|
||||
list.add(new ItemDto(item_to_y3, "码袋点位Y3", "DB2.W82"));
|
||||
list.add(new ItemDto(item_to_y4, "码袋点位Y4", "DB2.W84"));
|
||||
list.add(new ItemDto(item_to_y5, "码袋点位Y5", "DB2.W86"));
|
||||
list.add(new ItemDto(item_to_y6, "码袋点位Y6", "DB2.W88"));
|
||||
list.add(new ItemDto(item_to_y7, "码袋点位Y7", "DB2.W90"));
|
||||
list.add(new ItemDto(item_to_y8, "码袋点位Y8", "DB2.W92"));
|
||||
list.add(new ItemDto(item_to_y9, "码袋点位Y9", "DB2.W94"));
|
||||
list.add(new ItemDto(item_to_y10, "码袋点位Y10", "DB2.W96"));
|
||||
list.add(new ItemDto(item_to_y11, "码袋点位Y11", "DB2.W98"));
|
||||
list.add(new ItemDto(item_to_y12, "码袋点位Y12", "DB2.W100"));
|
||||
list.add(new ItemDto(item_to_y13, "码袋点位Y13", "DB2.W102"));
|
||||
list.add(new ItemDto(item_to_y14, "码袋点位Y14", "DB2.W104"));
|
||||
list.add(new ItemDto(item_to_y15, "码袋点位Y15", "DB2.W106"));
|
||||
list.add(new ItemDto(item_to_y16, "码袋点位Y16", "DB2.W108"));
|
||||
list.add(new ItemDto(item_to_y17, "码袋点位Y17", "DB2.W110"));
|
||||
list.add(new ItemDto(item_to_y18, "码袋点位Y18", "DB2.W112"));
|
||||
list.add(new ItemDto(item_to_y19, "码袋点位Y19", "DB2.W114"));
|
||||
list.add(new ItemDto(item_to_y20, "码袋点位Y20", "DB2.W116"));
|
||||
list.add(new ItemDto(item_to_order_compel_finished, "工单强制完成", "DB2.W122"));
|
||||
list.add(new ItemDto(item_to_order_box_num, "订单总箱数", "DB2.D124"));
|
||||
list.add(new ItemDto(item_to_order_bag_num, "订单总袋数", "DB2.D128"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB2.D132"));
|
||||
list.add(new ItemDto(item_to_bag_num_of_box, "每箱袋数", "DB2.D136"));
|
||||
list.add(new ItemDto(item_to_one_box_weight, "每箱重量", "DB2.D140"));
|
||||
list.add(new ItemDto(item_to_one_bag_weight, "每袋重量", "DB2.D144"));
|
||||
list.add(new ItemDto(item_to_template_no, "模板号", "DB2.D148"));
|
||||
list.add(new ItemDto(item_to_one_box_up_weight, "每箱重量上限重量", "DB2.D152"));
|
||||
list.add(new ItemDto(item_to_one_box_down_weight, "每箱重量下限重量", "DB2.D156"));
|
||||
list.add(new ItemDto(item_to_empty_box_weight, "空纸箱重量", "DB2.D160"));
|
||||
list.add(new ItemDto(item_to_order, "工单号", "DB2.D200"));
|
||||
list.add(new ItemDto(item_to_is_auto_confirm, "是否自动确认", "DB2.W24"));
|
||||
list.add(new ItemDto(item_to_time, "封箱确认时间秒数", "DB2.W26"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
|
||||
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num());
|
||||
}
|
||||
if (storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num")))) {
|
||||
if (storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
|
||||
requireSucess = false;
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号storage_stock_num:" + last_storage_stock_num + "->" + storage_stock_num);
|
||||
@@ -162,7 +162,7 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
message = "";
|
||||
|
||||
//倒料位满足联机,剩余数量小于最小数量申请缓存线出库任务
|
||||
if (mode == 1 && !requireSucess && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num) {
|
||||
if (mode == 1 && !requireSucess && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) >= storage_stock_num && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != 0) {
|
||||
boolean flag = applyOutCacheLineTask();
|
||||
this.noApplyTaskMessage = null;
|
||||
if (flag) {
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_unboxing_machine;
|
||||
|
||||
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_status = "status";
|
||||
//开箱机故障
|
||||
public static String item_unboxing_error = "unboxing_error";
|
||||
//开箱机运行状态
|
||||
public static String item_unboxing_running = "unboxing_running";
|
||||
//开箱机就绪
|
||||
public static String item_unboxing_ready = "unboxing_ready";
|
||||
//订单完成
|
||||
public static String item_order_finish = "order_finish";
|
||||
//订单强制完成
|
||||
public static String item_order_compel_finish = "order_compel_finish";
|
||||
//error
|
||||
public static String item_error = "error";
|
||||
//订单实时
|
||||
public static String item_now_order_num = "now_order_num";
|
||||
//jobNo
|
||||
public static String item_task = "task";
|
||||
//开机准备时间
|
||||
public static String item_open_ready_time = "open_ready_time";
|
||||
//设备运转时间
|
||||
public static String item_device_running_time = "device_running_time";
|
||||
//待机时间
|
||||
public static String item_await_time = "await_time";
|
||||
//工单号
|
||||
public static String item_order = "order";
|
||||
|
||||
|
||||
//是否正转
|
||||
public static String item_to_foreward = "to_foreward";
|
||||
//当前产量清零
|
||||
public static String item_to_clear = "to_clear";
|
||||
//订单确认完成
|
||||
public static String item_to_confirm_finished = "to_confirm_finished";
|
||||
//专机暂停
|
||||
public static String item_to_pause = "to_pause";
|
||||
//工单强制完成
|
||||
public static String item_to_order_compel_finished = "to_order_compel_finished";
|
||||
//订单总箱数
|
||||
public static String item_to_order_box_num = "to_order_box_num";
|
||||
//任务号
|
||||
public static String item_to_task = "to_task";
|
||||
//工单号
|
||||
public static String item_to_order = "to_order";
|
||||
|
||||
private UnboxingMachineDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(UnboxingMachineDeviceDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
public int getHeartbeat() {
|
||||
return this.getOpcIntegerValue(item_heartbeat);
|
||||
}
|
||||
|
||||
|
||||
public int getItem_status() {
|
||||
return this.getOpcIntegerValue(item_status);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_unboxing_error() {
|
||||
return this.getOpcIntegerValue(item_unboxing_error);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_unboxing_running() {
|
||||
return this.getOpcIntegerValue(item_unboxing_running);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_unboxing_ready() {
|
||||
return this.getOpcIntegerValue(item_unboxing_ready);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_order_finish() {
|
||||
return this.getOpcIntegerValue(item_order_finish);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_order_compel_finish() {
|
||||
return this.getOpcIntegerValue(item_order_compel_finish);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_error() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_now_order_num() {
|
||||
return this.getOpcIntegerValue(item_now_order_num);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_task() {
|
||||
return this.getOpcIntegerValue(item_task);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_open_ready_time() {
|
||||
return this.getOpcIntegerValue(item_open_ready_time);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_device_running_time() {
|
||||
return this.getOpcIntegerValue(item_device_running_time);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_await_time() {
|
||||
return this.getOpcIntegerValue(item_await_time);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int getItem_order() {
|
||||
return this.getOpcIntegerValue(item_order);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
||||
Boolean isonline;
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.W82"));
|
||||
list.add(new ItemDto(item_status, "开箱机状态", "DB1.B0.0"));
|
||||
list.add(new ItemDto(item_unboxing_error, "开箱机故障", "DB1.B0.1"));
|
||||
list.add(new ItemDto(item_unboxing_running, "开箱机运行状态", "DB1.B0.2"));
|
||||
list.add(new ItemDto(item_unboxing_ready, "开箱机就绪", "DB1.B0.3"));
|
||||
list.add(new ItemDto(item_order_finish, "订单完成", "DB1.B0.4"));
|
||||
list.add(new ItemDto(item_order_compel_finish, "订单强制完成", "DB1.B0.5"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.W4"));
|
||||
list.add(new ItemDto(item_now_order_num, "订单实时", "DB1.D84"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D88"));
|
||||
list.add(new ItemDto(item_open_ready_time, "开机准备时间", "DB1.D108"));
|
||||
list.add(new ItemDto(item_device_running_time, "设备运转时间", "DB1.D112"));
|
||||
list.add(new ItemDto(item_await_time, "待机时间", "DB1.D116"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D156"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_foreward, "是否正转", "DB2.W4"));
|
||||
list.add(new ItemDto(item_to_clear, "当前产量清零", "DB2.W6"));
|
||||
list.add(new ItemDto(item_to_confirm_finished, "订单确认完成", "DB2.W8"));
|
||||
list.add(new ItemDto(item_to_pause, "专机暂停", "DB2.W10"));
|
||||
list.add(new ItemDto(item_to_order_compel_finished, "工单强制完成", "DB2.W10"));
|
||||
list.add(new ItemDto(item_to_order_box_num, "订单总箱数", "DB2.D84"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB2.D84"));
|
||||
list.add(new ItemDto(item_to_order, "工单号", "DB2.D156"));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_unboxing_machine;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 拆箱机
|
||||
*/
|
||||
@Service
|
||||
public class UnboxingMachineDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "hailiang_unboxing_machine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "海亮-拆箱机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "海亮-拆箱机";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new UnboxingMachineDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return UnboxingMachineDeviceDriver.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,190 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_unboxing_machine;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
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 UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
|
||||
|
||||
int heartbeat = 0;
|
||||
int status = 0;
|
||||
int unboxing_error = 0;
|
||||
int unboxing_running = 0;
|
||||
int unboxing_ready = 0;
|
||||
int order_finish = 0;
|
||||
int order_compel_finish = 0;
|
||||
int error = 0;
|
||||
int now_order_num = 0;
|
||||
int task = 0;
|
||||
int open_ready_time = 0;
|
||||
int device_running_time = 0;
|
||||
int await_time = 0;
|
||||
int order = 0;
|
||||
|
||||
int last_heartbeat = 0;
|
||||
int last_status = 0;
|
||||
int last_unboxing_error = 0;
|
||||
int last_unboxing_running = 0;
|
||||
int last_unboxing_ready = 0;
|
||||
int last_order_finish = 0;
|
||||
int last_order_compel_finish = 0;
|
||||
int last_error = 0;
|
||||
int last_now_order_num = 0;
|
||||
int last_task = 0;
|
||||
int last_open_ready_time = 0;
|
||||
int last_device_running_time = 0;
|
||||
int last_await_time = 0;
|
||||
int last_order = 0;
|
||||
|
||||
|
||||
Boolean isonline = true;
|
||||
String message = null;
|
||||
Boolean iserror = false;
|
||||
|
||||
private int instruction_require_time_out;
|
||||
boolean requireSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
String device_code = null;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
status = this.itemProtocol.getItem_status();
|
||||
unboxing_error = this.itemProtocol.getItem_unboxing_error();
|
||||
unboxing_running = this.itemProtocol.getItem_unboxing_running();
|
||||
unboxing_ready = this.itemProtocol.getItem_unboxing_ready();
|
||||
order_finish = this.itemProtocol.getItem_order_finish();
|
||||
order_compel_finish = this.itemProtocol.getItem_order_compel_finish();
|
||||
error = this.itemProtocol.getItem_error();
|
||||
now_order_num = this.itemProtocol.getItem_now_order_num();
|
||||
task = this.itemProtocol.getItem_task();
|
||||
order = this.itemProtocol.getItem_order();
|
||||
|
||||
if (status != last_status) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + "->" + status + "复位请求标记");
|
||||
}
|
||||
if (unboxing_error != last_unboxing_error) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号unboxing_error:" + last_unboxing_error + "->" + unboxing_error + "复位请求标记");
|
||||
}
|
||||
if (unboxing_running != last_unboxing_running) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号unboxing_running:" + last_unboxing_running + "->" + unboxing_running + "复位请求标记");
|
||||
}
|
||||
if (unboxing_ready != last_unboxing_ready) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号unboxing_ready:" + last_unboxing_ready + "->" + unboxing_ready + "复位请求标记");
|
||||
}
|
||||
if (order_finish != last_order_finish) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_finish:" + last_order_finish + "->" + order_finish + "复位请求标记");
|
||||
}
|
||||
if (order_compel_finish != last_order_compel_finish) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order_compel_finish:" + last_order_compel_finish + "->" + order_compel_finish + "复位请求标记");
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error + "复位请求标记");
|
||||
}
|
||||
if (now_order_num != last_now_order_num) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号now_order_num:" + last_now_order_num + "->" + now_order_num + "复位请求标记");
|
||||
}
|
||||
if (task != last_task) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task + "复位请求标记");
|
||||
}
|
||||
if (order != last_order) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号order:" + last_order + "->" + order + "复位请求标记");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (1 == 2) {
|
||||
this.setIsonline(false);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
|
||||
|
||||
}
|
||||
last_status = status;
|
||||
last_unboxing_error = unboxing_error;
|
||||
last_unboxing_running = unboxing_running;
|
||||
last_unboxing_ready = unboxing_ready;
|
||||
last_order_finish = order_finish;
|
||||
last_order_compel_finish = order_compel_finish;
|
||||
last_error = error;
|
||||
last_now_order_num = now_order_num;
|
||||
last_task = task;
|
||||
last_order = order;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String mode = "";
|
||||
String action = "";
|
||||
String move = "";
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
|
||||
this.control(itemMap);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/updateTaskStatus")
|
||||
@Log("wms更改任务状态")
|
||||
@ApiOperation("wms更改任务状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> updateTaskStatus(@RequestBody List<JSONObject> taskStatus) {
|
||||
return new ResponseEntity<>(wmstoacsService.updateTaskStatus(taskStatus), HttpStatus.OK);
|
||||
}
|
||||
@@ -57,6 +58,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/orderStatusUpdate")
|
||||
@Log("wms更改工单状态")
|
||||
@ApiOperation("wms更改工单状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> orderStatusUpdate(@RequestBody List<JSONObject> orderStatus) {
|
||||
return new ResponseEntity<>(wmstoacsService.orderStatusUpdate(orderStatus), HttpStatus.OK);
|
||||
}
|
||||
@@ -64,6 +66,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/issuedBarcode")
|
||||
@Log("扫码异常下发条码")
|
||||
@ApiOperation("扫码异常下发条码")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> issuedBarcode(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.issuedBarcode(param), HttpStatus.OK);
|
||||
}
|
||||
@@ -71,6 +74,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/puaseCacheLine")
|
||||
@Log("暂停或恢复缓存线")
|
||||
@ApiOperation("暂停或恢复缓存线")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> pauseCacheLine(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.pauseCacheLine(param), HttpStatus.OK);
|
||||
}
|
||||
@@ -78,6 +82,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/updateDeviceGoodsFromWms")
|
||||
@Log("WMS修改点位状态")
|
||||
@ApiOperation("WMS修改点位状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> updateDeviceGoodsFromWms(@RequestBody String whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -85,6 +90,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/areaControl")
|
||||
@Log("区域控制")
|
||||
@ApiOperation("区域控制")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> areaControl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -92,6 +98,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/action")
|
||||
@Log("下发动作")
|
||||
@ApiOperation("WMS修改点位状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> putAction(@RequestBody String whereJson) throws Exception {
|
||||
return new ResponseEntity<>(wmstoacsService.putAction(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -99,6 +106,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/querydevice")
|
||||
@Log("查询设备状态")
|
||||
@ApiOperation("查询设备状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception {
|
||||
return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -107,6 +115,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/queryDeviceDBValue")
|
||||
@Log("查询设备DB值")
|
||||
@ApiOperation("查询设备DB值")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryDeviceDBValue(@RequestBody String whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@@ -114,6 +123,7 @@ public class WmsToAcsController {
|
||||
@PostMapping("/replaceDevice")
|
||||
@Log("工单更换设备")
|
||||
@ApiOperation("工单更换设备")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> replaceDevice(@RequestBody String whereJson) {
|
||||
return new ResponseEntity<>(wmstoacsService.replaceDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -430,6 +430,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String ext_order_id = jsonObject.getString("workorder_id");
|
||||
String type = jsonObject.getString("type");
|
||||
ProduceshiftorderDto pd = produceshiftorderService.findOrderByExtOrderId(ext_order_id);
|
||||
if (pd == null){
|
||||
throw new BadRequestException("工单信息不存在!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(pd.getDevice_code());
|
||||
if (StrUtil.equals(type, WorkerOrderEnum.FORCEFINISH.getMesCode())) {
|
||||
JSONObject param = new JSONObject();
|
||||
|
||||
@@ -327,11 +327,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
@Override
|
||||
public void orderFinishedNoSendMes(JSONObject param) {
|
||||
String ext_order_id = param.getString("workorder_id");
|
||||
String type = param.getString("type");
|
||||
String status = param.getString("status");
|
||||
if (StrUtil.isEmpty(ext_order_id)) {
|
||||
throw new BadRequestException("外部工单标识不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
if (StrUtil.isEmpty(status)) {
|
||||
throw new BadRequestException("更新工单状态type不能为空!");
|
||||
}
|
||||
ProduceshiftorderDto dto = this.findOrderByExtOrderId(ext_order_id);
|
||||
@@ -349,7 +349,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
}
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||
dto.setOrder_status(type);
|
||||
dto.setOrder_status(status);
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setUpdate_by("mes");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
Reference in New Issue
Block a user