예제 #1
0
        private void ProcessData()
        {
            _rsltPivotDic = new Dictionary <string, IocvData.ResultPivot>();
            _rsltChartDic = new Dictionary <string, IocvData.ResultChart>();

            var modelContext = this._result.GetCtx <ModelDataContext>();

            // ACT_DATE : string 형식 (20161215 180000 위와 같이 데이터 들어옴)
            //var dtAct = modelContext.InOutAct.Where(x => x.SHOP_ID == this.SelectedShopID
            //    & this.FromTime <= x.ACT_DATE.Replace(" ", "").DbToDateTime()
            //    & x.ACT_DATE.Replace(" ", "").DbToDateTime() < this.ToTime)
            //    .Where(x => this.IsAllProductSeletected ? true : this.SelectedProductList.Contains(x.PRODUCT_ID))
            //    .Where(x => this.IsAllInOutSeletected ? true : this.SelectedInOutList.Contains(x.IN_OUT.ToUpper()))
            //    .Where(x => x.ACT_QTY > 0)
            //    .GroupBy(x => new {
            //        SHOP_ID = x.SHOP_ID,
            //        IN_OUT_FLAG = x.IN_OUT.ToUpper() == IocvData.Consts.InFlag ? IocvData.Consts.InFlag :
            //            IocvData.Consts.OutFlag,
            //        TARGET_DATE = x.ACT_DATE.Replace(" ", "").DbToDateTime(),
            //        PROD_ID = x.PRODUCT_ID,
            //        PROD_VER = x.PRODUCT_VERSION
            //        })
            //    .Select(g => new
            //        {
            //            SHOP_ID = g.Key.SHOP_ID,
            //            IN_OUT_FLAG = g.Key.IN_OUT_FLAG,
            //            TARGET_DATE = g.Key.TARGET_DATE,
            //            PROD_ID = g.Key.PROD_ID,
            //            PROD_VER = g.Key.PROD_VER,
            //            DEPT = IocvData.Consts.ACT,
            //            QTY = g.Sum(s => s.ACT_QTY)
            //        });

            //foreach (var row in dtAct)
            //{
            //    AddResult(row.SHOP_ID, row.IN_OUT_FLAG, row.TARGET_DATE, row.PROD_ID, row.PROD_VER,
            //        IocvData.Consts.ACT, row.QTY);
            //}

            // PLAN_DATE : DateTime 형식 (2016-12-08 00:00:00 위와 같이 데이터 들어옴)
            var dtPlan = modelContext.InOutPlan.Where(x => x.SHOP_ID == this.SelectedShopID)
                         .Where(x => this.IsAllProductSeletected ? true : this.SelectedProductList.Contains(x.PRODUCT_ID))
                         .Where(x => this.IsAllInOutSeletected ? true : this.SelectedInOutList.Contains(x.IN_OUT.ToUpper()))
                         .Where(x => x.PLAN_QTY > 0)
                         .Select(x => new
            {
                SHOP_ID     = x.SHOP_ID,
                IN_OUT_FLAG = x.IN_OUT.Trim().ToUpper() == IocvData.Consts.InFlag ? IocvData.Consts.InFlag :
                              IocvData.Consts.OutFlag,
                TARGET_DATE = x.PLAN_DATE == x.PLAN_DATE.Date ?
                              ShopCalendar.StartTimeOfDay(x.PLAN_DATE) : //x.PLAN_DATE.AddHours(ShopCalendar.StartTime.Hours)
                              x.PLAN_DATE,                               // Data가 00:00:00 형식에 대한 예외처리
                PROD_ID = x.PRODUCT_ID,
                //PROD_VER = x.PRODUCT_VERSION,
                DEPT = IocvData.Consts.PLAN,
                QTY  = (double)x.PLAN_QTY
            })
                         .Where(x => this.FromTime <= x.TARGET_DATE & x.TARGET_DATE < this.ToTime);

            foreach (var row in dtPlan)
            {
                AddResult(row.SHOP_ID,
                          row.IN_OUT_FLAG,
                          row.TARGET_DATE,
                          row.PROD_ID,
                          "-",//row.PROD_VER,
                          IocvData.Consts.PLAN, row.QTY);
            }

            string filter = Globals.CreateFilter(string.Empty, SmcvData.Schema.SHOP_ID, "=", this.SelectedShopID);

            filter = Globals.CreateFilter(filter, SimResultData.StepMoveSchema.TARGET_DATE, ">=", this.FromTime.ToString(), "AND");
            filter = Globals.CreateFilter(filter, SimResultData.StepMoveSchema.TARGET_DATE, "<", this.ToTime.ToString(), "AND");

            DataTable dtStepMove = _result.LoadOutput(SimResultData.OutputName.StepMove, filter);

            foreach (DataRow row in dtStepMove.Rows)
            {
                SimResultData.StepMoveInfo info = new SimResultData.StepMoveInfo(row);

                if (this.IsAllProductSeletected == false && this.SelectedProductList.Contains(info.ProductID) == false)
                {
                    continue;
                }

                string inStepID = this.SelectedShopID == "ARRAY" ? this.SelectedArrayInStepID :
                                  (this.SelectedShopID == "CF" ? this.SelectedCfInStepID : this.SelectedCellInStepID);
                string outStepID = this.SelectedShopID == "ARRAY" ? this.SelectedArrayOutStepID :
                                   (this.SelectedShopID == "CF" ? this.SelectedCfOutStepID : "--");

                string inOutFlag = string.Empty;
                if (info.StepID == inStepID)
                {
                    inOutFlag = IocvData.Consts.InFlag;
                }
                else if (info.StepID == outStepID)
                {
                    inOutFlag = IocvData.Consts.OutFlag;
                }
                else
                {
                    continue;
                }

                if (this.IsAllInOutSeletected == false && this.SelectedInOutList.Contains(inOutFlag) == false)
                {
                    continue;
                }

                double qty = inOutFlag == IocvData.Consts.InFlag ? info.InQty : info.OutQty;

                AddResult(info.ShopID, inOutFlag, info.TargetDate, info.ProductID, info.ProductVersion, IocvData.Consts.SIM, qty);
            }
        }
