private void PrepareDispatchingData() { if (this.DispInfos == null) { this.DispInfos = new DoubleDictionary <string, DateTime, DataRow>(); } string filter = string.Empty; var dispatchDt = _result.LoadOutput(EqpGanttChartData.EQP_DISPATCH_LOG_TABLE_NAME, filter); foreach (DataRow row in dispatchDt.Rows) { string eqpID = row.GetString(EqpGanttChartData.EqpDispatchLog.Schema.EQP_ID); string timeTemp = row.GetString(EqpGanttChartData.EqpDispatchLog.Schema.DISPATCH_TIME); if (string.IsNullOrEmpty(timeTemp)) { continue; } DateTime dispatchingTime = timeTemp.DbToDateTime(); Dictionary <DateTime, DataRow> dic; if (DispInfos.TryGetValue(eqpID, out dic) == false) { DispInfos[eqpID] = dic = new Dictionary <DateTime, DataRow>(); } DataRow info; if (dic.TryGetValue(dispatchingTime, out info) == false) { dic[dispatchingTime] = info = row; } } }
private void SetEqpGroupCheckBox() { // EqpGroup CheckComboBox bool useArea = GetUseAreaControl(); List <string> eqpGroupInAreaList = new List <string>(); if (useArea) { foreach (string area in this.areaChkBoxEdit.Properties.Items.GetCheckedValues()) { List <string> eqpGrps; if (_eqpGrpsInAreaDic.TryGetValue(area, out eqpGrps) == false) { continue; } eqpGroupInAreaList.AddRange(eqpGrps); } } this.eqpGroupsCheckedBox.Items.Clear(); //ICollection<string> eqpGroupList = ComboHelper.Distinct(dtEqpDispatchLog, SimResultData.EqpDispatchLog.Schema.EQP_GROUP, filter); string filter = Globals.CreateFilter(string.Empty, SimResultData.EqpDispatchLog.Schema.SHOP_ID, "=", this.SelectedShopID); DataTable dtEqpDispatchLog = _result.LoadOutput(SimResultData.OutputName.EqpDispatchLog, filter); List <string> eqpGroupList = new List <string>(); foreach (DataRow row in dtEqpDispatchLog.Rows) { SimResultData.EqpDispatchLog info = new SimResultData.EqpDispatchLog(row); string eqpGroupInEqp; if (_eqpGrpInEqpDic.TryGetValue(info.ShopID + info.EqpID, out eqpGroupInEqp) == false) { continue; } if (useArea) { if (eqpGroupInAreaList.Contains(eqpGroupInEqp) == false) { continue; } } // if (this.eqpGroupsCheckedBox.Items.Contains(eqpGroupInEqp) == false) 이거 이거 안먹음 if (eqpGroupList.Contains(eqpGroupInEqp) == false) { eqpGroupList.Add(eqpGroupInEqp); this.eqpGroupsCheckedBox.Items.Add(eqpGroupInEqp); } } }
private void GetPreprocessData() { this.EqpMgr = new EqpMaster(); this.EqpMgr.LoadEqp(_result); _presetList = new List <EqpGanttChartData.PresetInfo>(); DataTable pdt = _result.LoadOutput(EqpGanttChartData.WEIGHT_PRESET_LOG_TABLE_NAME); //DataTable pdt = _result.LoadInput(EqpGanttChartData.PRESET_INFO_TABLE_NAME); foreach (DataRow row in pdt.Rows) { _presetList.Add(new EqpGanttChartData.PresetInfo(row)); } }
private void SetOwnerTypeCombo() { #region OwnerTypes Combo DataTable dt = _result.LoadOutput(TargetPlanCompareData.DATA_TABLE_3); List <string> ownerTypes = new List <string>(); foreach (DataRow row in dt.Rows) { TargetPlanCompareData.EqpPlan ep = new TargetPlanCompareData.EqpPlan(row); if (string.IsNullOrWhiteSpace(ep.OwnerType)) { continue; } if (!ownerTypes.Contains(ep.OwnerType)) { ownerTypes.Add(ep.OwnerType); } string key = ep.ShopID + ep.ProductID + ep.StepID; if (!this._ownerTypeDict.Keys.Contains(key)) { _ownerTypeDict.Add(key, ep.OwnerType); } } ownerTypes.Sort(); foreach (string ownerType in ownerTypes) { this.ownerTypeCombo.Items.Add(ownerType); } this.ownerTypeCombo.SelectedIndex = 1; #endregion }
private void InitializeData() { var modelContext = this._result.GetCtx <ModelDataContext>(); // ALL Step정보 _stepInfoDic = new Dictionary <string, SwvData.StepInfo>(); var stdStep = modelContext.StdStep.Where(x => x.STEP_SEQ > 0) .OrderBy(x => x.SHOP_ID).OrderByDescending(x => x.STEP_SEQ); foreach (var step in stdStep) { if (_stepInfoDic.ContainsKey(step.SHOP_ID + step.STEP_ID) == false) { _stepInfoDic.Add(step.SHOP_ID + step.STEP_ID, new SwvData.StepInfo(step.SHOP_ID, step.STEP_ID, step.STEP_DESC, step.STEP_TYPE, (int)step.STEP_SEQ, step.LAYER_ID)); } } // StepWip 정보 _stepWipAllDic = new Dictionary <string, SwvData.StepWipInf>(); _stepWipChartAllDDic = new DoubleDictionary <DateTime, string, List <SwvData.StepWipChartInf> >(); // Result / StepWip 재공정보 DataTable dtStepWip = _result.LoadOutput(SimResultData.OutputName.StepWip); foreach (DataRow drow in dtStepWip.Rows) { SimResultData.StepWip row = new SimResultData.StepWip(drow); SwvData.StepInfo stepInfo; _stepInfoDic.TryGetValue(row.ShopID + row.StepID, out stepInfo); string stepDesc = stepInfo == null ? Consts.NULL_ID : stepInfo.StepDesc; int stepSeq = stepInfo == null ? int.MaxValue : stepInfo.StepSeq; string layer = stepInfo == null ? Consts.NULL_ID : stepInfo.Layer; Dictionary <string, List <SwvData.StepWipChartInf> > dic; if (_stepWipChartAllDDic.TryGetValue(row.TargetDate, out dic) == false) { _stepWipChartAllDDic.Add(row.TargetDate, dic = new Dictionary <string, List <SwvData.StepWipChartInf> >()); } List <SwvData.StepWipChartInf> list; if (dic.TryGetValue(row.ShopID, out list) == false) { dic.Add(row.ShopID, list = new List <SwvData.StepWipChartInf>()); } SwvData.StepWipChartInf inf = new SwvData.StepWipChartInf(row.TargetDate, row.ShopID, row.StepID, stepDesc, stepSeq, layer); list.Add(inf); } }
private void SetProdIdCheckBox() { this.prodIdCheckedComboBoxEdit.Properties.Items.Clear(); var modelContext = this._result.GetCtx <ModelDataContext>(); // ProductID CheckComboBox this.prodIdCheckedComboBoxEdit.Properties.Items.Clear(); var prodIDs = modelContext.Product.Where(x => this.SelectedShopID == x.SHOP_ID).Select(x => x.PRODUCT_ID) .Distinct(); //List<string> prodsInTatList; //if (_prodIdsInTatDic.TryGetValue(this.SelectedShopID, out prodsInTatList) == false) // prodsInTatList = new List<string>(); //var seleProds = prodsInTatList.Where(x => prodIDs.Contains(x)); string filter = Globals.CreateFilter(string.Empty, SimResultData.StepWipSchema.SHOP_ID, "=", this.SelectedShopID); filter = Globals.CreateFilter(filter, SimResultData.StepWipSchema.TARGET_DATE, ">=", this.FromTime.ToString(), "AND"); filter = Globals.CreateFilter(filter, SimResultData.StepWipSchema.TARGET_DATE, "<", this.ToTime.ToString(), "AND"); DataTable dtStepWip = _result.LoadOutput(SimResultData.OutputName.StepWip, filter); var prodsInStepWip = ComboHelper.Distinct(dtStepWip, SimResultData.StepWipSchema.PRODUCT_ID, string.Empty); var seleProds = prodIDs.Where(x => prodsInStepWip.Contains(x)); foreach (var item in seleProds) { this.prodIdCheckedComboBoxEdit.Properties.Items.Add(item.ToString()); } this.prodIdCheckedComboBoxEdit.CheckAll(); }
public static EntityTable <T> GetEntityTable <T>(this IExperimentResultItem result, string key, string filter = "") where T : IEntityObject { IEnumerable <T> item; try { item = result.LoadOutput <T>(key, filter); } catch { item = result.LoadInput <T>(key, filter); return(item.ToEntityTable()); } return(item.ToEntityTable()); }
private void LoadData() { _eqpPlanTable = _result.LoadOutput(JobChangePlanData.EQP_PLAN_DATA_TABLE); List <string> prodList = _prodGroupDict[SelectedProdGrp]; _resultDict = new Dictionary <string, ProductInfo>(); if (SelectedProduct != Consts.ALL) { prodList = new List <string>(); prodList.Add(SelectedProduct); } foreach (DataRow epRow in _eqpPlanTable.Rows) { JobChangePlanData.EqpPlan ep = new JobChangePlanData.EqpPlan(epRow); if (ep.ProductID.StartsWith("CE")) { ep.ProductID = GetCellProductID(ep.ProductID); } if (prodList.Contains(ep.ProductID) == false) { continue; } ProductInfo info; if (_resultDict.TryGetValue(ep.ProductID, out info) == false) { info = new ProductInfo(ep.ProductID, ep.ShopID); _resultDict.Add(ep.ProductID, info); } if (IsInStep(ep.StepID)) { info.AddInfo(ep.OutTargetQty, 0, 0); info.SetInOutTime(ep.StartTime, ep.EndTime, true); } if (IsOutStep(ep.StepID)) { info.AddInfo(0, ep.OutTargetQty, 0); info.SetInOutTime(ep.StartTime, ep.EndTime, false); } } }
private void InitializeData() { var item = (IMenuDocItem)this.Document.ProjectItem; _result = (IExperimentResultItem)item.Arguments[0]; Globals.InitFactoryTime(_result.Model); //base.SetWaitDialogCaption(DataConsts.In_StdStep); //_dtStdStep = _result.LoadInput(DataConsts.In_StdStep); base.SetWaitDialogCaption(EuData.DATA_TABLE_1); _dtEquipment = _result.LoadInput(EuData.DATA_TABLE_1); base.SetWaitDialogCaption(EuData.DATA_TABLE_2); _dtLoadStat = _result.LoadOutput(EuData.DATA_TABLE_2); }
private void LoadBaseData() { _dtEqpPlan = _result.LoadOutput(LotGanttChartData.EQP_PLAN_TABLE_NAME); _productKindDict = new Dictionary <string, string>(); DataTable dt = _result.LoadInput(EqpGanttChartData.PRODUCT_TABLE_NAME); foreach (DataRow row in dt.Rows) { LotGanttChartData.Product prod = new LotGanttChartData.Product(row); string key = prod.LineID + prod.ProductID; if (!_productKindDict.Keys.Contains(key)) { _productKindDict.Add(key, prod.ProductKind); } } }
private void InitializeData() { _dtStepMove = _result.LoadOutput(SimResultData.OutputName.StepMove); //_dtStepMoveAct = _result.LoadInput(SimInputData.InputName.StepMoveAct); _eqpGrpDic = new Dictionary <string, string>(); DataTable dtEqp = _result.LoadInput(SimInputData.InputName.Eqp); foreach (DataRow dRow in dtEqp.Rows) { SimInputData.Eqp eqp = new SimInputData.Eqp(dRow); if (_eqpGrpDic.ContainsKey(eqp.ShopID + eqp.EqpID) == false) { _eqpGrpDic.Add(eqp.ShopID + eqp.EqpID, eqp.EqpGroupID); } } }
private void LoadData() { #region Wip string filter = string.Format("{0} = '{1}' OR {0} = '{2}'", BalanceTableViewData.Wip.Schema.STEP_ID, BalanceTableViewData.BANK_STEP, BalanceTableViewData.NEXT_STEP); DataTable wipTable = _result.LoadInput(BalanceTableViewData.WIP_DATA_TABLE, filter); foreach (DataRow wRow in wipTable.Rows) { BalanceTableViewData.Wip wip = new BalanceTableViewData.Wip(wRow); if (wip.ProductID == "CE0002") { Console.WriteLine("a"); } if (wip.StepID == BalanceTableViewData.BANK_STEP) { string cellID = GetToProductID(wip.ProductID); CellInfo cinfo; if (_resultDict.TryGetValue(cellID, out cinfo)) { cinfo.AddQty(wip.ProductID.StartsWith("C") ? CellInfo.CF_WIP : CellInfo.TFT_WIP, BalanceTableViewData.INITIAL_SHIFT, wip.Qty); } } else if (wip.StepID == BalanceTableViewData.NEXT_STEP) { CellInfo cinfo; if (_resultDict.TryGetValue(wip.ProductID, out cinfo)) { cinfo.AddQty(CellInfo.CF_WIP, BalanceTableViewData.INITIAL_SHIFT, wip.Qty); cinfo.AddQty(CellInfo.TFT_WIP, BalanceTableViewData.INITIAL_SHIFT, wip.Qty); } } } #endregion #region StepTarget filter = string.Format("{0} = '{1}'", BalanceTableViewData.StepTarget.Schema.STEP_ID, BalanceTableViewData.NEXT_STEP); DataTable stepTargetTable = _result.LoadOutput(BalanceTableViewData.STEP_TARGET_DATA_TABLE, filter); foreach (DataRow sRow in stepTargetTable.Rows) { BalanceTableViewData.StepTarget st = new BalanceTableViewData.StepTarget(sRow); if (st.ProductID == "CE0011") { Console.WriteLine("a"); } CellInfo cinfo; if (_resultDict.TryGetValue(st.ProductID, out cinfo)) { cinfo.AddQty(CellInfo.CELL_IN_TARGET, st.TargetDate, st.InTargetQty); cinfo.AddQty(CellInfo.CELL_OUT_TARGET, st.TargetDate, st.OutTargetQty); } } #endregion #region EqpPlan filter = string.Format("{0} = '{1}' OR {0} = '{2}'", BalanceTableViewData.EqpPlan.Schema.STEP_ID, BalanceTableViewData.BANK_STEP, BalanceTableViewData.NEXT_STEP); DataTable eqpPlanTable = _result.LoadOutput(BalanceTableViewData.EQP_PLAN_DATA_TABLE, filter); foreach (DataRow eRow in eqpPlanTable.Rows) { BalanceTableViewData.EqpPlan ep = new BalanceTableViewData.EqpPlan(eRow); if (ep.ProductID == "TF0007") { Console.WriteLine("a"); } string shiftIn = ShopCalendar.ShiftStartTimeOfDayT(ep.StartTime).ToString("yyyy-MM-dd HH"); string shiftOut = ShopCalendar.ShiftStartTimeOfDayT(ep.EndTime).ToString("yyyy-MM-dd HH"); if (ep.StepID == BalanceTableViewData.BANK_STEP) { string cellID = GetToProductID(ep.ProductID); CellInfo cinfo; if (_resultDict.TryGetValue(cellID, out cinfo)) { cinfo.AddQty(ep.ProductID.StartsWith("C") ? CellInfo.CF_DONE : CellInfo.TFT_DONE, shiftIn, ep.OutTargetQty); } } else if (ep.StepID == BalanceTableViewData.NEXT_STEP) { CellInfo cinfo; if (_resultDict.TryGetValue(ep.ProductID, out cinfo)) { cinfo.AddQty(CellInfo.CELL_IN_PLAN, shiftIn, ep.OutTargetQty); cinfo.AddQty(CellInfo.CELL_OUT_PLAN, shiftOut, ep.OutTargetQty); } } } #endregion }
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); } }
private void InitializeData() { var modelContext = this._result.GetCtx <ModelDataContext>(); _stdStepDic = new Dictionary <string, TcData.StepInfo>(); var stdStep = modelContext.StdStep.Where(x => x.STEP_SEQ > 0) .OrderBy(x => x.SHOP_ID);//.OrderByDescending(x => x.STEP_SEQ); foreach (var step in stdStep) { if (_stdStepDic.ContainsKey(step.SHOP_ID + step.STEP_ID) == false) { _stdStepDic.Add(step.SHOP_ID + step.STEP_ID, new TcData.StepInfo(step.SHOP_ID, step.STEP_ID, step.STEP_DESC, step.STEP_TYPE, (int)step.STEP_SEQ, step.LAYER_ID)); } } try { _defaultRunTat = this.IsUseDefaultTatChecked ? Convert.ToDouble(_result.Experiment.GetArgument("DefaultRunTAT")) : 0.0; _defaultWaitTat = this.IsUseDefaultTatChecked ? Convert.ToDouble(_result.Experiment.GetArgument("DefaultWaitTAT")) : 0.0; } catch { _defaultWaitTat = 0; _defaultRunTat = 0; } var dtProduct = modelContext.Product; Dictionary <string, string> mainProcByProdDic = new Dictionary <string, string>(); foreach (var prod in dtProduct) { if (mainProcByProdDic.ContainsKey(prod.SHOP_ID + prod.PRODUCT_ID) == false) { mainProcByProdDic.Add(prod.SHOP_ID + prod.PRODUCT_ID, prod.PROCESS_ID); } } var dtTat = modelContext.Tat;//modelContext.Tat.Where(x => x.PRODUCT_TYPE == Consts.Production); Dictionary <string, TcData.TatInfo> tatAllDic = new Dictionary <string, TcData.TatInfo>(); foreach (var row in dtTat) { TcData.TatInfo tatInfo = new TcData.TatInfo(row.WAIT_TAT, row.RUN_TAT); if (tatAllDic.ContainsKey(row.SHOP_ID + row.PRODUCT_ID + row.PROCESS_ID + row.STEP_ID) == false) { tatAllDic.Add(row.SHOP_ID + row.PRODUCT_ID + row.PROCESS_ID + row.STEP_ID, tatInfo); } } var dtProcStepMand = modelContext.ProcStep.OrderBy(x => x.SHOP_ID + x.PROCESS_ID).OrderBy(x => x.STEP_SEQ); _procStepDic = new Dictionary <string, List <ProcStep> >(); foreach (var row in dtProcStepMand) { string key = CommonHelper.CreateKey(row.SHOP_ID, row.PROCESS_ID); List <ProcStep> list; if (_procStepDic.TryGetValue(key, out list) == false) { _procStepDic.Add(key, list = new List <ProcStep>()); } list.Add(row); } List <string> mainProcInEqpPlanList = new List <string>(); DataTable dtEqpPlan = _result.LoadOutput(SimResultData.OutputName.EqpPlan); foreach (DataRow drow in dtEqpPlan.Rows) { SimResultData.EqpPlan eqpPlan = new SimResultData.EqpPlan(drow); string mainProcID = string.Empty; mainProcByProdDic.TryGetValue(eqpPlan.ShopID + eqpPlan.ProductID, out mainProcID); if (string.IsNullOrEmpty(mainProcID)) { continue; } string item = CommonHelper.CreateKey(eqpPlan.ShopID, eqpPlan.ProductID, mainProcID); if (mainProcInEqpPlanList.Contains(item) == false) { mainProcInEqpPlanList.Add(item); } } // 기준정보 Tat 집계 _tatDic = new Dictionary <string, TcData.ProcStepTatInfo>(); foreach (string item in mainProcInEqpPlanList) { string shopID = item.Split('@')[0]; string prodID = item.Split('@')[1]; string mainProcID = item.Split('@')[2]; string key = CommonHelper.CreateKey(shopID, mainProcID); List <ProcStep> procStepList; if (_procStepDic.TryGetValue(key, out procStepList) == false) { continue; } double cumTat = 0; List <string> keyList = new List <string>(); foreach (ProcStep procStep in procStepList) { double waitTat = _defaultWaitTat; double runTat = _defaultWaitTat; double tat = waitTat + runTat; string key2 = procStep.SHOP_ID + prodID + procStep.PROCESS_ID + procStep.STEP_ID; TcData.TatInfo tatInfo; if (tatAllDic.TryGetValue(key2, out tatInfo)) { waitTat = tatInfo.WaitTat; runTat = tatInfo.RunTat; tat = tatInfo.Tat; } cumTat += tat; TcData.ProcStepTatInfo psTatInfo; if (_tatDic.TryGetValue(key2, out psTatInfo) == false) { _tatDic.Add(key2, psTatInfo = new TcData.ProcStepTatInfo(procStep.SHOP_ID, prodID, procStep.PROCESS_ID, procStep.STEP_ID, procStep.STEP_SEQ, waitTat, runTat, cumTat)); } if (keyList.Contains(key2) == false) { keyList.Add(key2); } } double totalTat = cumTat; foreach (string k in keyList) { TcData.ProcStepTatInfo psTatInfo; if (_tatDic.TryGetValue(k, out psTatInfo) == false) { continue; // 있을 수 없음 } psTatInfo.SetTotalTat(totalTat); } } // Simuation Run, Wait TAT 산출 && 시뮬레이션에서 FabIn부터 FabOut까지 흐른 Product 집계 _simTatInfoDic = new Dictionary <string, TcData.SimTatInfo>(); _allStepRunProdInSimList = new List <string>(); var eqpPlanDic = dtEqpPlan.AsEnumerable() .GroupBy(x => x.GetString(SimResultData.EqpPlanSchema.LOT_ID)) .ToDictionary(x => x.Key); foreach (string lotID in eqpPlanDic.Keys) { var sortedList = eqpPlanDic[lotID].OrderBy(x => x.GetDateTime(SimResultData.EqpPlanSchema.START_TIME)); if (sortedList.Count() >= 2) { var firstRow = sortedList.ToList()[0]; foreach (var row in sortedList) { string rowShopID = row.GetString(SimResultData.EqpPlanSchema.SHOP_ID); string rowStepID = row.GetString(SimResultData.EqpPlanSchema.STEP_ID); if (_stdStepDic.ContainsKey(rowShopID + rowStepID)) { firstRow = row; break; } } var lastRow = sortedList.ToList()[sortedList.Count() - 1]; string shopID = firstRow.GetString(SimResultData.EqpPlanSchema.SHOP_ID); string prodID = firstRow.GetString(SimResultData.EqpPlanSchema.PRODUCT_ID); string mainProcID = string.Empty; mainProcByProdDic.TryGetValue(shopID + prodID, out mainProcID); if (string.IsNullOrEmpty(mainProcID) == false) { string key = CommonHelper.CreateKey(shopID, mainProcID); List <ProcStep> procStepList; if (_procStepDic.TryGetValue(key, out procStepList) && procStepList.Count() >= 2) { string firstStepReal = procStepList[0].STEP_ID; string lastStepReal = procStepList[procStepList.Count() - 1].STEP_ID; string firstStepLot = firstRow.GetString(SimResultData.EqpPlanSchema.STEP_ID); string lastStepLot = lastRow.GetString(SimResultData.EqpPlanSchema.STEP_ID); if (firstStepReal == firstStepLot && lastStepReal == lastStepLot) { if (_allStepRunProdInSimList.Contains(shopID + prodID) == false) { _allStepRunProdInSimList.Add(shopID + prodID); } } } } } DateTime preRowEndTime = DateTime.MinValue; foreach (var row in sortedList) { string shopID = row.GetString(SimResultData.EqpPlanSchema.SHOP_ID); string prodID = row.GetString(SimResultData.EqpPlanSchema.PRODUCT_ID); string procID = row.GetString(SimResultData.EqpPlanSchema.PROCESS_ID); string stepID = row.GetString(SimResultData.EqpPlanSchema.STEP_ID); DateTime startTime = row.GetDateTime(SimResultData.EqpPlanSchema.START_TIME); DateTime endTime = row.GetDateTime(SimResultData.EqpPlanSchema.END_TIME); // 시뮬레이션 투입 Lot은 EqpPlan에 ARRAY/ARRAY00000 이런 식으로 정보가 한 줄 더 찍힘 -> 이에 대한 예외처리 if (_stdStepDic.ContainsKey(shopID + stepID) == false) { continue; } string mainChecker = CommonHelper.CreateKey(shopID, prodID, procID); if (mainProcInEqpPlanList.Contains(mainChecker) == false) { preRowEndTime = endTime; continue; } double runTAT = endTime > startTime ? (endTime - startTime).TotalSeconds : 0; double waitTAT = preRowEndTime == DateTime.MinValue ? 0 : startTime > preRowEndTime ? (startTime - preRowEndTime).TotalSeconds : 0; if (runTAT <= 0 && preRowEndTime == DateTime.MinValue) { preRowEndTime = endTime; continue; } DateTime targetShift = ShopCalendar.ShiftStartTimeOfDayT(startTime); TcData.SimTatInfo simTatInfo; if (_simTatInfoDic.TryGetValue(shopID + targetShift + prodID + procID + stepID, out simTatInfo) == false) { _simTatInfoDic.Add(shopID + targetShift + prodID + procID + stepID, simTatInfo = new TcData.SimTatInfo(shopID, targetShift, prodID, procID, stepID)); } if (runTAT > 0) { simTatInfo.AddRunTatToList(runTAT); } if (preRowEndTime != DateTime.MinValue) { simTatInfo.AddWaitTatToList(waitTAT); } preRowEndTime = endTime; } } }
private void LoadData() { _eqpPlanTable = _result.LoadOutput(JobChangePlanData.EQP_PLAN_DATA_TABLE); List <string> prodList = _prodGroupDict[SelectedProdGrp]; _resultDict = new Dictionary <string, ProductInfo>(); if (SelectedProduct != Consts.ALL) { prodList = new List <string>(); prodList.Add(SelectedProduct); } foreach (DataRow epRow in _eqpPlanTable.Rows) { JobChangePlanData.EqpPlan ep = new JobChangePlanData.EqpPlan(epRow); if ((SelectedProduct != Consts.ALL && ep.ProductID != SelectedProduct) || string.IsNullOrWhiteSpace(ep.BatchID)) { continue; } if (ep.ProductID.StartsWith("CE")) { ep.ProductID = GetCellProductID(ep.ProductID); } ProductInfo info; if (_resultDict.TryGetValue(ep.BatchID, out info) == false) { info = new ProductInfo(ep.ProductID, ep.BatchID, ep.ShopID); _resultDict.Add(ep.BatchID, info); string filter = string.Format("{0} = '{1}'", JobChangePlanData.EqpPlan.Schema.LOT_ID, ep.LotID); DataTable temp = _result.LoadOutput(JobChangePlanData.EQP_PLAN_DATA_TABLE, filter); foreach (DataRow item in temp.Rows) { JobChangePlanData.EqpPlan t = new JobChangePlanData.EqpPlan(item); if (IsShopStep(t.StepID)) { info.LotInTime(t.LotID, t.StartTime); } } } if (IsInStep(ep.StepID)) { info.AddInfo(ep.OutTargetQty, 0, 0); info.SetInOutTime(ep.StartTime, ep.EndTime, true); } if (IsOutStep(ep.StepID)) { info.AddInfo(0, ep.OutTargetQty, 0); info.SetInOutTime(ep.StartTime, ep.EndTime, false); info.LotOutTime(ep.LotID, ep.EndTime); } } }
private Dictionary <string, SortedDictionary <string, LotInfoItem> > GetLotsInfo() { Dictionary <string, SortedDictionary <string, LotInfoItem> > lotsInfo = new Dictionary <string, SortedDictionary <string, LotInfoItem> >(); DataTable dtLotInfo = _result.LoadOutput(DataConsts.Out_EqpPlan); foreach (DataRow row in dtLotInfo.Rows) { string versionNo = row.GetString("VERSION_NO"); string factoryID = row.GetString("FACTORY_ID"); string shopID = row.GetString("SHOP_ID"); string eqpID = row.GetString("EQP_ID"); string eqpGroupID = row.GetString("EQP_GROUP_ID"); string stateCode = row.GetString("STATE_CODE"); //string eventID = row.GetString("EVENT_ID"); string lotID = row.GetString("LOT_ID"); //string slpsLine = row.GetString("SLPS_LINE"); string stepID = row.GetString("STEP_ID"); string layerID = row.GetString("LAYER_ID"); DateTime startTime = row.GetDateTime("START_TIME"); DateTime endTime = row.GetDateTime("END_TIME"); string toolID = row.GetString("TOOL_ID"); string processID = row.GetString("PROCESS_ID"); string productID = row.GetString("PRODUCT_ID"); string productKind = row.GetString("PRODUCT_KIND"); //string kop = row.GetString("KOP"); //int seqNo = row.GetInt32("SEQ_NO"); //int jcSeqNo = row.GetInt32("JC_SEQNO"); //string lotAttributes = row.GetString("LOT_ATTRIBUTES"); //string lotUserID = row.GetString("LOT_USER_ID"); //string toProductID = row.GetString("TO_PRODUCT_ID"); //string linkSiteID = row.GetString("LINK_SITE_ID"); //string shipMethod = row.GetString("SHIP_METHOD"); //string stepGroup = row.GetString("STEP_GROUP"); string stepType = row.GetString("STEP_TYPE"); int unitQty = row.GetInt32("UNIT_QTY"); //int glassQty = row.GetInt32("GLASS_QTY"); string wipStepSeq = row.GetString("WIP_STEP_ID"); //string wipLotAttribute = row.GetString("WIP_LOT_ATTRIBUTE"); //string wipLaneCode = row.GetString("WIP_LANE_CODE"); string day = row.GetString("TARGET_DAY"); DateTime targetDay; if (DateTime.TryParse(day, out targetDay) == false) { targetDay = DateTime.MinValue; } string targetProductID = row.GetString("TARGET_PRODUCT_ID"); string tarDemandID = row.GetString("TAR_DEMAND_ID"); string tarSeqNo = row.GetString("TAR_SEQ_NO"); //string tarModelCode = row.GetString("TAR_MODEL_CODE"); DateTime tarPlanDate = row.GetDateTime("TAR_PLAN_DATE"); int tarPlanQty = row.GetInt32("TAR_PLAN_QTY"); //float adjustFactor = row.GetFloat("ADJUST_FACTOR"); //int apdValue = row.GetInt32("APD_VALUE"); if (lotsInfo.ContainsKey(lotID) == false) { lotsInfo[lotID] = new SortedDictionary <string, LotInfoItem>(); } string shopNo = "9"; if (shopID.Equals("T")) { shopNo = "1"; } else if (shopID.Equals("F")) { shopNo = "2"; } else if (shopID.Equals("C")) { shopNo = "3"; } else if (shopID.Equals("M")) { shopNo = "4"; } string stepKey = CommonHelper.CreateKey(shopNo, stepID); if (lotsInfo[lotID].ContainsKey(stepKey) == false) { lotsInfo[lotID][stepKey] = new LotInfoItem(); } lotsInfo[lotID][stepKey].AddItem(versionNo, factoryID, shopID, eqpID, eqpGroupID, stateCode, lotID, stepID, layerID, startTime, endTime, toolID, processID, productID, productKind, stepType, unitQty, wipStepSeq, targetDay, targetProductID, tarDemandID, tarSeqNo, tarPlanDate, tarPlanQty); } return(lotsInfo); }