from enum import Enum from tortoise import fields, models class AccessMode(Enum): PUBLIC = 0 WHITELIST = 1 BLACKLIST = 2 def __eq__(self, other): return self.value == other class Cabinet(models.Model): id = fields.UUIDField(pk=True) terminal = fields.ForeignKeyField('rms.Terminal', null=True, description='所属终端') mac_addr = fields.CharField(unique=True, max_length=50, null=True, description='下位机Mac地址') model = fields.CharField(max_length=50, null=True, description='柜体型号') ip = fields.CharField(max_length=50, null=True, description='下位机IP') label = fields.CharField(null=True, max_length=255, description='柜体标签') location = fields.CharField(null=True, max_length=255, description='物理位置') matrix = fields.CharField(null=True, max_length=50, description='抽屉矩阵') params = fields.JSONField(null=True, description='柜体参数') type = fields.IntField(default=1, null=True, description='1智能柜 2普通柜 3货架') user_id = fields.CharField(null=True, max_length=255, description='当前使用人') phone = fields.CharField(null=True, max_length=25, description="负责人电话") director = fields.CharField(null=True, max_length=30, description='负责人') archive = fields.ForeignKeyField('rms.Archive', null=True, description='药剂类型') created_at = fields.DatetimeField(auto_now_add=True) updated_at = fields.DatetimeField(auto_now=True) class Meta: table = 'cabinets' table_description = '柜体表'