Beispiel #1
0
        private static void Update_RSL_RTS_EQP_IN_OUT_ACT_IF()
        {
            var table = InputMart.Instance.IF_LOTHISTORY;

            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            var result = OutputMart.Instance.RSL_RTS_EQP_IN_OUT_ACT_IF;

            if (MainHelper.CheckActiveAction(result.Table.TableName) == false)
            {
                return;
            }

            var dashboard = InputMart.Instance.Dashboard;
            var runType   = dashboard.RunType;

            var      modelContext = ModelContext.Current;
            DateTime now          = modelContext.StartTime;

            string factoryID = LcdHelper.GetTargetFactoryID();
            string isFixed   = runType == InboudRunType.INBOUND_IF ? "Y" : "N";

            DateTime currRptDate = GetRptDate_1Hour(now);

            foreach (var entity in table.DefaultView)
            {
                int qty = entity.PRODUCTQUANTITY;
                if (qty <= 0)
                {
                    continue;
                }

                string eventName = entity.EVENTNAME;
                string shopID    = entity.FACTORYNAME;
                string eqpID     = entity.MACHINENAME;

                //IN : TrackIn, OUT : TrackOut / Ship(9900, 9990)
                bool baseTrackIn = LcdHelper.Equals(eventName, "TrackIn");

                DateTime rptDate = GetRptDate_1Hour(entity.EVENTTIME);

                //已保存到RTS_EQP_IN_OUT_ACT_IF table的时间排除在Update对象里
                //이미 RTS_EQP_IN_OUT_ACT_IF table에 확정 저장된 시간은 Update 제외
                if (rptDate <= dashboard.ActFixedDate)
                {
                    continue;
                }

                //TrackOut의 경우 OLD값 기준으로 기록
                string stepID         = baseTrackIn ? entity.PROCESSOPERATIONNAME : entity.OLDPROCESSOPERATIONNAME;
                string processID      = baseTrackIn ? entity.PROCESSFLOWNAME : entity.OLDPROCESSFLOWNAME;
                string productID      = baseTrackIn ? entity.PRODUCTSPECNAME : entity.OLDPRODUCTSPECNAME;
                string productVersion = baseTrackIn ? entity.PRODUCTSPECVERSION : entity.OLDPRODUCTSPECVERSION;

                string ownerID   = entity.OWNERID;
                string ownerType = GetOwnerType(ownerID);

                Add_RSL_RTS_EQP_IN_OUT_ACT_IF(result, factoryID, shopID, rptDate,
                                              eqpID, stepID, processID, productID, productVersion,
                                              ownerType, ownerID, qty,
                                              isFixed, baseTrackIn, currRptDate, now);

                //新增ARRAY/CF 9900/9990 TrackIn Event (按9900/9990前面站点的TrackInOut为基准)
                //ARRAY/CF 9900/9990 TrackIn 이벤트 추가 생성 (9900/9990 이전 공정의 TrackInOut을 기준으로 생성)
                if (LcdHelper.Equals(eventName, "TrackInOut") == false && LcdHelper.IsCellShop(shopID) == false)
                {
                    string chkStepID = entity.PROCESSOPERATIONNAME;
                    var    ioType    = LcdHelper.GetInOutType(shopID, chkStepID);
                    if (ioType == InOutType.OUT)
                    {
                        string dummyEqpID = LcdHelper.IdentityNull();

                        //9900/9990 TrackIn
                        Add_RSL_RTS_EQP_IN_OUT_ACT_IF(result, factoryID, shopID, rptDate,
                                                      dummyEqpID, chkStepID,
                                                      entity.PROCESSFLOWNAME,
                                                      entity.PRODUCTSPECNAME,
                                                      entity.PRODUCTSPECVERSION,
                                                      ownerType, ownerID, qty,
                                                      isFixed, true, currRptDate, now);

                        //Ship(9900, 9990) Event记录,做例外处理 (2019.09.26 - by.刘健)
                        //Ship(9900, 9990) 이벤트에서 기록되어 제외 처리 (2019.09.26 - by.liujian(유건))
                        //以9900/9990 Track Out --> 9900/9990 Ship基准进行记录
                        //9900/9990 Track Out --> 9900/9990 Ship 기준으로 기록
                        //Add_RSL_RTS_EQP_IN_OUT_ACT_IF(result, factoryID, shopID, rptDate,
                        //                              dummyEqpID, chkStepID,
                        //                              entity.PROCESSFLOWNAME,
                        //                              entity.PRODUCTSPECNAME,
                        //                              entity.PRODUCTSPECVERSION,
                        //                              ownerType, ownerID, qty,
                        //                              isFixed, false, currRptDate, now);
                    }
                }
            }
        }
