private void InitializeControl() { _isEndLoadDocument = false; //DateEdit Controls this.fromDateEdit.DateTime = ShopCalendar.SplitDate(_planStartTime); ComboHelper.ShiftName(this.shiftComboBoxEdit, _planStartTime); this.daySpinEdit.Value = _result.GetPlanPeriod(); // ShopID ComboBox ComboHelper.AddDataToComboBox(this.shopIdComboBoxEdit, _result, SimInputData.InputName.StdStep, SimInputData.StdStepSchema.SHOP_ID, false); // ProductIDs SetProdIdCheckBox(); // Step TAT Unit this.stepTatUnitComboBox.Properties.Items.Add("Sec"); this.stepTatUnitComboBox.Properties.Items.Add("Min"); this.stepTatUnitComboBox.Properties.Items.Add("Hour"); this.stepTatUnitComboBox.Properties.Items.Add("Day"); this.stepTatUnitComboBox.SelectedIndex = 1; // Total TAT Unit this.totalTatUnitComboBox.Properties.Items.Add("Sec"); this.totalTatUnitComboBox.Properties.Items.Add("Min"); this.totalTatUnitComboBox.Properties.Items.Add("Hour"); this.totalTatUnitComboBox.Properties.Items.Add("Day"); this.totalTatUnitComboBox.SelectedIndex = 3; }
private void SetControls() { this.startDatePicker.DateTime = _planStartTime; this.startDatePicker.Properties.EditMask = "yyyy-MM-dd"; this.startDatePicker.Properties.VistaDisplayMode = DevExpress.Utils.DefaultBoolean.True; this.startDatePicker.Properties.VistaEditTime = DevExpress.Utils.DefaultBoolean.True; DateTime defaultEndTime = _result.StartTime.AddDays(Globals.GetResultPlanPeriod(_result)); this.endDatePicker.DateTime = ShopCalendar.ShiftStartTimeOfDayT(defaultEndTime); this.endDatePicker.Properties.EditMask = "yyyy-MM-dd"; this.endDatePicker.Properties.VistaDisplayMode = DevExpress.Utils.DefaultBoolean.True; this.endDatePicker.Properties.VistaEditTime = DevExpress.Utils.DefaultBoolean.True; SetAreaIDComboBox(); SetShopCombo(); SetStepIDCombo(TargetShopID); SetOwnerTypeCombo(); SetProductCombo(); _isFirstLoad = true; }
private void InitializeControl() { var modelContext = this._result.GetCtx <ModelDataContext>(); // ShopID ComboBox ComboHelper.AddDataToComboBox(this.shopIdComboBoxEdit, _result, SimInputData.InputName.StdStep, SimInputData.StdStepSchema.SHOP_ID, false); if (this.shopIdComboBoxEdit.Properties.Items.Contains("ARRAY")) { this.shopIdComboBoxEdit.SelectedIndex = this.shopIdComboBoxEdit.Properties.Items.IndexOf("ARRAY"); } //DateEdit Controls this.fromDateEdit.DateTime = ShopCalendar.SplitDate(_planStartTime); ComboHelper.ShiftName(this.shiftComboBoxEdit, _planStartTime); //// Set ProdInTatDic //_prodIdsInTatDic = new Dictionary<string, List<string>>(); //var dtTat = modelContext.Tat.Where(x => x.PRODUCT_TYPE == "Production") // .Select(x => new { SHOP_ID = x.SHOP_ID, PROD_ID = x.PRODUCT_ID }).Distinct(); //foreach (var row in dtTat) //{ // List<string> prodInTatList; // if (_prodIdsInTatDic.TryGetValue(row.SHOP_ID, out prodInTatList) == false) // _prodIdsInTatDic.Add(row.SHOP_ID, prodInTatList = new List<string>()); // prodInTatList.Add(row.PROD_ID); //} // ProductIDs SetProdIdCheckBox(); }
private void InitializeControl() { var modelContext = this._result.GetCtx <ModelDataContext>(); // ShopID ComboBox ComboHelper.AddDataToComboBox(this.shopIdComboBoxEdit, _result, SimInputData.InputName.StdStep, SimInputData.StdStepSchema.SHOP_ID, false); if (this.shopIdComboBoxEdit.Properties.Items.Contains("ARRAY")) { this.shopIdComboBoxEdit.SelectedIndex = this.shopIdComboBoxEdit.Properties.Items.IndexOf("ARRAY"); } // ProductID CheckComboBox this.prodIdCheckedComboBoxEdit.Properties.Items.Clear(); var prodIDs = (from a in modelContext.Product select new { PRODUCT_ID = a.PRODUCT_ID }) .Distinct().OrderBy(x => x.PRODUCT_ID); foreach (var item in prodIDs) { this.prodIdCheckedComboBoxEdit.Properties.Items.Add(item.PRODUCT_ID.ToString()); } this.prodIdCheckedComboBoxEdit.CheckAll(); //DateEdit Controls this.fromDateEdit.DateTime = ShopCalendar.SplitDate(_planStartTime); ComboHelper.ShiftName(this.shiftComboBoxEdit, _planStartTime); }
/// <summary> /// </summary> /// <param name="task"/> /// <param name="context"/> /// <param name="handled"/> public void SETUP_QUERY_ARGS1(ModelTask task, ModelContext context, ref bool handled) { FactoryConfiguration.Current.Initialize(); string runServer = LcdHelper.GetArguments(task.Context.Arguments, "RunServer", string.Empty);; string varsionDate = context.StartTime.SplitDate().ToString("yyyyMMdd"); DateTime planStartTime = context.StartTime; DateTime planEndTime = context.EndTime; DateTime planStartOfDayT = ShopCalendar.StartTimeOfDayT(planStartTime); string actStartTime = LcdHelper.DbToString(planStartOfDayT.AddDays(-1)); string actEndTime = LcdHelper.DbToString(planStartTime); var args = context.QueryArgs; args["ARG_RUN_SERVER"] = runServer; args["ARG_VERSION_DATE"] = varsionDate; args["ARG_VERSION_NO"] = task.Context.VersionNo; args["ARG_TARGET_SHOP_LIST"] = LcdHelper.GetTargetShopList(); args["ARG_ACT_START_TIME"] = actStartTime; args["ARG_ACT_END_TIME"] = actEndTime; args["ARG_PLAN_START_TIME"] = LcdHelper.DbToString(planStartTime); args["ARG_PLAN_END_TIME"] = LcdHelper.DbToString(planEndTime); args["ARG_ACT_FIXED_DATE"] = LcdHelper.DbToString(LcdHelper.GetActFixedDate_Default()); }
private void BindPivotGrid(string batchID) { _detailDict = new Dictionary <string, DetailInfo>(); bool isFirstItem = true; foreach (DataRow row in _eqpPlanTable.Rows) { JobChangePlanData.EqpPlan ep = new JobChangePlanData.EqpPlan(row); if (ep.ProductID.StartsWith("CE")) { ep.ProductID = GetCellProductID(ep.ProductID); } if (ep.BatchID != batchID) { continue; } string layer = FindLayer(ep.ShopID, ep.StepID); string stepDesc = FindDesc(ep.ShopID, ep.StepID); if (layer == string.Empty) { continue; } string key = layer + ep.StepID; DetailInfo info; if (_detailDict.TryGetValue(key, out info) == false) { info = new DetailInfo(ep.BatchID, ep.ShopID, layer, ep.StepID, stepDesc); if (isFirstItem) { info.FillDummyDates(_shiftList); } _detailDict.Add(key, info); } DateTime shift = ShopCalendar.ShiftStartTimeOfDayT(ep.StartTime); info.AddQty(shift, ep.OutTargetQty); if (ep.StepID == "T02100") { Console.WriteLine("a"); } info.CalculateTimes(ep.StartTime, ep.EndTime); isFirstItem = false; } }
public static DateTime GetPlanStartTime(IExperimentResultItem result) { if (result.Experiment.GetArgument("nextShiftVer", false)) { int shift = ShopCalendar.ClassifyShift(GetPlanStartTime_OLD(result).AddHours(8)); return(ShopCalendar.GetShiftStartTime(GetPlanStartTime_OLD(result).AddHours(8), shift)); } else { var st = result.Experiment.GetArgument("start-time"); if (st == null) { return(DateTime.Now); } var planStartTime = DateTime.MinValue; try { planStartTime = st.ToString().DbToDateTime(); } catch { return(DateTime.Now); } if (planStartTime == DateTime.MinValue) { return(DateTime.Now); } return(planStartTime); } }
private void AddResult(string shopID, string inOutFlag, DateTime targetDate, string prodID, string prodVer, string dept, double qty) { if (qty <= 0) { return; } //StartTimeOfDay 확인하기 string sTargetDate = ShopCalendar.StartTimeOfDayT(targetDate).DbToDateString(); // Result Of Pivot string key = shopID + dept + inOutFlag + sTargetDate + prodID + prodVer; IocvData.ResultPivot rsltPivot; if (_rsltPivotDic.TryGetValue(key, out rsltPivot) == false) { _rsltPivotDic.Add(key, rsltPivot = new IocvData.ResultPivot(shopID, inOutFlag, sTargetDate, targetDate, prodID, prodVer, dept)); } rsltPivot.AddQty(qty); // Result Of Chart string key2 = sTargetDate + "_" + inOutFlag; IocvData.ResultChart rsltChart; if (_rsltChartDic.TryGetValue(key2, out rsltChart) == false) { _rsltChartDic.Add(key2, rsltChart = new IocvData.ResultChart(shopID, sTargetDate, targetDate, inOutFlag)); } rsltChart.AddQty(qty, dept); }
private void SetDateRange() { _dateList = new List <string>(); for (DateTime dt = ShopCalendar.ShiftStartTimeOfDayT(_planStartTime); dt <= EndTime; dt = dt.AddDays(1)) { _dateList.Add(dt.ToString("yyyyMMdd")); } }
public static DateTime GetRptDate_1Hour(DateTime t) { //DayStartTime为基准 //DayStartTime 기준 int baseMinute = ShopCalendar.StartTimeOfDayT(ModelContext.Current.StartTime).Minute; return(LcdHelper.GetRptDate_1Hour(t, baseMinute)); }
/// /// 개발 포인트 /// private void ParseRow(DataRow row) { this.AreaID = row.GetString(Schema.AREA_ID); this.ShopID = row.GetString(Schema.SHOP_ID); this.ProductID = row.GetString(Schema.PRODUCT_ID); this.StepID = row.GetString(Schema.STEP_ID); this.TargetDate = ShopCalendar.SplitDate(row.GetDateTime(Schema.TARGET_DATE)).ToString("yyyyMMdd"); this.CampareTargetDate = row.GetDateTime(Schema.TARGET_DATE); this.OutTargetQty = row.GetFloat(Schema.OUT_TARGET_QTY); this.StepType = row.GetString(Schema.STEP_TYPE); }
private void InitializeControl() { //// ShopID ComboBox //ComboHelper.AddDataToComboBox(this.shopIdComboBoxEdit, _result, // SimInputData.InputName.StdStep, SimInputData.StdStepSchema.SHOP_ID, false); //if (this.shopIdComboBoxEdit.Properties.Items.Contains("ARRAY")) // this.shopIdComboBoxEdit.SelectedIndex = this.shopIdComboBoxEdit.Properties.Items.IndexOf("ARRAY"); //DateEdit Controls this.fromDateEdit.DateTime = ShopCalendar.SplitDate(_planStartTime.AddDays(-2)); ComboHelper.ShiftName(this.shiftComboBoxEdit, _planStartTime); }
/// <summary> /// </summary> /// <param name="entity"/> /// <param name="now"/> /// <param name="target"/> /// <param name="factor"/> /// <param name="ctx"/> /// <returns/> public WeightValue STEP_TARGET_PRIORITY(Mozart.Simulation.Engine.ISimEntity entity, DateTime now, Mozart.Simulation.Engine.ActiveObject target, Mozart.SeePlan.DataModel.WeightFactor factor, Mozart.SeePlan.Simulation.IDispatchContext ctx) { if (factor.Factor == 0) { return(new WeightValue(0)); } FabLot lot = entity as FabLot; if (lot.LotID == "TH011797N01") { Console.WriteLine(); } if (lot.CurrentFabPlan.IsPegged == false) { return(new WeightValue(0)); } int precedeDay = (int)factor.Criteria[0]; int delayDay = (int)factor.Criteria[1]; double duration = precedeDay + delayDay; if (duration <= 0) { return(new WeightValue(0)); } DateTime targetdate = lot.CurrentFabPlan.MainTarget.DueDate; DateTime targetday = ShopCalendar.SplitDate(targetdate); DateTime nowday = ShopCalendar.SplitDate(now); TimeSpan gap = nowday - targetday; //shift zero point (zero point로 변경하여 로직 처리) double gapDays = gap.TotalDays + precedeDay; float score = 0f; if (gapDays >= 0) { double ratio = gapDays / duration; score = (float)Math.Max(ratio, 1f); } string desc = string.Format("[GAP:{0}]", Math.Round(gap.TotalDays, 2)); return(new WeightValue(score * factor.Factor, desc)); }
/// /// 개발 포인트 /// private void ParseRow(DataRow row) { this.ShopID = row.GetString(Schema.SHOP_ID); this.ProductID = row.GetString(Schema.PRODUCT_ID); this.BatchID = row.GetString(Schema.BATCH_ID); this.StepID = row.GetString(Schema.STEP_ID); this.LotID = row.GetString(Schema.LOT_ID); this.TargetDate = ShopCalendar.SplitDate(row.GetDateTime(Schema.TARGET_DATE)).ToString("yyyyMMdd"); this.OutTargetQty = row.GetFloat(Schema.OUT_TARGET_QTY); this.StartTime = row.GetDateTime(Schema.START_TIME); this.EndTime = row.GetDateTime(Schema.END_TIME); }
private DateTime GetPlanDate(DateTime t) { DateTime planDate = t; if (this.dayRadioBtn.Checked) { planDate = ShopCalendar.SplitDate(t); } else if (this.shiftRadioBtn.Checked) { planDate = ShopCalendar.ShiftStartTimeOfDayT(t); } return(planDate); }
/// /// 개발 포인트 /// private void ParseRow(DataRow row) { this.AreaID = row.GetString(Schema.AREA_ID); this.ShopID = row.GetString(Schema.SHOP_ID); this.ProductID = row.GetString(Schema.PRODUCT_ID); this.StepID = row.GetString(Schema.STEP_ID); this.StdStepSeq = row.GetInt32(Schema.STD_STEP_SEQ); this.OwnerType = row.GetString(Schema.OWNER_TYPE); //this.TargetDate = row.GetDateTime(Schema.TARGET_DATE).ToString("yyyyMMdd"); this.TargetDate = ShopCalendar.SplitDate(row.GetDateTime(Schema.TARGET_DATE)).ToString("yyyyMMdd"); this.CompareTargetDate = row.GetDateTime(Schema.TARGET_DATE); this.InQty = row.GetFloat(Schema.IN_QTY); this.OutQty = row.GetFloat(Schema.OUT_QTY); }
public void AddJobChange(DateTime tkinTime) { string chgTime = tkinTime.ToString(this.DateKeyPattern); string shiftTime = ShopCalendar.ShiftStartTimeOfDayT(tkinTime).ToString(this.DateGroupPattern); if (_jobChgCntByHour.ContainsKey(chgTime) == false) { _jobChgCntByHour.Add(chgTime, 0); } if (_jobChgCntByShift.ContainsKey(shiftTime) == false) { _jobChgCntByShift.Add(shiftTime, 0); } _jobChgCntByHour[chgTime]++; _jobChgCntByShift[shiftTime]++; }
private void SetDateRanges() { _dateRangeList = new List <DateTime>(); float hours = this.IsTimeConditionHour ? 24 : (int)ShopCalendar.ShiftHours; for (DateTime start = ShopCalendar.ShiftStartTimeOfDayT(this.FromTime); // this.FromTime; start < ShopCalendar.ShiftStartTimeOfDayT(this.ToTime); //this.ToTime; start = start.AddHours(hours)) { _dateRangeList.Add(start); } //if (/*this.shiftComboBoxEdit.SelectedIndex > 0 &&*/ this.ToTime != ShopCalendar.StartTimeOfDay(this.ToTime) // && _dateRangeList.Contains(this.ToTime) == false) //{ // _dateRangeList.Add(this.ToTime); //} }
public static DateTime GetRptDate_1Hour(DateTime t) { //1시간 단위 int baseHours = 1; //DayStartTime 기준 int baseMinute = ShopCalendar.StartTimeOfDayT(ModelContext.Current.StartTime).Minute; //ex) HH:30:00 DateTime rptDate = LcdHelper.Trim(t, "HH").AddMinutes(baseMinute); //baseMinute(ex.30분) 이상인 경우 이후 시간대 baseMinute의 실적 //07:30 = 06:30(초과) ~ 07:30(이하)인경우, 06:40 --> 07:30, 07:30 --> 07:30, 07:40 --> 08:30 if (t.Minute > baseMinute) { rptDate = rptDate.AddHours(baseHours); } return(rptDate); }
protected void InitControl() { layoutControlItem8.Text = LotGanttChartData.LOT_ID; fromShiftComboBox.Value = Globals.GetResultPlanPeriod(_result) * ShopCalendar.ShiftCount;//ShopCalendar.ShiftCount * 7; _planStartTime = _result.StartTime; dateEdit1.DateTime = ShopCalendar.SplitDate(_planStartTime); ComboHelper.AddDataToComboBox(shopIDcomboBox, _result, LotGanttChartData.LOT_TABLE_NAME, LotGanttChartData.Lot.Schema.SHOP_ID, false); if (this.shopIDcomboBox.Properties.Items.Contains("ARRAY")) { this.shopIDcomboBox.SelectedIndex = this.shopIDcomboBox.Properties.Items.IndexOf("ARRAY"); } else { this.shopIDcomboBox.SelectedIndex = 0; } var cellWidth = Extensions.GetLocalSetting(this.ServiceProvider, _pageID + "ganttCellWidth"); var cellHeight = Extensions.GetLocalSetting(this.ServiceProvider, _pageID + "ganttCellHeight"); cellWidth = cellWidth == null?this.CellWidthSize.ToString() : cellWidth; cellHeight = cellHeight == null?this.CellHeightSize.ToString() : cellHeight; if (!string.IsNullOrEmpty(cellWidth)) { this.ganttSizeControl1.CellWidth = Convert.ToInt32(cellWidth); } if (!string.IsNullOrEmpty(cellHeight)) { this.ganttSizeControl1.CellHeight = Convert.ToInt32(cellHeight); } ComboHelper.ShiftName(shiftNameComboBox, _planStartTime); //lindIDcomboBox.SelectedIndexChanged += new EventHandler(cbeLine_SelectedIndexChanged); }
private static bool IsFilterInflowMoreThenRemainArrMtype(this JobFilterInfo info, FabAoEquipment eqp) { if (InputMart.Instance.GlobalParameters.ApplyArrangeMType == false) { return(false); } WeightFactor wf; WeightHelper.TryGetEqpWeightFactor(eqp, Constants.WF_MIN_MOVEQTY_PRIORITY, out wf); if (wf == null || wf.Factor == 0) { return(false); } FabLot lot = info.Sample; if (info.IsRunning) { return(false); } if (lot == null) { return(false); } var list = lot.CurrentEqpArrange.EqpArrrangeSet.Items.FindAll(x => x.ActivateType == ActivateType.M); if (list == null || list.Count == 0) { return(false); } float minMoveQty = (int)wf.Criteria[0] / 2; float tactTime = (float)SiteConfigHelper.GetDefaultTactTime().TotalSeconds; StepTime st = info.Step.GetStepTime(eqp.EqpID, info.ProductID); if (st != null) { tactTime = st.TactTime; } Time inflowTime = Time.FromSeconds(minMoveQty * tactTime); decimal inflowQty = InFlowAgent.GetInflowQty(lot, eqp, (decimal)inflowTime.TotalHours, 0); Time endTime = eqp.Now + inflowTime; bool isContinueNextDay = ShopCalendar.StartTimeOfNextDay(eqp.NowDT) <= endTime; foreach (var item in list) { int remainQty = item.RemainQty; if (isContinueNextDay && item.IsDailyMode) { remainQty += item.LimitQty; } //limit(M) 잔여 수량이 MIN_MOVEQTY의 1 / 2 이상인 경우 체크 제외. if (remainQty >= minMoveQty) { continue; } if (remainQty < inflowQty) { info.FilterReason = string.Format("Remain:{0} < Inflow:{1}", remainQty, inflowQty); return(true); } } return(false); }
internal static void WriteStepTarget(FabPegTarget pt, bool isOut, string stepType, bool isExtraAdd) { FabPegPart pp = pt.PegPart as FabPegPart; FabStep step = pp.Current.Step; FabProduct prod = pp.FabProduct; //Key : FactoryID, ShopID, ProductID, StepID, StepType, TargetShift, TargetKey string factoryID = step.FactoryID; string shopID = step.ShopID; string prodductID = prod.ProductID; string stepID = step.StepID; stepType = GetStepType(stepType); if (stepType == Constants.IN) { stepID = string.Format("{0}_{1}", shopID, Constants.IN); } else if (stepType == Constants.OUT) { stepID = string.Format("{0}_{1}", shopID, Constants.OUT); } DateTime targetShift = ShopCalendar.ShiftStartTimeOfDayT(pt.CalcDate); string targetKey = pt.TargetKey; Outputs.StepTarget row = OutputMart.Instance.StepTarget.Find(factoryID, shopID, prodductID, stepID, stepType, targetShift, targetKey); if (row != null) { if (isOut) { row.TARGET_OUT_QTY = +Convert.ToDecimal(pt.CalcQty); } else { row.TARGET_IN_QTY = +Convert.ToDecimal(pt.CalcQty); } } else { row = new Outputs.StepTarget(); row.VERSION_NO = ModelContext.Current.VersionNo; row.FACTORY_ID = step.FactoryID; row.AREA_ID = step.AreaID; row.SHOP_ID = step.ShopID; row.PRODUCT_ID = prod.ProductID; row.STEP_ID = stepID; row.TARGET_DATE = pt.CalcDate; row.TARGET_SHIFT = targetShift; row.DEMAND_ID = pt.FabMoPlan.DemandID; row.DEMAND_PRODUCT_ID = pt.FabMoPlan.PreMoPlan.ProductID; row.DEMAND_PLAN_DATE = pt.FabMoPlan.DueDate; row.DEMAND_QTY = pt.FabMoPlan.Qty; row.TARGET_KEY = pt.TargetKey; row.STEP_TYPE = stepType; row.SEQ = pt.Seq++; // GetSequence(step, stepType, isExtraAdd); if (isOut) { row.TARGET_IN_QTY = 0; row.TARGET_OUT_QTY = Convert.ToDecimal(pt.CalcQty); } else { row.TARGET_IN_QTY = Convert.ToDecimal(pt.CalcQty); row.TARGET_OUT_QTY = 0; } //InTarget용(BuildInPlan) if (isExtraAdd) { row.TARGET_IN_QTY = Convert.ToDecimal(pt.CalcQty); row.TARGET_OUT_QTY = Convert.ToDecimal(pt.CalcQty); } OutputMart.Instance.StepTarget.Add(row); } }
private void LoadData() { _dict = new Dictionary <string, ResultItem>(); string areaID = this.TargetAreaID; string shopID = this.TargetShopID; bool isFirst = true; SetDateRanges(); _stdStepList = GetStdStepList(areaID); bool isOnlyMainStep = this.ShowSubStep == false; bool useOrigProdVer = this.UseOrigProdVer; var stepWip = _resultCtx.StepWip; foreach (var item in stepWip) { if (areaID != item.AREA_ID) { continue; } if (item.SHOP_ID != shopID && shopID != Consts.ALL) { continue; } if (item.PLAN_DATE < this.QueryStartTime) { continue; } if (item.PLAN_DATE >= this.QueryEndTime) { continue; } if (this.StepComboBox.Text != Consts.ALL && !item.STD_STEP_ID.Contains(this.StepComboBox.Text.ToString())) { continue; } string stepID = item.STEP_ID; string stdStepID = item.STD_STEP_ID; int stepSeq = item.STD_STEP_SEQ; if (isOnlyMainStep) { var stdStep = FindMainStep(item.SHOP_ID, stdStepID); if (stdStep == null) { continue; } stepID = stdStep.STEP_ID; stdStepID = stdStep.STEP_ID; stepSeq = stdStep.STEP_SEQ; } string productVersion = item.PRODUCT_VERSION; if (useOrigProdVer) { productVersion = item.ORIG_PRODUCT_VERSION; } if (isFirst) { foreach (string date in _dayHourList) { ResultItem padding; string dateString = GetDateString(date); string k = item.SHOP_ID + item.PRODUCT_ID + productVersion + item.OWNER_TYPE + stdStepID + dateString; if (_dict.TryGetValue(k, out padding) == false) { padding = new ResultItem(); padding.LINE_ID = item.SHOP_ID; padding.STD_STEP = item.STD_STEP_ID; padding.STEP_SEQ = item.STD_STEP_SEQ; padding.PROD_ID = item.PRODUCT_ID; padding.PROD_VER = productVersion; padding.OWNER_TYPE = item.OWNER_TYPE; padding.DATE_INFO = dateString; padding.WAIT_QTY = 0; padding.RUN_QTY = 0; _dict.Add(k, padding); } } isFirst = false; } ResultItem ri; DateTime planDate = item.PLAN_DATE; DateTime shift = ShopCalendar.ShiftStartTimeOfDayT(planDate); string dateStr2 = GetDateString(planDate); string key = item.SHOP_ID + item.PRODUCT_ID + productVersion + item.OWNER_TYPE + stdStepID + dateStr2; if (_dict.TryGetValue(key, out ri) == false) { ri = new ResultItem(); ri.LINE_ID = item.SHOP_ID; ri.PROD_ID = item.PRODUCT_ID; ri.PROD_VER = productVersion; ri.OWNER_TYPE = item.OWNER_TYPE; ri.STD_STEP = item.STD_STEP_ID; ri.STEP_SEQ = item.STD_STEP_SEQ; ri.DATE_INFO = dateStr2; _dict.Add(key, ri); } ri.WAIT_QTY += Convert.ToSingle(item.WAIT_QTY); ri.RUN_QTY += Convert.ToSingle(item.RUN_QTY); } }
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 }
/// <summary> /// </summary> /// <param name="agent"/> /// <param name="waits"/> /// <param name="handled"/> /// <param name="prevReturnValue"/> /// <returns/> public List <IHandlingBatch> RUN_FRONT_IN_AGENT(Mozart.SeePlan.Simulation.InOutAgent agent, List <Mozart.SeePlan.Simulation.IHandlingBatch> waits, ref bool handled, List <Mozart.SeePlan.Simulation.IHandlingBatch> prevReturnValue) { if (SimHelper.IsCellRunning) { return(prevReturnValue); } List <ShopInTarget> delList = new List <ShopInTarget>(); DateTime inputLimitDate = ModelContext.Current.StartTime == ShopCalendar.StartTimeOfDayT(ModelContext.Current.StartTime) ? ModelContext.Current.StartTime.AddDays(InputMart.Instance.GlobalParameters.period - 1) : ShopCalendar.StartTimeOfDayT(ModelContext.Current.StartTime.AddDays(InputMart.Instance.GlobalParameters.period)); // 두시간에 한번씩 투입을 하면서 현재 시간보다 이전 Target 을 묶어 배치 사이즈에 맞추어 투입함 List <IHandlingBatch> InputBatches = new List <IHandlingBatch>(); foreach (FabProduct prod in InputMart.Instance.FabProduct.Values) { if (prod.IsFrontProduct(false) == false) { continue; } //if (InputMart.Instance.GlobalParameters.ApplyFabSyncRelease) //{ // if (prod.ShopID == Constants.CFShop) // continue; //} //var targets = InputMart.Instance.ShopInTargetProdView.FindRows(prod).ToList<ShopInTarget>(); //targets.Sort((x, y) => x.TargetDate.CompareTo(y.TargetDate)); //if (targets == null || targets.Count() == 0) // continue; //ShopInTarget first = targets.First(); ////var targetDate = ShopCalendar.StartTimeOfNextDayT(first.TargetDate); //var targetDate = first.TargetDate; //if (targetDate > agent.NowDT || targetDate > inputLimitDate) // continue; //int InputBatchLotQty = (int)Math.Ceiling((double)first.RemainQty / (double)prod.CstSize); //string batchID = EntityHelper.CreateBatchID(prod.ProductID, agent.NowDT); //int batchSize = prod.CstSize * InputBatchLotQty; //int inputSum = 0; //int lotQty = 0; //ProductType prodType = ProductType.Production; //BatchInfo info = EntityHelper.GetSafeBatchInfo(batchID); //foreach (var tg in targets) //{ // prodType = tg.ProdType; // while (tg.RemainQty > 0 && inputSum < batchSize) // { // int currentQty = lotQty; // if (tg.RemainQty > (prod.CstSize - currentQty)) // { // lotQty += (prod.CstSize - currentQty); // tg.RemainQty -= (prod.CstSize - currentQty); // } // else // { // lotQty += tg.RemainQty; // tg.RemainQty = 0; // delList.Add(tg); // } // if (lotQty == prod.CstSize) // { // // 투입 Lot 생성 // FabLot lot = EntityHelper.CreateFrontInLot(prod, prodType, lotQty, info); // lot.FrontInTarget = tg; // InputBatches.Add(lot); // inputSum += lot.UnitQty; // lotQty = 0; // } // } // if (batchSize <= inputSum) // break; //} //if (lotQty > 0) //{ // FabLot lot = EntityHelper.CreateFrontInLot(prod, prodType, lotQty, info); // InputBatches.Add(lot); // // targets.Last().RemainQty = 0; //} } foreach (ShopInTarget del in delList) { InputMart.Instance.ShopInTarget.Rows.Remove(del); } return(InputBatches); }
public static void WriteRelasePlan() { var dcnMst = ReleasePlanMaster.DcnMst; var bckList = dcnMst.Buckets; if (bckList == null || bckList.Count == 0) { return; } string versionNo = ModelContext.Current.VersionNo; foreach (var bck in bckList) { if (bck.HasAllocPlan() == false) { continue; } string factoryID = bck.FactoryID; string eqpGroupID = bck.EqpGroupID; string eqpID = bck.EqpID; int count = bck.Plans.Count; for (int i = 0; i < count; i++) { var plan = bck.Plans[i]; Outputs.ReleasePlan row = new ReleasePlan(); row.VERSION_NO = versionNo; row.FACTORY_ID = factoryID; row.EQP_GROUP_ID = eqpGroupID; row.EQP_ID = eqpID; var target = plan.Target; if (target != null) { row.STEP_ID = target.StepID; row.TARGET_DATE = target.TargetDate; row.TARGET_QTY = target.TargetQty; } row.SHOP_ID = plan.ShopID; row.PRODUCT_ID = plan.ProductID; DateTime planDate = ShopCalendar.SplitDate(plan.EqpStartTime); row.PLAN_DATE = LcdHelper.DbToString(planDate, false); row.START_TIME = plan.EqpStartTime; row.END_TIME = plan.EqpEndTime; row.UNIT_QTY = plan.AllocQty; if (target != null) { var inTarget = target.InTarget; if (inTarget != null) { row.DEMAND_ID = inTarget.DemandID; row.DEMAND_PLAN_DATE = inTarget.DueDate; } } row.ALLOC_EQP_SEQ = i + 1; row.ALLOC_SEQ = plan.AllocSeq; row.ALLOC_TIME = LcdHelper.DbToString(plan.AllocTime); var fixPlan = plan.FixPlan; if (fixPlan != null) { row.PLAN_STATE = fixPlan.PLAN_STATE; } else { row.PLAN_STATE = plan.EqpState; } OutputMart.Instance.ReleasePlan.Add(row); } //clear bck.ClearAllocPlan(); } }
private void InitializeData() { var modelContext = this._result.GetCtx <ModelDataContext>(); _totalWoListDic = new Dictionary <string, List <WoData.WorkOrder> >(); string filter = Globals.CreateFilter(string.Empty, SimResultData.EqpPlan.Schema.SHOP_ID, "=", this.SelectedShopID); filter = Globals.CreateFilter(filter, SimResultData.EqpPlan.Schema.EQP_ID, "<>", Consts.NULL_ID, "AND"); filter = Globals.CreateFilter(filter, SimResultData.EqpPlan.Schema.START_TIME, ">=", this.FromTime.ToString(), "AND"); filter = Globals.CreateFilter(filter, SimResultData.EqpPlan.Schema.START_TIME, "<", this.ToTime.ToString(), "AND"); DataTable dtEqpPlan = _result.LoadOutput(SimResultData.OutputName.EqpPlan, filter); string sorter = SimResultData.EqpPlan.Schema.SHOP_ID + "," + SimResultData.EqpPlan.Schema.EQP_ID + "," + SimResultData.EqpPlan.Schema.START_TIME + "," + SimResultData.EqpPlan.Schema.PRODUCT_ID + "," + SimResultData.EqpPlan.Schema.LAYER_ID + "," + SimResultData.EqpPlan.Schema.STEP_ID; DataView eqpPlanView = new DataView(dtEqpPlan, "", sorter, DataViewRowState.CurrentRows); dtEqpPlan = eqpPlanView.ToTable(); int totalRowCnt = dtEqpPlan.Rows.Count; bool isLast = false; WoData.WorkOrder workOrder = new WoData.WorkOrder(); int rowCnt = 0; string preShopEqp = string.Empty; string preShopEqpProd = string.Empty; string preStepInfo = string.Empty; DateTime preEndTime = DateTime.MaxValue; foreach (DataRow row in dtEqpPlan.Rows) { rowCnt++; SimResultData.EqpPlan eqpPlan = new SimResultData.EqpPlan(row); if (eqpPlan.EqpID == "8APPH13") { } string shift = ShopCalendar.ClassifyShift(eqpPlan.StartTime) == 1 ? WoData.Const.DAY : WoData.Const.NIGHT; if (rowCnt == 1) { string eqpGrpIdInEqp; if (_eqpGrpInEqpDic.TryGetValue(eqpPlan.ShopID + eqpPlan.EqpID, out eqpGrpIdInEqp) == false) { eqpGrpIdInEqp = string.Empty; } workOrder.SetBaseInfo(eqpPlan.ShopID, eqpPlan.EqpID, eqpPlan.EqpGroupID, eqpGrpIdInEqp, eqpPlan.ProductID, shift, eqpPlan.StartTime, eqpPlan.LayerID, eqpPlan.StepID); } string shopEqp = eqpPlan.ShopID + eqpPlan.EqpID; string shopEqpProd = eqpPlan.ShopID + eqpPlan.EqpID + eqpPlan.ProductID; string stepInfo = eqpPlan.LayerID + eqpPlan.StepID; bool isNew = false; if (shopEqp != preShopEqp) { isNew = true; } else if (shopEqpProd != preShopEqpProd) { isNew = true; } else if (eqpPlan.StartTime > preEndTime) { isNew = true; } else if (preStepInfo != stepInfo) { isNew = true; } if (rowCnt == totalRowCnt) { isLast = true; } bool savePreVal = false; bool newWorkOrder = false; if ((isNew == false && isLast == false) || rowCnt == 1) { workOrder.AddQty(eqpPlan.Qty); } else if (isNew && isLast == false) { savePreVal = true; // 여태까지꺼 rlst에 기록 newWorkOrder = true; // workOrder 새로 만들기 + Qty추가 } else if (isNew == false && isLast) { savePreVal = true; workOrder.AddQty(eqpPlan.Qty); } else if (isNew && isLast) { savePreVal = true; // 여태까지꺼 rlst에 기록 newWorkOrder = true; // workOrder 새로 만들고 + Qty추가하고 + rlst에 기록 } if (savePreVal) { List <WoData.WorkOrder> woList; if (_totalWoListDic.TryGetValue(preShopEqp, out woList) == false) { _totalWoListDic.Add(preShopEqp, woList = new List <WoData.WorkOrder>()); } woList.Add(workOrder); } if (newWorkOrder) { string eqpGrpIdInEqp; if (_eqpGrpInEqpDic.TryGetValue(eqpPlan.ShopID + eqpPlan.EqpID, out eqpGrpIdInEqp) == false) { eqpGrpIdInEqp = string.Empty; } workOrder = new WoData.WorkOrder(); workOrder.SetBaseInfo(eqpPlan.ShopID, eqpPlan.EqpID, eqpPlan.EqpGroupID, eqpGrpIdInEqp, eqpPlan.ProductID, shift, eqpPlan.StartTime, eqpPlan.LayerID, eqpPlan.StepID); workOrder.AddQty(eqpPlan.Qty); if (isLast) { List <WoData.WorkOrder> woList; if (_totalWoListDic.TryGetValue(shopEqp, out woList) == false) { _totalWoListDic.Add(shopEqp, woList = new List <WoData.WorkOrder>()); } woList.Add(workOrder); } } preShopEqp = shopEqp; preShopEqpProd = shopEqpProd; preEndTime = eqpPlan.EndTime; preStepInfo = stepInfo; } }
private void InitializeControl() { var modelContext = this._result.GetCtx <ModelDataContext>(); // ShopID ComboBox ComboHelper.AddDataToComboBox(this.shopIdComboBoxEdit, _result, SimInputData.InputName.StdStep, SimInputData.StdStepSchema.SHOP_ID, false); if (this.shopIdComboBoxEdit.Properties.Items.Contains("ARRAY")) { this.shopIdComboBoxEdit.SelectedIndex = this.shopIdComboBoxEdit.Properties.Items.IndexOf("ARRAY"); } // Area CheckComboBox _eqpGrpsInAreaDic = new Dictionary <string, List <string> >(); string filter = string.Format("{0} = '{1}'", SimInputData.ConstSchema.CATEGORY, "AREA_INFO"); DataTable dtConst = _result.LoadInput(SimInputData.InputName.Const, filter); if (dtConst != null) { List <string> eqpGrpsAllInAreaList = new List <string>(); foreach (DataRow drow in dtConst.Rows) { SimInputData.Const configConst = new SimInputData.Const(drow); if (this.areaChkBoxEdit.Properties.Items.Contains(configConst.Code) == false) { this.areaChkBoxEdit.Properties.Items.Add(configConst.Code); } string[] eqpGrps = configConst.Description.Split('@'); foreach (string eqpGrp in eqpGrps) { if (eqpGrpsAllInAreaList.Contains(eqpGrp) == false) { eqpGrpsAllInAreaList.Add(eqpGrp); } List <string> eqpGrpList; if (_eqpGrpsInAreaDic.TryGetValue(configConst.Code, out eqpGrpList) == false) { _eqpGrpsInAreaDic.Add(configConst.Code, eqpGrpList = new List <string>()); } if (eqpGrpList.Contains(eqpGrp) == false) { eqpGrpList.Add(eqpGrp); } } } if (this.areaChkBoxEdit.Properties.Items.Contains("OTHERS") == false) { this.areaChkBoxEdit.Properties.Items.Add("OTHERS"); } var eqpGrpInEqpList = modelContext.Eqp.Select(x => x.DSP_EQP_GROUP_ID).Distinct(); foreach (var eqpGrp in eqpGrpInEqpList) { if (eqpGrpsAllInAreaList.Contains(eqpGrp) == false) { List <string> eqpGrpList; if (_eqpGrpsInAreaDic.TryGetValue("OTHERS", out eqpGrpList) == false) { _eqpGrpsInAreaDic.Add("OTHERS", eqpGrpList = new List <string>()); } if (eqpGrpList.Contains(eqpGrp) == false) { eqpGrpList.Add(eqpGrp); } } } } if (this.areaChkBoxEdit.Properties.Items.Count > 0) { this.areaChkBoxEdit.CheckAll(); } _eqpGrpInEqpDic = new Dictionary <string, string>(); _eqpListbyEqpGrpDic = new Dictionary <string, List <string> >(); foreach (var row in modelContext.Eqp) { if (_eqpGrpInEqpDic.ContainsKey(row.SHOP_ID + row.EQP_ID) == false) { _eqpGrpInEqpDic.Add(row.SHOP_ID + row.EQP_ID, row.DSP_EQP_GROUP_ID); } List <string> eqpList; if (_eqpListbyEqpGrpDic.TryGetValue(row.SHOP_ID + row.DSP_EQP_GROUP_ID, out eqpList) == false) { _eqpListbyEqpGrpDic.Add(row.SHOP_ID + row.DSP_EQP_GROUP_ID, eqpList = new List <string>()); } if (eqpList.Contains(row.EQP_ID) == false) { eqpList.Add(row.EQP_ID); } } // EqpGroup CheckComboBox SetEqpGroupCheckBox(); //DateEdit Controls this.fromDateEdit.DateTime = ShopCalendar.SplitDate(_planStartTime); ComboHelper.ShiftName(this.shiftComboBoxEdit, _planStartTime); dayShiftSpinEdit.Value = 1; // _result.GetPlanPeriod(1); }
public static int WeekNo(DateTime date) { DateTime baseDay = BaseDayOfWeek(ShopCalendar.SplitDate(date)); return(baseDay.Year * 100 + WeekOfYear(baseDay)); }
public static string SplitDateToString(DateTime dt) { //TODO : 확인 필요 return(DateToString(ShopCalendar.SplitDate(dt))); }