private string NextDateToString(string str) { DateTime dt = DateUtility.DbToDate(str); dt = dt.AddDays(1); return(dt.ToString("yyyyMMdd")); }
private void FillData_LoadHist(DataTable result, DataView dvPlan, string targetShopID, string targetEqpID, bool showDownEqp) { //var runWipList = GetRunWipList(targetShopID); string factoryStartTime = ShopCalendar.StartTime.ToString().Replace(":", ""); HashSet <string> sameValueContainer = new HashSet <string>(); Dictionary <string, List <DataRow> > datas = CollectionPlanData(dvPlan); var fromTime = this.StartDate; var toTime = this.EndDate; foreach (List <DataRow> planDataRows in datas.Values) { int rowCount = planDataRows.Count; for (int j = 0; j < rowCount; j++) { DataRow row = planDataRows[j]; DataRow nextRow = j < (rowCount - 1) ? planDataRows[j + 1] : null; string eqpID = row.GetString(ColName.EqpID); string chamberID = row.GetString(ColName.ChamberID); string eqpGrp = row.GetString(ColName.EqpGroup); EqpMaster.Eqp eqp; if (TryGetValidEqp(eqpID, out eqp) == false) { continue; } DateTime targetDate = DateUtility.DbToDate(row.GetString("TARGET_DATE")); string[] data = SchedOut.LoadInfo.DetectNoise(SchedOut.Split(row), targetDate); for (int k = 0; k < data.Length; k++) { var loadInfo = PackedTable.Split <SchedOut.LoadInfo>(data[k]); string strStartTime = loadInfo.StartTime; string shopID = loadInfo.ShopID; string productID = loadInfo.ProductID; string productVersion = loadInfo.ProductVersion; string ownerType = loadInfo.OwnerType; string processID = loadInfo.ProcessID; string stepID = loadInfo.StepID; string stdStep = stepID; string toolID = loadInfo.ProcessID; string lotID = loadInfo.LotID; EqpState state = Enums.ParseEqpState(loadInfo.State); if (string.IsNullOrEmpty(targetEqpID) == false && LikeUtility.Like(eqpID, targetEqpID) == false) { continue; } //상태시작시간 DateTime startTime = SchedOut.LHStateTime(targetDate, loadInfo.StartTime); if (startTime >= toTime) { continue; } int qty = CommonHelper.ToInt32(loadInfo.Qty); if (state == EqpState.SETUP) { qty = 0; } //현재데이터값 string nowValue = eqpID + ";" + state + ";" + processID + ";" + stepID + ";" + lotID + ";" + qty.ToString(); if (loadInfo.StartTime.CompareTo(factoryStartTime) == 0 && sameValueContainer.Contains(nowValue)) { qty = 0; } sameValueContainer.Add(nowValue); //상태종료시간 DateTime endTime = toTime; //이전 OutTime에 현재 InTime 넣어주기 TryGetEndTime(data, targetDate, startTime, stepID, loadInfo.StartTime, k, ref endTime); //IDLE과 IDLERUN을 없애기 위한 Merge if (k < data.Length - 1) { var nextLoadInfo = PackedTable.Split <SchedOut.LoadInfo>(data[k + 1]); endTime = SchedOut.LHStateTime(targetDate, nextLoadInfo.StartTime); } else if (nextRow != null) { string nextEqpID = nextRow.GetString("EQP_ID"); DateTime nextTargetDate = DateUtility.DbToDate(nextRow.GetString("TARGET_DATE")); string[] nextDataTemp = PackedTable.Split(nextRow); string[] nextData = SchedOut.LoadInfo.DetectNoise(nextDataTemp, nextTargetDate); if (nextData.Length > 0) { var nextLoadInfo = PackedTable.Split <SchedOut.LoadInfo>(nextData[0]); //공장가동 시간(06시)의 전날 자료 무시(이전 데이터와 동일 데이터) if (nextLoadInfo.StartTime.CompareTo(factoryStartTime) == 0) { string nextValue = nextEqpID + ";" + nextLoadInfo.State + ";" + nextLoadInfo.ProcessID + ";" + nextLoadInfo.StepID + ";" + nextLoadInfo.LotID + ";" + nextLoadInfo.Qty.ToString(); if (sameValueContainer.Contains(nextValue) && nextData.Length > 1) { nextLoadInfo = PackedTable.Split <SchedOut.LoadInfo>(nextData[1]); } } string endDate2 = DateHelper.DateToString(nextTargetDate) + nextLoadInfo.StartTime; endTime = ShopCalendar.AdjustSectionDateTime(DateHelper.StringToDateTime(endDate2)); } } if (endTime <= fromTime) { continue; } //ProcessedTime is zoro if (startTime >= endTime) { continue; } ////IDLE, IDLERUN //if ((state == EqpState.IDLE || state == EqpState.IDLERUN)) // continue; string layer = GetLayer(shopID, stepID); string origLotID = lotID; DataRow dispatchingInfo = FindDispInfo(eqpID, startTime); AddItem(result, eqpID, eqpGrp, chamberID, layer, lotID, origLotID, productID, productVersion, ownerType, processID, stepID, toolID, startTime, endTime, qty, state, eqpID, dispatchingInfo); } } } }