'use strict'; module.exports = app => { const { STRING, INTEGER, BIGINT, ENUM, DATE } = app.Sequelize; const InboundDirectLog = app.model.define('wms_inbound_direct_log', { id: { type: BIGINT(20).UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键ID', }, warehouse_id: { type: BIGINT(20).UNSIGNED, allowNull: false, comment: '仓库ID', }, store_id: { type: BIGINT(20).UNSIGNED, allowNull: true, comment: '货主ID', }, stock_id: { type: BIGINT(20), allowNull: false, comment: '商品SKU ID,关联 wms_stock_warehouse.id', }, quantity: { type: INTEGER(12), allowNull: false, comment: '入库数量', }, inbound_type: { type: ENUM('import', 'pda'), allowNull: false, comment: '入库方式:import-导入入库 pda-PDA入库', }, entry_order_id: { type: BIGINT(20).UNSIGNED, allowNull: true, comment: '关联入库单ID(可选),关联 wms_entry_order.id', }, entry_order_code: { type: STRING(50), allowNull: true, comment: '入库单号(冗余,方便查询)', }, remark: { type: STRING(500), allowNull: true, comment: '备注(如导入文件名、PDA操作备注等)', }, space_id: { type: BIGINT(20).UNSIGNED, allowNull: true, defaultValue: null, comment: '存放库位ID,关联 wms_location_space.id', }, operator_id: { type: BIGINT(20).UNSIGNED, allowNull: true, comment: '操作人ID', }, operator_name: { type: STRING(50), allowNull: true, comment: '操作人名称', }, created_at: { type: DATE, allowNull: false, comment: '创建时间', }, }, { tableName: 'wms_inbound_direct_log', comment: '非收货单途径入库直接记录表(导入/PDA入库)', timestamps: false, indexes: [ { name: 'idx_warehouse_id', fields: [ 'warehouse_id' ], }, { name: 'idx_stock_id', fields: [ 'stock_id' ], }, { name: 'idx_inbound_type', fields: [ 'inbound_type' ], }, { name: 'idx_entry_order_id', fields: [ 'entry_order_id' ], }, { name: 'idx_created_at', fields: [ 'created_at' ], }, ], }); return InboundDirectLog; };