| name | wps-cn-calendar |
| description | 日历排班值班表。生成带法定节假日和调休标注的月度/年度日历表,
还能做三班倒/两班倒排班表和节假日值班安排,颜色区分不同班次一目了然。
用于帮助用户生成日历和排班表。当用户提到日历、排班、值班、节假日时触发。
Chinese calendar with holidays, shift scheduling, and duty rosters.
|
| license | MIT |
| user-invocable | true |
| argument-hint | [年月] [类型] |
| allowed-tools | Read, Grep, Glob, Bash, Write, Edit |
| metadata | {"author":"BWKYD","title":"日历排班表","description_zh":"生成带法定节假日的月度日历,支持排班表和值班表","tags":["日历","排班","节假日","值班","WPS"],"version":"1.0.1","license":"MIT"} |
中国日历/排班表生成器
生成含法定节假日+农历的日历表,以及排班/值班安排。
When to Use
- 生成月度/年度日历
- 制作员工排班表
- 制作值班安排表
- 查看法定节假日安排
- 用户说"做个日历""排班表""值班安排"
When NOT to Use
- 考勤统计 → 使用
wps-attendance
- 项目排期 → 使用
wps-gantt
功能模块
[1] 月度日历 → 含农历、节假日标注
[2] 年度日历 → 12个月一览表
[3] 排班表 → 三班倒/两班倒/弹性
[4] 值班表 → 节假日/周末值班安排
工作流程
Step 1: 确认需求
- 类型:日历/排班/值班
- 时间范围:哪年哪月
- 排班模式(如需要):几班倒、人员名单
- 特殊安排(如需要):谁请假、谁优先
Step 2: 生成日历/排班表
from openpyxl import Workbook
from openpyxl.styles import Font, Alignment, PatternFill, Border, Side
from datetime import datetime, timedelta
import calendar
import os
HOLIDAYS_2026 = {
'2026-01-01': '元旦',
'2026-01-29': '除夕', '2026-01-30': '春节', '2026-01-31': '春节',
'2026-02-01': '春节', '2026-02-02': '春节', '2026-02-03': '春节',
'2026-02-04': '春节',
'2026-04-05': '清明', '2026-04-06': '清明', '2026-04-07': '清明',
'2026-05-01': '劳动节', '2026-05-02': '劳动节', '2026-05-03': '劳动节',
'2026-05-04': '劳动节', '2026-05-05': '劳动节',
'2026-05-31': '端午', '2026-06-01': '端午', '2026-06-02': '端午',
'2026-10-01': '国庆', '2026-10-02': '国庆', '2026-10-03': '国庆',
: , : , : ,
: ,
}
WORKDAYS_2026 = {, , }
():
wb = Workbook()
ws = wb.active
ws.title =
header_fill = PatternFill(, fgColor=)
weekend_fill = PatternFill(, fgColor=)
holiday_fill = PatternFill(, fgColor=)
today_fill = PatternFill(, fgColor=)
header_font = Font(name=, size=, bold=, color=)
ws.merge_cells()
ws[] =
ws[].font = Font(name=, size=, bold=)
ws[].alignment = Alignment(horizontal=)
weekdays = [, , , , , , ]
col, wd (weekdays, ):
cell = ws.cell(row=, column=col, value=)
cell.font = header_font
cell.fill = header_fill
cell.alignment = Alignment(horizontal=)
ws.column_dimensions[(+col)].width =
cal = calendar.Calendar(firstweekday=)
row =
week cal.monthdatescalendar(year, month):
col, date (week, ):
date.month != month:
date_str = date.strftime()
cell = ws.cell(row=row, column=col)
cell.value = date.day
cell.font = Font(name=, size=)
cell.alignment = Alignment(horizontal=, vertical=)
ws.row_dimensions[row].height =
date_str HOLIDAYS_2026:
cell.fill = holiday_fill
note_cell = ws.cell(row=row, column=col)
note_cell.value =
note_cell.font = Font(name=, size=)
note_cell.alignment = Alignment(horizontal=,
vertical=,
wrap_text=)
date.weekday() >= date_str WORKDAYS_2026:
cell.fill = weekend_fill
row +=
output_path:
output_path =
wb.save(output_path)
os.path.abspath(output_path)
():
wb = Workbook()
ws = wb.active
ws.title =
shifts = {
: [, , , ],
: [, , , ],
: [, , , , , , ],
}
pattern = shifts.get(shift_pattern, shifts[])
header_fill = PatternFill(, fgColor=)
header_font = Font(name=, size=, bold=, color=)
shift_colors = {
: PatternFill(, fgColor=),
: PatternFill(, fgColor=),
: PatternFill(, fgColor=),
: PatternFill(, fgColor=),
: PatternFill(, fgColor=),
: PatternFill(, fgColor=),
: PatternFill(, fgColor=),
}
days_in_month = calendar.monthrange(year, month)[]
ws.cell(row=, column=, value=).font = header_font
ws.cell(row=, column=).fill = header_fill
d (, days_in_month + ):
date = datetime(year, month, d)
cell = ws.cell(row=, column=d+, value=)
cell.font = Font(name=, size=, color=)
cell.fill = header_fill
cell.alignment = Alignment(horizontal=, wrap_text=)
ws.column_dimensions[(+d) d < ].width =
i, name (staff_list):
ws.cell(row=i+, column=, value=name).font = Font(name=, size=)
d (, days_in_month + ):
shift_idx = (d - + i) % (pattern)
shift = pattern[shift_idx]
cell = ws.cell(row=i+, column=d+, value=shift)
cell.alignment = Alignment(horizontal=)
cell.font = Font(name=, size=)
shift shift_colors:
cell.fill = shift_colors[shift]
output_path:
output_path =
wb.save(output_path)
os.path.abspath(output_path)
Step 3: 交付
- 生成日历/排班表Excel
- 节假日用红色标注,周末用浅红色
- 排班表用颜色区分不同班次
示例
/wps-cn-calendar 生成2026年4月的日历
/wps-cn-calendar 4月排班表,三班倒,人员:张三李四王五赵六
/wps-cn-calendar 五一假期值班安排,6个人轮流