Exemplo n.º 1
0
        public bool IsSameTypeBar(GanttBar bar)
        {
            var selectedBar = this.SelectedBar as GanttBar;

            if (this.SelectedBar.State == EqpState.SETUP)
            {
                if (this.SelectedBar.State == bar.State)
                {
                    return(true);
                }
            }
            else
            {
                switch (this.MouseSelectionType)
                {
                case MouseSelectionType.ProductID:
                    return(bar.ProductID == selectedBar.ProductID);

                case MouseSelectionType.LotID:
                    return(bar.LotID == selectedBar.LotID);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        public void AddItem(string key, GanttBar bar, string seltype)
        {
            BarList list;

            if (!this.Items.TryGetValue(key, out list))
            {
                this.Items.Add(key, list = new BarList());
                list.Add(bar);
                return;
            }

            foreach (GanttBar it in list)
            {
                if (seltype.StartsWith("Product"))
                {
                    if (it.BarKey != bar.BarKey || it.State != bar.State)
                    {
                        continue;
                    }

                    if (it.Merge(bar))
                    {
                        it.TOQty  += bar.TOQty;
                        it.LotID  += "/" + bar.LotID;
                        it.EndTime = bar.EndTime;
                        return;
                    }
                }
                else
                {
                    if (it.LotID != bar.LotID || it.State != bar.State)
                    {
                        continue;
                    }

                    if (it.Merge(bar))
                    {
                        it.TOQty     += bar.TOQty;
                        it.ProductID += "/" + bar.ProductID;
                        it.EndTime    = bar.EndTime;
                        return;
                    }
                }
            }

            list.Add(bar);
        }
Exemplo n.º 3
0
        public BrushInfo GetBrushInfo(GanttBar bar)
        {
            BrushInfo brushinfo = null;

            if (bar.State == EqpState.SETUP)
            {
                brushinfo = new BrushInfo(Color.Orange);
            }
            else if (bar.State == EqpState.PM)
            {
                brushinfo = new BrushInfo(Color.Red);
            }
            else if (bar.State == EqpState.DOWN)
            {
                brushinfo = new BrushInfo(HatchStyle.Percent30, Color.Gray, Color.Black);
            }
            else
            {
                brushinfo = new BrushInfo(GetColor(bar.BarKey));
            }

            if (!this.EnableSelect || this.SelectedBar == null)
            {
                bar.BackColor = brushinfo.BackColor;
                return(brushinfo);
            }

            if (!this.IsSameTypeBar(bar))
            {
                bar.BackColor = emptyBrush.BackColor;
                return(emptyBrush);
            }

            if (this.MouseSelectionType == MouseSelectionType.ProductID && bar.State == EqpState.SETUP && this.SelectedBar.State != EqpState.SETUP)
            {
                bar.BackColor = emptyBrush.BackColor;
                return(emptyBrush);
            }

            bar.BackColor = brushinfo.BackColor;
            return(brushinfo);
        }
Exemplo n.º 4
0
        private GanttBar AddItem(
            EqpPlanItem item,
            DateTime tkin,
            DateTime tkout,
            EqpState state,
            string seltype
            )
        {
            var info = this.TryGetGanttInfo(item.LineID, item.STEP_GROUP, item.EqpID);

            var currentBar = new GanttBar(item, tkin, tkout, item.Qty, item.Qty, state);

            if (string.IsNullOrEmpty(currentBar.BarKey))
            {
                return(null);
            }

            info.AddItem(currentBar.BarKey, currentBar, seltype);

            return(currentBar);
        }
Exemplo n.º 5
0
        void GanttView_BarDraw(object sender, BarDrawEventArgs args)
        {
            var bar = args.Bar as GanttBar;

            args.Background = this.gantt.GetBrushInfo(bar);
            args.DrawFrame  = this.gantt.EnableSelect && this.gantt.SelectedBar != null && !this.gantt.IsSameTypeBar(bar);
            args.FrameColor = Color.Black;
            args.ForeColor  = (bar.State == EqpState.PM || bar.State == EqpState.DOWN) ? Color.White : Color.Black;
            args.Text       = bar.GetTitle();
            if (this.currentBar != null && this.currentBar == args.Bar)
            {
                if (prebar != bar)
                {
                    prebar           = bar;
                    prebarwidth      = bar.Bounds.Width;
                    bar.Bounds.Width = bar.Bounds.Width - 2.5f;
                }
                var p = new Pen(Color.Black, 4);
                args.Graphics.DrawRectangle(p, bar.Bounds.X, bar.Bounds.Y, bar.Bounds.Width + 0.5f, bar.Bounds.Height);
            }

            args.DrawDefault = true;
        }