Beispiel #2
0
        private static void Load_IF_CT_FACILITYRESULTHISTORY()
        {
            var table = InputMart.Instance.IF_CT_FACILITYRESULTHISTORY;

            if (MainHelper.CheckActiveAction(table.TableName) == false)
            {
                return;
            }

            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            var result = OutputMart.Instance.RSL_RTS_EQP_STATUS_IF;

            var      modelContext = ModelContext.Current;
            DateTime now          = modelContext.StartTime;

            string factoryID = LcdHelper.GetTargetFactoryID();

            var group = table.Rows.GroupBy(t => t.MACHINENAME);

            foreach (var it in group)
            {
                string eqpID = it.Key;

                //按时间最近进行排序
                //최근 순으로 정렬
                var infos = it.OrderByDescending(t => t.EVENTTIME);
                if (infos == null)
                {
                    continue;
                }

                var finds = InputMart.Instance.RTS_EQPbyEqpID.FindRows(eqpID);
                if (finds == null)
                {
                    continue;
                }

                var eqp = finds.FirstOrDefault();
                if (eqp == null)
                {
                    continue;
                }

                var entity = infos.FirstOrDefault();
                if (entity == null)
                {
                    continue;
                }

                string shopID = eqp.SHOP_ID;

                float density = LcdHelper.ToFloat(entity.PARAVALUE);
                if (density <= 0)
                {
                    continue;
                }

                var find = result.Find(factoryID, shopID, eqpID);
                if (find == null)
                {
                    find                   = new RSL_RTS_EQP_STATUS_IF();
                    find.FACTORY_ID        = factoryID;
                    find.SHOP_ID           = shopID;
                    find.EQP_ID            = eqpID;
                    find.LAST_ACID_DENSITY = 0;

                    result.Add(find);
                }

                find.LAST_ACID_DENSITY = density;
                find.UPDATE_DTTM       = now;
            }
        }
Beispiel #3
0
        private static void Update_RSL_RTS_EQP_STATUS_IF()
        {
            var table = InputMart.Instance.IF_LOTHISTORY;

            if (MainHelper.CheckActiveAction(table.TableName) == false)
            {
                return;
            }

            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            var      dashboard         = InputMart.Instance.Dashboard;
            DateTime lastInterfaceTime = dashboard.LastInterfaceTime;

            //仅统计“设定时间(lastInterfaceTime)” 后的信息
            //확정된 시간 (lastInterfaceTime) 이후의 정보만으로 정보 집계
            var list = table.Rows.ToList().FindAll(t => t.EVENTNAME == "TrackIn" && t.EVENTTIME > lastInterfaceTime);

            if (list == null || list.Count == 0)
            {
                return;
            }

            var result = OutputMart.Instance.RSL_RTS_EQP_STATUS_IF;

            var      modelContext = ModelContext.Current;
            DateTime now          = modelContext.StartTime;

            string factoryID = LcdHelper.GetTargetFactoryID();

            var group = list.GroupBy(t => t.MACHINENAME);

            foreach (var it in group)
            {
                string eqpID = it.Key;
                var    infos = it.OrderBy(t => t.EVENTTIME);
                if (infos == null)
                {
                    continue;
                }

                var finds = InputMart.Instance.RTS_EQPbyEqpID.FindRows(eqpID);
                if (finds == null)
                {
                    continue;
                }

                var eqp = finds.FirstOrDefault();
                if (eqp == null)
                {
                    continue;
                }

                string shopID = eqp.SHOP_ID;

                var find = result.Find(factoryID, shopID, eqpID);
                if (find == null)
                {
                    find                     = new RSL_RTS_EQP_STATUS_IF();
                    find.FACTORY_ID          = factoryID;
                    find.SHOP_ID             = shopID;
                    find.EQP_ID              = eqpID;
                    find.LAST_CONTINUOUS_QTY = 0;

                    result.Add(find);
                }

                foreach (var entity in infos)
                {
                    DateTime evnetTime = entity.EVENTTIME;
                    int      qty       = entity.PRODUCTQUANTITY;

                    bool isLastPlan = IsLastPlan(find, entity);
                    if (isLastPlan)
                    {
                        find.LAST_CONTINUOUS_QTY += qty;
                    }
                    else
                    {
                        find.LAST_SHOP_ID         = entity.FACTORYNAME;
                        find.LAST_STEP_ID         = entity.PROCESSOPERATIONNAME;
                        find.LAST_PRODUCT_ID      = entity.PRODUCTSPECNAME;
                        find.LAST_PRODUCT_VERSION = entity.PRODUCTSPECVERSION;
                        find.LAST_OWNER_TYPE      = GetOwnerType(entity.OWNERID);

                        find.LAST_CONTINUOUS_QTY = qty;
                    }

                    find.UPDATE_DTTM = now;
                }
            }
        }
