示例#1
0
        /// <summary>
        /// حضور اول وقت قبل از ماموریت ساعتی بعد از ساعت 10 اجباری است
        /// </summary>
        /// <param name="MyRule"></param>
        public void R4502(AssignedRule MyRule)
        {
            //2 کارکرد خالص
            //ماموريت ساعتي 2004
            //3021 تاخیر مجاز
            //3029 تاخیر غیر مجاز
            GetLog(MyRule, DebugRuleState.Before, 2004, 2, 13, 3021, 3029, 3020, 3028);

            if (this.DoConcept(2004).Value > 0)
            {
                PairableScndCnpValue duty    = ((PairableScndCnpValue)this.DoConcept(2004));
                PairableScndCnpValue present = ((PairableScndCnpValue)this.DoConcept(1));

                if (duty.Pairs.FirstOrDefault() != null && duty.Pairs.OrderBy(x => x.From).First().From > 10 * HourMin)
                {
                    if (present.Pairs.FirstOrDefault() != null && present.Pairs.OrderBy(x => x.From).First().From > 10 * HourMin)
                    {
                        duty.ClearPairs();
                        this.DoConcept(2004).Value = 0;
                    }
                }
                else
                {//و اگرتاخیر داشت مجاز است
                    ProceedTraffic proceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate);
                    if (proceedTraffic.Pairs.FirstOrDefault() == null || proceedTraffic.Pairs.OrderBy(x => x.From).First().From > 10 * HourMin)
                    {
                        this.DoConcept(3021).Value = this.DoConcept(3029).Value;
                        ((PairableScndCnpValue)this.DoConcept(3029)).ClearPairs();
                        this.DoConcept(2).Value += this.DoConcept(3021).Value;
                        this.ReCalculate(13, 3020, 3028);
                    }
                }
            }
            GetLog(MyRule, DebugRuleState.After, 2004, 2, 13, 3021, 3029, 3020, 3028);
        }
示例#2
0
        /// <summary>
        /// روزانه اضافه کار با غیبت جبران شود
        /// در اسن نسخه به غیبت مجاز اضافه نمیکند تا یر جمع ماهانه درست باشد - بندر عباس
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R1005(AssignedRule MyRule)
        {
            //غيبت ساعتي 3001
            //اضافه کار ساعتي 56
            //3028 غيبت ساعتی غیرمجاز
            //4002 اضافه کارساعتي مجاز
            //2 کارکردخالص ساعتي
            //4017 اضافه کار مجاز کارتی
            ProceedTraffic proceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate);

            if (proceedTraffic.IsFilled)
            {
                GetLog(MyRule, DebugRuleState.Before, 3028, 4002, 4017, 2);
                if (this.DoConcept(4002).Value > 0 && this.DoConcept(3028).Value > 0)
                {
                    int tmp = Operation.Minimum(this.DoConcept(3028).Value,
                                                this.DoConcept(4002).Value,
                                                MyRule["First", this.RuleCalculateDate].ToInt());
                    ((PairableScndCnpValue)this.DoConcept(3028)).DecreasePairFromLast(tmp);
                    ((PairableScndCnpValue)this.DoConcept(4002)).DecreasePairFromLast(tmp);
                    this.DoConcept(2).Value += tmp;
                }

                if (this.DoConcept(4017).Value > 0 && this.DoConcept(3028).Value > 0)
                {
                    int tmp = Operation.Minimum(this.DoConcept(3028).Value,
                                                this.DoConcept(4017).Value,
                                                MyRule["First", this.RuleCalculateDate].ToInt());
                    ((PairableScndCnpValue)this.DoConcept(3028)).DecreasePairFromLast(tmp);
                    ((PairableScndCnpValue)this.DoConcept(4017)).DecreasePairFromLast(tmp);
                    this.DoConcept(2).Value += tmp;
                }
                GetLog(MyRule, DebugRuleState.After, 3028, 4002, 4017, 2);
            }
        }
示例#3
0
        private void Remove(Person p, ProceedTraffic pt)
        {
            PersonRepository personRepository = new PersonRepository(false);

            personRepository.DeleteProceedTraffic(pt);
            p.ProceedTrafficList.Remove(pt);
        }
