fix:线程阻塞、清除时设备连接

This commit is contained in:
2024-08-22 19:07:33 +08:00
parent 3363a5ecb9
commit 1a37c3b38c
7 changed files with 20 additions and 20 deletions

View File

@@ -240,7 +240,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
to_container_no = this.itemProtocol.getContainer_direction(); to_container_no = this.itemProtocol.getContainer_direction();
if (move != last_move) { if (move != last_move && last_move == 1 && mode > 0) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }

View File

@@ -197,7 +197,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
} }
update_instruction_status(); update_instruction_status();
} }
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }

View File

@@ -198,7 +198,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
update_instruction_status(); update_instruction_status();
} }
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }

View File

@@ -202,7 +202,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
update_instruction_status(); update_instruction_status();
} }
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }

View File

@@ -199,7 +199,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
update_instruction_status(); update_instruction_status();
} }
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }

View File

@@ -246,7 +246,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} }
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }

View File

@@ -132,23 +132,23 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
runnable.setIndex(this.runs); runnable.setIndex(this.runs);
ExecutorService executorService = (ExecutorService) ThreadPoolExecutorUtil.getPoll(); ExecutorService executorService = (ExecutorService) ThreadPoolExecutorUtil.getPoll();
Future<?> future = executorService.submit(runnable); executorService.submit(runnable);
ScheduledExecutorService scheduler = (ScheduledExecutorService) DtpRegistry.getExecutor("scheduled_pool"); // ScheduledExecutorService scheduler = (ScheduledExecutorService) DtpRegistry.getExecutor("scheduled_pool");
EagerDtpExecutor eagerDtpExecutor = (EagerDtpExecutor) DtpRegistry.getExecutor("scheduled_pool"); // EagerDtpExecutor eagerDtpExecutor = (EagerDtpExecutor) DtpRegistry.getExecutor("scheduled_pool");
OrderedDtpExecutor orderedDtpExecutor = (OrderedDtpExecutor) DtpRegistry.getExecutor("scheduled_pool"); // OrderedDtpExecutor orderedDtpExecutor = (OrderedDtpExecutor) DtpRegistry.getExecutor("scheduled_pool");
// 使用调度器在超时后取消任务 // 使用调度器在超时后取消任务
scheduler.schedule(() -> { // scheduler.schedule(() -> {
//异步任务没有结束 // //异步任务没有结束
if (!future.isDone()) { // if (!future.isDone()) {
try { // try {
future.get(5, TimeUnit.SECONDS); // future.get(5, TimeUnit.SECONDS);
} catch (Exception e) { // } catch (Exception e) {
future.cancel(true); // future.cancel(true);
} // }
} // }
}, 1, TimeUnit.MILLISECONDS); // 设置超时时间为10秒 // }, 1, TimeUnit.MILLISECONDS); // 设置超时时间为10秒
} }
} }
} }