liufumingren b5e5d4d588 feat(storeWarehouse,report,notice,order): 签约导出与代开户备注兜底、报表meta下线、入库完成通知与编码规范化
- storeWarehouse: 货主签约列表异步导出 export/exportTaskProgress(26列中文表头Excel+进度回写);openAccount 代开户未传 store_remask(或传空)时默认取公司全称前50字符填充,保证货主名称在列表/导出中始终有值

- report: 下线 report.meta(破坏性),窗口参数改由 definition.typeList、勾选字段经 definition.list 提供;报表投递目标货主状态放宽为 1/2(正常/审核中);reportDelivery 实体展示名称兼容下划线/驼峰并优雅回退 ID

- notice/order: 入库单完成通知货主(entry_order_completed,固定订阅回退链:收货组→售后组→仓库异常群);入库明细 itemId 规范化(非法值降级按 item_code 精确/归一化条码匹配,剥离中文后缀,多命中报错防错配);库存预警定时任务与 webhook 模型调整

- storage: 快捷直入/入库单基本信息等相关小改(inbound_direct_log、storage/entry、storage/inventory)

- docs: methods/system 0.3.62→0.3.63、openapi/qimen 同步,AI_METHOD_ROUTING 与 report-config-guide 同步,methods/changes/*.json 补变更记录
2026-08-31 17:17:48 +08:00

58 lines
2.3 KiB
JavaScript
Raw 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';
const sevenDayStockFlow = require('./sevenDayStockFlow');
/**
* 报表内置查询器注册表。
* key 对应 wms_report_definition.type;
* 新增查询器时在此登记,签名统一为
* async ({ ctx, storeId, warehouseId, params }) => ({ windows, rows, meta })。
* 每个查询器需在模块上挂载静态字段清单 `fields`(如 module.exports.fields)
* 与缺省窗口参数 `defaultWindow`,供报表引擎 report.definition.typeList 读取。
* 注意:该对象会作为 service 模块导出,egg 加载器需要在其上挂载
* `Symbol(EGG_LOADER_ITEM_FULLPATH)` 等内部符号,因此禁止对导出对象使用
* Object.freeze / Object.seal / Object.preventExtensions。
* @type {Object<string, Function>}
*/
const QUERIES = {
stockFlow: sevenDayStockFlow,
};
/**
* 注册表描述元数据:key/title/description/window/fields。
* @type {Array<{key: string, title: string, description: string, window: Object, fields: Array<Object>}>}
*/
const DESCRIPTIONS = [
{
key: 'stockFlow',
title: '库存变化以及补货报表',
description: '按日窗口聚合出入库流水与正品库存,输出每 SKU 每日出/入库、可用/总库存、'
+ '锁定数、待出、日均出/入库、预计可售天数、建议补货量与库存预警',
window: {
...(sevenDayStockFlow.defaultWindow || { dayCount: 7, cutoverHour: 7 }),
},
fields: (Array.isArray(sevenDayStockFlow.fields) ? sevenDayStockFlow.fields : []).map(field => ({ ...field })),
},
];
/**
* 输出注册表可读描述(含全量字段清单),供 report.definition.typeList 复用。
* 返回副本,避免调用方误改注册表元数据。
* @return {Array<{key: string, title: string, description: string, window: Object, fields: Array<Object>}>} 注册描述列表
*/
function describe() {
return DESCRIPTIONS.map(entry => ({
...entry,
window: { ...(entry.window || {}) },
fields: (Array.isArray(entry.fields) ? entry.fields : []).map(field => ({
...field,
children: Array.isArray(field.children) ? field.children.map(child => ({ ...child })) : undefined,
})),
}));
}
// egg 加载器要求导出对象可扩展,describe 作为方法属性挂在 QUERIES 上
QUERIES.describe = describe;
module.exports = QUERIES;