fix:线程阻塞、清除时设备连接
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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秒
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user