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:
@@ -28,6 +28,7 @@ from module_admin.service.log_service import LogQueueService
|
||||
from module_admin.service.login_service import LoginService
|
||||
from module_business.controller import inbound_controller as inbound_controller_module
|
||||
from module_business.dao.access_dao import AccessDao
|
||||
from module_business.dao.inbound_summary_dao import InboundSummaryDao
|
||||
from module_business.dao.inventory_dao import InventoryDao
|
||||
from module_business.dao.master_dao import MasterDao
|
||||
from module_business.dao.operation_dao import OperationDao
|
||||
@@ -45,7 +46,9 @@ from module_business.entity.vo.operation_vo import (
|
||||
BusinessOptionModel,
|
||||
ConfirmCommandModel,
|
||||
InboundCreateModel,
|
||||
InboundListItemModel,
|
||||
InboundModel,
|
||||
InboundOverviewModel,
|
||||
InboundPageQueryModel,
|
||||
InboundScanQueryModel,
|
||||
InboundUpdateModel,
|
||||
@@ -741,6 +744,7 @@ class TestInboundReadService(unittest.IsolatedAsyncioTestCase):
|
||||
with (
|
||||
patch.object(AccessDao, 'list_user_warehouse_ids', new=AsyncMock(return_value=[7, 3, 7])) as scope,
|
||||
patch.object(OperationDao, 'get_inbound_list', new=get_list),
|
||||
patch.object(InboundSummaryDao, 'get_list_summaries', new=AsyncMock(return_value={})),
|
||||
):
|
||||
actual = await InboundService.get_inbound_list_services(
|
||||
self.db, query, self.user, TestBatchScope.formal(), is_page=True
|
||||
@@ -827,6 +831,7 @@ class TestInboundReadService(unittest.IsolatedAsyncioTestCase):
|
||||
) as scope,
|
||||
patch.object(OperationDao, 'get_inbound_by_id', new=get_detail),
|
||||
patch.object(AccessService, 'assert_warehouse_access', new=access),
|
||||
patch.object(InboundSummaryDao, 'get_item_identities', new=AsyncMock(return_value={})),
|
||||
):
|
||||
actual = await InboundService.inbound_detail_services(self.db, 11, self.user, TestBatchScope.formal())
|
||||
|
||||
@@ -1900,6 +1905,7 @@ class TestInboundController(unittest.TestCase):
|
||||
schema = app.openapi()
|
||||
expected = {
|
||||
('/business/inbound/list', 'get'),
|
||||
('/business/inbound/summary', 'get'),
|
||||
('/business/inbound/warehouse-options', 'get'),
|
||||
('/business/inbound/scan/{qr_token}', 'get'),
|
||||
('/business/inbound/{inbound_id}', 'get'),
|
||||
@@ -1913,7 +1919,12 @@ class TestInboundController(unittest.TestCase):
|
||||
self.assertIn('warehouseId', {parameter['name'] for parameter in scan_parameters})
|
||||
|
||||
routes = self._routes()
|
||||
self.assertEqual(PageResponseModel[InboundModel], routes[('/business/inbound/list', 'GET')].response_model)
|
||||
self.assertEqual(
|
||||
PageResponseModel[InboundListItemModel], routes[('/business/inbound/list', 'GET')].response_model
|
||||
)
|
||||
self.assertEqual(
|
||||
DataResponseModel[InboundOverviewModel], routes[('/business/inbound/summary', 'GET')].response_model
|
||||
)
|
||||
self.assertEqual(
|
||||
DataResponseModel[list[BusinessOptionModel]],
|
||||
routes[('/business/inbound/warehouse-options', 'GET')].response_model,
|
||||
@@ -1937,12 +1948,14 @@ class TestInboundController(unittest.TestCase):
|
||||
def test_static_routes_are_declared_before_dynamic_detail(self) -> None:
|
||||
paths = [route.path_format for route in inbound_controller_module.inbound_controller.routes]
|
||||
detail_index = paths.index('/business/inbound/{inbound_id}')
|
||||
self.assertLess(paths.index('/business/inbound/summary'), detail_index)
|
||||
self.assertLess(paths.index('/business/inbound/warehouse-options'), detail_index)
|
||||
self.assertLess(paths.index('/business/inbound/scan/{qr_token}'), detail_index)
|
||||
|
||||
def test_each_route_has_exact_permission_and_five_unique_permission_values(self) -> None:
|
||||
expected = {
|
||||
('/business/inbound/list', 'GET'): 'business:inbound:list',
|
||||
('/business/inbound/summary', 'GET'): 'business:inbound:list',
|
||||
('/business/inbound/warehouse-options', 'GET'): 'business:inbound:query',
|
||||
('/business/inbound/scan/{qr_token}', 'GET'): 'business:inbound:query',
|
||||
('/business/inbound/{inbound_id}', 'GET'): 'business:inbound:query',
|
||||
|
||||
Reference in New Issue
Block a user