示例#4
0
 /// <summary></summary>
 /// <remarks>شناسه اين قانون در تعاريف بعدي دویست و هشتاد و یک-280 درنظر گرفته شده است</remarks>
 ///  کارکرد در تعطیلات خاص
 ///  اگر حداقل تا 12 ظهر حضورداشت تعلق گیرد
 public void R2502(AssignedRule MyRule)
 {
     //7 کارکرد در روز
     //51 تعطیلات خاص مانند عید قربان و ...
     //20 حضور تعطیلات خاص
     //4002 اضافه کار مجاز
     //3006 غیبت روزانه
     if (this.EngEnvironment.HasCalendar(this.RuleCalculateDate, "51"))
     {
         GetLog(MyRule, DebugRuleState.Before, 3028, 2, 4, 3004, 1501, 20, 4002);
         if (this.DoConcept(4002).Value == 0)
         {
             this.DoConcept(4).Value = 1;
             this.DoConcept(2).Value = this.Person.GetShiftByDate(this.RuleCalculateDate).PairValues; //this.DoConcept(7).Value;
         }
         this.DoConcept(3004).Value = 0;
         this.DoConcept(1501).Value = 0;
         if (this.DoConcept(1).Value > 0)
         {
             ProceedTraffic ProceedTraffic   = this.Person.GetProceedTraficByDate(this.RuleCalculateDate);
             int            aftermidDayCount = ProceedTraffic.Pairs.OrderBy(x => x.To).Where(x => x.IsFilled && x.To > 12 * HourMin).Count();
             if (aftermidDayCount > 0)
             {
                 this.DoConcept(20).Value = 1;
                 ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(this.DoConcept(1));
             }
         }
         this.ReCalculate(13);
         GetLog(MyRule, DebugRuleState.After, 3028, 2, 4, 3004, 1501, 20, 4002);
     }
 }
示例#5
0
        /// <summary>مفهوم غيبت خالص ساعتي</summary>
        /// <param name="Result"></param>
        /// <remarks>شناسه اين مفهوم در تعاريف بعدي سي و شش-36 درنظر گرفته شده است</remarks>
        public override void C3001(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Result.Value = 0;
            PairableScndCnpValue.ClearPairsValue(Result);
            ProceedTraffic proceedTraffic = this.Person.GetProceedTraficByDate(this.ConceptCalculateDate);

            if (proceedTraffic.IsFilled && this.DoConcept(1090).Value == 0 && this.DoConcept(2005).Value == 0 && this.DoConcept(1091).Value == 0 &&
                this.DoConcept(2026).Value == 0)
            {
                if (this.Person.GetShiftByDate(this.ConceptCalculateDate).ShiftType != ShiftTypesEnum.OVERTIME)
                {
                    if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0 && proceedTraffic != null && (proceedTraffic.HasHourlyItem || (!proceedTraffic.HasHourlyItem && !proceedTraffic.HasDailyItem)))
                    {
                        ((PairableScndCnpValue)Result).AddPairs(Operation.Differance(this.Person.GetShiftByDate(this.ConceptCalculateDate), proceedTraffic));
                    }
                    else if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0 && proceedTraffic == null)
                    {
                        ((PairableScndCnpValue)Result).AppendPairs(this.Person.GetShiftByDate(this.ConceptCalculateDate).Pairs);
                    }
                    else
                    {
                        Result.Value = 0;
                    }
                }
                else
                {
                    Result.Value = 0;
                }
            }
        }
示例#6
0
        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);
        }
示例#7
0
        /// <summary>مفهوم تاخير خالص ساعتي</summary>
        /// <param name="Result"></param>
        /// <remarks>شناسه اين مفهوم در تعاريف بعدي چهل و دو-42 درنظر گرفته شده است</remarks>
        public virtual void C3010(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Result.Value = 0;
            PairableScndCnpValue.ClearPairsValue(Result);
            ProceedTraffic proceedTraffic = Person.GetProceedTraficByDate(this.ConceptCalculateDate);

            this.DoConcept(3038).Value = 0;
            if (this.DoConcept(1090).Value == 0 && this.DoConcept(2005).Value == 0 && this.DoConcept(1091).Value == 0)
            {
                PairableScndCnpValue absent = (PairableScndCnpValue)this.DoConcept(3001);
                BaseShift            shift  = this.Person.GetShiftByDate(this.ConceptCalculateDate);

                if (absent != null && shift != null && absent.PairCount != 0 && shift.PairCount != 0)
                {
                    if (proceedTraffic != null && proceedTraffic.Pairs.Where(x => x.IsFilled).Count() > 0 &&
                        Operation.Intersect(this.Person.GetShiftByDate(this.ConceptCalculateDate), proceedTraffic).Value > 0)
                    {
                        IPair pair = proceedTraffic.Pairs.Where(x => x.IsFilled).OrderBy(x => x.From).First();
                        //ShiftPair firstShiftPair = shift.Pairs.OrderBy(x => x.From).First();
                        foreach (ShiftPair shiftPair in shift.Pairs.OrderBy(x => x.From).ToList())
                        {
                            PairableScndCnpValue p = Operation.Intersect(shiftPair, absent);
                            if (p.PairCount > 0 && p.Pairs.OrderBy(x => x.From).Last().To ==
                                shiftPair.To)
                            {
                                //PairableScndCnpValue val = Operation.Differance(p.Pairs.OrderBy(x => x.From).First(), pair);
                                PairableScndCnpValue.AppendPairToScndCnpValue(p.Pairs.Last(), Result);
                                this.DoConcept(3038).Value += 1;
                                //break;
                            }
                        }
                    }
                    else
                    {
                        //در نظر گرفتن کل غیبت
                        foreach (ShiftPair shiftPair in shift.Pairs.OrderBy(x => x.From).ToList())
                        {
                            PairableScndCnpValue p = Operation.Intersect(shiftPair, absent);
                            if (p.PairCount > 0 && p.Pairs.OrderBy(x => x.From).First().From ==
                                shiftPair.From)
                            {
                                PairableScndCnpValue.AppendPairToScndCnpValue(p.Pairs.OrderBy(x => x.From).First(), Result);
                                this.DoConcept(3038).Value += 1;
                            }
                        }
                    }
                }
            }
        }
