Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }