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; }
private GanttBar AddItem( EqpPlanItem item, DateTime tkin, DateTime tkout, EqpState state, string seltype ) { var info = this.TryGetGanttInfo(item.LineID, item.STEP_GROUP, item.EqpID); var currentBar = new GanttBar(item, tkin, tkout, item.Qty, item.Qty, state); if (string.IsNullOrEmpty(currentBar.BarKey)) { return(null); } info.AddItem(currentBar.BarKey, currentBar, seltype); return(currentBar); }
private void FillEqpPlan( string lineID, string stepGroup, string equipmentID, DateTime startDate, int duration, string seltype) { var resultCtx = this.result.GetCtx <ResultDataContext>(); var endDate = startDate.AddDays(duration); var prevGanttBar = new Dictionary <string, GanttBar>(); foreach (var row in resultCtx.EqpPlan.OrderBy(x => x.START_TIME)) { if (lineID != Constants.ALL && row.LINE_ID != lineID) { continue; } if (stepGroup != Constants.ALL && row.STEP_GROUP != stepGroup) { continue; } if (!string.IsNullOrEmpty(equipmentID) && !LikeUtility.Like(row.EQP_ID, equipmentID, true)) { continue; } if (!this.validEquipments.ContainsKey(row.EQP_ID)) { continue; } var startTime = row.START_TIME; if (startTime < this.FromTime || startTime >= this.ToTime) { continue; } var endTime = row.END_TIME; if (startTime >= endTime) { continue; } var state = row.STATUS == Constants.STR_PM ? EqpState.PM : row.STATUS == Constants.STR_SETUP ? EqpState.SETUP : EqpState.BUSY; var barKey = row.PRODUCT_ID; if (string.IsNullOrEmpty(barKey)) { barKey = Mozart.Studio.TaskModel.UserLibrary.StringUtility.IdentityNull; } GanttBar prevBar; if (prevGanttBar.TryGetValue(row.EQP_ID, out prevBar)) { if (startTime <= prevBar.TkinTime) { continue; } if (startTime < prevBar.TkoutTime) { startTime = prevBar.TkoutTime; } if (prevBar.BarKey == barKey && prevBar.State == state && startTime > prevBar.TkoutTime && startTime <= prevBar.TkoutTime.AddMinutes(this.MergeThreshold)) { startTime = prevBar.TkoutTime; } } this.AddVisibleItem(row.EQP_ID); var item = new EqpPlanItem(row); var currentBar = this.AddItem(item, startTime, endTime, state, seltype); if (currentBar != null) { prevGanttBar[item.EqpID] = currentBar; } } }