fix: em/service 修改tkx 设备model
This commit is contained in:
parent
42d8dced09
commit
c0f796f4a0
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.12 on 2024-11-26 01:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('em', '0019_auto_20241125_1812'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='equipment',
|
||||
name='device_people',
|
||||
field=models.CharField(blank=True, default='', max_length=100, verbose_name='设备管理人'),
|
||||
),
|
||||
]
|
|
@ -89,6 +89,7 @@ class Equipment(CommonBModel):
|
|||
count = models.PositiveIntegerField("数量", default=1)
|
||||
keeper = models.ForeignKey(User, verbose_name="责任人", on_delete=models.CASCADE, null=True, blank=True)
|
||||
description = models.CharField("描述", max_length=200, default="", blank=True)
|
||||
device_people = models.CharField("设备管理人", max_length=100, default="", blank=True)
|
||||
|
||||
# 以下是计量检测设备单独字段
|
||||
# mgmtype = models.IntegerField('管理类别', choices=mgmtype_choices, default=1)
|
||||
|
|
|
@ -49,7 +49,15 @@ def shutdown_or_startup(equipId: str, last_timex: datetime, last_mrs, note: str
|
|||
"""
|
||||
last_mrs 设备运行状态值
|
||||
"""
|
||||
equip = Equipment.objects.get(id=equipId)
|
||||
# try:
|
||||
# equip = Equipment.objects.get(id=equipId)
|
||||
# except Equipment.DoesNotExist:
|
||||
# myLogger.error(f"设备{equipId}不存在")
|
||||
# return
|
||||
equip =Equipment.objects.get_queryset(all=True).get(id=equipId)
|
||||
if equip.is_deleted:
|
||||
equip.is_deleted = False
|
||||
equip.save()
|
||||
equip.running_state = last_mrs
|
||||
equip.save(update_fields=["running_state"])
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class MpointViewSet(CustomModelViewSet):
|
|||
"formula": ["exact", "contains"],
|
||||
"material": ["exact"],
|
||||
"material__code": ["exact", "in"],
|
||||
"code": ["exact", "contains"],
|
||||
"code": ["exact", "contains", "in"],
|
||||
}
|
||||
|
||||
search_fields = ["name", "code", "nickname", "material__code", "material__name"]
|
||||
|
|
Loading…
Reference in New Issue