/// <summary> کد حداکثر اضافه کاری بعد از وقت - پارامتر پویا</summary> /// <remarks></remarks> //اضافه کار مجاز4002 public virtual void R6507(AssignedRule MyRule) { GetLog(MyRule, DebugRuleState.Before, 4002, 4003, 4007, 13); var personParam = this.Person.PersonTASpec.GetParamValue(this.Person.ID, "MAXEBAV", this.RuleCalculateDate); if (personParam != null && this.DoConcept(4007).Value > System.Convert.ToInt32(personParam.Value)) { int notAllowValue = this.DoConcept(4007).Value - System.Convert.ToInt32(personParam.Value); PairableScndCnpValue notAllow = new PairableScndCnpValue(); foreach (PairableScndCnpValuePair pair in ((PairableScndCnpValue)this.DoConcept(4007)).Pairs.OrderByDescending(x => x.From)) { if (pair.Value >= notAllowValue) { IPair notAloowPair = new PairableScndCnpValuePair(pair.To - notAllowValue, pair.To); notAllow.Pairs.Add(notAloowPair); notAllowValue = 0; break; } else { notAllowValue -= pair.Value; notAllow.Pairs.Add(pair); } } ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(Operation.Intersect(this.DoConcept(4002), notAllow)); ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(Operation.Differance(this.DoConcept(4002), notAllow)); this.ReCalculate(13, 4007); } GetLog(MyRule, DebugRuleState.After, 4002, 4003, 4007, 13); }
/// <summary>مفهوم اضافه کاراول وقت</summary> /// <param name="Result"></param> /// <remarks>شناسه اين مفهوم در تعاريف بعدي شصت و دو-62 درنظر گرفته شده است</remarks> //public override void C4008(BaseScndCnpValue Result, SecondaryConcept MyConcept) //{ // int i = 0; // ((PairableScndCnpValue)Result).ClearPairs(); // PairableScndCnpValue unionResult = (PairableScndCnpValue)this.DoConcept(1); // PairableScndCnpValue validLeave = new PairableScndCnpValue(); // ((PairableScndCnpValue)validLeave ).AddPairs(Operation.Differance (unionResult, // this.Person.GetShiftByDate(this.ConceptCalculateDate)).Pairs); // PairableScndCnpValue overTime = (PairableScndCnpValue)this.DoConcept(4002); // BaseShift shift = this.Person.GetShiftByDate(this.ConceptCalculateDate); // if (shift != null && shift.PairCount > 0) // { // IPair shiftPair = shift.Pairs.OrderBy(x => x.From).First(); // if (shift.PastedPairs.From == shiftPair.From) // { // while (i <= overTime.PairCount - 1) // { // if (shiftPair.From > overTime.PairPart(i).From) // { // ((PairableScndCnpValue)Result).AppendPair(overTime.PairPart(i)); // } // i++; // } // } // } //} /// <summary>مفهوم اضافه کار ساعتی جمعه کاری </summary> /// <param name="Result"></param> public override void C4046(BaseScndCnpValue Result, SecondaryConcept MyConcept) { ((PairableScndCnpValue)Result).ClearPairs(); if (this.ConceptCalculateDate.DayOfWeek == DayOfWeek.Friday) { PairableScndCnpValue unionResult = new PairableScndCnpValue(); PairableScndCnpValuePair unionResult2 = new PairableScndCnpValuePair(); PairableScndCnpValuePair unionResult3 = new PairableScndCnpValuePair(); unionResult2.From = 1440; unionResult2.To = 2880; unionResult3.From = 1; unionResult3.To = 1439; ((PairableScndCnpValue)Result).AddPairs(Operation.Intersect( Operation.Differance(this.DoConcept(1), this.Person.GetShiftByDate(this.ConceptCalculateDate) ), Operation.Intersect(this.DoConcept(4002), unionResult3))); ((PairableScndCnpValue)Result).AppendPairs(Operation.Intersect(this.DoConcept(4002), this.DoConcept(2004))); //((PairableScndCnpValue)Result).AppendPairs(); if (this.DoConcept(4002, this.RuleCalculateDate.AddDays(-1)).Value > 0) { unionResult = (PairableScndCnpValue)this.DoConcept(4002, this.RuleCalculateDate.AddDays(-1)); ((PairableScndCnpValue)Result).AppendPairs(Operation.Intersect(unionResult, unionResult2)); } } }
/// <summary> /// اعمال اضافه کار شبکاری با کد 152 /// درخواست اضافه کار عادی منجر به مجاز شدن نمیشود /// </summary> /// <param name="MyRule"></param> public virtual void R6502(AssignedRule MyRule) { var conceptList = new List <int>(); conceptList.AddRange(new[] { 4002, 4003, 13, 6503 }); GetLog(MyRule, DebugRuleState.Before, conceptList.Distinct().ToArray()); PairableScndCnpValuePair pair = new PairableScndCnpValuePair(MyRule["First", this.RuleCalculateDate].ToInt(), MyRule["Second", this.RuleCalculateDate].ToInt()); Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(152)); if (permit != null && permit.Value > 0 && Operation.Intersect(this.DoConcept(4003), pair).Value > 0) { this.DoConcept(13).Value += Operation.Intersect(this.DoConcept(4003), pair).Value; ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(Operation.Intersect(this.DoConcept(4003), pair)); ((PairableScndCnpValue)this.DoConcept(6503)).AppendPairs(Operation.Intersect(this.DoConcept(4003), pair)); ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(Operation.Differance(this.DoConcept(4003), pair)); } /* else if ((permit != null || permit.Value > 0) * && Operation.Intersect(this.DoConcept(4002), pair).Value > 0) * { * this.DoConcept(13).Value -= Operation.Intersect(this.DoConcept(4002), pair).Value; * * ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(Operation.Intersect(this.DoConcept(4002), pair)); * ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(Operation.Differance(this.DoConcept(4002), pair)); * * }*/ GetLog(MyRule, DebugRuleState.After, conceptList.Distinct().ToArray()); }
/// <summary> /// اعمال تاخیر روز بعد از رست /// </summary> /// <param name="MyRule"></param> public void R3503(AssignedRule MyRule) { //1501 رست //3028 غیبت ساعنی //3004 غیبت روزانه //3029 تاخیر //3020 غیبت ساتی مجاز //3021 تاخیر ساعتی مجاز //3024 تاخیر مجاز ماهانه //3026 غیبت مجاز ماهانه //3032 تاخیر ماهانه //3034 غیبت ساعتی ماهانه // 3 کارکرد ناخالص ماهانه //5 کارکرد روزانه ماهانه GetLog(MyRule, DebugRuleState.Before, 2, 4, 1501, 3020, 3021, 3028, 3029, 13, 3020, 3028, 3, 5, 3024, 3026, 3032, 3034); if (this.DoConcept(1501).Value == 0 && this.DoConcept(3004).Value == 0 && this.DoConcept(3029).Value > 0 && this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value > 0 && !EngEnvironment.HasCalendar(this.ConceptCalculateDate, "3")) { int allowToTime = MyRule["first", this.RuleCalculateDate].ToInt(); IPair alowPair = new PairableScndCnpValuePair(this.Person.GetShiftByDate(this.RuleCalculateDate).PastedPairs.From, allowToTime); this.DoConcept(3021).Value = Operation.Intersect(alowPair, this.DoConcept(3029)).Value; ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(this.DoConcept(3029), alowPair)); this.DoConcept(2).Value += this.DoConcept(3021).Value; this.DoConcept(4).Value = 1; this.ReCalculate(13, 3020, 3028, 5, 3, 3024, 3026, 3032, 3034); } GetLog(MyRule, DebugRuleState.After, 2, 4, 1501, 3020, 3021, 3028, 3029, 13, 3020, 3028, 3, 5, 3024, 3026, 3032, 3034); }
/// <summary> /// مرخصی نیم روز /// مرخصی روزانه ای که تا حد مشخصی از غیبت را پوشش میدهد و د هر صورت به میزان مشخص از /// مانده مرخصی کسر میگردد /// </summary> /// <param name="Result"></param> /// <param name="MyConcept"></param> public virtual void C1501(BaseScndCnpValue Result, SecondaryConcept MyConcept) { ((PairableScndCnpValue)Result).ClearPairs(); PairableScndCnpValue validLeave = new PairableScndCnpValue(); PairableScndCnpValue AbsentLeave = new PairableScndCnpValue(); Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(150)); BaseShift shift = this.Person.GetShiftByDate(this.ConceptCalculateDate); if (shift != null && shift.PairCount > 0 && permit.Value > 0) { // ساعات نیم روز سوال گردد IPair firstHalf = new PairableScndCnpValuePair(shift.PastedPairs.From, 11 * 60 + 30); IPair secondHalf = new PairableScndCnpValuePair(10 * 60 + 45, shift.PastedPairs.To); if (Operation.Intersect(firstHalf, this.DoConcept(3028)).Value > Operation.Intersect(secondHalf, this.DoConcept(3028)).Value) { this.Person.AddUsedLeave(this.ConceptCalculateDate, firstHalf.Value, permit); //((PairableScndCnpValue)Result).AddPair(firstHalf); Result.Value = 1; ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), firstHalf)); ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(this.DoConcept(3028)); } else { this.Person.AddUsedLeave(this.ConceptCalculateDate, secondHalf.Value, permit); //((PairableScndCnpValue)Result).AddPair(secondHalf); Result.Value = 1; ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), secondHalf)); ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(this.DoConcept(3028)); } this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031); } }
public void R6502(AssignedRule MyRule) { //4032 اضافه کار ویژه //4033 اضافه کار ویژه ماهانه GetLog(MyRule, " Before Execute State:", 4002); int start = MyRule["first", this.RuleCalculateDate].ToInt(); int end = MyRule["second", this.RuleCalculateDate].ToInt(); int overwork = MyRule["third", this.RuleCalculateDate].ToInt(); if (this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.Count > 1) { IPair pair = new PairableScndCnpValuePair(this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs[0].To, this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs[1].From); ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(Operation.Differance(this.DoConcept(4002), pair)); } ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate); //2023 ماموریت ساعتی bool applyed = false; if (this.DoConcept(2023).Value > 0) { foreach (PairableScndCnpValuePair pair in ((PairableScndCnpValue)this.DoConcept(2023)).Pairs) { if (pair.From >= start && pair.To <= end) { ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(overwork); applyed = true; this.DoConcept(13).Value += overwork; if (this.DoConcept(9).Value > 0) { this.ReCalculate(4005); } break; } } } if (!applyed && ProceedTraffic != null && ProceedTraffic.Pairs != null && ProceedTraffic.Pairs.Where(x => x.IsFilled).Count() > 1) { for (int i = 0; i < ProceedTraffic.Pairs.Count - 1; i++) { if (ProceedTraffic.Pairs[i].To >= start && ProceedTraffic.Pairs[i + 1].From <= end) { ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(overwork); this.DoConcept(13).Value += overwork; if (this.DoConcept(9).Value > 0) { this.ReCalculate(4005); } break; } } } GetLog(MyRule, " After Execute State:", 4002); }
/// <summary> /// تا ---- دقیقه تاخیر تا سقف ---- ساعت در ماه به مرخصی استحقاقی تبدیل شود /// </summary> /// <param name="MyRule"></param> public virtual void R3501(AssignedRule MyRule) { //3029 تاخیر //3028 غیبت ساعتی //1501 تاخیر تبدیل شده به مرخصی //1502 تاخیر تبدیل شده به مرخصی ماهانه int maxTakhir = MyRule["first", this.RuleCalculateDate].ToInt(); int maxInMonth = MyRule["second", this.RuleCalculateDate].ToInt(); int demandLeave = this.Person.GetRemainLeave(this.ConceptCalculateDate); //چک کردن عدم تردد ناقص وحداقل یک تردد ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficAllByDate(this.RuleCalculateDate); if ((ProceedTraffic.PairCount > 0 && !ProceedTraffic.IsFilled) || ProceedTraffic.PairCount <= 0) { // this.DoConcept(3029).Value = 0; return; } if (this.DoConcept(3029).Value > 0 && demandLeave > 0 && this.DoConcept(1502).Value < maxInMonth) { GetLog(MyRule, DebugRuleState.Before, 1003, 3029, 3028, 2, 13, 1501, 1502); int takhir = this.DoConcept(3029).Value; if (this.DoConcept(3029).Value > maxTakhir) { takhir = maxTakhir; } int mojaz = this.DoConcept(1502).Value + takhir < maxInMonth ? takhir : maxInMonth - this.DoConcept(1502).Value; int toLeave = demandLeave >= mojaz ? mojaz : demandLeave; int startOfShift = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From; IPair pair = new PairableScndCnpValuePair(startOfShift, startOfShift + toLeave); this.Person.AddUsedLeave(this.RuleCalculateDate, toLeave, null); ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(this.DoConcept(3029), pair)); ((PairableScndCnpValue)this.DoConcept(1003)).AppendPair(pair); this.DoConcept(1501).Value += toLeave; this.ReCalculate(3028, 2, 13); GetLog(MyRule, DebugRuleState.After, 1003, 3029, 3028, 2, 13, 1501, 1502); } }
/// <summary> حداکثر اضافه کاری روز غیر کاری - پارامتر پویا</summary> /// <remarks></remarks> //اضافه کار مجاز4002 public virtual void R6509(AssignedRule MyRule) { GetLog(MyRule, DebugRuleState.Before, 4002, 4003, 13); var personParam = this.Person.PersonTASpec.GetParamValue(this.Person.ID, "MAXERG", this.RuleCalculateDate); if (personParam != null && this.DoConcept(4015).Value == 1) { return; } if (personParam != null && this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0 && this.DoConcept(4002).Value > System.Convert.ToInt32(personParam.Value)) { int notAllowedValue = this.DoConcept(4002).Value - System.Convert.ToInt32(personParam.Value); foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4002)).Pairs) { if (pair.Value - notAllowedValue > 0) { IPair notAllowedPair = new PairableScndCnpValuePair(pair.To - notAllowedValue, pair.To); ((PairableScndCnpValue)this.DoConcept(4003)).AppendPair(notAllowedPair); pair.To -= notAllowedValue; this.DoConcept(4002).Value = ((PairableScndCnpValue)this.DoConcept(4002)).PairValues; break; } else if (pair.Value - notAllowedValue == 0) { ((PairableScndCnpValue)this.DoConcept(4003)).AppendPair(pair); pair.From = pair.To = 0; this.DoConcept(4002).Value = ((PairableScndCnpValue)this.DoConcept(4002)).PairValues; break; } else { ((PairableScndCnpValue)this.DoConcept(4003)).AppendPair(pair); notAllowedValue -= pair.Value; pair.From = pair.To = 0; this.DoConcept(4002).Value = ((PairableScndCnpValue)this.DoConcept(4002)).PairValues; } } this.ReCalculate(13); } GetLog(MyRule, DebugRuleState.After, 4002, 4003, 13); }
/// <summary> /// اعمال خروج روز قبل و ورود روز بعد از رست /// آولویت آن از 100011 به 1801 منتقل شد تا قبل قانون 13 انجام شود /// </summary> /// <param name="MyRule"></param> public void R3504(AssignedRule MyRule) { //1501 رست //1502 رست ماهانه //7 کارکرد در روز //3028 غیبت ساعنی //3004 غیبت روزانه //3029 تاخیر //3020 غیبت ساتی مجاز //4002 اضافه کار //3030 تعجیل ساعتی غیر مجاز //1005 استحقاقی روزانه //مثلا اگر روز اول رست تعطیل کاری باشد Permit rest = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(202)); if ((/*this.DoConcept(1501).Value == 1*/ (rest != null && rest.Value > 0) || this.DoConcept(1005).Value == 1) && this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 0 && this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 0) { ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate.AddDays(-1)); if (ProceedTraffic != null && ProceedTraffic.PairCount > 0) { if (Operation.Intersect( this.DoConcept(3028, this.RuleCalculateDate.AddDays(-1)), this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))) .Value > 0) { IPair pair = ProceedTraffic.Pairs.OrderBy(x => x.To).Last(); if (pair.To >= 12 * HourMin) { IPair alowPair = new PairableScndCnpValuePair(12 * HourMin, this.Person.GetShiftByDate(this.RuleCalculateDate).PastedPairs.To); PairableScndCnpValue allowAbsence = Operation.Intersect(alowPair, this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))); this.DoConcept(2, this.RuleCalculateDate.AddDays(-1)).Value += allowAbsence.PairValues; this.DoConcept(4, this.RuleCalculateDate.AddDays(-1)).Value = 1; this.DoConcept(3020, this.RuleCalculateDate.AddDays(-1)).Value += allowAbsence.PairValues; PairableScndCnpValue absence = Operation.Differance(this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1)), allowAbsence); ((PairableScndCnpValue)this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))).AddPairs(absence); this.DoConcept(3004, this.RuleCalculateDate.AddDays(-1)).Value = 0; this.ReCalculate(3028, this.RuleCalculateDate.AddDays(-1)); this.ReCalculate(4002, this.RuleCalculateDate.AddDays(-1)); this.ReCalculate(13, this.RuleCalculateDate.AddDays(-1)); } } } } //مثلا اگر روز آخر رست تعطیل کاری باشد rest = this.Person.GetPermitByDate(this.RuleCalculateDate.AddDays(-1), EngEnvironment.GetPrecard(202)); if ((/*this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 1*/ (rest != null && rest.Value > 0) || this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 1 ) && this.DoConcept(1501).Value == 0 && this.DoConcept(1005).Value == 0) { GetLog(MyRule, DebugRuleState.Before, 4028, 2, 4, 3028, 3004, 3020, 4002, 13); ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate); if (ProceedTraffic != null && ProceedTraffic.PairCount > 0) { if (Operation.Intersect( this.DoConcept(3028), this.DoConcept(3029)).Value > 0) { IPair pair = ProceedTraffic.Pairs.OrderBy(x => x.To).Last(); if (pair.From <= 11 * HourMin + 30) { IPair alowPair = new PairableScndCnpValuePair(5 * 60, 11 * HourMin + 30); PairableScndCnpValue allowAbsence = Operation.Intersect(alowPair, this.DoConcept(3028)); this.DoConcept(2).Value += allowAbsence.PairValues; this.DoConcept(4).Value = 1; this.DoConcept(3020).Value += allowAbsence.PairValues; PairableScndCnpValue absence = Operation.Differance(this.DoConcept(3028), allowAbsence); ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(absence); this.DoConcept(3004).Value = 0; this.ReCalculate(4002); this.ReCalculate(13); } } } GetLog(MyRule, DebugRuleState.After, 4028, 2, 4, 3028, 3004, 3020, 4002, 13); } }
/// <summary> /// • در صورتی به شخص کارکرد روزانه داده میشود که شخص حداقل به میزان 7:30 حضور داشته باشد. //• در صورت حضور کمتر از 7:30 , میزان حضور اضافه کار لحاظ میگردد. //• در صورت حضور بیش از 7:30 , علاوه بر اختصاص کارکرد روزانه , اضافه کار نیز به شخص تعلق میگیرد. //• در صورت عدم حضور شخص در یک روز , به شخص غیبت روزانه تعلق میگیرد /// </summary> /// <param name="MyRule"></param> public virtual void R2501_old(AssignedRule MyRule) { GetLog(MyRule, DebugRuleState.Before, 4, 4002, 3028, 3004, 13); if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0) { this.DoConcept(4).Value = 0; } PairableScndCnpValue tmpCnp = new PairableScndCnpValue(); PairableScndCnpValue orginTmpCnp = new PairableScndCnpValue(); tmpCnp.AddPairs(this.DoConcept(1)); tmpCnp.AppendPairs(this.DoConcept(1003)); tmpCnp.AppendPairs(this.DoConcept(2023)); ((PairableScndCnpValue)this.DoConcept(4002)).ClearPairs(); int minHozour = MyRule["first", this.RuleCalculateDate].ToInt(); int esterhat = MyRule["second", this.RuleCalculateDate].ToInt(); int in2Shift = MyRule["third", this.RuleCalculateDate].ToInt(); this.DoConcept(3012).Value = minHozour;//بعلت عدم تعریم مفهوم از این استفاده میشود if (tmpCnp.Value > 0) { orginTmpCnp.AddPairs(tmpCnp); int start1 = MyRule["4th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت صبح int start2 = MyRule["5th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار بعد وقت صبح int end2 = MyRule["6th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت صبح int start3 = MyRule["7th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت عصر int end3 = MyRule["8th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار قبل وقت عصر int end4 = MyRule["9th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت عصر int start = tmpCnp.Pairs.First().From; int end = tmpCnp.Pairs.Last().To; PairableScndCnpValuePair notAllow = new PairableScndCnpValuePair(); PairableScndCnpValue notAllowOverwork = new PairableScndCnpValue(); if (start1 > 0 && end4 > 0) { notAllow = new PairableScndCnpValuePair(start1, end4); notAllowOverwork.AddPairs(Operation.Differance(tmpCnp, notAllow)); tmpCnp.AddPairs(Operation.Intersect(tmpCnp, notAllow)); } if (end > 0 && start2 > 0 && end2 > 0 && end > start2 && end < end2) { notAllow = new PairableScndCnpValuePair(start2, end2); notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow)); tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow)); } if (start > 0 && start3 > 0 && end3 > 0 && start > start3 && start < end3) { notAllow = new PairableScndCnpValuePair(start3, end3); notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow)); tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow)); } ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowOverwork); } if (tmpCnp.Value > minHozour) { if (tmpCnp.Value >= in2Shift && in2Shift > 0) { tmpCnp.DecreasePairFromFirst(esterhat * 2); } else { tmpCnp.DecreasePairFromFirst(esterhat); } } if (tmpCnp.Value > 0) { this.DoConcept(13).Value = tmpCnp.Value; if (tmpCnp.Value >= this.DoConcept(7).Value) { this.DoConcept(4).Value = 1; tmpCnp.DecreasePairFromFirst(this.DoConcept(7).Value); ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp); } else { //اگر حداقل حضور که معمولا 3:30 است را داشته باشد , این مفهوم مقدار دهس میشود if (tmpCnp.Value >= minHozour) { this.DoConcept(503).Value = 1; ((PairableScndCnpValue)this.DoConcept(3028)).IncreaseValue(this.DoConcept(7).Value);// - tmpCnp.Value); ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp); } else { ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp); // this.DoConcept(13).Value = this.DoConcept(4002).Value; } } } else if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0 && this.DoConcept(1091).Value == 0) { this.DoConcept(3004).Value = 1; } this.DoConcept(5022).FromPairs = ""; GetLog(MyRule, DebugRuleState.After, 4, 4002, 3028, 3004, 13); }
/// <summary> /// • در صورتی به شخص کارکرد روزانه داده میشود که شخص حداقل به میزان 7:30 حضور داشته باشد. //• در صورت حضور کمتر از 7:30 , میزان حضور اضافه کار لحاظ میگردد. //• در صورت حضور بیش از 7:30 , علاوه بر اختصاص کارکرد روزانه , اضافه کار نیز به شخص تعلق میگیرد. //• در صورت عدم حضور شخص در یک روز , به شخص غیبت روزانه تعلق میگیرد /// </summary> /// <param name="MyRule"></param> public virtual void R2501(AssignedRule MyRule) { GetLog(MyRule, DebugRuleState.Before, 4, 4002, 3028, 3004, 13); this.DoConcept(501).Value = 1;//روز محاسبه شده را نگه میدارد.بوسیله این متوجه میشویم که حداکثر تعداد روز محاسباتی در ماه چقدر است-همیشه نمیتوان به تعداد رینج ماهانه اکتفا کرد if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0) { this.DoConcept(4).Value = 0; } PairableScndCnpValue tmpCnp = new PairableScndCnpValue(); PairableScndCnpValue orginTmpCnp = new PairableScndCnpValue(); tmpCnp.AddPairs(this.DoConcept(1)); tmpCnp.AppendPairs(this.DoConcept(1003)); tmpCnp.AppendPairs(this.DoConcept(2023)); ((PairableScndCnpValue)this.DoConcept(4002)).ClearPairs(); int minHozour = MyRule["first", this.RuleCalculateDate].ToInt(); int esterhat = MyRule["second", this.RuleCalculateDate].ToInt(); int in2Shift = MyRule["third", this.RuleCalculateDate].ToInt(); this.DoConcept(3012).Value = minHozour; //بعلت عدم تعریم مفهوم از این استفاده میشود if (tmpCnp.Value > 0) //کم کردن کارکرد خارج از محدوده { orginTmpCnp.AddPairs(tmpCnp); int start1 = MyRule["4th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت صبح int start2 = MyRule["5th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار بعد وقت صبح int end2 = MyRule["6th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت صبح int start3 = MyRule["7th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت عصر int end3 = MyRule["8th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار قبل وقت عصر int end4 = MyRule["9th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت عصر int start = tmpCnp.Pairs.First().From; int end = tmpCnp.Pairs.Last().To; PairableScndCnpValuePair notAllow = new PairableScndCnpValuePair(); PairableScndCnpValue notAllowOverwork = new PairableScndCnpValue(); if (start1 > 0 && end4 > 0) { notAllow = new PairableScndCnpValuePair(start1, end4); notAllowOverwork.AddPairs(Operation.Differance(tmpCnp, notAllow)); tmpCnp.AddPairs(Operation.Intersect(tmpCnp, notAllow)); } if (end > 0 && start2 > 0 && end2 > 0 && end > start2 && end < end2) { notAllow = new PairableScndCnpValuePair(start2, end2); notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow)); tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow)); } if (start > 0 && start3 > 0 && end3 > 0 && start > start3 && start < end3) { notAllow = new PairableScndCnpValuePair(start3, end3); notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow)); tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow)); } //((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowOverwork); } if (tmpCnp.Value > 0)//کم کردن مدت استراحت { if (tmpCnp.Value >= in2Shift && in2Shift > 0) { tmpCnp.DecreasePairFromFirst(esterhat * 2); } else { tmpCnp.DecreasePairFromFirst(esterhat); } } if (tmpCnp.Value > 0) { this.DoConcept(13).Value = tmpCnp.Value; } else if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0 && this.DoConcept(1091).Value == 0) { this.DoConcept(3004).Value = 1; } this.DoConcept(5022).FromPairs = ""; GetLog(MyRule, DebugRuleState.After, 4, 4002, 3028, 3004, 13); }
/// <summary> /// اعمال خروج روز قبل و ورود روز بعد از رست /// آولویت آن از 100011 به 1801 منتقل شد تا قبل قانون 13 انجام شود /// </summary> /// <param name="MyRule"></param> public void R293(AssignedRule MyRule) { //1501 رست //1502 رست ماهانه //7 کارکرد در روز //3028 غیبت ساعنی //3004 غیبت روزانه //3029 تاخیر //3020 غیبت ساتی مجاز //4002 اضافه کار //3030 تعجیل ساعتی غیر مجاز //1005 استحقاقی روزانه GetLog(MyRule, " Before Execute State:", 4028, 2, 4, 3028, 3004); if ((this.DoConcept(1501).Value == 1 || this.DoConcept(1005).Value == 1) && this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 0 && this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 0) { ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate.AddDays(-1)); if (ProceedTraffic != null && ProceedTraffic.PairCount > 0) { if (Operation.Intersect( this.DoConcept(3028, this.RuleCalculateDate.AddDays(-1)), this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))) .Value > 0) { IPair pair = ProceedTraffic.Pairs.OrderBy(x => x.To).Last(); if (pair.To >= 12 * HourMin) { IPair alowPair = new PairableScndCnpValuePair(12 * HourMin, this.Person.GetShiftByDate(this.RuleCalculateDate).PastedPairs.To); PairableScndCnpValue allowAbsence = Operation.Intersect(alowPair, this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))); this.DoConcept(2, this.RuleCalculateDate.AddDays(-1)).Value += allowAbsence.PairValues; this.DoConcept(4, this.RuleCalculateDate.AddDays(-1)).Value = 1; this.DoConcept(3020, this.RuleCalculateDate.AddDays(-1)).Value += allowAbsence.PairValues; PairableScndCnpValue absence = Operation.Differance(this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1)), allowAbsence); ((PairableScndCnpValue)this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))).AddPairs(absence); this.DoConcept(3004, this.RuleCalculateDate.AddDays(-1)).Value = 0; this.ReCalculate(3028, this.RuleCalculateDate.AddDays(-1)); this.ReCalculate(4002, this.RuleCalculateDate.AddDays(-1)); this.ReCalculate(13, this.RuleCalculateDate.AddDays(-1)); } } } } if ((this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 1 || this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 1) && this.DoConcept(1501).Value == 0 && this.DoConcept(1005).Value == 0) { ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate); if (ProceedTraffic != null && ProceedTraffic.PairCount > 0) { if (Operation.Intersect( this.DoConcept(3028), this.DoConcept(3029)).Value > 0) { IPair pair = ProceedTraffic.Pairs.OrderBy(x => x.To).Last(); if (pair.From <= 11 * HourMin + 30) { IPair alowPair = new PairableScndCnpValuePair(5 * 60, 11 * HourMin + 30); PairableScndCnpValue allowAbsence = Operation.Intersect(alowPair, this.DoConcept(3028)); this.DoConcept(2).Value += allowAbsence.PairValues; this.DoConcept(4).Value = 1; this.DoConcept(3020).Value += allowAbsence.PairValues; PairableScndCnpValue absence = Operation.Differance(this.DoConcept(3028), allowAbsence); ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(absence); this.DoConcept(3004).Value = 0; this.ReCalculate(4002); this.ReCalculate(13); } } } } GetLog(MyRule, " After Execute State:", 4028, 2, 4, 3028, 3004); }
/// <summary> /// کد 6032 : اعمال مجوز اضافه کاری /// </summary> /// <param name="MyRule"></param> public override void R6032(AssignedRule MyRule) { //4002 اضافه کارساعتي مجاز //4003 اضافه کارساعتي غیرمجاز //4015 اضافه کار با مجوز باشد //4016 مفهوم اضافه کار بعد از وقت مجوزی است //4029 مفهوم مجوز اضافه کاری //4007 مفهوم اضافه کارآخر وقت //4026 سقف اضافه کار که ضریب تعلق میگیرد Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.OverTime)); Permit permitFriday = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(151)); GetLog(MyRule, DebugRuleState.Before, 4007, 4002, 4005, 4003, 13); #region Apply Parameters int withoutPermitAlow = 0; if (this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0) { withoutPermitAlow = MyRule["MojazTatil", this.RuleCalculateDate].ToInt(); } else { withoutPermitAlow = MyRule["MojazAadi", this.RuleCalculateDate].ToInt(); } if (withoutPermitAlow > 0) { foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4003)).Pairs) { if (pair.Value - withoutPermitAlow > 0) { IPair allowedPair = new PairableScndCnpValuePair(pair.From, pair.From + withoutPermitAlow); ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(allowedPair); this.DoConcept(13).Value += allowedPair.Value;; pair.From += withoutPermitAlow; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; break; } else if (pair.Value - withoutPermitAlow == 0) { ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair); this.DoConcept(13).Value += pair.Value; pair.From = pair.To = 0; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; break; } else { ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair); this.DoConcept(13).Value += pair.Value; withoutPermitAlow -= pair.Value; pair.From = pair.To = 0; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; } } } #endregion if (permit != null && permit.Value > 0) { if (this.DoConcept(4003).Value > 0) { foreach (PermitPair permitPair in permit.Pairs) { //مجوز مقداری و بازه ای - در حال حاضر نمیتوان روی خصیصه جفت بودن در مجوز حساب کرد //لذا از روش زیر جهت شناسایی استفاده میگردد #region Pairly Permit if (permitPair.To - permitPair.From == permitPair.Value) { PairableScndCnpValue allowedOverWork = Operation.Intersect(permitPair, (PairableScndCnpValue)this.DoConcept(4003)); PairableScndCnpValue notAllowedOverWork = Operation.Differance(this.DoConcept(4003), allowedOverWork); ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(allowedOverWork); ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowedOverWork); this.ReCalculate(13); permitPair.IsApplyedOnTraffic = true;//اعمال شد } #endregion #region Value Permit else if ((permitPair.From == 1439 && permitPair.To == 1439 && permitPair.Value > 0) || permitPair.To - permitPair.From != permitPair.Value) { int permitOverWork = permitPair.Value; foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4003)).Pairs) { if (pair.Value - permitOverWork > 0) { IPair allowedPair = new PairableScndCnpValuePair(pair.From, pair.From + permitOverWork); ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(allowedPair); pair.From += permitOverWork; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; break; } else if (pair.Value - permitOverWork == 0) { ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair); pair.From = pair.To = 0; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; break; } else { ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair); permitOverWork -= pair.Value; pair.From = pair.To = 0; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; } } permitPair.IsApplyedOnTraffic = true;//اعمال شد } #endregion } } } if (permitFriday != null && permitFriday.Value > 0) { if (this.DoConcept(4003).Value > 0) { foreach (PermitPair permitPair in permitFriday.Pairs) { //مجوز مقداری و بازه ای - در حال حاضر نمیتوان روی خصیصه جفت بودن در مجوز حساب کرد //لذا از روش زیر جهت شناسایی استفاده میگردد #region Pairly permitFriday if (permitPair.To - permitPair.From == permitPair.Value) { PairableScndCnpValue allowedOverWork = Operation.Intersect(permitPair, (PairableScndCnpValue)this.DoConcept(4003)); PairableScndCnpValue notAllowedOverWork = Operation.Differance(this.DoConcept(4003), allowedOverWork); ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(allowedOverWork); ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowedOverWork); permitPair.IsApplyedOnTraffic = true;//اعمال شد } #endregion #region Value permitFriday else if ((permitPair.From == 1439 && permitPair.To == 1439 && permitPair.Value > 0) || permitPair.To - permitPair.From != permitPair.Value) { int permitOverWork = permitPair.Value; foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4003)).Pairs) { if (pair.Value - permitOverWork > 0) { IPair allowedPair = new PairableScndCnpValuePair(pair.From, pair.From + permitOverWork); ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(allowedPair); pair.From += permitOverWork; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; break; } else if (pair.Value - permitOverWork == 0) { ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair); pair.From = pair.To = 0; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; break; } else { ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair); permitOverWork -= pair.Value; pair.From = pair.To = 0; this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues; } } permitPair.IsApplyedOnTraffic = true;//اعمال شد } #endregion } } } this.DoConcept(13).Value = this.DoConcept(2).Value + this.DoConcept(4002).Value; DateRange dateRange1 = this.GetDateRange(4005, this.RuleCalculateDate); if (this.RuleCalculateDate == dateRange1.ToDate || CalcDateZone.ToDate == this.RuleCalculateDate) { this.ReCalculate(4005); } this.ReCalculate(4007); GetLog(MyRule, DebugRuleState.After, 4007, 4002, 4005, 4003, 13); }