fix(ft546): preserve legacy vehicle snapshots
This commit is contained in:
@@ -6,9 +6,13 @@ import com.ruoyi.api.controller.Wcs2WmsController;
|
||||
import com.ruoyi.api.domain.RequestLog;
|
||||
import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.domain.wcs2wms.ReceiveJob;
|
||||
import com.ruoyi.api.domain.wcs2wms.SrgvVehicleSnapshot;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.api.service.impl.ApiServiceImpl;
|
||||
import com.ruoyi.api.service.impl.RequestLogServiceImpl;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.device.srgv.domain.DeviceSrgv;
|
||||
import com.ruoyi.device.srgv.mapper.DeviceSrgvMapper;
|
||||
import com.ruoyi.project.ft546.config.Ft546WcsProperties;
|
||||
import com.ruoyi.wcs.application.task.CreateTransportOrderCommand;
|
||||
import com.ruoyi.wcs.application.task.TransportOrderResult;
|
||||
@@ -18,6 +22,7 @@ import com.ruoyi.wcs.port.in.TransportOrderUseCase;
|
||||
import com.ruoyi.wcs.port.out.WmsNotification;
|
||||
import com.ruoyi.wcs.port.out.WmsNotificationReceipt;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
@@ -141,6 +146,37 @@ class Ft546WmsAdapterServiceTest {
|
||||
verify(legacy, never()).tidyVehicleSnapshot();
|
||||
}
|
||||
|
||||
@Test
|
||||
void legacySnapshotDoesNotDependOnTheStandardWcsAdapter() {
|
||||
DeviceSrgvMapper deviceMapper = mock(DeviceSrgvMapper.class);
|
||||
DeviceSrgv vehicle = new DeviceSrgv();
|
||||
vehicle.setGuid("GUID-1");
|
||||
vehicle.setDeviceId(1);
|
||||
vehicle.setAgvStatus("1");
|
||||
vehicle.setAlarm(0);
|
||||
vehicle.setErrMsg(0);
|
||||
vehicle.setTaskNo(0);
|
||||
vehicle.setLocked(0);
|
||||
vehicle.setChargeFlag(0);
|
||||
vehicle.setCurrSite("070501");
|
||||
when(deviceMapper.selectDeviceSrgvList(any(DeviceSrgv.class)))
|
||||
.thenReturn(Collections.singletonList(vehicle));
|
||||
ApiServiceImpl legacy = new ApiServiceImpl();
|
||||
ReflectionTestUtils.setField(legacy, "deviceSrgvMapper", deviceMapper);
|
||||
|
||||
AjaxResult result = legacy.tidyVehicleSnapshot();
|
||||
|
||||
assertTrue(result.isSuccess());
|
||||
List<?> snapshots = (List<?>) result.get(AjaxResult.DATA_TAG);
|
||||
assertEquals(1, snapshots.size());
|
||||
SrgvVehicleSnapshot snapshot = (SrgvVehicleSnapshot) snapshots.get(0);
|
||||
assertEquals("GUID-1", snapshot.getGuid());
|
||||
assertTrue(snapshot.getOnline());
|
||||
assertTrue(snapshot.getHealthy());
|
||||
assertTrue(snapshot.getIdle());
|
||||
assertEquals("070501", snapshot.getCurrSite());
|
||||
}
|
||||
|
||||
@Test
|
||||
void notificationUsesEventIdAsLegacyCallbackIdempotencyKey() {
|
||||
FakeRequestLogService requestLogs = new FakeRequestLogService();
|
||||
|
||||
Reference in New Issue
Block a user