From fc23c26d6c42c483eb7e1b876292f2c0ffbe35e0 Mon Sep 17 00:00:00 2001 From: HSZ_HeSongZhen <210202959@qq.com> Date: Tue, 22 Apr 2025 21:26:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F=E6=89=AB?= =?UTF-8?q?=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/a8k/OS.java | 2 +- .../HbotCodeScanPosVerificationPage.java | 34 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/java/a8k/OS.java b/src/main/java/a8k/OS.java index 976ebf0..10064d5 100644 --- a/src/main/java/a8k/OS.java +++ b/src/main/java/a8k/OS.java @@ -15,7 +15,7 @@ public class OS { } } - private static void threadSleep(Integer mills) { + public static void threadSleep(Integer mills) { try { Thread.sleep(mills); } catch (InterruptedException ignored) { diff --git a/src/main/java/a8k/extui/page/test/verification/HbotCodeScanPosVerificationPage.java b/src/main/java/a8k/extui/page/test/verification/HbotCodeScanPosVerificationPage.java index 9c7d778..c7afebe 100644 --- a/src/main/java/a8k/extui/page/test/verification/HbotCodeScanPosVerificationPage.java +++ b/src/main/java/a8k/extui/page/test/verification/HbotCodeScanPosVerificationPage.java @@ -24,6 +24,8 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; +import static a8k.OS.threadSleep; + @Component @Slf4j @RequiredArgsConstructor @@ -56,6 +58,34 @@ public class HbotCodeScanPosVerificationPage { codeScanerDriver.pipetteModCodeScannerStopScan(); } + public void testCodeScan(Integer times, Integer overtime) throws AppException { + if(overtime < 0){ + overtime = 0; + } + if(times < 1){ + times = 1; + } + if(times > 100){ + times = 100; + } + log.info("testCodeScan times:{} overtime:{}", times, overtime); + + for (int i = 0; i < times; i++) { + log.info("testCodeScan times:{}", i); + hbotMoveExCtrlService.moveQuickToZero(); + + for(var cg: ConsumableGroup.values()){ + moveToPBScanPos(cg); + threadSleep(overtime); + String result = codeScanerDriver.pipetteModCodeScannerScanCode(); + if(result == null || result.isEmpty()){ + log.info("cg {} 扫码失败", cg); + } + log.info("cg {} 扫码结果:{}", cg, result); + } + } + } + @PostConstruct void init() { @@ -66,6 +96,10 @@ public class HbotCodeScanPosVerificationPage { cfg.addFunction("移动到大瓶扫码位置", this::moveToLargeBSCodeScanPos); cfg.addFunction("扫码", this::startCodeScan); cfg.addFunction("停止扫码", this::stopCodeScan); + + cfg.newGroup("扫描测试"); + cfg.addFunction("批量扫码", this::testCodeScan); + extApiPageMgr.addPage(cfg); } }