添加现场存活日志校验

This commit is contained in:
刘汗青
2026-05-18 15:21:26 +08:00
parent b4ed427de9
commit 2272a89b2a
6 changed files with 183 additions and 134 deletions

View File

@@ -161,28 +161,37 @@ public class ScheduleThread {
* 开始线程
*/
public void startAllThread() {
if (plcSsjReadCustomThread !=null){
plcSsjReadCustomThread.getThread().setName("输送机读取线程");
plcSsjReadCustomThread.getThread().start();
}
if (plcDdj1ReadCustomThread!=null){
plcDdj1ReadCustomThread.getThread().setName("ddj1读取线程");
plcDdj1ReadCustomThread.getThread().start();
}
if (plcDdj2ReadCustomThread!=null){
plcDdj2ReadCustomThread.getThread().setName("ddj2读取线程");
plcDdj2ReadCustomThread.getThread().start();
}
if (plcDdj3ReadCustomThread!=null){
plcDdj3ReadCustomThread.getThread().setName("ddj3读取线程");
plcDdj3ReadCustomThread.getThread().start();
}
if (plcDdj4ReadCustomThread!=null){
plcDdj4ReadCustomThread.getThread().setName("ddj4读取线程");
plcDdj4ReadCustomThread.getThread().start();
}
if (plcDdj5ReadCustomThread!=null){
plcDdj5ReadCustomThread.getThread().setName("ddj5读取线程");
plcDdj5ReadCustomThread.getThread().start();
}
if (plcDdj6ReadCustomThread!=null){
plcDdj6ReadCustomThread.getThread().setName("ddj6读取线程");
plcDdj6ReadCustomThread.getThread().start();
}
@@ -193,28 +202,37 @@ public class ScheduleThread {
* 开启线程2
*/
public void startAllThread2() {
if (monitoringCustomThread!=null){
monitoringCustomThread.thread.setName("监控线程");
monitoringCustomThread.thread.start();
}
if (ddj1CustomThread!=null){
ddj1CustomThread.thread.setName("ddj1调度线程");
ddj1CustomThread.thread.start();
}
if (ddj2CustomThread!=null){
ddj2CustomThread.thread.setName("ddj5调度线程");
ddj2CustomThread.thread.start();
}
if (ddj3CustomThread!=null){
ddj3CustomThread.thread.setName("ddj3调度线程");
ddj3CustomThread.thread.start();
}
if (ddj4CustomThread!=null){
ddj4CustomThread.thread.setName("ddj4调度线程");
ddj4CustomThread.thread.start();
}
if (ddj5CustomThread!=null){
ddj5CustomThread.thread.setName("ddj5调度线程");
ddj5CustomThread.thread.start();
}
if (ddj6CustomThread!=null){
ddj6CustomThread.thread.setName("ddj6调度线程");
ddj6CustomThread.thread.start();
}

View File

@@ -37,6 +37,7 @@ public class PlcDdjRead extends Thread {
@Override
public void run() {
int i = 0;
while (isRun) {
try {
if (IsConnect()) {
@@ -45,9 +46,13 @@ public class PlcDdjRead extends Thread {
} else {
reConnect();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
i++;
if (i==100){
log.info("读取线程执行正常");
i=0;
}
} catch (Exception e) {
log.error(e.getMessage(),e);
log.info("********IP:" + this.ip + " port:" + this.port + "端口号 " + e.getMessage());
}

View File

@@ -46,6 +46,7 @@ public class PlcSsjRead implements Runnable {
@Override
public void run() {
int i = 0;
while (isRun) {
try {
if (IsConnect()) {
@@ -72,11 +73,13 @@ public class PlcSsjRead implements Runnable {
} else {
reConnect();
}
} catch (InterruptedException e) {
// 捕获中断异常,退出循环
Thread.currentThread().interrupt(); // 重新设置中断标志
return;
i++;
if (i==100){
log.info("读取线程执行正常");
i=0;
}
} catch (Exception e) {
log.error(e.getMessage(),e);
log.info("********IP:" + this.ip + " port:" + this.port + "读取数据异常 " + e.getMessage());
}

View File

@@ -84,6 +84,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
@Override
public void run() {
init();
int i = 0;
while (isRun) {
for (String type : ddjCodeList.keySet()) {
@@ -96,6 +97,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
generateOutBoundQueue(msgDdj);
setOutSsjStatus(msgDdj);
ddjTask(msgDdj);
} else {
log.error("堆垛机设备为空");
}
@@ -105,10 +107,15 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
}
}
i++;
if (i==100){
log.info("ddj{},循环完成",ddjCodeList);
i=0;
}
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
log.error(e.getMessage(),e);
}
}

View File

@@ -45,9 +45,12 @@ public class MonitoringThread implements Runnable {
@Override
public void run() {
init();
int i =0;
while (isRun){
try {
for (String ssjCode : PlcSsjRead.deviceSsjMap.keySet()) {
try {
DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ssjCode);
deviceSsjService.updateDeviceSsj(deviceSsj);
int taskNo = deviceSsj.getTaskNo();
@@ -150,8 +153,13 @@ public class MonitoringThread implements Runnable {
basFaultRecordService.updateBasFaultRecord(record);
}
}
} catch (Exception e) {
log.error(e.getMessage(),e);
}
}
for (String ddjCode : PlcDdjRead.deviceDdjMap.keySet()) {
try {
MsgDdj msgDdj = PlcDdjRead.deviceDdjMap.get(ddjCode);
msgDdjService.updateMsgDdj(msgDdj);
//记录异常
@@ -190,8 +198,16 @@ public class MonitoringThread implements Runnable {
basFaultRecordService.updateBasFaultRecord(record);
}
}
} catch (Exception e) {
log.error(e.getMessage(),e);
}
}
i++;
if (i==100){
log.info("监控线程循环完成");
i=0;
}
Thread.sleep(1500);
} catch (Exception e) {
log.error(e.getMessage(), e);

View File

@@ -6,8 +6,8 @@ spring:
druid:
#主数据信息
master:
# url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs;
url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs-2;
url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs;
# url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs-2;
username: sa
password: Flrd0914.
# 从库数据源