Feat: 后端新增基础资料与业务管理只读汇总接口
为 Web 端改版提供名称、统计和看板数据。只新增只读查询、扩展列表与详情 返回字段;写接口、托盘状态机和幂等键规则均未改动,未新增权限标识。 - 基础资料:列表补充名称与汇总,客户详情返回现场树,托盘详情返回最近流转, 托盘列表支持按流转阶段筛选和二维码精确匹配;新增现场、产线、隧道的上级 资料选项接口;Excel 导入支持 preview 只校验不写入 - 发货出库:列表支持 keyword、receiptState 筛选并补充名称、托盘数、包数和 菌种构成;详情明细补充托盘号、菌种、批次 - 首次入库:列表与详情补充名称、托盘数、托盘当前状态;新增 /summary - 托盘退回:列表支持 keyword 并补充名称与托盘汇总,详情补充托盘号和隧道; 新增 /summary、/site-options - 工厂装填:列表支持 keyword 并补充托盘号、仓库、操作人;新增 /summary、 /batches、/batches/detail - 客户现场使用:列表支持 keyword、fifoSkipped 并补充名称和被跳过的先到托盘号; 新增 /site-options、/site-board 以及 usage-fifo 的 /queue - 先到先用 DAO 抽出公共候选条件与排序,建议查询生成的 SQL 与改动前一致 - 新增各汇总 DAO 的单元测试,同步更新路由权限与模型字段契约测试 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,7 +88,14 @@ async def _import_excel(
|
||||
db: AsyncSession,
|
||||
current_user: CurrentUserModel,
|
||||
scope: TestBatchScope,
|
||||
preview: bool = False,
|
||||
) -> Response:
|
||||
if preview:
|
||||
preview_result = await MasterExcelService.preview_import(
|
||||
db, resource, file, update_support, current_user, scope
|
||||
)
|
||||
logger.info('导入校验完成')
|
||||
return ResponseUtil.success(msg='校验完成,尚未写入', data=preview_result)
|
||||
result = await MasterExcelService.import_resource(
|
||||
db, resource, file, update_support, current_user, scope
|
||||
)
|
||||
@@ -127,8 +134,9 @@ async def import_master_strain_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('strain', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('strain', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@strain_excel_controller.post(
|
||||
@@ -176,8 +184,9 @@ async def import_master_customer_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('customer', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('customer', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@customer_excel_controller.post(
|
||||
@@ -225,8 +234,9 @@ async def import_master_site_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('site', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('site', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@site_excel_controller.post(
|
||||
@@ -274,8 +284,9 @@ async def import_master_line_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('line', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('line', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@line_excel_controller.post(
|
||||
@@ -323,8 +334,9 @@ async def import_master_warehouse_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('warehouse', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('warehouse', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@warehouse_excel_controller.post(
|
||||
@@ -372,8 +384,9 @@ async def import_master_pallet_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('pallet', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('pallet', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@pallet_excel_controller.post(
|
||||
@@ -421,8 +434,9 @@ async def import_master_tunnel_excel(
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
preview: Annotated[bool, Query(description='只校验不写入')] = False,
|
||||
) -> Response:
|
||||
return await _import_excel('tunnel', file, update_support, query_db, current_user, scope)
|
||||
return await _import_excel('tunnel', file, update_support, query_db, current_user, scope, preview)
|
||||
|
||||
|
||||
@tunnel_excel_controller.post(
|
||||
|
||||
Reference in New Issue
Block a user