2026-04-17 19:21:57 +08:00

62 lines
1.6 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';
const MainService = require('../../main');
/**
* 系统方法层:storage.expiry(库存有效期列表包装层)。
* 职责:拆解 where 与分页参数,调用库存有效期业务服务并统一包装响应。
*/
class StorageExpiryMethodService extends MainService {
constructor(ctx) {
super(ctx);
const _noNeedLogin = '';
const _noNeedRight = 'list';
const _noNeedLog = 'list';
const _noNeedAuth = 'list';
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
}
/**
* 查询库存有效期预警列表。
*
* @param {Object} data 请求体
* @param {Object} [data.where] 查询条件
* @param {Object} [data.pagination] 分页参数
* @return {Promise<Object>} 统一 success 包装响应
*/
async list(data = {}) {
const { service } = this;
const { pagination } = data;
const { where } = this.prepareWhereContext(data, {
specialFieldMap: {
item_code: {
bucket: 'stock',
},
goods_code: {
bucket: 'stock',
},
item_name: {
bucket: 'stock',
},
sku_property: {
bucket: 'stock',
},
stock_unit: {
bucket: 'stock',
},
is_shelf_life_mgmt: {
bucket: 'stock',
field: 'is_shelf_life_mgmt',
},
remaining_threshold_days: {
bucket: 'stock',
},
},
});
const result = await service.systems.storage.expiry.list(where, pagination);
return this.success('ok', result);
}
}
module.exports = StorageExpiryMethodService;