oms/backend/app/lib/billStatus.js
liufumingren 489563a4b2 feat(backend): 仪表盘报表接口、配置裁剪、单号 5 位与账号名称/头像
- 仪表盘报表:新增 app/service/dashboard.js + app/controller/dashboard.js +
  app/lib/billStatus.js,注册 GET /api/dashboard/report(jwtAuth + principalCheck),
  一次聚合返回概览指标、发货单/入库单/出库单状态分布与待办、近 N 天单据量与
  出入库数量趋势、库存 Top 商品、最近出入库流水;warehouse_id 只过滤单据与流水
  (product_stocks 无仓库维度);契约 dashboard* 同步到 swagger
- 接口配置裁剪:仓库接口配置只保留 api_version 与 item_name_with_spec;
  历史 warehouse_apis.extra 冗余键、owner_code 配置、递交/回传设置一并清理
  (迁移 20260915002400~02800)
- 入库/出库/发货单报文与字段对齐 WMS 标准:去掉 ownerCode、operatorCode 等多余字段,
  入库明细补 itemId;发货单明细去掉无意义的 owner_code(迁移 20260915002600)
- 单号 5 位起:四张单据表 AUTO_INCREMENT 提到 10000(迁移 20260915002900)
- 账号名称/头像按主体维护:principal_users 增 name/avatar 并回填(迁移 20260915003000/03100),
  新增 app/lib/accountProfile.js(关联表名称/头像 → users 兜底);审核人写入 operator/operator_name;
  register 不再写 nickname、updateProfile 仅接受邮箱/手机号
- 出库单推送/锁库存链路的配套调整(outboundOrderPush、订单与发货单控制器)

Co-Authored-By: GitHub Copilot <noreply@github.com>
2026-09-14 16:09:35 +08:00

44 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
/**
* 单据状态常量(入库单 / 出库单 / 发货单通用口径)。
*
* 状态由业务事务推动,不提供直接改状态的接口:
* 1 待处理 → 2 已审核(audit)→ 3 已推送(push)→ 4 已完成(complete / WMS 回传确认)
* 另有 5 已作废(void,仅已审核可作废)、9 已取消(cancel,可 restore 恢复)
*
* 说明:状态文案的单一来源,供仪表盘报表等聚合场景复用,避免前后端枚举漂移。
*/
const BILL_STATUS = {
PENDING: 1,
AUDITED: 2,
PUSHED: 3,
DONE: 4,
VOID: 5,
CANCELED: 9,
};
const BILL_STATUS_LABELS = {
1: '待处理',
2: '已审核',
3: '已推送',
4: '已完成',
5: '已作废',
9: '已取消',
};
/** 列表展示顺序(与业务流转顺序一致,取消/作废排最后) */
const BILL_STATUS_ORDER = [ 1, 2, 3, 4, 5, 9 ];
const BILL_STATUS_LIST = BILL_STATUS_ORDER.map(value => ({
value,
label: BILL_STATUS_LABELS[value],
}));
module.exports = {
BILL_STATUS,
BILL_STATUS_LABELS,
BILL_STATUS_ORDER,
BILL_STATUS_LIST,
};