From aaf4a5039c86db159587e1299d5c3925adb70489 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期四, 18 十二月 2025 16:16:39 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java | 52 ++++++++++++++++++++++++++++------------------------
1 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java b/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java
index 6aa6da4..570b9aa 100644
--- a/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java
@@ -29,6 +29,7 @@
@Override
public boolean disconnect() {
+ try { executor.shutdownNow(); } catch (Exception ignore) {}
return true;
}
@@ -84,14 +85,14 @@
int taskNo = command.getTaskNo().intValue();
this.crnStatus.setTaskNo(taskNo);
+ this.crnStatus.setMode(taskMode);
this.crnStatus.setStatus(CrnStatusType.FETCH_MOVING.id);
moveY(this.crnStatus.getBay(), sourcePosY);
moveZ(this.crnStatus.getLevel(), sourcePosZ);
this.crnStatus.setStatus(CrnStatusType.FETCHING.id);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(2000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
this.crnStatus.setLoaded(1);
@@ -99,10 +100,9 @@
moveY(this.crnStatus.getBay(), destinationPosY);
moveZ(this.crnStatus.getLevel(), destinationPosZ);
this.crnStatus.setStatus(CrnStatusType.PUTTING.id);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(2000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
this.crnStatus.setLoaded(0);
this.crnStatus.setStatus(CrnStatusType.WAITING.id);
@@ -115,10 +115,9 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosZ++;
this.crnStatus.setLevel(initSourcePosZ);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}else {
@@ -127,10 +126,9 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosZ--;
this.crnStatus.setLevel(initSourcePosZ);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}
@@ -143,10 +141,9 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosY++;
this.crnStatus.setBay(initSourcePosY);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}else {
@@ -155,12 +152,19 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosY--;
this.crnStatus.setBay(initSourcePosY);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}
}
+
+ private void sleep(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
}
--
Gitblit v1.9.1