add:日志

This commit is contained in:
2025-10-20 16:00:12 +08:00
parent ee95726bd8
commit 1dfc984b83
2 changed files with 201 additions and 48 deletions

View File

@@ -111,6 +111,51 @@ public class ItemProtocol {
return this.getOpcStringValue(item_to_material); return this.getOpcStringValue(item_to_material);
} }
public String getTo_spec() {
return this.getOpcStringValue(item_to_spec);
}
public String getTo_qty() {
return this.getOpcStringValue(item_to_qty);
}
public String getTo_material1() {
return this.getOpcStringValue(item_to_material1);
}
public String getTo_spec1() {
return this.getOpcStringValue(item_to_spec1);
}
public String getTo_qty1() {
return this.getOpcStringValue(item_to_qty1);
}
public String getTo_material2() {
return this.getOpcStringValue(item_to_material2);
}
public String getTo_spec2() {
return this.getOpcStringValue(item_to_spec2);
}
public String getTo_qty2() {
return this.getOpcStringValue(item_to_qty2);
}
public String getTo_material3() {
return this.getOpcStringValue(item_to_material3);
}
public String getTo_spec3() {
return this.getOpcStringValue(item_to_spec3);
}
public String getTo_qty3() {
return this.getOpcStringValue(item_to_qty3);
}
Boolean isonline; Boolean isonline;
@@ -169,4 +214,5 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_qty3, "下发BH-19物料数量", "DB2.W8")); list.add(new ItemDto(item_to_qty3, "下发BH-19物料数量", "DB2.W8"));
return list; return list;
} }
} }

View File

