A staff property that consists only of numbers can be retrieved as a Python Dictionary.
This can be used to configure various settings for each staff member.
import sc3
for day in AllDays:
sc3.print('\t\tDay index'+str(day)+' is '+daydef[day]+'.\n')
def number_of_dayoffs():
for person in Day_Offs_per_Month.keys():
#sc3.print(str(person)+'\n')
value=Day_Offs_per_Month[person]
print(staffdef[person]+'Day Offs are'+str(value)+'/n')
VList=[]
for day in AllDays:
if day<StartDate:
continue
v1=sc3.GetShiftVar(person,day,'Day Off')
VList.append(v1)
s="person"+str(person)+"Number of Day Offs"
sc3.AddSoft(sc3.SeqError(value,value,7,VList),s,7) #
def number_of_work_days_per_week():
for person in Work_Days_per_Week.keys():
n=Work_Days_per_Week[person]
print(staffdef[person]+' Work_Days_per_Week are '+str(n)+'\n')
for mon in Mon:#See one week from Monday
sc3.print('Monday '+str(mon)+'\n')
VList=[]
for d in range(7):
day=mon+d
if day >FinishDate:
break
else:
v1=sc3.GetShiftVar(person,day,'Day Off')#
VList.append(~v1)# Working is negation of Day Off
s="person"+str(person)+ ' Mon' +str(mon)+'Working Days per Week'
if len(VList)==7:
sc3.AddSoft(sc3.SeqError(n,n,4,VList),s,3) #level 3 allowable errors=ー4
else:
nn=int(len(VList)*n/7);#Truncate if less than 7 days
print(str(nn)+" is target value\n")
sc3.AddSoft(sc3.SeqError(nn,nn,4,VList),s,3)#level 3 allowable erros=4
number_of_dayoffs()
number_of_work_days_per_week()