添加现场存活日志校验
This commit is contained in:
@@ -161,28 +161,37 @@ public class ScheduleThread {
|
|||||||
* 开始线程
|
* 开始线程
|
||||||
*/
|
*/
|
||||||
public void startAllThread() {
|
public void startAllThread() {
|
||||||
|
if (plcSsjReadCustomThread !=null){
|
||||||
|
plcSsjReadCustomThread.getThread().setName("输送机读取线程");
|
||||||
plcSsjReadCustomThread.getThread().start();
|
plcSsjReadCustomThread.getThread().start();
|
||||||
|
}
|
||||||
if (plcDdj1ReadCustomThread!=null){
|
if (plcDdj1ReadCustomThread!=null){
|
||||||
|
plcDdj1ReadCustomThread.getThread().setName("ddj1读取线程");
|
||||||
plcDdj1ReadCustomThread.getThread().start();
|
plcDdj1ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (plcDdj2ReadCustomThread!=null){
|
if (plcDdj2ReadCustomThread!=null){
|
||||||
|
plcDdj2ReadCustomThread.getThread().setName("ddj2读取线程");
|
||||||
plcDdj2ReadCustomThread.getThread().start();
|
plcDdj2ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (plcDdj3ReadCustomThread!=null){
|
if (plcDdj3ReadCustomThread!=null){
|
||||||
|
plcDdj3ReadCustomThread.getThread().setName("ddj3读取线程");
|
||||||
plcDdj3ReadCustomThread.getThread().start();
|
plcDdj3ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (plcDdj4ReadCustomThread!=null){
|
if (plcDdj4ReadCustomThread!=null){
|
||||||
|
plcDdj4ReadCustomThread.getThread().setName("ddj4读取线程");
|
||||||
plcDdj4ReadCustomThread.getThread().start();
|
plcDdj4ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (plcDdj5ReadCustomThread!=null){
|
if (plcDdj5ReadCustomThread!=null){
|
||||||
|
plcDdj5ReadCustomThread.getThread().setName("ddj5读取线程");
|
||||||
plcDdj5ReadCustomThread.getThread().start();
|
plcDdj5ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (plcDdj6ReadCustomThread!=null){
|
if (plcDdj6ReadCustomThread!=null){
|
||||||
|
plcDdj6ReadCustomThread.getThread().setName("ddj6读取线程");
|
||||||
plcDdj6ReadCustomThread.getThread().start();
|
plcDdj6ReadCustomThread.getThread().start();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -193,28 +202,37 @@ public class ScheduleThread {
|
|||||||
* 开启线程2
|
* 开启线程2
|
||||||
*/
|
*/
|
||||||
public void startAllThread2() {
|
public void startAllThread2() {
|
||||||
|
if (monitoringCustomThread!=null){
|
||||||
|
monitoringCustomThread.thread.setName("监控线程");
|
||||||
monitoringCustomThread.thread.start();
|
monitoringCustomThread.thread.start();
|
||||||
|
}
|
||||||
if (ddj1CustomThread!=null){
|
if (ddj1CustomThread!=null){
|
||||||
|
ddj1CustomThread.thread.setName("ddj1调度线程");
|
||||||
ddj1CustomThread.thread.start();
|
ddj1CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ddj2CustomThread!=null){
|
if (ddj2CustomThread!=null){
|
||||||
|
ddj2CustomThread.thread.setName("ddj5调度线程");
|
||||||
ddj2CustomThread.thread.start();
|
ddj2CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ddj3CustomThread!=null){
|
if (ddj3CustomThread!=null){
|
||||||
|
ddj3CustomThread.thread.setName("ddj3调度线程");
|
||||||
ddj3CustomThread.thread.start();
|
ddj3CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ddj4CustomThread!=null){
|
if (ddj4CustomThread!=null){
|
||||||
|
ddj4CustomThread.thread.setName("ddj4调度线程");
|
||||||
ddj4CustomThread.thread.start();
|
ddj4CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ddj5CustomThread!=null){
|
if (ddj5CustomThread!=null){
|
||||||
|
ddj5CustomThread.thread.setName("ddj5调度线程");
|
||||||
ddj5CustomThread.thread.start();
|
ddj5CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ddj6CustomThread!=null){
|
if (ddj6CustomThread!=null){
|
||||||
|
ddj6CustomThread.thread.setName("ddj6调度线程");
|
||||||
ddj6CustomThread.thread.start();
|
ddj6CustomThread.thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class PlcDdjRead extends Thread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
int i = 0;
|
||||||
while (isRun) {
|
while (isRun) {
|
||||||
try {
|
try {
|
||||||
if (IsConnect()) {
|
if (IsConnect()) {
|
||||||
@@ -45,9 +46,13 @@ public class PlcDdjRead extends Thread {
|
|||||||
} else {
|
} else {
|
||||||
reConnect();
|
reConnect();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
i++;
|
||||||
Thread.currentThread().interrupt();
|
if (i==100){
|
||||||
|
log.info("读取线程执行正常");
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
log.info("********IP:" + this.ip + " port:" + this.port + "端口号 " + e.getMessage());
|
log.info("********IP:" + this.ip + " port:" + this.port + "端口号 " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
int i = 0;
|
||||||
while (isRun) {
|
while (isRun) {
|
||||||
try {
|
try {
|
||||||
if (IsConnect()) {
|
if (IsConnect()) {
|
||||||
@@ -72,11 +73,13 @@ public class PlcSsjRead implements Runnable {
|
|||||||
} else {
|
} else {
|
||||||
reConnect();
|
reConnect();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
i++;
|
||||||
// 捕获中断异常,退出循环
|
if (i==100){
|
||||||
Thread.currentThread().interrupt(); // 重新设置中断标志
|
log.info("读取线程执行正常");
|
||||||
return;
|
i=0;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
log.info("********IP:" + this.ip + " port:" + this.port + "读取数据异常 " + e.getMessage());
|
log.info("********IP:" + this.ip + " port:" + this.port + "读取数据异常 " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
init();
|
init();
|
||||||
|
int i = 0;
|
||||||
while (isRun) {
|
while (isRun) {
|
||||||
for (String type : ddjCodeList.keySet()) {
|
for (String type : ddjCodeList.keySet()) {
|
||||||
|
|
||||||
@@ -96,6 +97,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
generateOutBoundQueue(msgDdj);
|
generateOutBoundQueue(msgDdj);
|
||||||
setOutSsjStatus(msgDdj);
|
setOutSsjStatus(msgDdj);
|
||||||
ddjTask(msgDdj);
|
ddjTask(msgDdj);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.error("堆垛机设备为空");
|
log.error("堆垛机设备为空");
|
||||||
}
|
}
|
||||||
@@ -105,10 +107,15 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
|
if (i==100){
|
||||||
|
log.info("ddj{},循环完成",ddjCodeList);
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
log.error(e.getMessage(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,12 @@ public class MonitoringThread implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
init();
|
init();
|
||||||
|
int i =0;
|
||||||
while (isRun){
|
while (isRun){
|
||||||
try {
|
try {
|
||||||
|
|
||||||
for (String ssjCode : PlcSsjRead.deviceSsjMap.keySet()) {
|
for (String ssjCode : PlcSsjRead.deviceSsjMap.keySet()) {
|
||||||
|
try {
|
||||||
DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ssjCode);
|
DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ssjCode);
|
||||||
deviceSsjService.updateDeviceSsj(deviceSsj);
|
deviceSsjService.updateDeviceSsj(deviceSsj);
|
||||||
int taskNo = deviceSsj.getTaskNo();
|
int taskNo = deviceSsj.getTaskNo();
|
||||||
@@ -150,8 +153,13 @@ public class MonitoringThread implements Runnable {
|
|||||||
basFaultRecordService.updateBasFaultRecord(record);
|
basFaultRecordService.updateBasFaultRecord(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
for (String ddjCode : PlcDdjRead.deviceDdjMap.keySet()) {
|
for (String ddjCode : PlcDdjRead.deviceDdjMap.keySet()) {
|
||||||
|
try {
|
||||||
MsgDdj msgDdj = PlcDdjRead.deviceDdjMap.get(ddjCode);
|
MsgDdj msgDdj = PlcDdjRead.deviceDdjMap.get(ddjCode);
|
||||||
msgDdjService.updateMsgDdj(msgDdj);
|
msgDdjService.updateMsgDdj(msgDdj);
|
||||||
//记录异常
|
//记录异常
|
||||||
@@ -190,8 +198,16 @@ public class MonitoringThread implements Runnable {
|
|||||||
basFaultRecordService.updateBasFaultRecord(record);
|
basFaultRecordService.updateBasFaultRecord(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
|
if (i==100){
|
||||||
|
log.info("监控线程循环完成");
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
#主数据信息
|
#主数据信息
|
||||||
master:
|
master:
|
||||||
# url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs;
|
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-2;
|
||||||
username: sa
|
username: sa
|
||||||
password: Flrd0914.
|
password: Flrd0914.
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|||||||
Reference in New Issue
Block a user