Exemple #1
0
        private IList <ItemFlowPlanDetail> ConvertOrderDmdToItemFlowPlanDetail(ItemFlowPlan itemFlowPlan, IList <OrderLocationTransaction> orderLocTransList)
        {
            IList <ItemFlowPlanDetail> itemFlowPlanDetailList = new List <ItemFlowPlanDetail>();
            List <DateTime>            dateTimeList           = this.CollectDateList(orderLocTransList);

            if (dateTimeList.Count > 0)
            {
                foreach (DateTime date in dateTimeList)
                {
                    ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail();
                    itemFlowPlanDetail.ItemFlowPlan   = itemFlowPlan;
                    itemFlowPlanDetail.ReqDate        = date;
                    itemFlowPlanDetail.OrderRemainQty = 0;
                    foreach (OrderLocationTransaction orderLocTrans in orderLocTransList)
                    {
                        if (DateTime.Compare(date, orderLocTrans.OrderDetail.OrderHead.WindowTime.Date) == 0)
                        {
                            itemFlowPlanDetail.OrderRemainQty += orderLocTrans.RemainQty;
                            ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                            itemFlowPlanTrack.ItemFlowPlanDetail       = itemFlowPlanDetail;
                            itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans;
                            //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty;
                            itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack);
                        }
                    }

                    if (itemFlowPlanDetail.OrderRemainQty > 0)
                    {
                        itemFlowPlanDetailList.Add(itemFlowPlanDetail);
                    }
                }
            }

            return(itemFlowPlanDetailList);
        }
        public void AddItemFlowPlanTrack(ItemFlowPlanTrack itemFlowPlanTrack)
        {
            if (this.ItemFlowPlanTracks == null)
            {
                this.ItemFlowPlanTracks = new List<ItemFlowPlanTrack>();
            }

            this.ItemFlowPlanTracks.Add(itemFlowPlanTrack);
        }
        public void SaveRelation(ItemFlowPlanDetail ifpd, ItemFlowPlanDetail parIfpd, decimal rate)
        {
            ItemFlowPlanTrack ifpt = new ItemFlowPlanTrack();

            ifpt.ItemFlowPlanDetail  = ifpd;
            ifpt.ReferencePlanDetail = parIfpd;
            ifpt.Rate = rate;
            ItemFlowPlanTrackMgr.CreateItemFlowPlanTrack(ifpt);
        }
        public void AddItemFlowPlanTrack(ItemFlowPlanTrack itemFlowPlanTrack)
        {
            if (this.ItemFlowPlanTracks == null)
            {
                this.ItemFlowPlanTracks = new List <ItemFlowPlanTrack>();
            }

            this.ItemFlowPlanTracks.Add(itemFlowPlanTrack);
        }
        public IList<ItemFlowPlanTrack> GenerateItemFlowPlanTrack(ItemFlowPlanDetail parentItemFlowPlanDetail, ItemFlowPlanDetail itemFlowPlanDetail, decimal qtyPer)
        {
            IList<ItemFlowPlanTrack> itemFlowPlanTrackList = new List<ItemFlowPlanTrack>();
            if (parentItemFlowPlanDetail.ItemFlowPlanTracks != null && parentItemFlowPlanDetail.ItemFlowPlanTracks.Count > 0)
            {
                foreach (ItemFlowPlanTrack parentItemFlowPlanTrack in parentItemFlowPlanDetail.ItemFlowPlanTracks)
                {
                    ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                    itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail;
                    itemFlowPlanTrack.ReferencePlanDetail = parentItemFlowPlanTrack.ReferencePlanDetail;
                    itemFlowPlanTrack.OrderLocationTransaction = parentItemFlowPlanTrack.OrderLocationTransaction;
                    //itemFlowPlanTrack.DemandQty = parentItemFlowPlanTrack.DemandQty * qtyPer;
                    itemFlowPlanTrackList.Add(itemFlowPlanTrack);
                }
            }

            return itemFlowPlanTrackList;
        }
Exemple #6
0
        public IList <ItemFlowPlanTrack> GenerateItemFlowPlanTrack(ItemFlowPlanDetail parentItemFlowPlanDetail, ItemFlowPlanDetail itemFlowPlanDetail, decimal qtyPer)
        {
            IList <ItemFlowPlanTrack> itemFlowPlanTrackList = new List <ItemFlowPlanTrack>();

            if (parentItemFlowPlanDetail.ItemFlowPlanTracks != null && parentItemFlowPlanDetail.ItemFlowPlanTracks.Count > 0)
            {
                foreach (ItemFlowPlanTrack parentItemFlowPlanTrack in parentItemFlowPlanDetail.ItemFlowPlanTracks)
                {
                    ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                    itemFlowPlanTrack.ItemFlowPlanDetail       = itemFlowPlanDetail;
                    itemFlowPlanTrack.ReferencePlanDetail      = parentItemFlowPlanTrack.ReferencePlanDetail;
                    itemFlowPlanTrack.OrderLocationTransaction = parentItemFlowPlanTrack.OrderLocationTransaction;
                    //itemFlowPlanTrack.DemandQty = parentItemFlowPlanTrack.DemandQty * qtyPer;
                    itemFlowPlanTrackList.Add(itemFlowPlanTrack);
                }
            }

            return(itemFlowPlanTrackList);
        }
