Beispiel #1
0
        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);
        }
Beispiel #2
0
        /// <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());
        }
Beispiel #3
0
        public static DateTime GetRptDate_1Hour(DateTime t)
        {
            //DayStartTime为基准
            //DayStartTime 기준
            int baseMinute = ShopCalendar.StartTimeOfDayT(ModelContext.Current.StartTime).Minute;

            return(LcdHelper.GetRptDate_1Hour(t, baseMinute));
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        /// <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);
        }
Beispiel #6
0
        private void LoadWipData()
        {
            //Dictionary<string, SmcvData.WipDetail>
            var wipCurStepDic = _wipCurStepDic.ToDictionary(x => x.Key, y => y.Value);

            if (this.SelectedShopID == Consts.ALL && this.IsSelectedInputWip)
            {
                foreach (string shopID in this.shopIdComboBoxEdit.Properties.Items)
                {
                    if (shopID == Consts.ALL)
                    {
                        continue;
                    }

                    wipCurStepDic.Clear();

                    foreach (string key in _wipCurStepDic.Keys)
                    {
                        if (key.StartsWith(shopID) == false)
                        {
                            continue;
                        }

                        if (wipCurStepDic.ContainsKey(key) == false)
                        {
                            wipCurStepDic.Add(key, _wipCurStepDic[key]);
                        }
                    }
                }
            }
            else if (this.SelectedShopID == Consts.ALL && this.IsSelectedInputWip == false)
            {
                wipCurStepDic.Clear();

                string sFromTime = this.FromTime != ShopCalendar.ShiftStartTimeOfDayT(this.FromTime) ?
                                   ShopCalendar.ShiftStartTimeOfDayT(this.FromTime).AddHours((double)ShopCalendar.ShiftHours).DbToString()
                            : this.FromTime.DbToString();

                wipCurStepDic = _wipCurStepDic.Where(x => x.Key.StartsWith(sFromTime))
                                .ToDictionary(x => x.Key, y => y.Value);
            }
            else if (this.SelectedShopID != Consts.ALL && this.IsSelectedInputWip)
            {
                wipCurStepDic.Clear();

                wipCurStepDic = _wipCurStepDic.Where(x => x.Key.StartsWith(this.SelectedShopID))
                                .ToDictionary(x => x.Key, y => y.Value);
            }
            else
            {
                wipCurStepDic.Clear();

                string sFromTime = this.FromTime != ShopCalendar.ShiftStartTimeOfDayT(this.FromTime) ?
                                   ShopCalendar.ShiftStartTimeOfDayT(this.FromTime).AddHours((double)ShopCalendar.ShiftHours).DbToString()
                            : this.FromTime.DbToString();

                wipCurStepDic = _wipCurStepDic
                                .Where(x => x.Key.StartsWith(sFromTime + this.SelectedShopID))
                                .ToDictionary(x => x.Key, y => y.Value);
            }


            foreach (var wipCur in wipCurStepDic)
            {
                foreach (DateTime date in _dateRangeList)
                {
                    SmcvData.ResultItem padding;

                    string dateString = this.IsTimeConditionHour ? ShopCalendar.StartTimeOfDayT(date).ToString("yyyyMMdd") : date.DbToTimeString();

                    string k = wipCur.Value.ShopID + wipCur.Value.ProductID + wipCur.Value.ProductVersion + wipCur.Value.OwnerType + wipCur.Value.StepID
                               + Consts.NULL_ID + dateString;
                    string k2 = wipCur.Value.ShopID + wipCur.Value.ProductID + wipCur.Value.ProductVersion + wipCur.Value.OwnerType + wipCur.Value.StepID;
                    if (this.IsSelectedInputWip == false)
                    {
                        k2 = this.FromTime.DbToString() + k2;
                    }

                    int wipCurStep = 0;
                    SmcvData.WipDetail wipDetail;
                    _wipCurStepDic.TryGetValue(k2, out wipDetail);
                    wipCurStep = wipDetail == null ? 0 : wipDetail.GlassQty;

                    if (_dict.TryGetValue(k, out padding) == false)
                    {
                        SmcvData.StepInfo stepInfo;
                        _stepInfoDic.TryGetValue(wipCur.Value.ShopID + wipCur.Value.StepID, out stepInfo);

                        padding = new SmcvData.ResultItem(wipCur.Value.ShopID, wipCur.Value.ProductID, wipCur.Value.ProductVersion, wipCur.Value.OwnerType,
                                                          wipCur.Value.StepID, Consts.NULL_ID, date);//, 0, 0);
                        padding.SetStepInfo(stepInfo);

                        _dict.Add(k, padding);
                    }

                    padding.UpdateWipQty(wipCurStep, 0);
                }
            }

            var wipMainStepDic = _wipMainStepDic.ToDictionary(x => x.Key, y => y.Value);

            if (this.SelectedShopID == Consts.ALL && this.IsSelectedInputWip)
            {
                foreach (string shopID in this.shopIdComboBoxEdit.Properties.Items)
                {
                    if (shopID == Consts.ALL)
                    {
                        continue;
                    }

                    wipMainStepDic.Clear();

                    foreach (string key in _wipMainStepDic.Keys)
                    {
                        if (key.StartsWith(shopID) == false)
                        {
                            continue;
                        }

                        if (wipMainStepDic.ContainsKey(key) == false)
                        {
                            wipMainStepDic.Add(key, _wipMainStepDic[key]);
                        }
                    }
                }
            }
            else if (this.SelectedShopID == Consts.ALL && this.IsSelectedInputWip == false)
            {
                wipMainStepDic.Clear();

                wipMainStepDic = _wipMainStepDic.Where(x => x.Key.StartsWith(this.FromTime.DbToString()))
                                 .ToDictionary(x => x.Key, y => y.Value);
            }
            else if (this.SelectedShopID != Consts.ALL && this.IsSelectedInputWip)
            {
                wipMainStepDic.Clear();

                wipMainStepDic = _wipMainStepDic.Where(x => x.Key.StartsWith(this.SelectedShopID))
                                 .ToDictionary(x => x.Key, y => y.Value);
            }
            else
            {
                wipMainStepDic.Clear();

                wipMainStepDic = _wipMainStepDic
                                 .Where(x => x.Key.StartsWith(this.FromTime.DbToString() + this.SelectedShopID))
                                 .ToDictionary(x => x.Key, y => y.Value);
            }

            foreach (var wipMain in wipMainStepDic)
            {
                foreach (DateTime date in _dateRangeList)
                {
                    SmcvData.ResultItem padding;

                    string dateString = this.IsTimeConditionHour ? ShopCalendar.StartTimeOfDayT(date).ToString("yyyyMMdd") : date.DbToTimeString();

                    string k = wipMain.Value.ShopID + wipMain.Value.ProductID + wipMain.Value.ProductVersion + wipMain.Value.OwnerType + wipMain.Value.StepID
                               + Consts.NULL_ID + dateString;
                    string k2 = wipMain.Value.ShopID + wipMain.Value.ProductID + wipMain.Value.ProductVersion + wipMain.Value.OwnerType + wipMain.Value.StepID;
                    if (this.IsSelectedInputWip == false)
                    {
                        k2 = this.FromTime.DbToString() + k2;
                    }

                    if (k2 == "ARRAYB8A550QU5V501AASMP041500-00")
                    {
                    }

                    int wipMainStep = 0;
                    SmcvData.WipDetail wipDetail;
                    _wipMainStepDic.TryGetValue(k2, out wipDetail);
                    wipMainStep = wipDetail == null ? 0 : wipDetail.GlassQty;

                    if (_dict.TryGetValue(k, out padding) == false)
                    {
                        SmcvData.StepInfo stepInfo;
                        _stepInfoDic.TryGetValue(wipMain.Value.ShopID + wipMain.Value.StepID, out stepInfo);

                        padding = new SmcvData.ResultItem(wipMain.Value.ShopID, wipMain.Value.ProductID, wipMain.Value.ProductVersion, wipMain.Value.OwnerType,
                                                          wipMain.Value.StepID, Consts.NULL_ID, date);//, 0, 0);
                        padding.SetStepInfo(stepInfo);

                        _dict.Add(k, padding);
                    }

                    padding.UpdateWipQty(0, wipMainStep);
                }
            }
        }
