示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#4
0
        private void FillEqpPlan(
            string lineID,
            string prodID,
            string stepGroup,
            DateTime startDate,
            int duration,
            string seltype)
        {
            var resultCtx = this.result.GetCtx <ResultDataContext>();
            var inputCtx  = this.result.GetCtx <ModelDataContext>();

            var eqpInfoDic = (from a in inputCtx.Equipment
                              select new { EQP_ID = a.EQP_ID, EQP_TYPE = a.STEP_GROUP }).Distinct();
            var eqpInfo = eqpInfoDic.OrderBy(x => x.EQP_ID).ToDictionary(x => x.EQP_ID, x => x.EQP_TYPE);

            var mcpBomDic = (from a in inputCtx.McpBom
                             select new { TO_PROD_ID = a.TO_PROD_ID, COMP_SEQ = a.COMP_SEQ }).Distinct();
            var mcpBom = mcpBomDic.OrderBy(x => x.TO_PROD_ID).ToDictionary(x => x.TO_PROD_ID, x => x.COMP_SEQ);

            var finalProdDic = (from a in inputCtx.McpBom
                                select new { TO_PROD_ID = a.TO_PROD_ID, FINAL_PROD_ID = a.FINAL_PROD_ID }).Distinct();
            var finalProd = finalProdDic.OrderBy(x => x.TO_PROD_ID).ToDictionary(x => x.TO_PROD_ID, x => x.FINAL_PROD_ID);

            var endDate = startDate.AddDays(duration);

            var plans = resultCtx.EqpPlan.OrderBy(x => x.START_TIME).ThenBy(x => x.STEP_ID);

            foreach (var plan in plans)
            {
                if (lineID != Constants.ALL && plan.LINE_ID != lineID)
                {
                    continue;
                }

                if (stepGroup != Constants.ALL && plan.STEP_GROUP != stepGroup)
                {
                    continue;
                }

                if (prodID != Constants.ALL && plan.PRODUCT_ID != prodID)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(plan.EQP_ID) && !LikeUtility.Like(plan.EQP_ID, plan.EQP_ID, true))
                {
                    continue;
                }

                if (!this.validEquipments.ContainsKey(plan.EQP_ID))
                {
                    continue;
                }

                string findAoProd = string.Empty;
                finalProd.TryGetValue(plan.PRODUCT_ID, out findAoProd);

                var key = Tuple.Create(plan.LINE_ID, plan.EQP_ID, findAoProd, plan.PRODUCT_ID, plan.STEP_ID);

                if (this.RowValueInfos.Contains(key) == false)
                {
                    this.RowValueInfos.Add(key);
                }
            }

            foreach (var rowInfo in this.RowValueInfos)
            {
                string findStepGroup = string.Empty;
                eqpInfo.TryGetValue(rowInfo.Item2, out findStepGroup);

                int findMcpSeq = 0;
                mcpBom.TryGetValue(rowInfo.Item4, out findMcpSeq);

                string findAoProd = string.Empty;
                finalProd.TryGetValue(rowInfo.Item4, out findAoProd);

                var             info  = this.TryGetGanttInfo(rowInfo.Item1, findStepGroup, rowInfo.Item2, rowInfo.Item3, rowInfo.Item4, findMcpSeq, rowInfo.Item5);
                var             key   = new Tuple <string, string, string, string, string>(lineID, rowInfo.Item2, rowInfo.Item3, rowInfo.Item4, rowInfo.Item5);
                List <GanttBar> items = new List <GanttBar>();

                this.AddVisibleItem(rowInfo.Item2);

                foreach (var plan in plans)
                {
                    if (rowInfo.Item2 != plan.EQP_ID)
                    {
                        continue;
                    }

                    var startTime = plan.START_TIME;
                    if (startTime < this.FromTime || startTime >= this.ToTime)
                    {
                        continue;
                    }

                    var endTime = plan.END_TIME;
                    if (startTime >= endTime)
                    {
                        continue;
                    }

                    var state = plan.STATUS == Constants.STR_PM ? EqpState.PM : plan.STATUS == Constants.STR_SETUP ? EqpState.SETUP : EqpState.BUSY;

                    var barKey = plan.PRODUCT_ID;
                    if (string.IsNullOrEmpty(barKey))
                    {
                        barKey = Mozart.Studio.TaskModel.UserLibrary.StringUtility.IdentityNull;
                    }

                    var item       = new EqpPlanItem(plan);
                    var currentBar = new GanttBar(item, startTime, endTime, item.Qty, item.Qty, state);

                    items.Add(currentBar);
                }

                foreach (var item in items)
                {
                    info.AddItem(item.BarKey, item, seltype);
                }
            }
        }