From 2263c0decbc11483b771480ac496c03384ebc2a6 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 30 Apr 2024 19:00:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A6=82=E6=9E=9C=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=BA0=E7=82=B9=E5=88=99=E5=8F=96?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=E6=9D=A5=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=B9=B4=E6=9C=88=E6=97=A52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 2 +- apps/wpm/models.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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