Exemple #7
0
        private void RefreshItemFlowPlanDetail(ItemFlowPlanDetail itemFlowPlanDetail, IList <OrderLocationTransaction> orderLocTransList)
        {
            decimal inputOrderDmd = 0;

            if (orderLocTransList != null && orderLocTransList.Count > 0)
            {
                foreach (OrderLocationTransaction orderLocTrans in orderLocTransList)
                {
                    if (orderLocTrans.RemainQty > 0)
                    {
                        inputOrderDmd += orderLocTrans.RemainQty;

                        ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                        itemFlowPlanTrack.ItemFlowPlanDetail       = itemFlowPlanDetail;
                        itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans;
                        //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty;
                        itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack);
                    }
                }
            }

            itemFlowPlanDetail.OrderRemainQty = inputOrderDmd;
        }
Exemple #8
0
 public virtual void DeleteItemFlowPlanTrack(ItemFlowPlanTrack entity)
 {
     Delete(entity);
 }
Exemple #9
0
 public virtual void UpdateItemFlowPlanTrack(ItemFlowPlanTrack entity)
 {
     Update(entity);
 }
Exemple #10
0
 public virtual void CreateItemFlowPlanTrack(ItemFlowPlanTrack entity)
 {
     Create(entity);
 }
        private void RefreshItemFlowPlanDetail(ItemFlowPlanDetail itemFlowPlanDetail, IList<OrderLocationTransaction> orderLocTransList)
        {
            decimal inputOrderDmd = 0;
            if (orderLocTransList != null && orderLocTransList.Count > 0)
            {
                foreach (OrderLocationTransaction orderLocTrans in orderLocTransList)
                {
                    if (orderLocTrans.RemainQty > 0)
                    {
                        inputOrderDmd += orderLocTrans.RemainQty;

                        ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                        itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail;
                        itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans;
                        //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty;
                        itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack);
                    }
                }
            }

            itemFlowPlanDetail.OrderRemainQty = inputOrderDmd;
        }
 public virtual void DeleteItemFlowPlanTrack(ItemFlowPlanTrack entity)
 {
     entityDao.DeleteItemFlowPlanTrack(entity);
 }
 public virtual void CreateItemFlowPlanTrack(ItemFlowPlanTrack entity)
 {
     entityDao.CreateItemFlowPlanTrack(entity);
 }
