feat(shipping-notice): 我的待办改版为表格加抽屉并新增已完成明细报表
- 阶段 tab 收敛 4 个可动作阶段,计数改后端全量聚合 - 通知完成拆明细平铺报表(筛选/分页/12 列导出),批量改情境浮动条 - 同步 i18n 四语言与文档
This commit is contained in:
1 parent
18af972d20
commit
d8299ebf20
21 files changed
+3315
-761
No files matched your search
@@ -199,6 +199,7 @@ def workspace_shipping_my_todos():
|
||||
todo_category=str(request.args.get('todo_category') or '').strip() or None,
|
||||
customer=str(request.args.get('customer') or '').strip() or None,
|
||||
task_no=str(request.args.get('task_no') or '').strip() or None,
|
||||
terminal_kind=str(request.args.get('terminal_kind') or '').strip() or None,
|
||||
))
|
||||
|
||||
|
||||
@@ -212,6 +213,67 @@ def workspace_shipping_my_todos_count():
|
||||
return _ok(count_my_todos(user.id, is_admin=is_admin))
|
||||
|
||||
|
||||
def _done_lines_report_params() -> dict[str, Any]:
|
||||
"""解析明细报表共用筛选参数(客户/料号/发货通知日期范围),供查询与导出复用。"""
|
||||
return {
|
||||
'customer': str(request.args.get('customer') or '').strip() or None,
|
||||
'part_number': str(request.args.get('part_number') or '').strip() or None,
|
||||
'notice_date_from': str(request.args.get('notice_date_from') or '').strip() or None,
|
||||
'notice_date_to': str(request.args.get('notice_date_to') or '').strip() or None,
|
||||
}
|
||||
|
||||
|
||||
@workspace_shipping_notice_bp.route('/shipping-tasks/my-todos/done-lines', methods=['GET'])
|
||||
def workspace_shipping_done_lines():
|
||||
"""
|
||||
分页列出已完成(已核验上传成功)通知的平铺明细行,供「通知完成」子视图报表。
|
||||
|
||||
核心逻辑:明细行跨 Notice 混排、不按 OT 聚合;支持 客户 / 料号 /
|
||||
发货通知日期范围 筛选;行结构为标准 12 字段 + 溯源编号(task_no/business_no)。
|
||||
"""
|
||||
user = _require_user()
|
||||
from app.services.shipping_notice.done_line_report import list_done_notice_lines
|
||||
|
||||
is_admin = str(getattr(user, 'role', '') or '').lower() == 'admin'
|
||||
try:
|
||||
page = int(request.args.get('page') or 1)
|
||||
page_size = int(request.args.get('page_size') or 20)
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise ValidationError('page and page_size must be integers') from exc
|
||||
return _ok(list_done_notice_lines(
|
||||
user.id,
|
||||
is_admin=is_admin,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
**_done_lines_report_params(),
|
||||
))
|
||||
|
||||
|
||||
@workspace_shipping_notice_bp.route('/shipping-tasks/my-todos/done-lines/export', methods=['GET'])
|
||||
def workspace_shipping_done_lines_export():
|
||||
"""
|
||||
导出当前筛选下的已完成通知明细 Excel。
|
||||
|
||||
核心逻辑:固定 12 列标准格式(客户/客户编号/订单日期/订单项次/料号/数量/
|
||||
约定出货日期/客户PO/已用数量/open qty/订单单号/单价),OT 编号不落列;
|
||||
已用数量 / open qty 无数据源留空。
|
||||
"""
|
||||
user = _require_user()
|
||||
from app.services.shipping_notice.done_line_report import build_done_lines_xlsx
|
||||
|
||||
is_admin = str(getattr(user, 'role', '') or '').lower() == 'admin'
|
||||
stream, filename = build_done_lines_xlsx(
|
||||
user.id,
|
||||
is_admin=is_admin,
|
||||
**_done_lines_report_params(),
|
||||
)
|
||||
response = send_file(
|
||||
stream, as_attachment=True, download_name=filename, mimetype=EXPORT_MIME_TYPE,
|
||||
)
|
||||
response.call_on_close(stream.close)
|
||||
return response
|
||||
|
||||
|
||||
def _batch_task_nos(data: dict) -> list[str]:
|
||||
"""校验批量任务号,统一限制 100 条并去重,避免前端循环绕过服务端门禁。"""
|
||||
raw_task_nos = data.get('task_nos')
|
||||
|
||||
Reference in new issue
Block a user