This commit is contained in:
2026-08-17 10:54:08 +08:00
parent 7a9c72a6a2
commit d51e054def
8 changed files with 452 additions and 5 deletions
@@ -73,6 +73,8 @@ class Phase3BookingTruckPermissionSqlContractTest {
.contains("(5102149,0,'PLATFORM','BUTTON',5102140,'platform:firstleg:ocean-booking:allocate'")
.contains("(5102150,0,'PLATFORM','MENU',5102000,'platform:firstleg:truck-appointment:list'")
.contains("(5102154,0,'PLATFORM','BUTTON',5102150,'platform:firstleg:truck-appointment:operate'")
.contains("permission_code LIKE 'platform:firstleg:ocean-booking:%') <> 6")
.contains("p.permission_code LIKE 'platform:firstleg:ocean-booking:%') <> 12")
.contains("role.role_code IN ('PLATFORM_ADMIN','ORDER_OPERATOR')")
.doesNotContain("assert_phase3_booking_truck_permission_ids_available")
.doesNotContain("/trucking");
@@ -114,6 +114,25 @@ class CartonMeasurementServiceTest {
assertThat(measurement.getSourceCode()).isEqualTo("PLATFORM");
}
@Test
void measuringInboundAllowsManualEntryBeforeMeasurementSubmission() {
InboundOrderEntity measuring = inbound("MEASURING");
InboundMeasurementEntity measurement = measurement(30001L, "RECEIVED", 0);
when(repository.findInbound(10001L, 70001L)).thenReturn(measuring);
when(repository.lockInbound(10001L, 70001L)).thenReturn(measuring);
when(repository.findItemByBoxCode(10001L, "RK-001#5-1")).thenReturn(null);
when(repository.findLatestEditableMeasurement(10001L, 70001L)).thenReturn(measurement);
when(repository.listItems(10001L, 30001L)).thenAnswer(invocation -> List.of(insertedItem.get()));
when(repository.updateMeasurement(measurement)).thenReturn(true);
CartonMeasurementResult result = service.upsertManualForInbound(
10001L, 90001L, 70001L, acceptanceCommand());
assertThat(result.created()).isTrue();
assertThat(measurement.getSourceType()).isEqualTo(MeasurementBatchService.SOURCE_MANUAL);
verify(images).upload(any(), any(Long.TYPE), any(Long.TYPE), any(Long.TYPE), any());
}
@Test
void repeatedScanReplacesDeviceValuesButPreservesManualCountAndOldImageIsDeleted() {
InboundMeasurementEntity measurement = measurement(30001L, "RECEIVED", 4);