// app/model/platform_print_config.js 'use strict'; module.exports = app => { const { BIGINT, STRING, INTEGER, DATE } = app.Sequelize; const PlatformPrintConfig = app.model.define('wms_platform_print_config', { id: { type: BIGINT, primaryKey: true, autoIncrement: true, allowNull: false, comment: '主键ID', }, platform: { type: STRING(50), allowNull: false, unique: true, comment: '平台名称', }, platform_code: { type: STRING(50), allowNull: false, comment: '平台代码', }, print_port: { type: STRING(20), allowNull: false, comment: '打印服务端口', }, print_url: { type: STRING(200), allowNull: true, comment: '打印服务URL', }, protocol_type: { type: STRING(20), allowNull: true, defaultValue: 'WEBSOCKET', comment: '协议类型:WEBSOCKET,HTTP', }, status: { type: STRING(20), allowNull: true, defaultValue: 'ACTIVE', comment: '状态:ACTIVE-启用,DISABLED-禁用', }, retry_count: { type: INTEGER, allowNull: true, defaultValue: 3, comment: '重试次数', }, timeout_seconds: { type: INTEGER, allowNull: true, defaultValue: 30, comment: '超时时间(秒)', }, description: { type: STRING(200), allowNull: true, comment: '描述', }, create_time: { type: DATE, allowNull: false, defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), comment: '创建时间', }, update_time: { type: DATE, allowNull: false, defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), comment: '更新时间', }, }, { tableName: 'wms_platform_print_config', timestamps: false, underscored: false, comment: '平台打印端口配置表', indexes: [ { name: 'uk_platform', unique: true, fields: [ 'platform' ], }, { name: 'idx_platform_code', fields: [ 'platform_code' ], }, ], }); return PlatformPrintConfig; };