WMS_MAIN/app/model/express_print_record.js

205 lines
4.3 KiB
JavaScript

'use strict';
module.exports = app => {
const { BIGINT, STRING, INTEGER, DATE, TEXT, JSON } = app.Sequelize;
const ExpressPrintRecord = app.model.define('express_print_record', {
id: {
type: BIGINT(20),
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '主键ID',
},
express_id: {
type: BIGINT(20),
allowNull: false,
comment: '快递记录ID',
},
order_id: {
type: STRING(50),
allowNull: false,
comment: '订单ID',
},
express_no: {
type: STRING(50),
allowNull: false,
comment: '快递单号',
},
platform: {
type: STRING(50),
allowNull: false,
comment: '平台编码',
},
template_id: {
type: BIGINT(20),
allowNull: false,
comment: '模板ID',
},
template_url: {
type: STRING(500),
allowNull: true,
comment: '模板URL',
},
printer_name: {
type: STRING(100),
allowNull: true,
comment: '打印机名称',
},
printer_config_id: {
type: BIGINT(20),
allowNull: true,
comment: '打印配置ID',
},
print_data: {
type: JSON,
allowNull: false,
comment: '打印请求数据',
},
encrypted_data: {
type: TEXT,
allowNull: true,
comment: '加密数据',
},
signature: {
type: STRING(500),
allowNull: true,
comment: '签名',
},
add_data: {
type: JSON,
allowNull: true,
comment: '附加数据',
},
custom_data: {
type: JSON,
allowNull: true,
comment: '自定义数据',
},
print_status: {
type: STRING(20),
allowNull: false,
defaultValue: 'PENDING',
comment: '打印状态',
},
print_count: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '打印次数',
},
last_print_time: {
type: DATE,
allowNull: true,
comment: '最近打印时间',
},
next_retry_time: {
type: DATE,
allowNull: true,
comment: '下次重试时间',
},
request_id: {
type: STRING(100),
allowNull: true,
comment: '请求ID',
},
document_id: {
type: STRING(100),
allowNull: true,
comment: '文档ID',
},
batch_no: {
type: STRING(50),
allowNull: true,
comment: '批次号',
},
print_result: {
type: TEXT,
allowNull: true,
comment: '打印结果',
},
error_message: {
type: STRING(500),
allowNull: true,
comment: '错误信息',
},
print_cost_time: {
type: INTEGER(11),
allowNull: true,
comment: '打印耗时(ms)',
},
create_interface: {
type: STRING(100),
allowNull: true,
comment: '创建接口名',
},
print_interface: {
type: STRING(100),
allowNull: true,
comment: '打印接口名',
},
operator_id: {
type: BIGINT(20),
allowNull: true,
comment: '操作人ID',
},
warehouse_id: {
type: BIGINT(20),
allowNull: true,
comment: '仓库ID',
},
create_time: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间',
},
print_time: {
type: DATE,
allowNull: true,
comment: '打印时间',
},
update_time: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '更新时间',
},
}, {
tableName: 'wms_express_print_record',
freezeTableName: true,
underscored: true,
timestamps: false,
comment: '快递面单打印记录表',
indexes: [
{
name: 'idx_express_id',
fields: [ 'express_id' ],
},
{
name: 'idx_order_id',
fields: [ 'order_id' ],
},
{
name: 'idx_express_no',
fields: [ 'express_no' ],
},
{
name: 'uk_request_id',
unique: true,
fields: [ 'request_id' ],
},
{
name: 'idx_warehouse_id',
fields: [ 'warehouse_id' ],
},
{
name: 'idx_print_status',
fields: [ 'print_status' ],
},
],
});
return ExpressPrintRecord;
};