feat: enm/service 修改 service

This commit is contained in:
zty 2024-12-27 14:42:10 +08:00
parent 7f4acd2370
commit cc8d9b1bf4
1 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ def get_sflog(mgroup: Mgroup, happen_time: datetime):
start_time__lte=happen_time, end_time__gt=happen_time, mgroup=mgroup).order_by('-start_time').first()
if sflog is None: # 需要创建值班记录
make_sflogs(mgroup=mgroup, start_date=(
happen_time-datetime.timedelta(days=2)).date(), end_date=(happen_time+datetime.timedelta(days=1)).date())
happen_time-datetime.timedelta(days=2)).date(), end_date=(happen_time+datetime.timedelta(days=2)).date())
sflog = SfLog.objects.filter(
start_time__lte=happen_time, end_time__gt=happen_time, mgroup=mgroup).order_by('-start_time').first()
return sflog
@ -130,13 +130,13 @@ def get_pcoal_heat(year_s: int, month_s: int, day_s: int):
if s:
qs.pcoal_heat = s.pcoal_heat
else:
qs.pcoal_heat = 6000
qs.pcoal_heat = 25000
qs.save(update_fields=['pcoal_heat'])
cache.set(key, qs.pcoal_heat, timeout=60 * 60 * 8)
return qs.pcoal_heat
except Exception as e:
myLogger.error(f'获取煤粉热值失败,{e}', exc_info=True)
return 6000
myLogger.error(f'获取煤粉热值失败,{e}, {year_s}, {month_s}, {day_s}', exc_info=True)
return 25000
def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):