Browse Source

更改项:时间的str格式比较前,转换为时间格式

shangguanlie23 3 năm trước cách đây
mục cha
commit
fc831ff5f8
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      LIB/MIDDLE/SaftyCenter/diagfault/main.py

+ 2 - 2
LIB/MIDDLE/SaftyCenter/diagfault/main.py

@@ -93,9 +93,9 @@ def diag_cal():
                 if df_feishu_sta.empty:#飞书中没有该sn记录故障的新增
                     df_Diag_cal_early_unfix = df_Diag_Cal_new#如果为新出故障,则直接记录在df_diag_frame中
                 else:
-                    df_Diag_cal_later = df_Diag_Cal_new.loc[df_Diag_Cal_new['start_time'] > max(df_feishu_sta['start_time'])]#故障表中故障时间晚于飞书记录时间的新增
+                    df_Diag_cal_later = df_Diag_Cal_new.loc[pd.to_datetime(df_Diag_Cal_new['start_time']) > max(pd.to_datetime(df_feishu_sta['start_time']))]#故障表中故障时间晚于飞书记录时间的新增
                     df_Diag_cal_early = pd.concat([df_Diag_Cal_new,df_Diag_cal_later,df_Diag_cal_later]).drop_duplicates(subset=['product_id','code','start_time'],keep=False)#故障表中故障时间早于飞书记录时间
-                    df_feishu_sta_latest = df_feishu_sta.loc[df_feishu_sta['start_time'] == max(df_feishu_sta['start_time'])]#飞书中该SN下的最新故障
+                    df_feishu_sta_latest = df_feishu_sta.loc[pd.to_datetime(df_feishu_sta['start_time']) == max(pd.to_datetime(df_feishu_sta['start_time']))]#飞书中该SN下的最新故障
                     df_feishu_diag_unfix = (df_feishu_sta_latest['advice'] == '需正常返仓') | (df_feishu_sta_latest['advice'] == '需紧急返仓')
                     if any(df_feishu_diag_unfix):
                         df_Diag_cal_early_unfix = df_Diag_Cal_new