Пример #1
0
 public GanttBar(
     EqpPlanItem item,
     DateTime tkIn,
     DateTime tkOut,
     double tiQty,
     double toQty,
     EqpState state
     )
     : base(tkIn, tkOut, tiQty, toQty, state)
 {
     this.LineID    = item.LineID;
     this.ProductID = item.ProductID;
     this.ProcessID = item.ProcessID;
     this.StepID    = item.StepID;
     this.EqpID     = item.EqpID;
     this.LotID     = item.LotID;
     this.StartTime = item.StartTime;
     this.EndTime   = item.EndTime;
     this.Qty       = item.Qty;
     this.Status    = item.Status;
 }
Пример #2
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);
                }
            }
        }