feat: 设备表增加字段
This commit is contained in:
parent
af5a6c3d55
commit
2e0f2ec263
|
@ -0,0 +1,48 @@
|
|||
# Generated by Django 3.2.12 on 2024-02-21 09:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('em', '0011_auto_20240119_1135'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='ip',
|
||||
field=models.GenericIPAddressField(blank=True, null=True, verbose_name='IP地址'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='is_online',
|
||||
field=models.PositiveSmallIntegerField(default=0, verbose_name='是否在线'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='login_name',
|
||||
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='登录名'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='login_pwd',
|
||||
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='登录密码'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='port',
|
||||
field=models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='端口号'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='running_state',
|
||||
field=models.PositiveSmallIntegerField(default=50, verbose_name='运行状态'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='equipment',
|
||||
name='type',
|
||||
field=models.PositiveSmallIntegerField(choices=[(10, '生产设备'), (20, '计量设备'), (30, '治理设备'), (40, '监控设备')], default=10, verbose_name='类型'),
|
||||
),
|
||||
]
|
|
@ -1,10 +1,19 @@
|
|||
from django.db import models
|
||||
from apps.utils.models import CommonBModel, CommonADModel, CommonBDModel
|
||||
from apps.system.models import User
|
||||
from enum import Enum
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
||||
class RuningState(Enum):
|
||||
RUNING = 10
|
||||
STANDBY = 20
|
||||
STOP = 30
|
||||
FAILURE = 40
|
||||
UNKNOWN = 50
|
||||
|
||||
|
||||
class Equipment(CommonBModel):
|
||||
"""
|
||||
设备台账信息
|
||||
|
@ -21,7 +30,6 @@ class Equipment(CommonBModel):
|
|||
(EQUIP_STATE_FIX, '在修'),
|
||||
(EQUIP_STATE_DISABLE, '禁用'),
|
||||
(EQUIP_STATE_SCRAP, '报废')
|
||||
|
||||
)
|
||||
EQUIP_TYPE_PRO = 10
|
||||
EQUIP_TYPE_MEA = 20
|
||||
|
@ -29,6 +37,7 @@ class Equipment(CommonBModel):
|
|||
(10, '生产设备'),
|
||||
(20, '计量设备'),
|
||||
(30, '治理设备'),
|
||||
(40, '监控设备'),
|
||||
)
|
||||
# mgmtype_choices = (
|
||||
# (1, 'A'),
|
||||
|
@ -46,6 +55,12 @@ class Equipment(CommonBModel):
|
|||
# )
|
||||
tags_list_10 = ['生产设备', '输送设备']
|
||||
tags_list_20 = ['雾炮', '干雾', '除尘器', '环卫车', '洗车台']
|
||||
is_online = models.PositiveSmallIntegerField('是否在线', default=0)
|
||||
running_state = models.PositiveSmallIntegerField('运行状态', default=50)
|
||||
ip = models.GenericIPAddressField('IP地址', null=True, blank=True)
|
||||
port = models.PositiveSmallIntegerField('端口号', null=True, blank=True)
|
||||
login_name = models.CharField('登录名', max_length=100, null=True, blank=True)
|
||||
login_pwd = models.CharField('登录密码', max_length=100, null=True, blank=True)
|
||||
mgroup = models.ForeignKey(
|
||||
'mtm.mgroup', on_delete=models.SET_NULL, null=True, blank=True)
|
||||
type = models.PositiveSmallIntegerField(
|
||||
|
|
Loading…
Reference in New Issue