装柜
This commit is contained in:
@@ -145,6 +145,9 @@ public class LocationApplicationService {
|
||||
if (warehouse == null) {
|
||||
throw new BizException(ResultCode.FORBIDDEN, "仓库不属于当前企业租户或不在数据范围内");
|
||||
}
|
||||
if (!"DOMESTIC".equalsIgnoreCase(warehouse.getWarehouseType())) {
|
||||
throw new BizException(ResultCode.FORBIDDEN, "库位只能绑定国内中转仓");
|
||||
}
|
||||
if (active && !"ACTIVE".equals(warehouse.getStatus())) {
|
||||
throw new BizException(ResultCode.CONFLICT, "仓库已停用");
|
||||
}
|
||||
|
||||
+16
@@ -70,6 +70,17 @@ class LocationApplicationServiceTest {
|
||||
.isInstanceOf(BizException.class).hasMessageContaining("编码");
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsNonDomesticWarehouseForCreate() {
|
||||
when(repository.findWarehouse(10001L, 88L)).thenReturn(warehouse("ACTIVE", "FBA"));
|
||||
|
||||
assertThatThrownBy(() -> service.create(10001L, request("AVAILABLE", null)))
|
||||
.isInstanceOf(BizException.class)
|
||||
.hasMessageContaining("国内中转仓");
|
||||
|
||||
verify(repository, never()).insert(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldHandleCase03() {
|
||||
LocationEntity location = location("AVAILABLE", 3);
|
||||
@@ -110,10 +121,15 @@ class LocationApplicationServiceTest {
|
||||
}
|
||||
|
||||
private static WarehouseEntity warehouse(String status) {
|
||||
return warehouse(status, "DOMESTIC");
|
||||
}
|
||||
|
||||
private static WarehouseEntity warehouse(String status, String type) {
|
||||
WarehouseEntity warehouse = new WarehouseEntity();
|
||||
warehouse.setId(88L);
|
||||
warehouse.setTenantId(10001L);
|
||||
warehouse.setStatus(status);
|
||||
warehouse.setWarehouseType(type);
|
||||
return warehouse;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user