From cbd99ee2596b122305a618e2cbde05559a021094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B?= <1063331231@qq.com> Date: Sat, 14 Jun 2025 17:15:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=98=BB=E5=A1=9E=E9=98=9F?= =?UTF-8?q?=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/module/TransferModuleService.java | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java b/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java index d2583a4..57ee571 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java @@ -30,9 +30,11 @@ public class TransferModuleService { private final DeviceCommandService deviceCommandService; private final DeviceStateService deviceStateService; private final SystemConfigService systemConfigService; - private final BlockingQueue solutionQueue = new ArrayBlockingQueue<>(10); - private final BlockingQueue annealQueue = new ArrayBlockingQueue<>(10); - private final BlockingQueue heatQueue = new ArrayBlockingQueue<>(10); + private final BlockingQueue thinQueue = new ArrayBlockingQueue<>(1); + private final BlockingQueue thickQueue = new ArrayBlockingQueue<>(3); + private final BlockingQueue annealQueue = new ArrayBlockingQueue<>(3); + private final BlockingQueue heatQueue = new ArrayBlockingQueue<>(1); + private final BlockingQueue feedQueue = new ArrayBlockingQueue<>(3); /** * 申请使用转运模块。 @@ -46,12 +48,18 @@ public class TransferModuleService { // 1. 先把自己加入对应类型的队列尾部 Thread current = Thread.currentThread(); switch (type) { - case move_liquid: - solutionQueue.add(current); + case move_feed: + feedQueue.add(current); break; case move_heat: heatQueue.add(current); break; + case move_thin: + thinQueue.add(current); + break; + case move_thick: + thickQueue.add(current); + break; case move_anneal: annealQueue.add(current); break; @@ -69,10 +77,14 @@ public class TransferModuleService { } else { // 模块空闲时,再判断当前线程是否是“四个队列”里优先级最高且队头的那个 Thread head = null; - if (!heatQueue.isEmpty()) { + if (!feedQueue.isEmpty()) { + head = feedQueue.peek(); + } else if (!heatQueue.isEmpty()) { head = heatQueue.peek(); - } else if (!solutionQueue.isEmpty()) { - head = solutionQueue.peek(); + } else if (!thinQueue.isEmpty()) { + head = thinQueue.peek(); + } else if (!thickQueue.isEmpty()) { + head = thickQueue.peek(); } else if (!annealQueue.isEmpty()) { head = annealQueue.peek(); } @@ -121,11 +133,17 @@ public class TransferModuleService { */ private void removeCurrentFromQueue(CraftsTransferTypeCode type, Thread current) { switch (type) { + case move_feed: + feedQueue.remove(current); + break; case move_heat: heatQueue.remove(current); break; - case move_liquid: - solutionQueue.remove(current); + case move_thin: + thinQueue.remove(current); + break; + case move_thick: + thickQueue.remove(current); break; case move_anneal: annealQueue.remove(current); @@ -222,7 +240,6 @@ public class TransferModuleService { * 转运机械臂Z轴移动到0点 */ public void transferZMoveZero(String cmdId, String cmdCode) throws Exception { - //todo z轴存在丢步问题 用回原点代替归0 DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferZMove(0.0); //DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferZOrigin(); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand);