WMS_MAIN/app/model/package_supplier.js
liufumingren abf2c4d94a 1
2026-05-29 16:47:38 +08:00

90 lines
2.0 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';
/**
* 包材供应商模型。
* @param {import('egg').Application} app Egg 应用实例。
* @return {import('sequelize').ModelCtor<import('sequelize').Model>} Sequelize 模型。
*/
module.exports = app => {
const { BIGINT, STRING, TINYINT, INTEGER, DATE } = app.Sequelize;
const PackageSupplier = app.model.define('package_supplier', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '主键ID',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '仓库ID',
},
supplier_code: {
type: STRING(64),
allowNull: false,
comment: '供应商编码',
},
supplier_name: {
type: STRING(128),
allowNull: false,
comment: '供应商名称',
},
contact_name: {
type: STRING(64),
allowNull: true,
comment: '联系人',
},
contact_phone: {
type: STRING(32),
allowNull: true,
comment: '联系电话',
},
status: {
type: TINYINT(1),
allowNull: false,
defaultValue: 1,
comment: '状态:0=禁用,1=启用',
},
version: {
type: INTEGER.UNSIGNED,
allowNull: false,
defaultValue: 1,
comment: '版本号',
},
created_at: {
type: DATE,
allowNull: false,
comment: '创建时间',
},
updated_at: {
type: DATE,
allowNull: false,
comment: '更新时间',
},
}, {
tableName: 'wms_package_supplier',
freezeTableName: true,
underscored: true,
timestamps: true,
paranoid: false,
createdAt: 'created_at',
updatedAt: 'updated_at',
comment: '包材供应商表',
indexes: [
{
name: 'idx_wms_package_supplier_warehouse_id',
fields: [ 'warehouse_id' ],
},
{
name: 'uk_wms_package_supplier_warehouse_supplier_code',
unique: true,
fields: [ 'warehouse_id', 'supplier_code' ],
},
],
});
return PackageSupplier;
};