Пример #1
0
        ///// <summary>
        ///// 已经排到的最后一天
        ///// </summary>
        //public DateTime? CapEndTime { get; set; }
        ///// <summary>
        ///// 最后一天剩余的能力值
        ///// </summary>
        //public double LastCap { get; set; }

        ///// <summary>
        ///// 添加Step到数组中,并记录最后的完成时间
        ///// </summary>
        ///// <param name="step"></param>
        //public DateTime? AddStep(MOItemTask step)
        //{
        //    DateTime? EndTime = null ;
        //    if (!StepList.Where(p => p.MOItemTaskId == step.MOItemTaskId).Any())
        //    {
        //        StepList.Add(step);

        //        this.endTime = step.PlannedDateTo;

        //        EndTime = this.endTime;
        //    }

        //    SetTimeslice();

        //    return EndTime;
        //}

        //public void AddStep(MOItemTask step,double cap)
        //{
        //    double sum = LastCap + cap;
        //    double maxcap = VentureCap * 1.2;
        //    if (sum <= maxcap)
        //    {
        //        LastCap = VentureCap - sum;
        //    }
        //    else
        //    {
        //        LastCap = VentureCap - cap;
        //        if(CapEndTime == null)
        //        {
        //            CapEndTime = DateTime.Now;
        //        }

        //        do
        //        {
        //            CapEndTime = CapEndTime.Value.AddDays(1);
        //        }
        //        while (IsWorkTime(CapEndTime.Value));
        //    }

        //    step.PlannedDateFrom = new DateTime(CapEndTime.Value.Year, CapEndTime.Value.Month, CapEndTime.Value.Day, 8, 0, 0);
        //    step.PlannedDateTo = new DateTime(CapEndTime.Value.Year, CapEndTime.Value.Month, CapEndTime.Value.Day, 17, 0, 0);


        //    StepList.Add(step);
        //}

        public DateTime?AddStep(MOItemTask step, DateTime?lastTime, double cap)
        {
            if (lastTime != null)
            {
                var workTime = VenTureDayModel.GetWorkTime((DateTime)lastTime, VentureId);

                var venTureDayModel = this.VenTureDayModelList.Where(p => p.DayDate.Year == workTime.Year && p.DayDate.Month == workTime.Month && p.DayDate.Day == workTime.Day && p.LastCap > 0).FirstOrDefault();

                if (venTureDayModel == null)
                {
                    this.VenTureDayModelList.Add(new VenTureDayModel(workTime, VentureCap, new List <MOItemTask>()));

                    venTureDayModel = this.VenTureDayModelList.Where(p => p.DayDate >= lastTime).FirstOrDefault();
                }

                if (venTureDayModel.LastCap < cap && VentureCap * 0.25 < cap)
                {
                }

                var retModel = venTureDayModel.AddStep(step, cap, lastTime, this.VentureId);

                StepList.Add(retModel.MOItemTask);

                return(retModel.EndTime);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public void SetPlanCapCount()
        {
            this.PlanCapCount = 0;

            foreach (var mit in this.StepList)
            {
                int cap = VenTureDayModel.GetStandardWorkingTimeByProductId_SpecificationId(mit.ProductId, mit.SpecificationID);

                this.PlanCapCount += cap;
            }
        }
Пример #3
0
        public void DispatchStep()
        {
            foreach (var mit in StepList)
            {
                var vdm = VenTureDayModelList.Where(p => p.Year == mit.PlannedDateFrom.Value.Year && p.Month == mit.PlannedDateFrom.Value.Month && p.Day == mit.PlannedDateFrom.Value.Day).FirstOrDefault();
                if (vdm == null)
                {
                    vdm = new VenTureDayModel((DateTime)mit.PlannedDateFrom, this.VentureCap, new List <MOItemTask>());

                    this.VenTureDayModelList.Add(vdm);

                    vdm.StepList.Add(mit);
                }
                else
                {
                    vdm.StepList.Add(mit);
                }
            }

            foreach (var vdm in this.VenTureDayModelList)
            {
                vdm.SetTimeslice();
            }
        }