@@ -25,8 +25,8 @@ class YuthonShiftPlanning(models.Model):
|
||||
role = [role_template_a, role_template_b, role_template_c]
|
||||
planning_groups = {
|
||||
'planning_a_ids': range(len(role)), # 默认顺序: 早 -> 中 -> 夜
|
||||
'planning_b_ids': [1, 2, 0], # 中 -> 夜 -> 早
|
||||
'planning_c_ids': [2, 0, 1] # 夜 -> 早 -> 中
|
||||
'planning_c_ids': [1, 2, 0], # 中 -> 夜 -> 早
|
||||
'planning_b_ids': [2, 0, 1], # 夜 -> 早 -> 中
|
||||
}
|
||||
|
||||
weekday_mapping = {
|
||||
@@ -60,12 +60,17 @@ class YuthonShiftPlanning(models.Model):
|
||||
if resource_id in ever_holidays and current_weekday in ever_holidays[resource_id]:
|
||||
pass # 跳过休息日
|
||||
else:
|
||||
self.create_planning_slot(record, role_a, role[role_index], current_date)
|
||||
if current_date.day == 31:
|
||||
self.create_planning_slot(record, role_a, role[role_index-1], current_date)
|
||||
else:
|
||||
self.create_planning_slot(record, role_a, role[role_index], current_date)
|
||||
current_date += timedelta(days=1)
|
||||
if current_date >= end_date:
|
||||
break
|
||||
if current_date >= end_date:
|
||||
break
|
||||
if current_date >= end_date: # 检查是否月末且已排完当前组
|
||||
break
|
||||
|
||||
weekday_mapping = {
|
||||
'one': 6, 'two': 0, 'three': 1, 'four': 2, 'five': 3, 'six': 4, 'seven': 5
|
||||
@@ -96,7 +101,7 @@ class YuthonShiftPlanning(models.Model):
|
||||
while current_date <= end_date:
|
||||
current_weekday = current_date.weekday()
|
||||
if resource_id in ever_holidays and current_weekday in ever_holidays[resource_id]:
|
||||
pass # 跳过休息日
|
||||
pass
|
||||
else:
|
||||
self.create_planning_slot(record, role_a,role_item, current_date) # 确保这个方法存在
|
||||
current_date += timedelta(days=1)
|
||||
|
||||
Reference in New Issue
Block a user