yeg
2026-09-01 10940b706f4311d7e428419cc206a6f7d68daf0e
修正跨循环工步执行状态

按当前循环内工步位置计算方案状态,增加进入下一循环仍显示进行中的回归测试。
2个文件已修改
23 ■■■■■ 已修改文件
ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-device/src/test/java/com/ruoyi/device/bts/BtsDevelopmentSimulatorRecordStepCycleTest.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-device/src/main/java/com/ruoyi/device/bts/BtsDevelopmentSimulator.java
@@ -444,11 +444,10 @@
            List<BtsExcelFixture.FixtureRecord> sameCycle = BtsExcelFixture.records().stream()
                    .filter(item -> item.cycleNo() == first.cycleNo() && item.stepNo() == first.stepNo()).toList();
            BtsExcelFixture.FixtureRecord last = sameCycle.get(sameCycle.size() - 1);
            String status = playback.naturallyFinished() || playback.cycleNo() > first.cycleNo()
                    || (playback.cycleNo() == first.cycleNo() && playback.stepNo() > first.stepNo())
                            ? "已完成"
                            : playback.cycleNo() == first.cycleNo() && playback.stepNo() == first.stepNo()
                                    ? "进行中" : "待执行";
            // step 号在每个循环内重复,跨循环时必须按当前循环的工步位置判断,不能把上一循环的同号工步当成当前状态。
            String status = playback.naturallyFinished() ? "已完成"
                    : playback.stepNo() > first.stepNo() ? "已完成"
                            : playback.stepNo() == first.stepNo() ? "进行中" : "待执行";
            rows.add(new BtsTestPlanRow("STEP", first.stepNo(), first.stepName(),
                    Math.max(0d, last.offsetSeconds() - first.offsetSeconds()), first.voltageV(), status,
                    null, null));
ruoyi-device/src/test/java/com/ruoyi/device/bts/BtsDevelopmentSimulatorRecordStepCycleTest.java
@@ -53,6 +53,20 @@
    }
    @Test
    void testSnapshotKeepsCurrentStepVisibleWhenPlaybackEntersNextCycle() throws Exception
    {
        InMemoryBtsSimulatorStateStore store = new InMemoryBtsSimulatorStateStore();
        try (BtsDevelopmentSimulator simulator = new BtsDevelopmentSimulator(0, store))
        {
            simulator.updateChannel(1, 1, true, DeviceWorkStatus.WORKING);
            simulator.nextBtsCycle(1, 1);
            var snapshot = simulator.btsTest(1, 1);
            assertTrue(snapshot.rows().stream().anyMatch(row -> "STEP".equals(row.rowType()) && "进行中".equals(row.executionStatus())));
            assertTrue(snapshot.rows().stream().anyMatch(row -> "STEP".equals(row.rowType()) && "待执行".equals(row.executionStatus())));
        }
    }
    @Test
    void playbackSpeedPauseResumeAndRestartAreIndependentOfDeviceStatus() throws Exception
    {
        Instant start = Instant.parse("2026-08-31T00:00:00Z");