fix: keep terminal drayage actions executable
This commit is contained in:
+1
-1
@@ -257,7 +257,7 @@ public class TerminalDrayageService {
|
|||||||
if (current != null && current.sequence() >= CarrierScheduleNode.PICKUP_READY.sequence()
|
if (current != null && current.sequence() >= CarrierScheduleNode.PICKUP_READY.sequence()
|
||||||
&& value != null && value.getFleetSupplierId() != null && value.getPickupAppointmentAt() != null
|
&& value != null && value.getFleetSupplierId() != null && value.getPickupAppointmentAt() != null
|
||||||
&& actualPickupAt(context, value) == null) result.add("RECORD_PICKUP");
|
&& actualPickupAt(context, value) == null) result.add("RECORD_PICKUP");
|
||||||
if (context.unloadingCompletedAt() != null && actualPickupAt(context, value) != null
|
if (value != null && context.unloadingCompletedAt() != null && actualPickupAt(context, value) != null
|
||||||
&& actualEmptyReturnAt(context, value) == null) result.add("RECORD_EMPTY_RETURN");
|
&& actualEmptyReturnAt(context, value) == null) result.add("RECORD_EMPTY_RETURN");
|
||||||
return List.copyOf(result);
|
return List.copyOf(result);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
@@ -154,6 +154,19 @@ class TerminalDrayageServiceTest {
|
|||||||
assertThat(service.detail(11L).emptyReturnWarning().overdueHours()).isZero();
|
assertThat(service.detail(11L).emptyReturnWarning().overdueHours()).isZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void doesNotOfferEmptyReturnWithoutExecutableDrayageAggregate() {
|
||||||
|
LocalDateTime unloadedAt = LocalDateTime.of(2026, 9, 3, 0, 0);
|
||||||
|
Context context = context("PICKED_UP", unloadedAt);
|
||||||
|
when(mapper.context(11L)).thenReturn(context);
|
||||||
|
when(mapper.find(11L)).thenReturn(null);
|
||||||
|
|
||||||
|
var result = service.detail(11L);
|
||||||
|
|
||||||
|
assertThat(result.status()).isEqualTo("UNLOADED");
|
||||||
|
assertThat(result.allowedActions()).doesNotContain("RECORD_EMPTY_RETURN");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void sameIdempotencyKeyWithDifferentPayloadConflictsWithoutWriting() {
|
void sameIdempotencyKeyWithDifferentPayloadConflictsWithoutWriting() {
|
||||||
Context context = context("ARRIVED_DESTINATION_PORT", null);
|
Context context = context("ARRIVED_DESTINATION_PORT", null);
|
||||||
|
|||||||
Reference in New Issue
Block a user