fix: 堆垛机清点位校验、开始线程不判断状态

This commit is contained in:
ls
2025-06-24 10:29:05 +08:00
parent 1e82417a81
commit eecb2ea9e7
2 changed files with 16 additions and 15 deletions

View File

@@ -34,17 +34,18 @@ public class AutoRunServiceImpl implements AutoRunService, ApplicationAutoInitia
*/ */
private List<AbstractAutoRunnable> thread_autoRun = new ArrayList(); private List<AbstractAutoRunnable> thread_autoRun = new ArrayList();
/** /**
* key * key
*/ */
private List<String> autoRun_code_index = new ArrayList(); private List<String> autoRun_code_index = new ArrayList();
/** /**
* 运行线程 * 运行线程
*/ */
private List<Thread> threads = new ArrayList(); private List<Thread> threads = new ArrayList();
/** /**
* key * key
*/ */
private List<String> thread_code_index = new ArrayList(); private List<String> thread_code_index = new ArrayList();
@Override @Override
public synchronized void startThread(String threadCode) { public synchronized void startThread(String threadCode) {
Thread thread = this.getThreadByCode(threadCode); Thread thread = this.getThreadByCode(threadCode);
@@ -65,24 +66,23 @@ public class AutoRunServiceImpl implements AutoRunService, ApplicationAutoInitia
Thread thread = this.getThreadByCode(threadCode); Thread thread = this.getThreadByCode(threadCode);
if (thread == null) { if (thread == null) {
throw new BadRequestException(LangProcess.msg("error_isNull", threadCode)); throw new BadRequestException(LangProcess.msg("error_isNull", threadCode));
} else if (!thread.isAlive()) { }
throw new BadRequestException(LangProcess.msg("error_status", threadCode)); try {
} else {
AbstractAutoRunnable runable = this.getRunablebyCode(threadCode); AbstractAutoRunnable runable = this.getRunablebyCode(threadCode);
runable.stop(); runable.stop();
thread.stop(); thread.stop();
thread.interrupt(); thread.interrupt();
thread.join();
try {
thread.join();
} catch (InterruptedException arg4) {
arg4.printStackTrace();
}
runable.setStopMessage("人工停止"); runable.setStopMessage("人工停止");
runable.setStopTime(new Date()); runable.setStopTime(new Date());
} catch (Exception arg4) {
arg4.printStackTrace();
throw new BadRequestException(LangProcess.msg("error_status", threadCode));
} }
} }
@Override @Override

View File

@@ -358,7 +358,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (!command.equals(last_command)) { if (!command.equals(last_command)) {
requireSucess = false; requireSucess = false;
if (command == 0) { Instruction byCodeFromCache = instructionService.findByCodeFromCache(String.valueOf(task));
if (command == 0 && byCodeFromCache==null) {
clearWrite(); clearWrite();
} }
} }