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..4c5b86f 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,54 @@ public class HbotCodeScanPosVerificationPage { codeScanerDriver.pipetteModCodeScannerStopScan(); } + public void batchCodeScan(Integer times, Integer overtime) throws AppException { + if(overtime < 0){ + overtime = 0; + } + + log.info("batchCodeScan times:{} overtime:{}", times, overtime); + + for (int i = 0; i < times; i++) { + log.info("batchCodeScan 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); + } + } + } + + public void codeScan(ConsumableGroup cg, Integer overtime) throws AppException + { + moveToPBScanPos(cg); + threadSleep(overtime); + String result = codeScanerDriver.pipetteModCodeScannerScanCode(); + if(result == null || result.isEmpty()){ + log.info("cg {} 扫码失败", cg); + } + log.info("cg {} 扫码结果:{}", cg, result); + } + + public void batchCodeScanWithCheck(ConsumableGroup cg, Integer times, Integer overtime) throws AppException { + if(overtime < 0){ + overtime = 0; + } + + log.info("batchCodeScanWithCheck times:{} overtime:{}", times, overtime); + + for (int i = 0; i < times; i++) { + log.info("batchCodeScanWithCheck times:{}", i); + hbotMoveExCtrlService.moveQuickToZero(); + codeScan(cg, overtime); + } + } + @PostConstruct void init() { @@ -66,6 +116,11 @@ public class HbotCodeScanPosVerificationPage { cfg.addFunction("移动到大瓶扫码位置", this::moveToLargeBSCodeScanPos); cfg.addFunction("扫码", this::startCodeScan); cfg.addFunction("停止扫码", this::stopCodeScan); + + cfg.newGroup("扫码测试"); + cfg.addFunction("批量扫码(One)", this::batchCodeScanWithCheck); + cfg.addFunction("批量扫码", this::batchCodeScan); + extApiPageMgr.addPage(cfg); } }