'use strict'; /** * 到货登记 Model。 * 货主/仓库群发送"到货+车牌号"时,AI 提取车牌号并登记, * 记录货主ID、仓库ID、登记时间(created_at)、车牌号。 * @param {Object} app Egg.js Application 实例。 * @return {Object} Sequelize Model 定义。 */ module.exports = app => { const { BIGINT, STRING } = app.Sequelize; const InboxArrivalRegister = app.model.define('inbox_arrival_register', { id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true, allowNull: false, comment: '主键ID', }, warehouse_id: { type: BIGINT.UNSIGNED, allowNull: false, comment: '仓库ID(数据隔离维度)', }, store_id: { type: BIGINT.UNSIGNED, allowNull: true, comment: '货主ID(仓库群登记时无货主,允许为空)', }, license_plate: { type: STRING(20), allowNull: false, comment: '车牌号', }, consumed: { type: app.Sequelize.TINYINT(1), allowNull: false, defaultValue: 0, comment: '是否已消费(离场登记)0=未消费 1=已消费', }, consumed_at: { type: app.Sequelize.DATE, allowNull: true, comment: '消费时间(离场时间)', }, created_at: { type: app.Sequelize.DATE, allowNull: false, defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), comment: '登记时间', }, updated_at: { type: app.Sequelize.DATE, allowNull: false, defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'), comment: '更新时间', }, }, { tableName: 'wms_inbox_arrival_register', timestamps: true, createdAt: 'created_at', updatedAt: 'updated_at', // 表无 deleted_at 列,必须显式关闭全局 define 的 paranoid 默认值, // 否则 findAll/findOne 会拼出 deleted_at 字段导致 Unknown column 报错 paranoid: false, comment: '到货登记表(货主ID、仓库ID、登记时间、车牌号)', }); return InboxArrivalRegister; };