46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
'use strict';
|
||
|
||
const MainService = require('../../main');
|
||
|
||
/**
|
||
* 系统方法层:storage.management(库存管理接口包装层)。
|
||
*/
|
||
class StorageManagementMethodService extends MainService {
|
||
constructor(ctx) {
|
||
super(ctx);
|
||
const _noNeedLogin = '';
|
||
const _noNeedRight = 'replenishmentDemand';
|
||
const _noNeedLog = '';
|
||
const _noNeedAuth = 'replenishmentDemand';
|
||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||
}
|
||
|
||
/**
|
||
* 分拣缺货补货需求计算。
|
||
*
|
||
* 仓库级别的计算,针对当前仓库所有未完成储位分配的订单,
|
||
* 计算每个 SKU 在分拣区与存货区的可用库存对比,
|
||
* 输出分拣区缺口及建议补货量,供仓库人员决策移库。
|
||
*
|
||
* 仓库 ID 从用户上下文(ctx.user.store_id / ctx.user.warehouse_id)自动获取,无需显式传入。
|
||
*
|
||
* @param {Object} [data={}] 请求参数。
|
||
* @param {Object} [data.pagination] 分页参数。
|
||
* @param {Object} [data.sort] 排序参数。
|
||
* @return {Promise<Object>} 统一 success 包装的补货需求明细、汇总与分页信息。
|
||
*/
|
||
async replenishmentDemand(data = {}) {
|
||
const { service } = this;
|
||
const requestData = this.isPlainObject(data) ? data : {};
|
||
const pagination = requestData.pagination || {};
|
||
const sort = requestData.sort || requestData.order || {};
|
||
const result = await service.systems.storage.management.replenishmentDemand({
|
||
pagination,
|
||
sort,
|
||
});
|
||
return this.success('补货需求计算完成', result);
|
||
}
|
||
}
|
||
|
||
module.exports = StorageManagementMethodService;
|