This commit is contained in:
2023-01-30 10:46:13 +08:00
11 changed files with 57 additions and 26 deletions

View File

@@ -293,11 +293,9 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
if (this.getMode() == 0) { if (this.getMode() == 0) {
mode = "未联机"; mode = "未联机";
} else if (this.getMode() == 1) { } else if (this.getMode() == 1) {
mode = ""; mode = "";
} else if (this.getMode() == 2) { } else if (this.getMode() == 2) {
mode = "联机"; mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
} }
String requireSucess = "0"; String requireSucess = "0";
if (this.requireSucess) { if (this.requireSucess) {

View File

@@ -130,7 +130,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.setRequireSucess(false); this.setRequireSucess(false);
message = null; message = null;
logServer.deviceExecuteLog(this.device_code, "", "", "信号复位后requireSuccess" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号复位后requireSuccess" + requireSucess);
} }
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
@@ -195,8 +194,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int action = hongXiangConveyorDeviceDriver.getAction(); int action = hongXiangConveyorDeviceDriver.getAction();
int error1 = hongXiangConveyorDeviceDriver.getError1(); int error1 = hongXiangConveyorDeviceDriver.getError1();
if (mode == 1 && door == 1 && action == 1 && error1 == 0) { if (mode == 1 && door == 1 && action == 1 && error1 == 0) {
if (this.getNow_steps_type() == 2) {
this.writing("to_command", "2"); this.writing("to_command", "2");
this.setNow_steps_type(3); this.setNow_steps_type(3);
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号now_steps_type=2");
}
} else { } else {
if (this.getNow_steps_type() == 2) { if (this.getNow_steps_type() == 2) {
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
@@ -215,8 +218,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
} }
} else { } else {
if (this.getNow_steps_type() == 2) {
this.writing("to_command", "2"); this.writing("to_command", "2");
this.setNow_steps_type(3); this.setNow_steps_type(3);
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为下发电气信号now_steps_type=2\")");
}
} }
} }
} else { } else {
@@ -248,8 +255,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
} }
if (this.getNow_steps_type() == 3) {
this.writing("to_command", "3"); this.writing("to_command", "3");
this.setNow_steps_type(4); this.setNow_steps_type(4);
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许取货now_steps_type=3");
}
} }
} else { } else {
if (this.getNow_steps_type() == 3) { if (this.getNow_steps_type() == 3) {
@@ -283,8 +294,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int action = hongXiangConveyorDeviceDriver.getAction(); int action = hongXiangConveyorDeviceDriver.getAction();
int error1 = hongXiangConveyorDeviceDriver.getError1(); int error1 = hongXiangConveyorDeviceDriver.getError1();
if (mode == 1 && door == 1 && action == 1 && error1 == 0) { if (mode == 1 && door == 1 && action == 1 && error1 == 0) {
if (this.getNow_steps_type() == 4) {
this.writing("to_command", "4"); this.writing("to_command", "4");
this.setNow_steps_type(5); this.setNow_steps_type(5);
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货now_steps_type=4");
}
} else { } else {
feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code();
if (mode != 1) { if (mode != 1) {
@@ -301,8 +316,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
} }
} else { } else {
if (this.getNow_steps_type() == 4) {
this.writing("to_command", "4"); this.writing("to_command", "4");
this.setNow_steps_type(5); this.setNow_steps_type(5);
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为允许放货now_steps_type=4");
}
} }
} else { } else {
if (this.getNow_steps_type() == 4) { if (this.getNow_steps_type() == 4) {
@@ -355,10 +374,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes)); hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes));
} }
} }
if (this.getNow_steps_type() == 5) {
this.writing("to_command", "5"); this.writing("to_command", "5");
this.setNow_steps_type(6); this.setNow_steps_type(6);
this.setNow_steps_type(0); this.setNow_steps_type(0);
feedMessage = ""; feedMessage = "";
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "未反馈电气信号原因:当前步骤不为放货完成now_steps_type=5");
}
// this.writing("to_onset", "0"); // this.writing("to_onset", "0");
// this.writing("to_target", "0"); // this.writing("to_target", "0");
// this.writing("to_task", "0"); // this.writing("to_task", "0");

View File

