From 97181f9fb36e7d47e84a00dd981a969d0b9c5cb1 Mon Sep 17 00:00:00 2001
From: L <L@132>
Date: 星期四, 04 九月 2025 13:48:39 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/core/MainProcess.java | 83 +++++++++++++++++++++++++----------------
1 files changed, 50 insertions(+), 33 deletions(-)
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index c101a51..fe79a52 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -1,18 +1,13 @@
package com.zy.core;
-import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.impl.MainServiceImpl;
import com.zy.core.properties.SystemProperties;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
/**
* WCS涓绘祦绋�
@@ -27,6 +22,7 @@
private MainServiceImpl mainService;
// 鎵�灞炵嚎绋�
private Thread thread;
+ private Thread licenseThread;
// 棰戠巼
private int[] autoZ = new int[]{0,0,0,0,0,0,0};
@@ -34,48 +30,69 @@
* =====>> 寮�濮嬪伐浣�
*/
public void start(){
- thread = new Thread(() -> {
- try{
+ thread = new Thread(this::mainThread);
+ thread.start();
+ licenseThread = new Thread(this::licenseThreadRun);
+ licenseThread.start();
+ }
+
+ private void mainThread(){
+ try{
+ Thread.sleep(200);
+ log.info("++++++++ 寮�濮嬮獙璇佽鍙瘉 ++++++++");
+ if (!mainService.licenseVerify()){
+ SystemProperties.WCS_RUNNING_STATUS.set(Boolean.FALSE);
+ log.info("++++++++ 楠岃瘉璁稿彲璇佸け璐� ++++++++");
+ } else {
+ SystemProperties.WCS_RUNNING_STATUS.set(Boolean.TRUE);
+ log.info("++++++++ 楠岃瘉璁稿彲璇佹垚鍔� ++++++++");
+ }
+ } catch (Exception e) {}
+ while (!Thread.currentThread().isInterrupted()) {
+ try {
+ // 闂撮殧
Thread.sleep(200);
+
+ // 绯荤粺杩愯鐘舵�佸垽鏂�
+ if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
+ continue;
+ }
+
+ //鏇存柊浣嶇疆淇℃伅
+ mainService.updateStePosition();
+ // 浠诲姟涓嬪彂
+ mainService.DevpTaskNoRun();
+ // 浠诲姟瀹屾垚
+ mainService.rgvCompleteWrkMastSta(autoZ);
+ // 浠诲姟鍙栨秷
+ mainService.rgvCancelWrkMastSta();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void licenseThreadRun(){
+ while (true) {
+ try{
+ Thread.sleep(60*60*1000L);
log.info("++++++++ 寮�濮嬮獙璇佽鍙瘉 ++++++++");
if (!mainService.licenseVerify()){
SystemProperties.WCS_RUNNING_STATUS.set(Boolean.FALSE);
log.info("++++++++ 楠岃瘉璁稿彲璇佸け璐� ++++++++");
} else {
- SystemProperties.WCS_RUNNING_STATUS.set(Boolean.TRUE);
+// SystemProperties.WCS_RUNNING_STATUS.set(Boolean.TRUE);
log.info("++++++++ 楠岃瘉璁稿彲璇佹垚鍔� ++++++++");
}
} catch (Exception e) {}
- while (!Thread.currentThread().isInterrupted()) {
- try {
- // 闂撮殧
- Thread.sleep(200);
-
- // 绯荤粺杩愯鐘舵�佸垽鏂�
- if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
- continue;
- }
-
- //鏇存柊浣嶇疆淇℃伅
- mainService.updateStePosition();
- // 浠诲姟涓嬪彂
- mainService.DevpTaskNoRun();
- // 浠诲姟瀹屾垚
- mainService.rgvCompleteWrkMastSta(autoZ);
- // 浠诲姟鍙栨秷
- mainService.rgvCancelWrkMastSta();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- thread.start();
+ }
}
@PreDestroy
public void shutDown(){
if (thread != null) thread.interrupt();
+ if (licenseThread != null) licenseThread.interrupt();
}
}
--
Gitblit v1.9.1