diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index 81946e20..ad51fba2 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -646,7 +646,7 @@ def cal_enstat2(type: str, year_s: int, month_s: int, day_s: int, cascade=True): enstat2.save() -def cal_enstat_pcoal_change(enstat, new_pcoal_heat): +def cal_enstat_pcoal_change(enstat: EnStat, new_pcoal_heat): type = enstat.type if type in ["hour_s", "sflog", "day_s"]: enstat.pcoal_heat = new_pcoal_heat diff --git a/apps/wpm/models.py b/apps/wpm/models.py index aa157ae6..074a8dc5 100644 --- a/apps/wpm/models.py +++ b/apps/wpm/models.py @@ -6,6 +6,7 @@ from apps.system.models import User from django.utils.timezone import localtime from apps.em.models import Equipment from apps.system.models import Dept +from datetime import timedelta # Create your models here. @@ -38,10 +39,9 @@ class SfLog(CommonADModel): """ 返回值班记录所属年月日 """ - end_time = self.end_time - if end_time.minute == 0 and end_time.second == 0 and end_time.hour == 0: # 如果结束时间为00:00:00 - end_time = self.start_time - end_time_local = localtime(end_time) + end_time_local = localtime(self.end_time) + if end_time_local.hour == 0 and end_time_local.minute == 0 and end_time_local.second == 0: # 如果结束时间为00:00:00 + end_time_local = localtime(self.start_time) return end_time_local.year, end_time_local.month, end_time_local.day