Improved: User Friendly
parent
266cfbcd4d
commit
34bbfe236a
|
|
@ -1,3 +1,9 @@
|
||||||
# HonorHours
|
# HonorHours
|
||||||
|
|
||||||
实现自动由维修排班表转化为荣誉小时数登记表格
|
## 功能
|
||||||
|
实现自动由维修排班表转化为荣誉小时数登记表格
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
按照值班排班表格示例与身份信息表格示例填写表格。
|
||||||
|
|
||||||
|
将值班排班表格与身份信息表格与程序放在同一个目录下,运行程序,按照指示操作即可。
|
||||||
25
main.py
25
main.py
|
|
@ -1,10 +1,23 @@
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import time, datetime
|
import time, datetime
|
||||||
from math import floor
|
from math import floor
|
||||||
|
import os
|
||||||
|
|
||||||
# Read & Process ID table
|
# Read & Process ID table
|
||||||
identities_path = r'./identities.xls'
|
items = os.listdir(os.path.abspath('.'))
|
||||||
|
print("在当前目录共有以下文件:")
|
||||||
|
file_index = 0
|
||||||
|
for item in items:
|
||||||
|
if item != "main.py" and item != "main.exe":
|
||||||
|
file_index += 1
|
||||||
|
print(f"{file_index} - {item}")
|
||||||
|
id_index = int(input("请选择身份证列表(输入数字后回车)"))
|
||||||
|
duty_index = int(input("请选择值班排班表(输入数字后回车)"))
|
||||||
|
|
||||||
|
identities_path = r'./' + items[id_index - 1]
|
||||||
|
duty_path = r'./' + items[duty_index - 1]
|
||||||
|
|
||||||
|
print("正在读取身份信息...")
|
||||||
identities = pd.read_excel(identities_path, sheet_name= "Sheet1")
|
identities = pd.read_excel(identities_path, sheet_name= "Sheet1")
|
||||||
|
|
||||||
id_dict = {}
|
id_dict = {}
|
||||||
|
|
@ -14,9 +27,10 @@ for name in identities["姓名"]:
|
||||||
id_dict[name] = identities["身份证号码"][index]
|
id_dict[name] = identities["身份证号码"][index]
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
# Read & Calculate Honor Hours
|
print("读取完毕!")
|
||||||
duty_path = r'./duty.xlsx'
|
|
||||||
|
|
||||||
|
# Read & Calculate Honor Hours
|
||||||
|
print("正在读取值班信息...")
|
||||||
duty = pd.read_excel(duty_path, sheet_name= "Sheet1")
|
duty = pd.read_excel(duty_path, sheet_name= "Sheet1")
|
||||||
|
|
||||||
hours_dict = {}
|
hours_dict = {}
|
||||||
|
|
@ -46,7 +60,10 @@ for member in hours_dict.keys():
|
||||||
hour /= 2
|
hour /= 2
|
||||||
hours_dict[member] = hour
|
hours_dict[member] = hour
|
||||||
|
|
||||||
|
print("读取完毕!")
|
||||||
|
|
||||||
# Generate Honor Hour table
|
# Generate Honor Hour table
|
||||||
|
print("正在生成信息填报表格...")
|
||||||
hour_path = r'./hour.xlsx'
|
hour_path = r'./hour.xlsx'
|
||||||
|
|
||||||
id_list = []
|
id_list = []
|
||||||
|
|
@ -57,4 +74,6 @@ df = pd.DataFrame({"姓名": hours_dict.keys(), "身份证号码": id_list, "荣
|
||||||
df = df.set_index("姓名")
|
df = df.set_index("姓名")
|
||||||
df.to_excel(hour_path)
|
df.to_excel(hour_path)
|
||||||
|
|
||||||
|
input("生成完毕!在当前文件夹下,文件名为 hour.xlsx,按回车键退出...")
|
||||||
|
|
||||||
# TODO: Write to Document
|
# TODO: Write to Document
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue