This commit is contained in:
USER-20220102CG\noblelift
2023-08-09 17:52:27 +08:00
20 changed files with 314 additions and 29 deletions

View File

@@ -72,6 +72,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
int angle = 0; //角度
int electric_qty = 0; //电量
int status = 0; //三色灯状态
int last_status = 0; //三色灯状态
int error = 0;
int last_error = 0;
String error_message = "";
@@ -442,6 +443,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
dto.setError_code(String.valueOf(error_code));
dto.setError_info(error_message);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", this.getError_message());
acsToWmsService.sendDeviceStatus(param);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
last_error = error;
@@ -460,6 +467,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (phase == 0x74) {
//三色灯状态
status = ikey;
if (status != last_status) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", status);
acsToWmsService.sendDeviceStatus(param);
}
last_status = status;
}
if (!ObjectUtil.isEmpty(data)) {
phase = 0;

View File

@@ -80,6 +80,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
int angle = 0; //角度
int electric_qty = 0; //电量
int status = 0; //三色灯状态
int last_status = 0; //三色灯状态
String error_message = "";
String error_type = "agv_error_type";
private Instruction instruction;
@@ -685,6 +686,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
dto.setError_code(String.valueOf(error_code));
dto.setError_info(error_message);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", this.getError_message());
acsToWmsService.sendDeviceStatus(param);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
last_error = error;
@@ -703,6 +710,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (phase == 0x74) {
//三色灯状态
status = ikey;
if (status != last_status) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", status);
acsToWmsService.sendDeviceStatus(param);
}
last_status = status;
}
//进入区域phase值
else if (phase == 0x50) {

View File

@@ -76,6 +76,7 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
String task_id = "";
Boolean iserror = false;
Boolean last_iserror = false;
Boolean hasGoods = false;
@Override
@@ -115,4 +116,15 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
jo.put("hasGoods", this.getHasGoods());
return jo;
}
public void setIserror(Boolean iserror) {
this.iserror = iserror;
if (this.iserror != this.last_iserror && this.iserror && device_id.startsWith("RGV")) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_id);
param.put("error", alarm);
param.put("error_msg", ErrorUtil.getDictDetail("ssx_error_type", alarm));
acsToWmsService.sendDeviceStatus(param);
}
this.last_iserror = iserror;
}
}

View File

@@ -177,6 +177,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
if (mode == 2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号复位前requireSuccess" + requireSucess);
this.setRequireSucess(false);
@@ -208,8 +213,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error)));
String errorInfo = ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -228,6 +228,14 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = false;
requireEmptyInSuccess = false;
}
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -258,8 +266,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto);
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -187,6 +187,12 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
requireEmptyOutSuccess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
}
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -216,8 +222,15 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -170,6 +170,12 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
requireEmptyOutSuccess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "复位请求标记成功!");
}
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -194,8 +200,15 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(

View File

@@ -161,6 +161,12 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
to_command = this.itemProtocol.getTo_command();
to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task();
if (last_mode != mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
@@ -175,8 +181,15 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
}
} catch (Exception var17) {

View File

@@ -230,6 +230,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat" + last_heartbeat + "->" + heartbeat);
// }
if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
inst_type = null;
cache_inst = null;
if (mode == 2) {
@@ -252,8 +257,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error)));
String errorInfo = ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -104,4 +104,6 @@ public interface AcsToWmsService {
// 输送线有货变成无货时向lms请求
HttpResponse shipDeviceUpdate(JSONObject param);
void sendDeviceStatus(JSONObject param);
}

View File

@@ -538,4 +538,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
return null;
}
@Override
public void sendDeviceStatus(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("sendDeviceStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
// log.info("sendDeviceStatus - 请求参数 {}", param);
HttpRequest
.post(url)
.body(param.toString())
.execute();
// log.info("sendDeviceStatus - 返回参数 {}", response.body());
}
} catch (Throwable ignored) {
} finally {
MDC.remove(log_file_type);
}
}
}