@@ -145,7 +145,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
if (mode != last_mode) { if (mode != last_mode) {
if( mode == 2){ if( mode == 2){
message = null;
requireSucess = false; requireSucess = false;
requireApplyLabelingSuccess = false; requireApplyLabelingSuccess = false;
requireApplyLaStrangulationSuccess =false; requireApplyLaStrangulationSuccess =false;
@@ -158,6 +157,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
if (move != last_move) { if (move != last_move) {
if(move == 0 && mode == 2 ){ if(move == 0 && mode == 2 ){
message = null;
inst_message = null;
this.clearWrite(); this.clearWrite();
} }
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move)); logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
@@ -442,6 +443,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
jo.put("move", move); jo.put("move", move);
jo.put("carrier_direction", carrier_direction); jo.put("carrier_direction", carrier_direction);
jo.put("task", task); jo.put("task", task);
jo.put("inst_message", this.inst_message);
jo.put("isOnline", this.getIsonline()); jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError()); jo.put("error", this.getError());
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());

View File

@@ -654,9 +654,6 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
} }
if(task >0 ){ if(task >0 ){
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isEmpty(instruction)){
instruction = instructionService.findByCode(String.valueOf(task));
}
vehicle_code = instruction.getVehicle_code(); vehicle_code = instruction.getVehicle_code();
} else { } else {
logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:"+task+"异常"); logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:"+task+"异常");

View File

@@ -702,7 +702,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//申请任务 //申请任务
if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) { if (mode == 2 && move1 == 0 && move2 == 0 && action1 == 0 && action2 == 0 && task1 == 0 && task2 == 0 && !requireSucess) {
//获取关联设备驱动信息 判断关联设备是否禁用 //获取关联设备驱动信息 判断关联设备是否禁用
Device device = deviceAppservice.findDeviceByCode(device_code); String link_device_code = String.valueOf(this.getDevice().getExtraValue().get("link_device_code"));
Device device = deviceAppservice.findDeviceByCode(link_device_code);
SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver; SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) { if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver(); slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();

View File

@@ -195,6 +195,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
} }
if (move != last_move) { if (move != last_move) {
if (move == 0 && mode == 2) { if (move == 0 && mode == 2) {
message = null;
inst_message = null;
thingToNothing(); thingToNothing();
} }
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move); logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
@@ -753,6 +755,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
jo.put("error", this.getError()); jo.put("error", this.getError());
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());
jo.put("message", this.getMessage()); jo.put("message", this.getMessage());
jo.put("inst_message", this.inst_message);
jo.put("task", this.getTask()); jo.put("task", this.getTask());
jo.put("barcode", plcbarcode); jo.put("barcode", plcbarcode);
jo.put("barcode_length", plcbarcode_length); jo.put("barcode_length", plcbarcode_length);

View File

@@ -16,6 +16,7 @@
package org.nl.modules.security.service; package org.nl.modules.security.service;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.utils.*; import org.nl.modules.common.utils.*;
@@ -118,6 +119,7 @@ public class OnlineUserService {
* @param token / * @param token /
*/ */
public void logout(String token) { public void logout(String token) {
if (ObjectUtil.isNotEmpty(token))
redisUtils.del(token); redisUtils.del(token);
} }

View File

@@ -2,7 +2,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: dev active: prod
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:

View File

@@ -149,7 +149,6 @@ https://juejin.cn/post/6844903775631572999
<!--生产环境:打印控制台和输出到文件--> <!--生产环境:打印控制台和输出到文件-->
<springProfile name="prod"> <springProfile name="prod">
<root level="info"> <root level="info">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="lokiAppender" /> <appender-ref ref="lokiAppender" />
<appender-ref ref="asyncFileAppender"/> <appender-ref ref="asyncFileAppender"/>
</root> </root>

View File

@@ -15,6 +15,7 @@
*/ */
package org.nl.modules.logging.aspect; package org.nl.modules.logging.aspect;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -128,7 +129,7 @@ public class LogAspect {
json.put("address", StringUtils.getCityInfo(requestIp)); json.put("address", StringUtils.getCityInfo(requestIp));
json.put("browser", StringUtils.getBrowser(request)); json.put("browser", StringUtils.getBrowser(request));
json.put("exception_detail", IdUtil.getStringId()); json.put("exception_detail", IdUtil.getStringId());
json.put("create_time", IdUtil.getStringId()); json.put("create_time", DateUtil.now());
json.put("return_result", JSONObject.fromObject(result).getJSONObject("body")); json.put("return_result", JSONObject.fromObject(result).getJSONObject("body"));
interfaceLog.insert(json); interfaceLog.insert(json);
} catch (Exception e) { } catch (Exception e) {

View File

@@ -6,6 +6,8 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.ISysParamService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Calendar;
/** /**
* 自动清除日志(操作日志、异常日志)数据 * 自动清除日志(操作日志、异常日志)数据
*/ */
@@ -18,8 +20,11 @@ public class CleanLog {
public void run(){ public void run(){
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10; //delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
WQLObject logTab = WQLObject.getWQLObject("sys_log"); WQLObject logTab = WQLObject.getWQLObject("sys_log");
WQLObject sys_interface_log = WQLObject.getWQLObject("sys_interface_log");
int days = Integer.parseInt(paramService.findByCode("log_day").getValue()); int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
sys_interface_log.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!"); log.info("自动清理日志执行成功...!");
} }