WMS_MAIN/app/model/print_record.js

87 lines
2.1 KiB
JavaScript
Raw 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";
module.exports = app => {
const { BIGINT, STRING, JSON, ENUM, TEXT, DATE } = app.Sequelize;
const PrintRecord = app.model.define("PrintRecord", {
id: {
type: BIGINT.UNSIGNED,
autoIncrement: true,
primaryKey: true,
comment: "主键ID",
},
warehouse_id: {
type: BIGINT.UNSIGNED,
allowNull: false,
comment: "仓库ID",
},
computer_id: {
type: BIGINT.UNSIGNED,
allowNull: false,
comment: "电脑ID",
},
printer: {
type: STRING(100),
allowNull: false,
comment: "打印机名称/标识",
},
type: {
type: STRING(50),
allowNull: false,
comment: "打印类型",
},
data: {
type: JSON,
allowNull: true,
comment: "打印数据(JSON格式)",
},
status: {
type: ENUM("pending", "sent", "success", "failed"),
allowNull: false,
defaultValue: "pending",
comment: "打印状态:pending-待发送,sent-已发送,success-打印成功,failed-打印失败",
},
error_message: {
type: TEXT,
allowNull: true,
comment: "错误信息",
},
sent_time: {
type: DATE,
allowNull: true,
comment: "发送时间",
},
print_time: {
type: DATE,
allowNull: true,
comment: "打印完成时间",
},
created_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal("CURRENT_TIMESTAMP"),
comment: "创建时间",
},
updated_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal("CURRENT_TIMESTAMP"),
comment: "更新时间",
},
}, {
tableName: "wms_print_record",
freezeTableName: true,
underscored: false,
timestamps: false,
indexes: [
{ name: "idx_warehouse_id", fields: ["warehouse_id"] },
{ name: "idx_computer_id", fields: ["computer_id"] },
{ name: "idx_status", fields: ["status"] },
{ name: "idx_created_at", fields: ["created_at"] },
{ name: "idx_sent_time", fields: ["sent_time"] },
],
comment: "打印记录表",
});
return PrintRecord;
};