fix(migration): contract_payment_contracts表创建前检查是否存在

This commit is contained in:
sophie committed 2026-09-03 08:47:59 +08:00
1 parent 03b9b46ebd
commit 85cfdde37b
5 files changed
+23 -81

No files matched your search

+8 -8
View File
@@ -12,8 +12,8 @@ from datetime import date, timedelta
import xlrd
from xlutils.copy import copy
SRC = r"e:\流程\加班\加班申请单模板_202601_原.xls"
OUT = r"e:\流程\加班\加班申请单_20260721-20260820.xls"
SRC = r"E:\和信\加班\加班申请单模板_202601_原.xls"
OUT = r"E:\和信\加班\加班申请单_20260821-20260920.xls"
def _date_str(d: date) -> str:
@@ -24,9 +24,9 @@ def _date_str(d: date) -> str:
def _overtime_hours(is_weekday: bool) -> str:
"""
按时间段计算加班时数。
核心逻辑:工作日 18:00–22:30 为 4.5 小时;周六 08:00–20:00 扣午休后为 10 小时。
核心逻辑:工作日 18:00–23:30 为 5.5 小时;周六 08:00–20:00 扣午休后为 10 小时。
"""
return "4.5" if is_weekday else "10"
return "5.5" if is_weekday else "10"
def build_ordered_dates(start: date, end: date) -> tuple[list[date], list[date], list[date]]:
@@ -53,7 +53,7 @@ def build_ordered_dates(start: date, end: date) -> tuple[list[date], list[date],
def fill_overtime_workbook(src_path: str, out_path: str, start: date, end: date) -> None:
"""
复制模板并填入加班明细。
核心逻辑:保留表头与 ABCD;工作日类型 026 / 18:00–22:30,周六类型 027 / 08:00–20:00。
核心逻辑:保留表头与 ABCD;工作日类型 026 / 18:00–23:30,周六类型 027 / 08:00–20:00。
"""
rb = xlrd.open_workbook(src_path, formatting_info=True)
rs = rb.sheet_by_index(0)
@@ -76,7 +76,7 @@ def fill_overtime_workbook(src_path: str, out_path: str, start: date, end: date)
is_weekday = day.weekday() < 5
ot_type = "026" if is_weekday else "027"
start_time = "18:00" if is_weekday else "08:00"
end_time = "22:30" if is_weekday else "20:00"
end_time = "23:30" if is_weekday else "20:00"
ds = _date_str(day)
row = idx
@@ -105,6 +105,6 @@ if __name__ == "__main__":
fill_overtime_workbook(
SRC,
OUT,
date(2026, 7, 21),
date(2026, 8, 20),
date(2026, 8, 21),
date(2026, 9, 20),
)