@@ -97,44 +97,44 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
int to_command = 0; int to_command = 0;
int last_to_command = 0; int last_to_command = 0;
//下发物料类型 //下发物料类型
String to_material =null; String to_material = null;
String last_to_material =null; String last_to_material = null;
//下发物料规格 //下发物料规格
int to_spec=0; String to_spec = null;
int last_to_spec=0; String last_to_spec = null;
//下发物料数量 //下发物料数量
int to_qty=0; String to_qty = null;
int last_to_qty=0; String last_to_qty = null;
//下发物料类型 //下发物料类型
String to_material1 =null; String to_material1 = null;
String last_to_material1 =null; String last_to_material1 = null;
//下发物料规格 //下发物料规格
int to_spec1=0; String to_spec1 = null;
int last_to_spec1=0; String last_to_spec1 = null;
//下发物料数量 //下发物料数量
int to_qty1=0; String to_qty1 = null;
int last_to_qty1=0;//下发物料类型 String last_to_qty1 = null;//下发物料类型
String to_material2 =null; String to_material2 = null;
String last_to_material2 =null; String last_to_material2 = null;
//下发物料规格 //下发物料规格
int to_spec2=0; String to_spec2 = null;
int last_to_spec2=0; String last_to_spec2 = null;
//下发物料数量 //下发物料数量
int to_qty2=0; String to_qty2 = null;
int last_to_qty2=0;//下发物料类型 String last_to_qty2 = null;//下发物料类型
String to_material3 =null; String to_material3 = null;
String last_to_material3 =null; String last_to_material3 = null;
//下发物料规格 //下发物料规格
int to_spec3=0; String to_spec3 = null;
int last_to_spec3=0; String last_to_spec3 = null;
//下发物料数量 //下发物料数量
int to_qty3=0; String to_qty3 = null;
int last_to_qty3=0; String last_to_qty3 = null;
//管芯编码 //管芯编码
String paper_code = null; String paper_code = null;
int paper_location = 0 ; int paper_location = 0;
Boolean isonline = true; Boolean isonline = true;
@@ -164,20 +164,118 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
public void execute() { public void execute() {
String message = null; String message = null;
try { try {
device_code = this.getDeviceCode(); device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode(); mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError(); error = this.itemProtocol.getError();
move = this.itemProtocol.getMove(); move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction(); action = this.itemProtocol.getAction();
paper_code = this.itemProtocol.getPaperCode(); paper_code = this.itemProtocol.getPaperCode();
paper_location = this.itemProtocol.getPaperLocation(); paper_location = this.itemProtocol.getPaperLocation();
if (mode != last_mode) { to_spec = this.itemProtocol.getTo_spec();
this.setRequireSucess(false); to_qty = this.itemProtocol.getTo_qty();
if (mode == 2) { to_material = this.itemProtocol.getTo_material();
this.writing(0); to_spec1 = this.itemProtocol.getTo_spec1();
to_qty1 = this.itemProtocol.getTo_qty1();
to_material1 = this.itemProtocol.getTo_material1();
to_spec2 = this.itemProtocol.getTo_spec2();
to_qty2 = this.itemProtocol.getTo_qty2();
to_material2 = this.itemProtocol.getTo_material2();
to_spec3 = this.itemProtocol.getTo_spec3();
to_qty3 = this.itemProtocol.getTo_qty3();
to_material3 = this.itemProtocol.getTo_material3();
if (!StrUtil.equals(to_spec, last_to_spec)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_spec, 由" + last_to_spec + "->" + to_spec)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_qty, last_to_qty)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_qty, 由" + last_to_qty + "->" + to_qty)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_material, last_to_material)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_material, 由" + last_to_material + "->" + to_material)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_spec1, last_to_spec1)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_spec1, 由" + last_to_spec1 + "->" + to_spec1)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_qty1, last_to_qty1)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_qty1, 由" + last_to_qty1 + "->" + to_qty1)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_material1, last_to_material1)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_material1, 由" + last_to_material1 + "->" + to_material1)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_spec2, last_to_spec2)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_spec2, 由" + last_to_spec2 + "->" + to_spec2)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_qty2, last_to_qty2)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_qty2, 由" + last_to_qty2 + "->" + to_qty2)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_material2, last_to_material2)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_material2, 由" + last_to_material2 + "->" + to_material2)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_spec3, last_to_spec3)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_spec3, 由" + last_to_spec3 + "->" + to_spec3)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_qty3, last_to_qty3)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_qty3, 由" + last_to_qty3 + "->" + to_qty3)
.log_level(4)
.build());
}
if (!StrUtil.equals(to_material3, last_to_material3)) {
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
.device_code(device_code)
.content("信号: to_material3, 由" + last_to_material3 + "->" + to_material3)
.log_level(4)
.build());
}
if (mode != last_mode) {
this.setRequireSucess(false);
if (mode == 2) {
this.writing(0);
}
} }
}
} catch (Exception var17) { } catch (Exception var17) {
return; return;
} }
@@ -210,9 +308,9 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
case 2: case 2:
break; break;
case 6: case 6:
if(!this.getRequireSucess() && StrUtil.isNotEmpty(this.getPaper_code()) && this.getPaper_location() > 0 && this.getPaper_location() < 6){ if (!this.getRequireSucess() && StrUtil.isNotEmpty(this.getPaper_code()) && this.getPaper_location() > 0 && this.getPaper_location() < 6) {
boolean b = feedbackDie(); boolean b = feedbackDie();
if(b){ if (b) {
requireSucess = true; requireSucess = true;
} }
} }
@@ -239,13 +337,22 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
last_action = action; last_action = action;
last_move = move; last_move = move;
last_qty = qty; last_qty = qty;
last_error =error; last_error = error;
last_material = material; last_material = material;
last_Itemized_qty = Itemized_qty; last_Itemized_qty = Itemized_qty;
last_to_command = to_command; last_to_command = to_command;
last_to_spec = to_spec; last_to_spec = to_spec;
last_to_material = to_material; last_to_material = to_material;
last_to_qty = to_qty; last_to_qty = to_qty;
last_to_spec1 = to_spec1;
last_to_material1 = to_material1;
last_to_qty1 = to_qty1;
last_to_spec2 = to_spec2;
last_to_material2 = to_material2;
last_to_qty2 = to_qty2;
last_to_spec3 = to_spec3;
last_to_material3 = to_material3;
last_to_qty3 = to_qty3;
} }
private boolean feedbackDie() { private boolean feedbackDie() {
@@ -255,9 +362,9 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
return false; return false;
} else { } else {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("device_code",this.getDevice_code()); jo.put("device_code", this.getDevice_code());
jo.put("row_num",this.getPaper_location()); jo.put("row_num", this.getPaper_location());
jo.put("material_code",this.getPaper_code()); jo.put("material_code", this.getPaper_code());
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("反馈管芯抓取位,请求参数:" + jo) .content("反馈管芯抓取位,请求参数:" + jo)
@@ -267,11 +374,11 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
logServer.deviceExecuteLog(this.device_code, "", "", "反馈管芯抓取位,参数:" + jo); logServer.deviceExecuteLog(this.device_code, "", "", "反馈管芯抓取位,参数:" + jo);
HttpResponse httpResponse = acsToWmsService.feedbackDies(jo); HttpResponse httpResponse = acsToWmsService.feedbackDies(jo);
JSONObject jsonObject = null; JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){ if (ObjectUtil.isNotEmpty(httpResponse)) {
String body = httpResponse.body(); String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body); jsonObject = JSONObject.parseObject(body);
} }
if(ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200){ if (ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200) {
Map map = new HashMap(); Map map = new HashMap();
map.put("to_command", 6); map.put("to_command", 6);
try { try {
@@ -291,7 +398,7 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
luceneExecuteLogService.deviceExecuteLog(logDto1); luceneExecuteLogService.deviceExecuteLog(logDto1);
} }
return true; return true;
}else{ } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("反馈LMS管芯失败" + httpResponse.body()) .content("反馈LMS管芯失败" + httpResponse.body())
@@ -370,7 +477,8 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
String action = ""; String action = "";
jo.put("device_name", this.getDevice().getDevice_name()); jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode); jo.put("mode", mode);
jo.put("move", move);jo.put("action", action); jo.put("move", move);
jo.put("action", action);
jo.put("isOnline", true); jo.put("isOnline", true);
jo.put("error", ErrorUtil.getDictDetail("gxhj_error_type", String.valueOf(this.getError()))); jo.put("error", ErrorUtil.getDictDetail("gxhj_error_type", String.valueOf(this.getError())));
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());
@@ -383,5 +491,4 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple
} }
} }