예제 #2
0
        private void LoadSimData()
        {
            string shopID = this.SelectedShopID;

            if (shopID == Consts.ALL)
            {
                shopID = string.Empty;
            }

            foreach (DataRow row in _dtStepMove.Rows)
            {
                SimResultData.StepMoveInfo item = new SimResultData.StepMoveInfo(row);

                if (shopID != "" && item.ShopID != shopID)
                {
                    continue;
                }

                if (item.TargetDate < this.FromTime || item.TargetDate >= this.ToTime)
                {
                    continue;
                }

                string eqpGrpID = string.Empty;
                _eqpGrpDic.TryGetValue(item.ShopID + item.EqpID, out eqpGrpID);

                if (this.IsAllAreaSelected == false)
                {
                    if (this.SelectedEqpGrpInAreaList.Count <= 0)
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(eqpGrpID))
                    {
                        continue;
                    }

                    if (this.SelectedEqpGrpInAreaList.Contains(eqpGrpID) == false)
                    {
                        continue;
                    }
                }

                foreach (DateTime date in _dateRangeList)
                {
                    SmcvData.ResultItem padding;

                    string dateString = this.IsTimeConditionHour ? ShopCalendar.StartTimeOfDayT(date).ToString("yyyyMMdd") : date.DbToTimeString();

                    string k  = item.ShopID + item.ProductID + item.ProductVersion + item.OwnerType + item.StepID + item.EqpID + dateString;
                    string k2 = item.ShopID + item.ProductID + item.ProductVersion + item.OwnerType + item.StepID;

                    int wipCurStep  = 0;
                    int wipMainStep = 0;
                    if (_dict.TryGetValue(k, out padding) == false)
                    {
                        SmcvData.WipDetail wipDetail;
                        _wipCurStepDic.TryGetValue(k2, out wipDetail);
                        wipCurStep = wipDetail == null ? 0 : wipDetail.GlassQty;
                        wipDetail  = null;
                        _wipMainStepDic.TryGetValue(k2, out wipDetail);
                        wipMainStep = wipDetail == null ? 0 : wipDetail.GlassQty;

                        if (k2 == "ARRAYB8A550QU5V501AASMP041500-00")
                        {
                        }

                        SmcvData.StepInfo stepInfo;
                        _stepInfoDic.TryGetValue(item.ShopID + item.StepID, out stepInfo);

                        padding = new SmcvData.ResultItem(item.ShopID, item.ProductID, item.ProductVersion, item.OwnerType, item.StepID, item.EqpID, date);
                        padding.SetStepInfo(stepInfo);

                        _dict.Add(k, padding);
                    }
                }

                SmcvData.ResultItem ri;

                DateTime modTargetDate = this.IsTimeConditionHour ? ShopCalendar.StartTimeOfDayT(item.TargetDate)
                    : ShopCalendar.ShiftStartTimeOfDayT(item.TargetDate);
                string curShopID = item.ShopID;
                string productID = item.ProductID;
                //string productVersion = item.ProductVersion;
                string productVersion = "-";
                string ownerType      = item.OwnerType;
                string stepID         = item.StepID;
                string eqpID          = item.EqpID;

                string dateString2 = this.IsTimeConditionHour ? modTargetDate.ToString("yyyyMMdd") : modTargetDate.DbToTimeString();

                string key = curShopID + productID + productVersion + ownerType + stepID + eqpID + dateString2;

                if (_dict.TryGetValue(key, out ri) == false)
                {
                    continue;   // 있을 수 없음

                    //ri = new SmcvData.ResultItem(curShopID, productID, productVersion, ownerType, stepID, eqpID, modTargetDate);

                    //_dict.Add(key, ri);
                }

                ri.UpdateSimQty((int)item.InQty, (int)item.OutQty);
            }
        }