Beispiel #7
0
        private void LoadActData()
        {
            string shopID = this.SelectedShopID;

            if (shopID == Consts.ALL)
            {
                shopID = string.Empty;
            }

            foreach (DataRow row in _dtStepMoveAct.Rows)
            {
                SimInputData.StepMoveAct item = new SimInputData.StepMoveAct(row);

                if (shopID != "" && item.ShopID != shopID)
                {
                    continue;
                }

                if (item.TargetDate < this.FromTime || item.TargetDate >= this.ToTime)
                {
                    continue;
                }

                string eqpGrpID = string.Empty;
                _eqpGrpDic.TryGetValue(item.ShopID + item.EqpID, out eqpGrpID);

                if (this.IsAllAreaSelected == false)
                {
                    if (this.SelectedEqpGrpInAreaList.Count <= 0)
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(eqpGrpID))
                    {
                        continue;
                    }

                    if (this.SelectedEqpGrpInAreaList.Contains(eqpGrpID) == false)
                    {
                        continue;
                    }
                }

                foreach (DateTime date in _dateRangeList)
                {
                    SmcvData.ResultItem padding;

                    string dateString = this.IsTimeConditionHour ? ShopCalendar.StartTimeOfDayT(date).ToString("yyyyMMdd") : date.DbToTimeString();

                    string k  = item.ShopID + item.ProductID + Consts.NULL_ID + item.OwnerType + item.StepID + item.EqpID + dateString;
                    string k2 = item.ShopID + item.ProductID + Consts.NULL_ID + item.OwnerType + item.StepID;

                    int wipCurStep  = 0;
                    int wipMainStep = 0;
                    if (_dict.TryGetValue(k, out padding) == false)
                    {
                        if (k2 == "ARRAYB8A550QU5V501AASMP041500-00")
                        {
                        }

                        SmcvData.WipDetail wipDetail;
                        _wipCurStepDic.TryGetValue(k2, out wipDetail);
                        wipCurStep = wipDetail == null ? 0 : wipDetail.GlassQty;
                        wipDetail  = null;
                        _wipMainStepDic.TryGetValue(k2, out wipDetail);
                        wipMainStep = wipDetail == null ? 0 : wipDetail.GlassQty;

                        SmcvData.StepInfo stepInfo;
                        _stepInfoDic.TryGetValue(item.ShopID + item.StepID, out stepInfo);

                        padding = new SmcvData.ResultItem(item.ShopID, item.ProductID, Consts.NULL_ID, item.OwnerType, item.StepID, item.EqpID, date);//, 0, 0);
                        padding.SetStepInfo(stepInfo);

                        _dict.Add(k, padding);
                    }
                }

                SmcvData.ResultItem ri;

                DateTime modTargetDate = this.IsTimeConditionHour ? ShopCalendar.StartTimeOfDayT(item.TargetDate)
                    : ShopCalendar.ShiftStartTimeOfDayT(item.TargetDate);
                string curShopID      = item.ShopID;
                string productID      = item.ProductID;
                string productVersion = Consts.NULL_ID;
                string ownerType      = item.OwnerType;
                string stepID         = item.StepID;
                string eqpID          = item.EqpID;

                //DateTime shift = ShopCalendar.ShiftStartTimeOfDayT(modTargetDate);

                string dateString2 = this.IsTimeConditionHour ? modTargetDate.ToString("yyyyMMdd") : modTargetDate.DbToTimeString();

                string key = curShopID + productID + ownerType + stepID + eqpID + dateString2;

                if (_dict.TryGetValue(key, out ri) == false)
                {
                    continue;   // 있을 수 없음

                    //ri = new SmcvData.ResultItem(curShopID, productID, productVersion, ownerType, stepID, eqpID, modTargetDate);

                    //_dict.Add(key, ri);
                }

                ri.UpdateActQty((int)item.InQty, (int)item.OutQty);
            }
        }