feat: 值班记录增加运转时间和停机时间
This commit is contained in:
parent
0abade21b7
commit
27a2a20cbe
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.2.12 on 2023-07-24 03:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wpm', '0004_sflog_last_test_time'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='sflog',
|
||||
name='shut_hour',
|
||||
field=models.FloatField(default=0, verbose_name='停机时间'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='sflog',
|
||||
name='work_hour',
|
||||
field=models.FloatField(default=12, verbose_name='运转时间'),
|
||||
),
|
||||
]
|
|
@ -26,6 +26,8 @@ class SfLog(CommonADModel):
|
|||
note = models.TextField('其他备注', null=True, blank=True)
|
||||
stlogs = models.ManyToManyField('wpm.stlog', verbose_name='关联停机记录', through='wpm.stsflog')
|
||||
last_test_time = models.DateTimeField('最后质检时间', null=True, blank=True)
|
||||
work_hour = models.FloatField('运转时间', default=12)
|
||||
shut_hour = models.FloatField('停机时间', default=0)
|
||||
|
||||
|
||||
class StSfLog(BaseModel):
|
||||
|
|
|
@ -17,5 +17,6 @@ def make_sflogs(mgroup: Mgroup, start_date: datetime.date, end_date: datetime.da
|
|||
"shift": shift,
|
||||
"start_time": start_time,
|
||||
"end_time": end_time,
|
||||
"work_hour": round((end_time-start_time).total_seconds/3600)
|
||||
})
|
||||
current_date = current_date + datetime.timedelta(days=1)
|
Loading…
Reference in New Issue