功能:隔离五类测试业务链路

This commit is contained in:
焦龙言
2026-09-23 08:27:14 +08:00
parent 43fe17cc70
commit f5df2150d8
18 changed files with 1206 additions and 831 deletions
@@ -11,6 +11,8 @@ from common.enums import BusinessType
from common.router import APIRouterPro
from common.vo import DataResponseModel, PageResponseModel, ResponseBaseModel
from module_admin.entity.vo.user_vo import CurrentUserModel
from module_business.dependency.test_batch_dependency import TestBatchScopeDependency
from module_business.domain.test_batch_scope import TestBatchScope
from module_business.entity.vo.operation_vo import (
BusinessOptionModel,
FillingCreateModel,
@@ -40,11 +42,13 @@ async def get_business_filling_list(
filling_page_query: Annotated[FillingPageQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await FillingService.get_filling_list_services(
query_db,
filling_page_query,
current_user,
test_scope,
is_page=True,
)
return ResponseUtil.success(model_content=result)
@@ -61,8 +65,9 @@ async def get_business_filling_strain_options(
request: Request,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await FillingService.get_strain_options_services(query_db, current_user)
result = await FillingService.get_strain_options_services(query_db, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -81,11 +86,13 @@ async def scan_business_filling_pallet(
],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await FillingService.scan_filling_pallet_services(
query_db,
qr_token,
current_user,
test_scope,
)
return ResponseUtil.success(data=result)
@@ -102,8 +109,9 @@ async def query_detail_business_filling(
filling_id: Annotated[int, Path(gt=0, description='装填记录ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await FillingService.filling_detail_services(query_db, filling_id, current_user)
result = await FillingService.filling_detail_services(query_db, filling_id, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -120,6 +128,7 @@ async def add_business_filling(
add_filling: FillingCreateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await FillingService.fill_pallet_services(query_db, add_filling, current_user)
result = await FillingService.fill_pallet_services(query_db, add_filling, current_user, test_scope)
return ResponseUtil.success(msg=result.message)
@@ -11,6 +11,8 @@ from common.enums import BusinessType
from common.router import APIRouterPro
from common.vo import DataResponseModel, PageResponseModel, ResponseBaseModel
from module_admin.entity.vo.user_vo import CurrentUserModel
from module_business.dependency.test_batch_dependency import TestBatchScopeDependency
from module_business.domain.test_batch_scope import TestBatchScope
from module_business.entity.vo.operation_vo import (
BusinessOptionModel,
ConfirmCommandModel,
@@ -43,11 +45,13 @@ async def get_business_inbound_list(
inbound_page_query: Annotated[InboundPageQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await InboundService.get_inbound_list_services(
query_db,
inbound_page_query,
current_user,
test_scope,
is_page=True,
)
return ResponseUtil.success(model_content=result)
@@ -64,8 +68,9 @@ async def get_business_inbound_warehouse_options(
request: Request,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await InboundService.get_warehouse_options_services(query_db, current_user)
result = await InboundService.get_warehouse_options_services(query_db, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -85,12 +90,14 @@ async def scan_business_inbound_pallet(
inbound_scan_query: Annotated[InboundScanQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await InboundService.scan_inbound_pallet_services(
query_db,
qr_token,
inbound_scan_query,
current_user,
test_scope,
)
return ResponseUtil.success(data=result)
@@ -107,8 +114,9 @@ async def query_detail_business_inbound(
inbound_id: Annotated[int, Path(gt=0, description='入库单ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await InboundService.inbound_detail_services(query_db, inbound_id, current_user)
result = await InboundService.inbound_detail_services(query_db, inbound_id, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -125,8 +133,9 @@ async def add_business_inbound(
add_inbound: InboundCreateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await InboundService.add_inbound_services(query_db, add_inbound, current_user)
result = await InboundService.add_inbound_services(query_db, add_inbound, current_user, test_scope)
return ResponseUtil.success(msg=result.message)
@@ -143,8 +152,9 @@ async def edit_business_inbound(
edit_inbound: InboundUpdateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await InboundService.edit_inbound_services(query_db, edit_inbound, current_user)
result = await InboundService.edit_inbound_services(query_db, edit_inbound, current_user, test_scope)
return ResponseUtil.success(msg=result.message)
@@ -164,11 +174,13 @@ async def delete_business_inbound(
],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await InboundService.delete_inbound_services(
query_db,
[int(inbound_id) for inbound_id in inbound_ids.split(',')],
current_user,
test_scope,
)
return ResponseUtil.success(msg=result.message)
@@ -187,11 +199,13 @@ async def confirm_business_inbound(
confirm_command: ConfirmCommandModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await InboundService.confirm_inbound_services(
query_db,
inbound_id,
confirm_command,
current_user,
test_scope,
)
return ResponseUtil.success(msg=result.message)
@@ -13,6 +13,8 @@ from common.enums import BusinessType
from common.router import APIRouterPro
from common.vo import DataResponseModel, PageResponseModel, ResponseBaseModel
from module_admin.entity.vo.user_vo import CurrentUserModel
from module_business.dependency.test_batch_dependency import TestBatchScopeDependency
from module_business.domain.test_batch_scope import TestBatchScope
from module_business.entity.vo.operation_vo import (
BusinessOptionModel,
PalletScanResponseModel,
@@ -44,11 +46,13 @@ async def get_business_return_list(
return_page_query: Annotated[ReturnPageQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ReturnService.get_return_list_services(
query_db,
return_page_query,
current_user,
test_scope,
is_page=True,
)
return ResponseUtil.success(model_content=result)
@@ -65,8 +69,9 @@ async def get_business_return_warehouse_options(
request: Request,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ReturnService.get_warehouse_options_services(query_db, current_user)
result = await ReturnService.get_warehouse_options_services(query_db, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -86,12 +91,14 @@ async def scan_business_return_pallet(
return_scan_query: Annotated[ReturnScanQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ReturnService.scan_return_pallet_services(
query_db,
qr_token,
return_scan_query,
current_user,
test_scope,
)
return ResponseUtil.success(data=result)
@@ -109,8 +116,9 @@ async def request_business_return(
request_command: ReturnRequestModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await ReturnService.request_return_services(query_db, request_command, current_user)
result = await ReturnService.request_return_services(query_db, request_command, current_user, test_scope)
return ResponseUtil.success(msg=result.message)
@@ -126,8 +134,9 @@ async def query_detail_business_return(
return_id: Annotated[int, Path(gt=0, description='退回单ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ReturnService.return_detail_services(query_db, return_id, current_user)
result = await ReturnService.return_detail_services(query_db, return_id, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -145,11 +154,13 @@ async def confirm_business_return(
confirm_command: ReturnConfirmModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await ReturnService.confirm_return_services(
query_db,
return_id,
confirm_command,
current_user,
test_scope,
)
return ResponseUtil.success(msg=result.message)
@@ -11,6 +11,8 @@ from common.enums import BusinessType
from common.router import APIRouterPro
from common.vo import DataResponseModel, PageResponseModel, ResponseBaseModel
from module_admin.entity.vo.user_vo import CurrentUserModel
from module_business.dependency.test_batch_dependency import TestBatchScopeDependency
from module_business.domain.test_batch_scope import TestBatchScope
from module_business.entity.vo.operation_vo import (
BusinessOptionModel,
ConfirmCommandModel,
@@ -43,11 +45,13 @@ async def get_business_shipment_list(
shipment_page_query: Annotated[ShipmentPageQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ShipmentService.get_shipment_list_services(
query_db,
shipment_page_query,
current_user,
test_scope,
is_page=True,
)
return ResponseUtil.success(model_content=result)
@@ -64,8 +68,9 @@ async def get_business_shipment_warehouse_options(
request: Request,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ShipmentService.get_warehouse_options_services(query_db, current_user)
result = await ShipmentService.get_warehouse_options_services(query_db, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -80,8 +85,9 @@ async def get_business_shipment_site_options(
request: Request,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ShipmentService.get_site_options_services(query_db, current_user)
result = await ShipmentService.get_site_options_services(query_db, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -101,12 +107,14 @@ async def scan_business_shipment_pallet(
shipment_scan_query: Annotated[ShipmentScanQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ShipmentService.scan_shipment_pallet_services(
query_db,
qr_token,
shipment_scan_query,
current_user,
test_scope,
)
return ResponseUtil.success(data=result)
@@ -123,8 +131,9 @@ async def query_detail_business_shipment(
shipment_id: Annotated[int, Path(gt=0, description='发货单ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await ShipmentService.shipment_detail_services(query_db, shipment_id, current_user)
result = await ShipmentService.shipment_detail_services(query_db, shipment_id, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -141,8 +150,9 @@ async def add_business_shipment(
add_shipment: ShipmentCreateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await ShipmentService.add_shipment_services(query_db, add_shipment, current_user)
result = await ShipmentService.add_shipment_services(query_db, add_shipment, current_user, test_scope)
return ResponseUtil.success(msg=result.message)
@@ -159,8 +169,9 @@ async def edit_business_shipment(
edit_shipment: ShipmentUpdateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await ShipmentService.edit_shipment_services(query_db, edit_shipment, current_user)
result = await ShipmentService.edit_shipment_services(query_db, edit_shipment, current_user, test_scope)
return ResponseUtil.success(msg=result.message)
@@ -180,11 +191,13 @@ async def delete_business_shipment(
],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await ShipmentService.delete_shipment_services(
query_db,
[int(shipment_id) for shipment_id in shipment_ids.split(',')],
current_user,
test_scope,
)
return ResponseUtil.success(msg=result.message)
@@ -203,11 +216,13 @@ async def confirm_business_shipment(
confirm_command: ConfirmCommandModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await ShipmentService.confirm_shipment_services(
query_db,
shipment_id,
confirm_command,
current_user,
test_scope,
)
return ResponseUtil.success(msg=result.message)
@@ -13,6 +13,8 @@ from common.enums import BusinessType
from common.router import APIRouterPro
from common.vo import DataResponseModel, PageResponseModel
from module_admin.entity.vo.user_vo import CurrentUserModel
from module_business.dependency.test_batch_dependency import TestBatchScopeDependency
from module_business.domain.test_batch_scope import TestBatchScope
from module_business.entity.vo.operation_vo import (
BusinessOptionModel,
PalletScanResponseModel,
@@ -43,11 +45,13 @@ async def get_business_usage_list(
usage_page_query: Annotated[UsagePageQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await UsageService.get_usage_list_services(
query_db,
usage_page_query,
current_user,
test_scope,
is_page=True,
)
return ResponseUtil.success(model_content=result)
@@ -65,8 +69,9 @@ async def get_business_usage_line_options(
site_id: Annotated[int, Query(alias='siteId', gt=0, description='客户现场ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await UsageService.get_line_options_services(query_db, site_id, current_user)
result = await UsageService.get_line_options_services(query_db, site_id, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -85,8 +90,9 @@ async def scan_business_usage_pallet(
],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await UsageService.scan_usage_pallet_services(query_db, qr_token, current_user)
result = await UsageService.scan_usage_pallet_services(query_db, qr_token, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -102,8 +108,9 @@ async def query_detail_business_usage(
usage_id: Annotated[int, Path(gt=0, description='使用记录ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await UsageService.usage_detail_services(query_db, usage_id, current_user)
result = await UsageService.usage_detail_services(query_db, usage_id, current_user, test_scope)
return ResponseUtil.success(data=result)
@@ -120,6 +127,7 @@ async def add_business_usage(
add_usage: UsageCreateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await UsageService.record_usage_services(query_db, add_usage, current_user)
result = await UsageService.record_usage_services(query_db, add_usage, current_user, test_scope)
return ResponseUtil.success(msg=result.message, data=result.result)