示例#8
0
        /// <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);
            }
        }
示例#9
0
        /// <summary>
        /// جهت دادن کارکرد روزانه یک بدون اعشار
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R2002(AssignedRule MyRule)
        {
            //3004 غيبت روزانه
            //7 کارکرددرروز
            //2 کارکردخالص ساعتي
            //کارکردخالص روزانه 4
            ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficAllByDate(this.RuleCalculateDate);

            if (this.DoConcept(3004).Value == 0 &&
                this.DoConcept(2).Value > 0 &&
                this.Person.GetShiftByDate(this.RuleCalculateDate).Value >= this.DoConcept(7).Value&&
                this.Person.GetShiftByDate(this.RuleCalculateDate).ShiftType != ShiftTypesEnum.OVERTIME &&
                ProceedTraffic.IsFilled)
            {
                GetLog(MyRule, DebugRuleState.Before, 4);
                this.DoConcept(4).Value = 1;
                GetLog(MyRule, DebugRuleState.After, 4);
            }
        }
示例#10
0
        /// <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);
            }
        }
示例#11
0
 /// <summary>
 /// در بین آیتم های قبلی که محاسبه روی آنها صورت گرفته است
 /// بررسی میکند که آیا آیتم جدید یا ویرایش شده وجود دارد یا نه
 /// در تریگر قرار است انجام شود
 /// </summary>
 private void CheckChangedItems()
 {
     if (_person.BasicTrafficList.Count > 0)
     {
         List <BasicTraffic> basicTrafList = _person.BasicTrafficList
                                             .Where(x => x.Active == false || x.Used == false)
                                             .ToList();
         if (basicTrafList.Count > 0)
         {
             int          index = CheckForNewItem(_person);
             BasicTraffic bt    = basicTrafList.First();
             if (index > -1 && bt.Date >= _person.BasicTrafficList[index].Date)
             {
                 bt = _person.BasicTrafficList[index];
             }
             List <ProceedTraffic> proceedTrafList = _person.ProceedTrafficList
                                                     .Where(x => x.Pairs
                                                            .Where(y => y.BasicTrafficIdFrom == bt.ID || y.BasicTrafficIdTo == bt.ID)
                                                            .Count() > 0)
                                                     .ToList();
             if (proceedTrafList.Count > 0)
             {
                 ProceedTraffic pt = proceedTrafList.First();
                 while (true)
                 {
                     proceedTrafList = _person.ProceedTrafficList
                                       .Where(x => x.ID < pt.ID)
                                       .ToList();
                     if (proceedTrafList.Count > 0)
                     {
                         pt = proceedTrafList.Last();
                         if (pt.Pairs.First().BasicTrafficIdFrom > 0)
                         {
                             List <BasicTraffic> btList = _person.BasicTrafficList.Where(x => x.ID == pt.Pairs[0].BasicTrafficIdFrom).ToList();
                             if (btList.Count > 0)
                             {
                                 BasicTraffic tmpBasic = btList.First();
                                 for (int i = 0; i < _person.BasicTrafficList.Count; i++)
                                 {
                                     decimal id = _person.BasicTrafficList[i].ID;
                                     if (tmpBasic.Date <= _person.BasicTrafficList[i].Date)
                                     {
                                         _person.BasicTrafficList[i].Used = false;
                                     }
                                 }
                             }
                             RemoveAfterID(_person, pt.ID);
                             break;
                         }
                     }
                     else
                     {
                         break;
                     }
                 }
             }
             if (bt.Active == false)
             {
                 _person.BasicTrafficList.Remove(bt);
             }
             //آگر آیتم جدید اضافه شده باشد و آیتم شروع ان قبلا محاسبه شده باشد آنرا حذف میکند
             BasicTraffic bt1 = _person.BasicTrafficController.CurrentBasicItem;
             if (_person.ProceedTrafficList.Count > 0 && _person.ProceedTrafficList.OrderBy(x => x.FromDate).Last().FromDate.Date == bt1.Date.Date)
             {
                 ProceedTraffic proceedTraffic = _person.ProceedTrafficList.OrderBy(x => x.FromDate).Last();
                 foreach (ProceedTrafficPair pair in proceedTraffic.Pairs)
                 {
                     if (_person.BasicTrafficList.Where(x => x.ID == pair.BasicTrafficIdFrom).Count() > 0)
                     {
                         _person.BasicTrafficList.Where(x => x.ID == pair.BasicTrafficIdFrom).First().Used = false;
                     }
                 }
                 Remove(_person, proceedTraffic);
             }
         }
     }
 }
示例#12
0
        /// <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);
        }