WMS_MAIN/app/service/systemMethods/printComputer.js
liufumingren f40370baca feat(print): 打印电脑管理增强(录制、软删除、独立接口)
- print_computer: 新增录制字段(is_recording/recording_size/remote_play_url/recording_directory/deleted_at)

- print_stations: 新增 deleted_at 软删除

- 新增 printComputer service (systemMethods + systems)

- order_print 重构: 商品信息从 picking 表直读,不再依赖 order_items

- 8 条迁移: 录制→软删除→权限→目录
2026-07-27 03:47:09 +08:00

82 lines
2.5 KiB
JavaScript

'use strict';
const MainService = require('../main');
class PrintComputerService extends MainService {
constructor(ctx) {
super(ctx);
const _noNeedLogin = '';
const _noNeedRight = '';
const _noNeedLog = '*';
const _noNeedAuth = '';
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
}
/**
* 打印电脑列表。
* @param {Object} data 查询参数 { pagination, where }
* @return {Promise<Object>} 列表数据与分页信息
*/
async list(data) {
try {
const result = await this.service.systems.printComputer.list(data || {});
return this.success('获取成功', result);
} catch (e) { return this.fail(e.message); }
}
/**
* 更新打印电脑。
* @param {Object} data { id, name? }
* @return {Promise<Object>} 更新后的电脑记录
*/
async update(data) {
try {
const { id, ...fields } = data || {};
if (!id) return this.fail('ID不能为空');
return this.success('更新成功', await this.service.systems.printComputer.update(parseInt(id), fields));
} catch (e) { return this.fail(e.message); }
}
/**
* 设置录制电脑(会先取消同仓库下其他录制电脑)。
* @param {Object} data { id, recording_size_value, recording_size_unit, remote_play_url, recording_directory }
* @return {Promise<Object>} 设置结果
*/
async setRecording(data) {
try {
const { id, ...fields } = data || {};
if (!id) return this.fail('ID不能为空');
return this.success('设置录制成功', await this.service.systems.printComputer.setRecording(parseInt(id), fields));
} catch (e) { return this.fail(e.message); }
}
/**
* 取消录制电脑。
* @param {Object} data { id }
* @return {Promise<Object>} 取消结果
*/
async cancelRecording(data) {
try {
const { id } = data || {};
if (!id) return this.fail('ID不能为空');
return this.success('取消录制成功', await this.service.systems.printComputer.cancelRecording(parseInt(id)));
} catch (e) { return this.fail(e.message); }
}
/**
* 软删除打印电脑。
* @param {Object} data { id }
* @return {Promise<Object>} 删除结果
*/
async delete(data) {
try {
const { id } = data || {};
if (!id) return this.fail('ID不能为空');
await this.service.systems.printComputer.delete(parseInt(id));
return this.success('删除成功');
} catch (e) { return this.fail(e.message); }
}
}
module.exports = PrintComputerService;