fix: 日志文件乱码修复日志配置,修复读取信号转换异常

This commit is contained in:
yanps
2025-01-20 11:26:02 +08:00
parent a8f76b7595
commit fc7ed902a1
7 changed files with 25 additions and 23 deletions

View File

@@ -126,9 +126,9 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if(ObjectUtil.isEmpty(value)){
if (ObjectUtil.isEmpty(value)) {
deviceStatus = true;
}else if (item_heartbeat.equals(protocol)){
} else if (item_heartbeat.equals(protocol)) {
deviceStatus = false;
}
if (value == null) {
@@ -138,6 +138,9 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
if (item_mode.equals(protocol)) {
return -1;
}
return 0;
}

View File

@@ -260,7 +260,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
last_inst_message = inst_message;
if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) {
this.requiresShipDeviceUpdate = false;
if (mode > 0) {
if (mode >= 0) {
shipDeviceUpdate();
}
}
@@ -358,7 +358,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
Instruction instruction = null;
List toInstructions;
if(mode > 0) {
if (mode > 0) {
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
@@ -615,10 +615,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
move = "有托盘有货";
jo.put("hasGoods", true);
}
if(deviceStatus){
if (deviceStatus) {
iserror = true;
}
if(error == 0 && !deviceStatus){
if (error == 0 && !deviceStatus) {
iserror = false;
}
if (this.carrier_direction == 1) {
@@ -630,7 +630,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if (this.requireSucess) {
requireSucess = "1";
}
if(error == 0 && iserror){
if (error == 0 && iserror) {
message = "信号连接异常!";
}
jo.put("device_name", this.getDevice().getDevice_name());
@@ -1086,7 +1086,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
apply.put("type", "2");
String str = acsToWmsService.applyTaskToWms(apply);
logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:" + apply + ",响应参数:" + JSON.toJSONString(str));
message = "申请空盘入库任务,请求参数:" + apply + "响应参数: "+ str;
message = "申请空盘入库任务,请求参数:" + apply + "响应参数: " + str;
JSONObject jo = JSON.parseObject(str);
if (ObjectUtil.isEmpty(jo)) {

View File

@@ -150,13 +150,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
/**
* 下发目标站
*/
int to_target = 0;
int last_to_target = 0;
String to_target = null;
String last_to_target = null;
/**
* 下发任务号
*/
int to_task = 0;
int last_to_task = 0;
String to_task = null;
String last_to_task = null;
/**
* 下发接纯数字托盘号
*/

View File

@@ -110,15 +110,15 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task);
}
public int getTo_task() {
return this.getOpcIntegerValue(item_to_task);
public String getTo_task() {
return this.getOpcStringValue(item_to_task);
}
public int getTotarget() {
return this.getOpcIntegerValue(item_to_target);
public String getTotarget() {
return this.getOpcStringValue(item_to_target);
}
public String getTo_command() {

View File

@@ -121,8 +121,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
String to_task = null;
String last_to_task = null;
int to_container_type = 0;
int last_to_container_type = 0;
String to_container_type = null;
String last_to_container_type = null;
String to_height_level = null;
String last_to_height_level = null;

View File

@@ -148,8 +148,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_container_type);
}
public int getTo_container_type(){
return this.getOpcIntegerValue(item_to_container_type);
public String getTo_container_type(){
return this.getOpcStringValue(item_to_container_type);
}
public String getTo_height_level(){

View File

@@ -30,11 +30,9 @@ https://juejin.cn/post/6844903775631572999
<withJansi>true</withJansi>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
<charset>${log.charset}</charset>
<!--<charset>${log.charset}</charset>-->
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -50,6 +48,7 @@ https://juejin.cn/post/6844903775631572999
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>