Beispiel #1
0
        private XtraPivotGridHelper.DataViewTable FillData(XtraPivotGridHelper.DataViewTable dt)
        {
            _chartRsltList = new List <string>();

            List <DataRow> rowList      = new List <DataRow>();
            List <DataRow> chartRowList = new List <DataRow>();

            foreach (var pair in _UtilInfos.OrderBy(t => t.Key))
            {
                string shopID   = pair.Key.Split('@')[0];
                string area     = pair.Key.Split('@')[1];
                string eqpGroup = pair.Key.Split('@')[2];

                EuData.GroupUtilInfo groupInfo = pair.Value;

                if (groupInfo == null)
                {
                    continue;
                }

                for (DateTime date = FromDate; date < ToDate; date = date.AddDays(1))
                {
                    float busy  = (float)Math.Round(groupInfo.GetAvgBusy(date), 1);
                    float setup = (float)Math.Round(groupInfo.GetAvgSetup(date), 1);

                    if (this.includeJobChgOnUtil.Checked)
                    {
                        busy = busy + setup;
                    }

                    if (busy < _minBusyValue)
                    {
                        _minBusyValue = busy;
                    }
                    if (busy > _maxBusyValue)
                    {
                        _maxBusyValue = busy;
                    }

                    if (this.IsUseUtilLowerLimit && busy <= this.UtilConditionVal)
                    {
                        continue;
                    }

                    string dateVal = date.ToString("yyyy'/'MM'/'dd");

                    DataRow chartRow = _dtChart.NewRow();

                    chartRow[EuData.SHOP_ID]      = shopID;
                    chartRow[EuData.AREA]         = area;
                    chartRow[EuData.EQP_GROUP_ID] = eqpGroup;
                    chartRow[EuData.DATE]         = dateVal;
                    chartRow[EuData.UTILIZATION]  = busy;

                    _dtChart.Rows.Add(chartRow);

                    string item = CommonHelper.CreateKey(shopID, area, eqpGroup);
                    if (_chartRsltList.Contains(item) == false)
                    {
                        _chartRsltList.Add(item);
                    }


                    if (eqpGroup != EuData.FOR_AREA)
                    {
                        DataRow newRow = dt.DataTable.NewRow();
                        newRow[EuData.SHOP_ID]      = shopID;
                        newRow[EuData.AREA]         = area;
                        newRow[EuData.EQP_GROUP_ID] = eqpGroup;
                        newRow[EuData.DATE]         = dateVal;
                        newRow[EuData.UTILIZATION]  = busy;

                        dt.DataTable.Rows.Add(newRow);

                        rowList.Add(newRow);
                    }
                }
            }

            return(dt);
        }
Beispiel #2
0
        private void BindData()
        {
            _eqpDic      = new Dictionary <string, string>();
            _eqpGroupDic = new Dictionary <string, List <string> >();

            foreach (DataRow row in _dtEquipment.Rows)
            {
                EuData.Eqp eqp = new EuData.Eqp(row);

                if (this.SelectedShopID != eqp.ShopID)
                {
                    continue;
                }

                if (this.IsAllAreaSelected == false && this.SelectedEqpGrpInAreaList.Contains(eqp.DspEqpGroup) == false)
                {
                    continue;
                }

                string area = Consts.NULL_ID;
                _areaByEqpGrpDic.TryGetValue(eqp.DspEqpGroup, out area);
                area = string.IsNullOrEmpty(area) ? Consts.NULL_ID : area;

                string info = CommonHelper.CreateKey(eqp.ShopID, area, eqp.DspEqpGroup);
                _eqpDic[eqp.EqpID] = info;

                List <string> list;

                if (_eqpGroupDic.TryGetValue(eqp.DspEqpGroup, out list) == false)
                {
                    _eqpGroupDic[eqp.DspEqpGroup] = list = new List <string>();
                }

                if (list.Contains(eqp.EqpID) == false)
                {
                    list.Add(eqp.EqpID);
                }
            }

            foreach (DataRow srow in _dtLoadStat.Rows)
            {
                EuData.LoadStat loadStat = new EuData.LoadStat(srow);

                DateTime date = new DateTime(loadStat.TargetDate.Year, loadStat.TargetDate.Month, loadStat.TargetDate.Day);

                string info;
                if (_eqpDic.TryGetValue(loadStat.EqpID, out info) == false)
                {
                    continue;
                }

                if (date < this.FromDate || date > this.ToDate)
                {
                    continue;
                }

                string shopID   = info.Split('@')[0];
                string area     = info.Split('@')[1];
                string eqpGrpID = info.Split('@')[2];

                if (area == "-")
                {
                    continue;
                }

                EuData.GroupUtilInfo groupInfo;
                if (_UtilInfos.TryGetValue(info, out groupInfo) == false)
                {
                    _UtilInfos[info] = groupInfo = new EuData.GroupUtilInfo(shopID, area, eqpGrpID);
                }

                groupInfo.AddData(loadStat.EqpID, date, loadStat.Setup, loadStat.Busy, loadStat.IdleRun, loadStat.Idle, loadStat.PM, loadStat.Down, _isShift);

                string info2 = CommonHelper.CreateKey(shopID, area, EuData.FOR_AREA);

                EuData.GroupUtilInfo groupInfo2;
                if (_UtilInfos.TryGetValue(info2, out groupInfo2) == false)
                {
                    _UtilInfos[info2] = groupInfo2 = new EuData.GroupUtilInfo(shopID, area, EuData.FOR_AREA);
                }

                groupInfo2.AddData(loadStat.EqpID, date, loadStat.Setup, loadStat.Busy, loadStat.IdleRun, loadStat.Idle, loadStat.PM, loadStat.Down, _isShift);
            }
        }