修正跨循环工步执行状态
按当前循环内工步位置计算方案状态,增加进入下一循环仍显示进行中的回归测试。
| | |
| | | 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)); |
| | |
| | | } |
| | | |
| | | @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"); |