Exemple #14
0
        public IList <ItemFlowPlanDetail> GetItemFlowPlanDetailView(ItemFlowPlan itemFlowPlan, IList <ItemFlowPlanDetail> itemFlowPlanDetailList, bool computePlanQty)
        {
            if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE)
            {
                if (itemFlowPlanDetailList != null && itemFlowPlanDetailList.Count > 0)
                {
                    foreach (ItemFlowPlanDetail itemFlowPlanDetail in itemFlowPlanDetailList)
                    {
                        DateTime startWinTime = itemFlowPlanDetail.ReqDate.Date;
                        DateTime endWinTime   = this.GetDmdEndTime(itemFlowPlanDetail, itemFlowPlanDetailList);

                        IList <OrderLocationTransaction> orderLocTransList = new List <OrderLocationTransaction>();
                        if (itemFlowPlanDetailList.IndexOf(itemFlowPlanDetail) == itemFlowPlanDetailList.Count - 1)
                        {
                            orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, startWinTime, null);
                        }
                        else
                        {
                            orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, startWinTime, endWinTime);
                        }

                        this.RefreshItemFlowPlanDetail(itemFlowPlanDetail, orderLocTransList);
                    }

                    if (DateTime.Compare(DateTime.Now.Date, itemFlowPlanDetailList[0].ReqDate) < 0)
                    {
                        IList <OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, itemFlowPlanDetailList[0].ReqDate);
                        IList <ItemFlowPlanDetail>       orderDemandList   = this.ConvertOrderDmdToItemFlowPlanDetail(itemFlowPlan, orderLocTransList);
                        foreach (ItemFlowPlanDetail ifpd in itemFlowPlanDetailList)
                        {
                            orderDemandList.Add(ifpd);
                        }
                        itemFlowPlanDetailList = orderDemandList;
                    }
                }
                else
                {
                    IList <OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, null);
                    itemFlowPlanDetailList = this.ConvertOrderDmdToItemFlowPlanDetail(itemFlowPlan, orderLocTransList);
                }
            }
            else if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS)
            {
                decimal PAB = this.GetDmdStartPAB(WorkCalendarMgr.GetDayShiftStart(DateTime.Now, itemFlowPlan.Flow.PartyTo.Code), "", itemFlowPlan.FlowDetail.Item.Code);
                //itemFlowPlan.PAB = PAB;

                DateTime maxDate = DateTime.Now.Date;
                if (itemFlowPlanDetailList != null && itemFlowPlanDetailList.Count > 0)
                {
                    maxDate = itemFlowPlanDetailList[itemFlowPlanDetailList.Count - 1].ReqDate;
                }
                IList <OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, null);
                if (orderLocTransList != null && orderLocTransList.Count > 0)
                {
                    DateTime maxWinTime = orderLocTransList[orderLocTransList.Count - 1].OrderDetail.OrderHead.WindowTime;
                    maxWinTime = WorkCalendarMgr.GetDayShiftStart(maxWinTime, itemFlowPlan.Flow.PartyTo.Code);
                    if (DateTime.Compare(maxDate, maxWinTime) < 0)
                    {
                        maxDate = maxWinTime;
                    }
                }

                DateTime date = DateTime.Now.Date;
                while (date <= maxDate)
                {
                    ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail();
                    itemFlowPlanDetail.ItemFlowPlan   = itemFlowPlan;
                    itemFlowPlanDetail.GrossDemand    = 0;
                    itemFlowPlanDetail.OrderRemainQty = 0;
                    itemFlowPlanDetail.PlanQty        = 0;

                    foreach (ItemFlowPlanDetail ifpd in itemFlowPlanDetailList)
                    {
                        if (DateTime.Compare(ifpd.ReqDate, date) == 0)
                        {
                            itemFlowPlanDetail = ifpd;
                            break;
                        }
                    }

                    foreach (OrderLocationTransaction orderLocTrans in orderLocTransList)
                    {
                        DateTime winTime = orderLocTrans.OrderDetail.OrderHead.WindowTime;
                        if (DateTime.Compare(date, winTime) <= 0 && DateTime.Compare(date.AddDays(1), winTime) > 0)
                        {
                            ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                            itemFlowPlanTrack.ItemFlowPlanDetail       = itemFlowPlanDetail;
                            itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans;
                            //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty;
                            itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack);
                        }
                    }

                    date = date.AddDays(1);
                }
            }

            itemFlowPlanDetailList = this.PlanningAndScheduling(itemFlowPlanDetailList, itemFlowPlan, computePlanQty);
            return(itemFlowPlanDetailList);
        }
        public IList<ItemFlowPlanDetail> GetItemFlowPlanDetailView(ItemFlowPlan itemFlowPlan, IList<ItemFlowPlanDetail> itemFlowPlanDetailList, bool computePlanQty)
        {
            if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE)
            {
                if (itemFlowPlanDetailList != null && itemFlowPlanDetailList.Count > 0)
                {
                    foreach (ItemFlowPlanDetail itemFlowPlanDetail in itemFlowPlanDetailList)
                    {
                        DateTime startWinTime = itemFlowPlanDetail.ReqDate.Date;
                        DateTime endWinTime = this.GetDmdEndTime(itemFlowPlanDetail, itemFlowPlanDetailList);

                        IList<OrderLocationTransaction> orderLocTransList = new List<OrderLocationTransaction>();
                        if (itemFlowPlanDetailList.IndexOf(itemFlowPlanDetail) == itemFlowPlanDetailList.Count - 1)
                        {
                            orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, startWinTime, null);
                        }
                        else
                        {
                            orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, startWinTime, endWinTime);
                        }

                        this.RefreshItemFlowPlanDetail(itemFlowPlanDetail, orderLocTransList);
                    }

                    if (DateTime.Compare(DateTime.Now.Date, itemFlowPlanDetailList[0].ReqDate) < 0)
                    {
                        IList<OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, itemFlowPlanDetailList[0].ReqDate);
                        IList<ItemFlowPlanDetail> orderDemandList = this.ConvertOrderDmdToItemFlowPlanDetail(itemFlowPlan, orderLocTransList);
                        foreach (ItemFlowPlanDetail ifpd in itemFlowPlanDetailList)
                        {
                            orderDemandList.Add(ifpd);
                        }
                        itemFlowPlanDetailList = orderDemandList;
                    }
                }
                else
                {
                    IList<OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, null);
                    itemFlowPlanDetailList = this.ConvertOrderDmdToItemFlowPlanDetail(itemFlowPlan, orderLocTransList);
                }
            }
            else if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS)
            {
                decimal PAB = this.GetDmdStartPAB(WorkCalendarMgrE.GetDayShiftStart(DateTime.Now, itemFlowPlan.Flow.PartyTo.Code), "", itemFlowPlan.FlowDetail.Item.Code);
                //itemFlowPlan.PAB = PAB;

                DateTime maxDate = DateTime.Now.Date;
                if (itemFlowPlanDetailList != null && itemFlowPlanDetailList.Count > 0)
                {
                    maxDate = itemFlowPlanDetailList[itemFlowPlanDetailList.Count - 1].ReqDate;
                }
                IList<OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, null);
                if (orderLocTransList != null && orderLocTransList.Count > 0)
                {
                    DateTime maxWinTime = orderLocTransList[orderLocTransList.Count - 1].OrderDetail.OrderHead.WindowTime;
                    maxWinTime = WorkCalendarMgrE.GetDayShiftStart(maxWinTime, itemFlowPlan.Flow.PartyTo.Code);
                    if (DateTime.Compare(maxDate, maxWinTime) < 0)
                    {
                        maxDate = maxWinTime;
                    }
                }

                DateTime date = DateTime.Now.Date;
                while (date <= maxDate)
                {
                    ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail();
                    itemFlowPlanDetail.ItemFlowPlan = itemFlowPlan;
                    itemFlowPlanDetail.GrossDemand = 0;
                    itemFlowPlanDetail.OrderRemainQty = 0;
                    itemFlowPlanDetail.PlanQty = 0;

                    foreach (ItemFlowPlanDetail ifpd in itemFlowPlanDetailList)
                    {
                        if (DateTime.Compare(ifpd.ReqDate, date) == 0)
                        {
                            itemFlowPlanDetail = ifpd;
                            break;
                        }
                    }

                    foreach (OrderLocationTransaction orderLocTrans in orderLocTransList)
                    {
                        DateTime winTime = orderLocTrans.OrderDetail.OrderHead.WindowTime;
                        if (DateTime.Compare(date, winTime) <= 0 && DateTime.Compare(date.AddDays(1), winTime) > 0)
                        {
                            ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                            itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail;
                            itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans;
                            //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty;
                            itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack);
                        }
                    }

                    date = date.AddDays(1);
                }
            }

            itemFlowPlanDetailList = this.PlanningAndScheduling(itemFlowPlanDetailList, itemFlowPlan, computePlanQty);
            return itemFlowPlanDetailList;
        }
        public IList<ItemFlowPlanDetail> ConvertOrderDmdToItemFlowPlanDetail(ItemFlowPlan itemFlowPlan, IList<OrderLocationTransaction> orderLocTransList)
        {
            IList<ItemFlowPlanDetail> itemFlowPlanDetailList = new List<ItemFlowPlanDetail>();
            List<DateTime> dateTimeList = this.CollectDateList(orderLocTransList);
            if (dateTimeList.Count > 0)
            {
                foreach (DateTime date in dateTimeList)
                {
                    ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail();
                    itemFlowPlanDetail.ItemFlowPlan = itemFlowPlan;
                    itemFlowPlanDetail.ReqDate = date;
                    itemFlowPlanDetail.OrderRemainQty = 0;
                    foreach (OrderLocationTransaction orderLocTrans in orderLocTransList)
                    {
                        if (DateTime.Compare(date, orderLocTrans.OrderDetail.OrderHead.WindowTime.Date) == 0)
                        {
                            itemFlowPlanDetail.OrderRemainQty += orderLocTrans.RemainQty;
                            ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack();
                            itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail;
                            itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans;
                            //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty;
                            itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack);
                        }
                    }

                    if (itemFlowPlanDetail.OrderRemainQty > 0)
                    {
                        itemFlowPlanDetailList.Add(itemFlowPlanDetail);
                    }
                }
            }

            return itemFlowPlanDetailList;
        }
 public void SaveRelation(ItemFlowPlanDetail ifpd, ItemFlowPlanDetail parIfpd, decimal rate)
 {
     ItemFlowPlanTrack ifpt = new ItemFlowPlanTrack();
     ifpt.ItemFlowPlanDetail = ifpd;
     ifpt.ReferencePlanDetail = parIfpd;
     ifpt.Rate = rate;
     ItemFlowPlanTrackMgrE.CreateItemFlowPlanTrack(ifpt);
 }
 public virtual void UpdateItemFlowPlanTrack(ItemFlowPlanTrack entity)
 {
     entityDao.UpdateItemFlowPlanTrack(entity);
 }