Exemple #1
0
        private static bool IsLastPlan(RSL_RTS_EQP_STATUS_IF last, IF_LOTHISTORY entity)
        {
            if (last == null || entity == null)
            {
                return(false);
            }

            if (last.LAST_STEP_ID != entity.PROCESSOPERATIONNAME)
            {
                return(false);
            }

            if (last.LAST_PRODUCT_ID != entity.PRODUCTSPECNAME)
            {
                return(false);
            }

            if (last.LAST_PRODUCT_VERSION != entity.PRODUCTSPECVERSION)
            {
                return(false);
            }

            if (last.LAST_OWNER_TYPE != GetOwnerType(entity.OWNERID))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        private static void Set_RSL_RTS_EQP_STATUS_IF(RSL_RTS_EQP_STATUS_IF parent, RSL_RTS_EQP_STATUS_IF child)
        {
            if (parent == null || child == null)
            {
                return;
            }

            child.STATUS           = parent.STATUS;
            child.REASON_CODE      = parent.REASON_CODE;
            child.EVENT_START_TIME = parent.EVENT_START_TIME;
            child.EVENT_END_TIME   = parent.EVENT_END_TIME;
            //child.VALID_CHAMBER = parent.VALID_CHAMBER;

            child.LAST_SHOP_ID         = parent.LAST_SHOP_ID;
            child.LAST_STEP_ID         = parent.LAST_STEP_ID;
            child.LAST_PRODUCT_ID      = parent.LAST_PRODUCT_ID;
            child.LAST_PRODUCT_VERSION = parent.LAST_PRODUCT_VERSION;
            child.LAST_OWNER_TYPE      = parent.LAST_OWNER_TYPE;
            child.LAST_TRACK_IN_TIME   = parent.LAST_TRACK_IN_TIME;
            child.LAST_CONTINUOUS_QTY  = parent.LAST_CONTINUOUS_QTY;

            child.UPDATE_DTTM = parent.UPDATE_DTTM;
        }
Exemple #3
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;
            }
        }
Exemple #4
0
        private static void Set_RSL_RTS_EQP_STATUS_IF(string eqpID, string lastStepID, RSL_RTS_EQP_STATUS_IF parent, RSL_RTS_EQP_STATUS_IF child)
        {
            var table = InputMart.Instance.IF_LOTHISTORY;

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

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

            child.STATUS           = parent.STATUS;
            child.REASON_CODE      = parent.REASON_CODE;
            child.EVENT_START_TIME = parent.EVENT_START_TIME;
            child.EVENT_END_TIME   = parent.EVENT_END_TIME;
            //child.VALID_CHAMBER = parent.VALID_CHAMBER;
            child.UPDATE_DTTM = parent.UPDATE_DTTM;

            //LOTHISTORY : 해당 Step를 진행한 마지막 정보 기록
            var list = table.Rows.ToList().FindAll(t => t.EVENTNAME == "TrackIn" && t.MACHINENAME == eqpID && t.PROCESSOPERATIONNAME == lastStepID);

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

            var last = list.OrderBy(t => t.EVENTTIME).LastOrDefault();

            if (last != null)
            {
                child.LAST_SHOP_ID         = last.FACTORYNAME;
                child.LAST_STEP_ID         = last.PROCESSOPERATIONNAME;
                child.LAST_PRODUCT_ID      = last.PRODUCTSPECNAME;
                child.LAST_PRODUCT_VERSION = last.PRODUCTSPECVERSION;
                child.LAST_OWNER_TYPE      = GetOwnerType(last.OWNERID);
                child.LAST_TRACK_IN_TIME   = LcdHelper.DbDateTime(last.EVENTTIME);

                //不可By Chamber统计(2019.09.21)
                //Chamber별 정보 집계 불가한 상태(2019.09.21)
                child.LAST_CONTINUOUS_QTY = 0;
            }
        }
Exemple #5
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);
                    }
                }
            }
        }
Exemple #6
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;
                }
            }
        }
Exemple #7
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;
            }
        }