fix: 调整员工历史记录中身份证和姓名的赋值位置

将身份证号码和姓名的赋值操作移到循环内部,确保每条历史记录都包含正确的个人信息
This commit is contained in:
Miu Li 2025-06-14 04:22:41 +08:00
parent ced4de4d4b
commit 11eb67a1d8

View File

@ -380,6 +380,8 @@ def main():
for rule in Rule_Level:
if row["入职时间"] < rule["start"]:
History_pd.loc[len(History_pd),["变动后时间","变动原因"]] = [rule["start"], "工资调标"]
History_pd["身份证号码"] = row["身份证号码"]
History_pd["姓名"] = row["姓名"]
History_pd["工龄"] = History_pd.apply(lambda x: calculate_seniority(row, x["变动后时间"]), axis=1)
History_pd = History_pd.sort_values(by="时间").reset_index(drop=True)
@ -444,8 +446,6 @@ def main():
fill_history_info(ws, History_pd)# 填充历史记录
# 将当前人员的历史记录添加到总表中
History_pd["身份证号码"] = row["身份证号码"]
History_pd["姓名"] = row["姓名"]
all_history = pd.concat([all_history, History_pd], ignore_index=True)
wb.save(f"个人台账/{row['身份证号码']}_{row['姓名']}.xlsx")