更新登录页及优化相关功能
This commit is contained in:
@@ -72,7 +72,7 @@ async def get_business_filling_strain_options(
|
||||
|
||||
|
||||
@filling_controller.get(
|
||||
'/scan/{qr_token}',
|
||||
'/scan/{qr_token:path}',
|
||||
summary='扫描待装填托盘接口',
|
||||
description='按托盘当前仓库数据范围判断空托盘是否可装填',
|
||||
response_model=DataResponseModel[PalletScanResponseModel],
|
||||
|
||||
@@ -75,7 +75,7 @@ async def get_business_inbound_warehouse_options(
|
||||
|
||||
|
||||
@inbound_controller.get(
|
||||
'/scan/{qr_token}',
|
||||
'/scan/{qr_token:path}',
|
||||
summary='扫描首次入库托盘接口',
|
||||
description='查询托盘是否可加入所选仓库的首次入库单',
|
||||
response_model=DataResponseModel[PalletScanResponseModel],
|
||||
|
||||
@@ -90,7 +90,7 @@ async def get_shipment_report_list(
|
||||
|
||||
@report_controller.get(
|
||||
'/consumption/list',
|
||||
summary='获取产线消耗报表分页列表接口',
|
||||
summary='获取隧道消耗报表分页列表接口(兼容产线)',
|
||||
response_model=PageResponseModel[ConsumptionReportModel],
|
||||
dependencies=[UserInterfaceAuthDependency('report:consumption:list')],
|
||||
)
|
||||
|
||||
@@ -76,7 +76,7 @@ async def get_business_return_warehouse_options(
|
||||
|
||||
|
||||
@return_controller.get(
|
||||
'/scan/{qr_token}',
|
||||
'/scan/{qr_token:path}',
|
||||
summary='扫描退回托盘接口',
|
||||
description='按申请现场或确认仓库数据范围重新查询托盘退回状态',
|
||||
response_model=DataResponseModel[PalletScanResponseModel],
|
||||
|
||||
@@ -23,6 +23,8 @@ from module_business.entity.vo.operation_vo import (
|
||||
ShipmentScanQueryModel,
|
||||
ShipmentUpdateModel,
|
||||
)
|
||||
from module_business.entity.vo.shipment_label_vo import ShipmentLabelModel
|
||||
from module_business.service.shipment_label_service import ShipmentLabelService
|
||||
from module_business.service.shipment_service import ShipmentService
|
||||
from utils.response_util import ResponseUtil
|
||||
|
||||
@@ -92,7 +94,7 @@ async def get_business_shipment_site_options(
|
||||
|
||||
|
||||
@shipment_controller.get(
|
||||
'/scan/{qr_token}',
|
||||
'/scan/{qr_token:path}',
|
||||
summary='扫描整托发货托盘接口',
|
||||
description='查询托盘是否可加入指定仓库至现场的整托发货单',
|
||||
response_model=DataResponseModel[PalletScanResponseModel],
|
||||
@@ -126,6 +128,24 @@ async def scan_business_shipment_pallet(
|
||||
return ResponseUtil.success(data=result)
|
||||
|
||||
|
||||
@shipment_controller.get(
|
||||
'/{shipment_id}/labels',
|
||||
summary='获取整托发货标签接口',
|
||||
description='在发货查询权限与仓库、现场、数据批次范围内读取原托盘标签',
|
||||
response_model=DataResponseModel[list[ShipmentLabelModel]],
|
||||
dependencies=[UserInterfaceAuthDependency('business:shipment:query')],
|
||||
)
|
||||
async def get_business_shipment_labels(
|
||||
request: Request,
|
||||
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 ShipmentLabelService.get_labels_services(query_db, shipment_id, current_user, test_scope)
|
||||
return ResponseUtil.success(data=result, headers={'Cache-Control': 'no-store'})
|
||||
|
||||
|
||||
@shipment_controller.get(
|
||||
'/{shipment_id}',
|
||||
summary='获取整托发货单详情接口',
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Path, Query, Request, Response
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.annotation.log_annotation import Log
|
||||
from common.aspect.db_seesion import DBSessionDependency
|
||||
from common.aspect.interface_auth import UserInterfaceAuthDependency
|
||||
from common.aspect.pre_auth import CurrentUserDependency, PreAuthDependency
|
||||
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 ShipmentModel
|
||||
from module_business.entity.vo.shipment_receipt_vo import (
|
||||
ShipmentReceiptCommandModel,
|
||||
ShipmentReceiptItemModel,
|
||||
ShipmentReceiptModel,
|
||||
ShipmentReceiptQueryModel,
|
||||
)
|
||||
from module_business.service.shipment_receipt_service import ShipmentReceiptService
|
||||
from utils.response_util import ResponseUtil
|
||||
|
||||
shipment_receipt_controller = APIRouterPro(
|
||||
prefix='/business/shipment-receipt',
|
||||
tags=['业务管理-发货收货核对'],
|
||||
dependencies=[PreAuthDependency()],
|
||||
)
|
||||
|
||||
|
||||
@shipment_receipt_controller.get(
|
||||
'/list',
|
||||
response_model=PageResponseModel[ShipmentModel],
|
||||
summary='查询目标现场收货单',
|
||||
dependencies=[UserInterfaceAuthDependency('business:shipment:receive')],
|
||||
)
|
||||
async def list_shipment_receipts(
|
||||
request: Request,
|
||||
query: Annotated[ShipmentReceiptQueryModel, Query()],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
|
||||
) -> Response:
|
||||
result = await ShipmentReceiptService.list_services(query_db, query, current_user, test_scope)
|
||||
return ResponseUtil.success(model_content=result)
|
||||
|
||||
|
||||
@shipment_receipt_controller.get(
|
||||
'/{shipment_id}',
|
||||
response_model=DataResponseModel[ShipmentReceiptModel],
|
||||
summary='查询原发货核对明细',
|
||||
dependencies=[UserInterfaceAuthDependency('business:shipment:receive')],
|
||||
)
|
||||
async def get_shipment_receipt(
|
||||
request: Request,
|
||||
shipment_id: Annotated[int, Path(gt=0)],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
|
||||
) -> Response:
|
||||
result = await ShipmentReceiptService.detail_services(query_db, shipment_id, current_user, test_scope)
|
||||
return ResponseUtil.success(data=result)
|
||||
|
||||
|
||||
@shipment_receipt_controller.get(
|
||||
'/{shipment_id}/scan/{identifier:path}',
|
||||
response_model=DataResponseModel[ShipmentReceiptItemModel],
|
||||
summary='扫码或录入原托盘号核对',
|
||||
dependencies=[UserInterfaceAuthDependency('business:shipment:receive')],
|
||||
)
|
||||
@Log(
|
||||
title='收货扫码',
|
||||
business_type=BusinessType.OTHER,
|
||||
request_log_mode='none',
|
||||
response_log_mode='summary',
|
||||
oper_url_mode='route',
|
||||
)
|
||||
async def scan_shipment_receipt(
|
||||
request: Request,
|
||||
shipment_id: Annotated[int, Path(gt=0)],
|
||||
identifier: Annotated[str, Path(min_length=1, max_length=128, pattern=r'\S')],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
|
||||
) -> Response:
|
||||
result = await ShipmentReceiptService.scan_services(query_db, shipment_id, identifier, current_user, test_scope)
|
||||
return ResponseUtil.success(data=result)
|
||||
|
||||
|
||||
@shipment_receipt_controller.put(
|
||||
'/{shipment_id}/confirm',
|
||||
response_model=ResponseBaseModel,
|
||||
summary='接收方确认核对收货',
|
||||
dependencies=[UserInterfaceAuthDependency('business:shipment:receive')],
|
||||
)
|
||||
@Log(title='发货收货核对', business_type=BusinessType.UPDATE)
|
||||
async def confirm_shipment_receipt(
|
||||
request: Request,
|
||||
shipment_id: Annotated[int, Path(gt=0)],
|
||||
command: ShipmentReceiptCommandModel,
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
) -> Response:
|
||||
result = await ShipmentReceiptService.confirm_services(query_db, shipment_id, command, current_user, test_scope)
|
||||
return ResponseUtil.success(msg=result.message)
|
||||
@@ -0,0 +1,126 @@
|
||||
from datetime import datetime
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Path, Query, Request, Response
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.annotation.log_annotation import Log
|
||||
from common.aspect.db_seesion import DBSessionDependency
|
||||
from common.aspect.interface_auth import UserInterfaceAuthDependency
|
||||
from common.aspect.pre_auth import CurrentUserDependency, PreAuthDependency
|
||||
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.master_vo import DeleteTunnelModel, TunnelModel, TunnelPageQueryModel
|
||||
from module_business.service.master_service import MasterService
|
||||
from utils.response_util import ResponseUtil
|
||||
|
||||
tunnel_controller = APIRouterPro(
|
||||
prefix='/master/tunnel',
|
||||
tags=['基础资料-隧道管理'],
|
||||
dependencies=[PreAuthDependency()],
|
||||
)
|
||||
|
||||
|
||||
@tunnel_controller.get(
|
||||
'/list',
|
||||
summary='获取隧道分页列表接口',
|
||||
description='用于获取客户现场隧道分页列表',
|
||||
response_model=PageResponseModel[TunnelModel],
|
||||
dependencies=[UserInterfaceAuthDependency('master:tunnel:list')],
|
||||
)
|
||||
async def get_master_tunnel_list(
|
||||
request: Request,
|
||||
tunnel_page_query: Annotated[TunnelPageQueryModel, Query()],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
|
||||
) -> Response:
|
||||
result = await MasterService.list_tunnel(query_db, tunnel_page_query, scope, is_page=True)
|
||||
return ResponseUtil.success(model_content=result)
|
||||
|
||||
|
||||
@tunnel_controller.get(
|
||||
'/{tunnel_id}',
|
||||
summary='获取隧道详情接口',
|
||||
description='用于获取指定隧道的详细信息',
|
||||
response_model=DataResponseModel[TunnelModel],
|
||||
dependencies=[UserInterfaceAuthDependency('master:tunnel:query')],
|
||||
)
|
||||
async def query_detail_master_tunnel(
|
||||
request: Request,
|
||||
tunnel_id: Annotated[int, Path(gt=0, description='隧道ID')],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
|
||||
) -> Response:
|
||||
result = await MasterService.detail_tunnel(query_db, tunnel_id, scope)
|
||||
return ResponseUtil.success(data=result)
|
||||
|
||||
|
||||
@tunnel_controller.post(
|
||||
'',
|
||||
summary='新增隧道接口',
|
||||
description='用于新增客户现场隧道',
|
||||
response_model=ResponseBaseModel,
|
||||
dependencies=[UserInterfaceAuthDependency('master:tunnel:add')],
|
||||
)
|
||||
@Log(title='隧道管理', business_type=BusinessType.INSERT)
|
||||
async def add_master_tunnel(
|
||||
request: Request,
|
||||
add_tunnel: TunnelModel,
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
) -> Response:
|
||||
current_time = datetime.now()
|
||||
add_tunnel.create_by = current_user.user.user_name
|
||||
add_tunnel.create_time = current_time
|
||||
add_tunnel.update_by = current_user.user.user_name
|
||||
add_tunnel.update_time = current_time
|
||||
result = await MasterService.add_tunnel(query_db, add_tunnel, current_user, scope)
|
||||
return ResponseUtil.success(msg=result.message)
|
||||
|
||||
|
||||
@tunnel_controller.put(
|
||||
'',
|
||||
summary='编辑隧道接口',
|
||||
description='用于编辑客户现场隧道',
|
||||
response_model=ResponseBaseModel,
|
||||
dependencies=[UserInterfaceAuthDependency('master:tunnel:edit')],
|
||||
)
|
||||
@Log(title='隧道管理', business_type=BusinessType.UPDATE)
|
||||
async def edit_master_tunnel(
|
||||
request: Request,
|
||||
edit_tunnel: TunnelModel,
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
) -> Response:
|
||||
edit_tunnel.update_by = current_user.user.user_name
|
||||
edit_tunnel.update_time = datetime.now()
|
||||
result = await MasterService.edit_tunnel(query_db, edit_tunnel, current_user, scope)
|
||||
return ResponseUtil.success(msg=result.message)
|
||||
|
||||
|
||||
@tunnel_controller.delete(
|
||||
'/{tunnel_ids}',
|
||||
summary='兼容旧接口,固定拒绝,请使用测试数据批次清理',
|
||||
description='兼容旧接口,固定拒绝单条物理删除,请使用测试数据批次清理',
|
||||
response_model=ResponseBaseModel,
|
||||
dependencies=[UserInterfaceAuthDependency('master:tunnel:remove')],
|
||||
)
|
||||
@Log(title='隧道管理', business_type=BusinessType.DELETE)
|
||||
async def delete_master_tunnel(
|
||||
request: Request,
|
||||
tunnel_ids: Annotated[
|
||||
str,
|
||||
Path(pattern=r'^[1-9]\d*(,[1-9]\d*)*$', description='需要删除的隧道ID'),
|
||||
],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
) -> Response:
|
||||
delete_tunnel = DeleteTunnelModel(tunnelIds=[int(tunnel_id) for tunnel_id in tunnel_ids.split(',')])
|
||||
result = await MasterService.remove_tunnel(query_db, delete_tunnel)
|
||||
return ResponseUtil.success(msg=result.message)
|
||||
@@ -18,6 +18,8 @@ from module_business.domain.test_batch_scope import TestBatchScope
|
||||
from module_business.entity.vo.operation_vo import (
|
||||
BusinessOptionModel,
|
||||
PalletScanResponseModel,
|
||||
TunnelEntryCreateModel,
|
||||
TunnelEntrySuccessResponseModel,
|
||||
UsageCreateModel,
|
||||
UsageModel,
|
||||
UsagePageQueryModel,
|
||||
@@ -76,7 +78,44 @@ async def get_business_usage_line_options(
|
||||
|
||||
|
||||
@usage_controller.get(
|
||||
'/scan/{qr_token}',
|
||||
'/tunnel-options',
|
||||
summary='获取客户现场启用隧道选项接口',
|
||||
description='仅返回当前用户有权访问的指定客户现场启用隧道',
|
||||
response_model=DataResponseModel[list[BusinessOptionModel]],
|
||||
dependencies=[UserInterfaceAuthDependency('business:usage:query')],
|
||||
)
|
||||
async def get_business_usage_tunnel_options(
|
||||
request: Request,
|
||||
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_tunnel_options_services(query_db, site_id, current_user, test_scope)
|
||||
return ResponseUtil.success(data=result)
|
||||
|
||||
|
||||
@usage_controller.post(
|
||||
'/enter-tunnel',
|
||||
summary='扫码入隧接口',
|
||||
description='将单个已到客户现场的托盘绑定到指定隧道,并生成或复用隧道内部溯源号',
|
||||
response_model=DataResponseModel[TunnelEntrySuccessResponseModel],
|
||||
dependencies=[UserInterfaceAuthDependency('business:usage:add')],
|
||||
)
|
||||
@Log(title='扫码入隧', business_type=BusinessType.INSERT)
|
||||
async def enter_business_usage_tunnel(
|
||||
request: Request,
|
||||
entry_command: TunnelEntryCreateModel,
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
|
||||
) -> Response:
|
||||
result = await UsageService.enter_tunnel_services(query_db, entry_command, current_user, test_scope)
|
||||
return ResponseUtil.success(msg=result.message, data=result.result)
|
||||
|
||||
|
||||
@usage_controller.get(
|
||||
'/scan/{qr_token:path}',
|
||||
summary='扫描客户现场待使用托盘接口',
|
||||
description='按托盘当前客户现场数据范围判断是否允许记录使用',
|
||||
response_model=DataResponseModel[PalletScanResponseModel],
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
"""只读先进先出建议;不强行阻断会议要求的多批次混用。"""
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Query, Request, Response
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.aspect.db_seesion import DBSessionDependency
|
||||
from common.aspect.interface_auth import UserInterfaceAuthDependency
|
||||
from common.aspect.pre_auth import CurrentUserDependency, PreAuthDependency
|
||||
from common.router import APIRouterPro
|
||||
from common.vo import DataResponseModel
|
||||
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.usage_fifo_vo import UsageFifoRecommendationModel
|
||||
from module_business.service.usage_fifo_service import UsageFifoService
|
||||
from utils.response_util import ResponseUtil
|
||||
|
||||
usage_fifo_controller = APIRouterPro(
|
||||
prefix='/business/usage-fifo',
|
||||
tags=['业务管理-客户现场使用'],
|
||||
dependencies=[PreAuthDependency(), UserInterfaceAuthDependency('business:usage:query')],
|
||||
)
|
||||
|
||||
|
||||
@usage_fifo_controller.get('/recommendation', response_model=DataResponseModel[UsageFifoRecommendationModel])
|
||||
async def get_usage_fifo_recommendation(
|
||||
request: Request,
|
||||
qr_token: Annotated[str, Query(alias='qrToken', min_length=1, max_length=128, pattern=r'\S')],
|
||||
query_db: Annotated[AsyncSession, DBSessionDependency()],
|
||||
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
|
||||
test_scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
|
||||
tunnel_id: Annotated[int | None, Query(alias='tunnelId', gt=0)] = None,
|
||||
) -> Response:
|
||||
result = await UsageFifoService.recommendation(
|
||||
query_db, qr_token, current_user, test_scope, tunnel_id=tunnel_id,
|
||||
)
|
||||
return ResponseUtil.success(data=result)
|
||||
Reference in New Issue
Block a user