优化
This commit is contained in:
+9
-6
@@ -4,7 +4,7 @@ import com.baiyue.lastleg.palletops.dto.PalletOperationRequests;
|
||||
import com.baiyue.lastleg.pda.move.dto.PdaInventoryMoveRequest;
|
||||
import com.baiyue.lastleg.pda.stocktake.dto.PdaStocktakeRequests;
|
||||
import com.baiyue.lastleg.relabel.pda.dto.PdaRelabelRequests;
|
||||
import com.baiyue.lastleg.dispatch.pda.dto.DispatchPdaRequests;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchCommands;
|
||||
import com.baiyue.lastleg.delivery.dto.DeliveryRequests;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -34,9 +34,9 @@ class PdaOperationsOpenApiContractTest {
|
||||
}
|
||||
}
|
||||
assertNoServerOwnedFields(PdaInventoryMoveRequest.class);
|
||||
assertNoServerOwnedFields(DispatchPdaRequests.Pick.class);
|
||||
assertNoServerOwnedFields(DispatchPdaRequests.CompletePicking.class);
|
||||
assertNoServerOwnedFields(DispatchPdaRequests.Depart.class);
|
||||
assertNoServerOwnedFields(DispatchCommands.Pick.class);
|
||||
assertNoServerOwnedFields(DispatchCommands.LoadingComplete.class);
|
||||
assertNoServerOwnedFields(DispatchCommands.Depart.class);
|
||||
assertNoServerOwnedFields(DeliveryRequests.PdaPick.class);
|
||||
assertNoServerOwnedFields(DeliveryRequests.PdaPalletPick.class);
|
||||
assertNoServerOwnedFields(DeliveryRequests.PdaComplete.class);
|
||||
@@ -72,7 +72,9 @@ class PdaOperationsOpenApiContractTest {
|
||||
"/api/pda/v1/last-leg/dispatches:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}/items/{itemId}/pick:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}/complete:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}/loading:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}/loading-complete:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}/commands/{idempotencyKey}:",
|
||||
"/api/pda/v1/last-leg/dispatches/{dispatchNo}/depart:",
|
||||
"/api/pda/v1/last-leg/outbound-tasks:",
|
||||
"/api/pda/v1/last-leg/outbound-tasks/resolve/{businessNo}:",
|
||||
@@ -81,7 +83,8 @@ class PdaOperationsOpenApiContractTest {
|
||||
"/api/pda/v1/last-leg/outbound-tasks/{taskNo}/pallets/{palletNo}/pick:",
|
||||
"/api/pda/v1/last-leg/outbound-tasks/{taskNo}/complete:");
|
||||
for (String path : paths) assertTrue(yaml.contains(path), path);
|
||||
assertEquals(34, paths.size());
|
||||
assertEquals(36, paths.size());
|
||||
assertFalse(yaml.contains("/api/pda/v1/last-leg/dispatches/{dispatchNo}/complete:"));
|
||||
assertTrue(yaml.contains("enum: [LOCATION, PALLET]"));
|
||||
assertTrue(yaml.contains("enum: [APPROVE, REWORK]"));
|
||||
assertTrue(yaml.contains("Warehouse 权威实物托盘码"));
|
||||
|
||||
+8
-7
@@ -6,8 +6,10 @@ import com.baiyue.lastleg.delivery.dto.DeliveryRequests;
|
||||
import com.baiyue.lastleg.delivery.dto.DeliveryResponses;
|
||||
import com.baiyue.lastleg.delivery.service.DeliveryTransferService;
|
||||
import com.baiyue.lastleg.dispatch.pda.controller.DispatchPdaController;
|
||||
import com.baiyue.lastleg.dispatch.pda.dto.DispatchPdaRequests;
|
||||
import com.baiyue.lastleg.dispatch.pda.service.DispatchPdaWorkflowService;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchCommands;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchContracts;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchTypes;
|
||||
import com.baiyue.lastleg.dispatch.service.DispatchPdaQueryService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
@@ -45,7 +47,7 @@ class PdaOutboundDispatchContractTest {
|
||||
}));
|
||||
}
|
||||
}
|
||||
assertTrue(Arrays.stream(DispatchPdaRequests.Pick.class.getRecordComponents())
|
||||
assertTrue(Arrays.stream(DispatchCommands.Pick.class.getRecordComponents())
|
||||
.noneMatch(component -> "warehouseId".equals(component.getName()) || "customerId".equals(component.getName())));
|
||||
assertTrue(Arrays.stream(DeliveryRequests.PdaPick.class.getRecordComponents())
|
||||
.noneMatch(component -> "warehouseId".equals(component.getName()) || "customerId".equals(component.getName())));
|
||||
@@ -55,19 +57,18 @@ class PdaOutboundDispatchContractTest {
|
||||
|
||||
@Test
|
||||
void controllersPassOnlyTokenBoundWarehouseToServices() {
|
||||
DispatchPdaWorkflowService dispatchService = mock(DispatchPdaWorkflowService.class);
|
||||
DispatchPdaQueryService dispatchService = mock(DispatchPdaQueryService.class);
|
||||
DeliveryTransferService outboundService = mock(DeliveryTransferService.class);
|
||||
DispatchPdaController dispatch = new DispatchPdaController();
|
||||
OutboundPdaController outbound = new OutboundPdaController();
|
||||
ReflectionTestUtils.setField(dispatch, "service", dispatchService);
|
||||
ReflectionTestUtils.setField(dispatch, "trips", mock(com.baiyue.lastleg.fleet.trip.FleetTripExecutionService.class));
|
||||
ReflectionTestUtils.setField(dispatch, "queries", dispatchService);
|
||||
ReflectionTestUtils.setField(outbound, "service", outboundService);
|
||||
AuthenticatedUser user = pda(Set.of("lastleg:pda:operate", "ROLE_OVERSEAS_WAREHOUSE_PDA_OPERATOR"), 900L);
|
||||
|
||||
dispatch.list(user, null);
|
||||
outbound.list(user, null);
|
||||
|
||||
verify(dispatchService).list("900", null);
|
||||
verify(dispatchService).list(new DispatchContracts.Actor("7",DispatchTypes.ActorMode.PDA,"900"),null);
|
||||
verify(outboundService).pdaTasks("900", null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user