docs: 仓储报表微调 + methods 接口文档同步更新
- storage/report: 报表逻辑微调 - methods/system.json: storeWarehouse 系列接口文档更新 - methods/changes/system.json: 新增 2026.07.08/07.09 变更记录
This commit is contained in:
parent
ca5c8a269e
commit
6d58d7ff1f
@ -71,6 +71,8 @@ class StorageReportMethodService extends MainService {
|
||||
* @param {string|Date} [data.where.end_time] 结束时间
|
||||
* @param {boolean|string|number} [data.where.by_space=false] 是否按库位返回
|
||||
* @param {Array<number|string>} [data.where.store_ids] 货主ID列表
|
||||
* @param {string} [data.export_mode] 导出模式:'item' 导出含锁定类型的全部变更记录,不传则排除锁定类型
|
||||
* @param {string} [data.exportMode] 导出模式(驼峰写法,同 export_mode)
|
||||
* @return {Promise<Object>} 统一 success 包装(返回任务ID)
|
||||
*/
|
||||
async export(data = {}) {
|
||||
@ -95,6 +97,8 @@ class StorageReportMethodService extends MainService {
|
||||
sortOrder: sortOrderCamel,
|
||||
} = sort || {};
|
||||
|
||||
const exportMode = String(data.export_mode || data.exportMode || '').trim();
|
||||
|
||||
const taskId = this.generateExportTaskId();
|
||||
const taskPayload = {
|
||||
task_id: taskId,
|
||||
@ -123,7 +127,7 @@ class StorageReportMethodService extends MainService {
|
||||
error: '',
|
||||
});
|
||||
|
||||
const result = await service.systems.storage.report.export(startTime, endTime, bySpace, storeIds, sortOption);
|
||||
const result = await service.systems.storage.report.export(startTime, endTime, bySpace, storeIds, sortOption, exportMode);
|
||||
|
||||
await this.setExportTaskProgress(taskId, {
|
||||
task_id: taskId,
|
||||
|
||||
@ -514,9 +514,10 @@ class StorageReportService extends Service {
|
||||
* @param {Object} [sort] 排序参数
|
||||
* @param {string} [sort.sortField] 排序字段
|
||||
* @param {string} [sort.sortOrder] 排序顺序
|
||||
* @param {string} [exportMode] 导出模式:'item' 导出全部(含锁定),不传/其他值则排除锁定类型记录
|
||||
* @return {Promise<Object>} excel 上传结果
|
||||
*/
|
||||
async export(startTime, endTime, bySpace = false, storeIds = [], sort = null) {
|
||||
async export(startTime, endTime, bySpace = false, storeIds = [], sort = null, exportMode = '') {
|
||||
const { ctx, app } = this;
|
||||
const searchResult = await this.search(startTime, endTime, bySpace, storeIds, sort);
|
||||
if (!searchResult || searchResult.code !== 200) {
|
||||
@ -552,6 +553,12 @@ class StorageReportService extends Service {
|
||||
replacements.storeIds = normalizedStoreIds;
|
||||
}
|
||||
|
||||
const normalizedExportMode = String(exportMode || '').trim();
|
||||
if (normalizedExportMode !== 'item') {
|
||||
whereClauses.push('t.transaction_type != :excludeLockType');
|
||||
replacements.excludeLockType = 'LOCK';
|
||||
}
|
||||
|
||||
const detailTransactionTable = isBySpace ? 'wms_storage_transaction' : 'wms_stock_transaction';
|
||||
const detailSpaceSelectSql = isBySpace ? 'COALESCE(t.space_id, 0) AS space_id' : '0 AS space_id';
|
||||
const detailInventoryTypeSelectSql = isBySpace ? 't.inventory_type' : '\'\' AS inventory_type';
|
||||
|
||||
@ -1,4 +1,42 @@
|
||||
[
|
||||
{
|
||||
"version": "2026.07.09-system-01",
|
||||
"date": "2026-07-09",
|
||||
"type": "updated",
|
||||
"summary": "签约 sign 方法改造:统一当前主体→store_id,解除角色校验,仓库可签仓库",
|
||||
"methods": [
|
||||
"storeWarehouse.store.sign",
|
||||
"storeWarehouse.warehouse.sign"
|
||||
],
|
||||
"notes": [
|
||||
"resolvePairIds:统一当前主体始终在 store_id(货主方/消费方),对方在 warehouse_id(仓库方/提供方)。不再根据 isWarehouse 分支。",
|
||||
"getCounterparty:移除 expectedRole 角色校验(仓库不再只能签货主,可签仓库)。",
|
||||
"findScopedRelation:改为 OR 查询 store_id/warehouse_id 两边,兼容新旧签约数据。",
|
||||
"sign preview:counterparty.role 改为根据对方 project 真实返回(warehouse/store),不再硬编码反推。",
|
||||
"签仓库:仓库发起签约时对方 ID 传 counterparty_id,系统自动将当前仓库放 store_id。"
|
||||
],
|
||||
"module": "storeWarehouse"
|
||||
},
|
||||
{
|
||||
"version": "2026.07.08-system-01",
|
||||
"date": "2026-07-08",
|
||||
"type": "updated",
|
||||
"summary": "storeWarehouse.store.list 与 storeWarehouse.warehouse.list 拆分实现,不再共用;仓库侧支持查询外部合作仓库",
|
||||
"methods": [
|
||||
"storeWarehouse.store.list",
|
||||
"storeWarehouse.warehouse.list"
|
||||
],
|
||||
"notes": [
|
||||
"拆分:store.list 调用 listForStore,warehouse.list 调用 listForWarehouse,不再共用同一个 list 方法。",
|
||||
"新规则:两个方法均按 store_id = 当前主体ID 过滤(主体在 store_id 为货主方/消费方,对方在 warehouse_id 为仓库方/提供方)。",
|
||||
"warehouse.list 新增支持查询外部合作仓库:当对方主体的 project='warehouse' 时为仓库-仓库合作,counterparty_role='warehouse'。",
|
||||
"响应新增 counterparty_role 字段(store/warehouse),标识对方主体的真实角色。",
|
||||
"warehouse.list 响应 use_status 改为 store_use_status(仓库在 store_id 方时,己方启用状态应为 store_use_status)。",
|
||||
"旧 list 方法保留标记为 @deprecated,保持向后兼容。",
|
||||
"新增 buildListWhereByStoreId 统一按 store_id 维度构建查询条件。"
|
||||
],
|
||||
"module": "storeWarehouse"
|
||||
},
|
||||
{
|
||||
"version": "2026.07.06-system-01",
|
||||
"date": "2026-07-06",
|
||||
|
||||
@ -22650,7 +22650,7 @@
|
||||
"list": [
|
||||
{
|
||||
"method": "storeWarehouse.store.list",
|
||||
"description": "查询当前主体可见的仓库-货主签约列表",
|
||||
"description": "查询当前主体可见的签约列表(当前主体在 store_id 方,对方在 warehouse_id 方)",
|
||||
"isNeedAuth": false,
|
||||
"isNeedLogin": true,
|
||||
"headers": [
|
||||
@ -22725,6 +22725,11 @@
|
||||
"type": "string",
|
||||
"description": "对方主体名称"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].counterparty_role",
|
||||
"type": "string",
|
||||
"description": "对方主体角色:warehouse 或 store"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].current_subject_role",
|
||||
"type": "string",
|
||||
@ -22865,7 +22870,7 @@
|
||||
},
|
||||
{
|
||||
"method": "storeWarehouse.store.sign",
|
||||
"description": "发起或确认仓库-货主签约",
|
||||
"description": "发起或确认签约(当前主体始终为 store_id 方/消费方,对方为 warehouse_id 方/提供方,支持仓库签仓库)",
|
||||
"isNeedAuth": false,
|
||||
"isNeedLogin": true,
|
||||
"headers": [
|
||||
@ -22878,18 +22883,11 @@
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"name": "store_id",
|
||||
"name": "counterparty_id",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"required": true,
|
||||
"source": "body",
|
||||
"description": "货主ID;由仓库侧发起时必传"
|
||||
},
|
||||
{
|
||||
"name": "warehouse_id",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "仓库ID;由货主侧发起时必传"
|
||||
"description": "对方主体 ID(兼容 warehouse_id / store_id),当前主体自动识别"
|
||||
},
|
||||
{
|
||||
"name": "temp_code",
|
||||
@ -23606,7 +23604,7 @@
|
||||
"list": [
|
||||
{
|
||||
"method": "storeWarehouse.warehouse.list",
|
||||
"description": "仓库侧查询当前仓库可见的货主签约列表",
|
||||
"description": "仓库侧查询签约列表(支持查询外部合作仓库),当前仓库在 store_id 方(消费方),对方在 warehouse_id 方(提供方)",
|
||||
"isNeedAuth": false,
|
||||
"isNeedLogin": true,
|
||||
"headers": [
|
||||
@ -23637,41 +23635,150 @@
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "搜索关键字,模糊匹配货主备注名、仓库备注名、货主公司名、仓库公司名"
|
||||
"description": "搜索关键字,模糊匹配己方备注名、对方备注名、己方公司名、对方公司名"
|
||||
},
|
||||
{
|
||||
"name": "warehouse_id",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "对方主体 ID(兼容 counterparty_id)"
|
||||
},
|
||||
{
|
||||
"name": "auth_status",
|
||||
"type": "string",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "授权状态筛选"
|
||||
"description": "授权状态筛选:1=申请中 2=已通过 3=已拒绝 4=已解除 5=已过期"
|
||||
},
|
||||
{
|
||||
"name": "use_status",
|
||||
"type": "number",
|
||||
"required": false,
|
||||
"source": "body",
|
||||
"description": "己方启用状态:0=禁用 1=启用"
|
||||
}
|
||||
],
|
||||
"response": [
|
||||
{
|
||||
"name": "list",
|
||||
"name": "data.list",
|
||||
"type": "array",
|
||||
"description": "签约列表"
|
||||
"description": "签约关系列表"
|
||||
},
|
||||
{
|
||||
"name": "total",
|
||||
"name": "data.list[].id",
|
||||
"type": "number",
|
||||
"description": "总条数"
|
||||
"description": "签约关系主键 ID"
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"name": "data.list[].store_id",
|
||||
"type": "number",
|
||||
"description": "己方主体 ID(当前仓库)"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].store_name",
|
||||
"type": "string",
|
||||
"description": "己方主体名称"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].warehouse_id",
|
||||
"type": "number",
|
||||
"description": "对方主体 ID"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].warehouse_name",
|
||||
"type": "string",
|
||||
"description": "对方主体名称"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].counterparty_id",
|
||||
"type": "number",
|
||||
"description": "对方主体 ID(同 warehouse_id)"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].counterparty_name",
|
||||
"type": "string",
|
||||
"description": "对方主体名称"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].counterparty_role",
|
||||
"type": "string",
|
||||
"description": "对方主体角色:warehouse(外部合作仓库)或 store(货主)"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].remask",
|
||||
"type": "string",
|
||||
"description": "己方对本次签约的备注名"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].use_status",
|
||||
"type": "number",
|
||||
"description": "己方启用状态:0=禁用 1=启用"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].auth_status",
|
||||
"type": "number",
|
||||
"description": "签约状态:1=申请中 2=已通过 3=已拒绝 4=已解除 5=已过期"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].auth_status_label",
|
||||
"type": "string",
|
||||
"description": "签约状态中文标签"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].auth_end",
|
||||
"type": "string|null",
|
||||
"description": "授权结束时间"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].print_quantity",
|
||||
"type": "number",
|
||||
"description": "面单余额数量"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].has_qimen_config",
|
||||
"type": "boolean",
|
||||
"description": "是否已配置奇门"
|
||||
},
|
||||
{
|
||||
"name": "data.list[].needs_my_confirm",
|
||||
"type": "boolean",
|
||||
"description": "是否需要当前仓库确认签约(对方发起且状态为申请中)"
|
||||
},
|
||||
{
|
||||
"name": "data.total",
|
||||
"type": "number",
|
||||
"description": "总记录数"
|
||||
},
|
||||
{
|
||||
"name": "data.page",
|
||||
"type": "number",
|
||||
"description": "当前页码"
|
||||
},
|
||||
{
|
||||
"name": "page_size",
|
||||
"name": "data.page_size",
|
||||
"type": "number",
|
||||
"description": "每页条数"
|
||||
},
|
||||
{
|
||||
"name": "current_subject",
|
||||
"name": "data.current_subject",
|
||||
"type": "object",
|
||||
"description": "当前主体信息,含 store_id、company_name、role(warehouse/store)"
|
||||
"description": "当前主体信息"
|
||||
},
|
||||
{
|
||||
"name": "data.current_subject.store_id",
|
||||
"type": "number",
|
||||
"description": "当前主体 ID"
|
||||
},
|
||||
{
|
||||
"name": "data.current_subject.company_name",
|
||||
"type": "string",
|
||||
"description": "当前主体公司名称"
|
||||
},
|
||||
{
|
||||
"name": "data.current_subject.role",
|
||||
"type": "string",
|
||||
"description": "当前主体角色:warehouse"
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user