Beispiel #4
0
        private static void Load_IF_MACHINESPEC_CHAMBER()
        {
            var table = InputMart.Instance.IF_MACHINESPEC_CHAMBER;

            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            if (MainHelper.CheckActiveAction(table.TableName) == false)
            {
                return;
            }

            var result = OutputMart.Instance.RSL_RTS_EQP_STATUS_IF;

            string   factoryID   = LcdHelper.GetTargetFactoryID();
            DateTime versionDate = LcdHelper.GetVersionDate();

            var eqpGroup = table.Rows.GroupBy(t => new Tuple <string, string>(t.FACTORYNAME, t.SUPERMACHINENAME));

            foreach (var it in eqpGroup)
            {
                var key         = it.Key;
                var chamberList = it.ToList();

                string shopID = key.Item1;
                string eqpID  = key.Item2;

                if (chamberList == null || chamberList.Count == 0)
                {
                    continue;
                }

                //parent EQP基准的EqpStatus最新信息
                //parent EQP 기준의 EqpStatus 최신 정보
                var parent = result.Find(factoryID, shopID, eqpID);
                if (parent == null)
                {
                    continue;
                }

                foreach (var chamber in chamberList)
                {
                    string chamberID  = chamber.MACHINENAME;
                    string lastStepID = ConfigHelper.GetCodeMap_LineOperMode(chamber.LINEOPERMODE);

                    var find = result.Find(factoryID, shopID, chamberID);
                    if (find == null)
                    {
                        find            = new RSL_RTS_EQP_STATUS_IF();
                        find.FACTORY_ID = factoryID;
                        find.SHOP_ID    = shopID;
                        find.EQP_ID     = chamberID;

                        result.Add(find);
                    }

                    if (parent.LAST_STEP_ID == lastStepID)
                    {
                        Set_RSL_RTS_EQP_STATUS_IF(parent, find);
                    }
                    else
                    {
                        Set_RSL_RTS_EQP_STATUS_IF(eqpID, lastStepID, parent, find);
                    }
                }
            }
        }
Beispiel #5
0
        private static void Load_IF_MACHINE()
        {
            var table = InputMart.Instance.IF_MACHINE;

            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            if (MainHelper.CheckActiveAction(table.TableName) == false)
            {
                return;
            }

            var      modelContext = ModelContext.Current;
            DateTime now          = modelContext.StartTime;

            string factoryID = LcdHelper.GetTargetFactoryID();
            //DateTime versionDate = LcdHelper.GetVersionDate();

            var result = OutputMart.Instance.RSL_RTS_EQP_STATUS_IF;

            foreach (var entity in table.DefaultView)
            {
                string shopID = entity.FACTORYNAME;
                string eqpID  = entity.MACHINENAME;

                if (DataVaildHelper.IsVaildEqp(eqpID) == false)
                {
                    continue;
                }

                var find = result.Find(factoryID, shopID, eqpID);
                if (find == null)
                {
                    find            = new RSL_RTS_EQP_STATUS_IF();
                    find.FACTORY_ID = factoryID;
                    find.SHOP_ID    = shopID;
                    find.EQP_ID     = eqpID;

                    result.Add(find);
                }

                find.STATUS      = entity.MACHINESTATENAME;
                find.REASON_CODE = entity.LASTEVENTNAME;

                DateTime eventStartTime = LcdHelper.DbToDateTime(LcdHelper.SafeSubstring(entity.LASTEVENTTIMEKEY, 0, 14));
                find.EVENT_START_TIME = LcdHelper.DbDateTime(eventStartTime);

                DateTime dueDate = LcdHelper.DbToDateTime(LcdHelper.SafeSubstring(entity.DUEDATE, 0, 14));
                find.EVENT_END_TIME = LcdHelper.DbDateTime(dueDate);

                find.UPDATE_DTTM = now;
            }

            //更新最新的 BATCH信息(by LotHistory)
            //LAST진행 BATCH 정보 업데이트(by LotHistory)
            Update_RSL_RTS_EQP_STATUS_IF();

            //LAST ACID浓度信息
            //LAST ACID 농도 정보
            Load_IF_CT_FACILITYRESULTHISTORY();

            //更新CHAMBER EQP STATUS信息
            //CHAMBER EQP STATUS 정보 업데이트
            Load_IF_MACHINESPEC_CHAMBER();

            var dashboard = InputMart.Instance.Dashboard;

            //设定时间 (lastLotEventTime)
            //확정된 시간 (lastLotEventTime) 설정
            DateTime lastLotEventTime = dashboard.LastLotEventTime;

            foreach (var entity in result.Table.Rows)
            {
                entity.IF_TIME = lastLotEventTime;
            }
        }