Files

42 lines
1.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
import io, sys, pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
conn = pymysql.connect(host='192.168.1.161', user='devgps', password='dev@2021GPS',
database='zentao_dev_2026', charset='utf8mb4')
cur = conn.cursor()
def q(sql):
cur.execute(sql); return cur.fetchall()
# KFZ 开发 13 人名单
devs = q("SELECT account, nickname FROM zt_user WHERE user_type=3 AND deleted='0'")
names = [d[1] for d in devs]
print("KFZ 13人:", names)
# 请假(os_system.it_approval,按 name 匹配 nickname,6月)
name_in = ','.join(f"'{n}'" for n in names)
rows = q(f"""SELECT a.name, a.apply_time_start, a.apply_time_end, a.apply_days FROM os_system.it_approval a
WHERE a.name IN ({name_in})
AND ((date(a.apply_time_start) BETWEEN '2026-06-01' AND '2026-06-30') OR (date(a.apply_time_end) BETWEEN '2026-06-01' AND '2026-06-30'))""")
print(f"\n6月请假记录 {len(rows)} 条:")
tot = 0
for r in rows:
print(r)
tot += float(r[3] or 0)
print(f"团队请假合计 = {tot} 小时 → 折算天数 = {tot/8}")
# 陈浩公式
wd, dev_count = 22, 13
consumed = 126.0
target = (wd * dev_count - tot/8) * 5 / dev_count
rate = consumed / target * 100 if target else 0
print(f"\n=== 陈浩 6月(按你的公式)===")
print(f"月度达标工时 = (22×13 − {tot}/8)×5 ÷ 13 = {target:.2f} h")
print(f"实际产出工时(consumed) = {consumed} h")
print(f"达标率 = {consumed}/{target:.2f} = {rate:.1f}%")
score = 20 if rate >= 100 else max(0, 20 - int(100 - rate) * 2)
print(f"得分(每减1%扣2分)= {score}")
# 对比:老版个人口径
old_target = (22*8 - 0) * 0.75
print(f"\n对比老版:达标工时=(22×8)×0.75={old_target}h, estimate={consumed} → 老口径率={consumed/old_target*100:.1f}%")