Exemple #1
0
        public static void LinkKeypartDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 3)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            string            Sn        = Input.Value.ToString();
            MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WOSession == null)
            {
                WOSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(WOSession);
            }

            MESStationSession SubKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (SubKPSession == null)
            {
                SubKPSession = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(SubKPSession);
            }
            MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (MainKPSession == null)
            {
                MainKPSession = new MESStationSession()
                {
                    MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(MainKPSession);
            }
            SN          sn  = null;
            WorkOrder   wo  = null;
            T_C_KEYPART tck = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);

            sn.Load(Sn, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            wo.Init(sn.WorkorderNo, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <C_KEYPART> keyparts = tck.GetKeypartListByWOAndStation(Station.SFCDB, wo.WorkorderNo, Station.StationName);

            SubKPSession.Value  = keyparts.Where(s => s.SEQ_NO == 10).ToList();
            MainKPSession.Value = keyparts.Where(s => s.SEQ_NO != 10).ToList().OrderBy(s => s.SEQ_NO);
        }
Exemple #2
0
        public static void SNLinkMainSNKPAction_Old(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            WorkOrder wO = null;
            //SN Sub_SN = null;
            //SN Min_Sn = null;
            SN     Sub_SN     = new SN();
            SN     Min_Sn     = new SN();
            string ErrMessage = string.Empty;
            string wo         = Station.Inputs.Find(s => s.DisplayName == "WO").Value.ToString();
            string s_sn       = Station.Inputs.Find(s => s.DisplayName == "SUB_SN").Value.ToString();
            string m_sn       = Station.Inputs.Find(s => s.DisplayName == "MIN_SN").Value.ToString();

            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession WOLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WOLoadPoint == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            wO = (WorkOrder)WOLoadPoint.Value;
            Sub_SN.Load(s_sn, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Min_Sn.Load(m_sn, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            T_C_KEYPART                tck      = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            T_R_SN_KEYPART_DETAIL      T_kd     = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <C_KEYPART>           KEYPARTS = tck.GetKeypartListByWOAndStation(Station.SFCDB, wO.WorkorderNo, Station.StationName);
            List <R_SN_KEYPART_DETAIL> KEYPARTD = T_kd.GetKeypartBySub_Sn(Station.SFCDB, s_sn, Station.StationName);

            if (KEYPARTS.Count >= 2)
            {
                if (KEYPARTS.Count > KEYPARTD.Count)
                {
                    int i = KEYPARTD.Count;
                    T_kd.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, Sub_SN.ID, Sub_SN.SerialNo, Min_Sn.SerialNo, Station.StationName, KEYPARTS[i].PART_NO, KEYPARTS[i].SEQ_NO, KEYPARTS[i].CATEGORY_NAME, KEYPARTS[i].CATEGORY, Station.LoginUser.EMP_NO);
                }
                Station.AddMessage("MES00000180", new string[] { "MAIN_SN", m_sn }, StationMessageState.Pass);
            }
            else
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { Min_Sn.SerialNo });
                throw new MESReturnMessage(ErrMessage);
            }
        }
Exemple #3
0
        public static void SNLinkSubSNKPAction_Old(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            WorkOrder wO = null;
            //SN snob = null;
            string ErrMessage = string.Empty;
            string wo         = Station.Inputs.Find(s => s.DisplayName == "WO").Value.ToString();
            string sn         = Station.Inputs.Find(s => s.DisplayName == "SUB_SN").Value.ToString();

            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession WOLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (WOLoadPoint == null)
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY });
                throw new MESReturnMessage(ErrMessage);
            }
            wO = (WorkOrder)WOLoadPoint.Value;
            //snob.Load(sn,Station.SFCDB,DB_TYPE_ENUM.Oracle);
            SN snob = new SN(sn, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            if (snob == null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "SN Point" }));
            }

            T_C_KEYPART           tck      = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            T_R_SN_KEYPART_DETAIL T_kd     = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <C_KEYPART>      KEYPARTS = tck.GetKeypartListByWOAndStation(Station.SFCDB, wO.WorkorderNo, Station.StationName);

            if (KEYPARTS.Count > 0)
            {
                T_kd.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, snob.ID, snob.SerialNo, sn, Station.StationName, KEYPARTS[0].PART_NO, KEYPARTS[0].SEQ_NO, KEYPARTS[0].CATEGORY_NAME, KEYPARTS[0].CATEGORY, Station.LoginUser.EMP_NO);
                Station.AddMessage("MES00000180", new string[] { "SUB_SN", sn }, StationMessageState.Pass);
            }
            else
            {
                ErrMessage = MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { sn });
                throw new MESReturnMessage(ErrMessage);
            }
        }
Exemple #4
0
        /// <summary>
        /// 從第一個輸入框加載PanelSN
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        /// Add by LLF 2018-02-01
        //public static void SNInputDataloader(MESStationBase Station, MESStationInput Input, List<R_Station_Action_Para> Paras)
        //{
        //    string StrSN = Input.Value.ToString();

        //    MESStationSession SNSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, SessionKey = Paras[0].SESSION_KEY, ResetInput = Input };
        //    Station.StationSession.Add(SNSession);

        //    SNSession.InputValue = Input.Value.ToString();
        //    SNSession.Value = StrSN;
        //}

        public static void SNLinkKeypartDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >();
            int SeqNo = 0;

            KPList = null;
            if (Paras.Count != 5)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            string            Sn        = Input.Value.ToString();
            MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SNSession == null)
            {
                SNSession = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(SNSession);
            }
            MESStationSession WOSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (WOSession == null)
            {
                WOSession = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[1].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(WOSession);
            }
            MESStationSession SubKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[2].SESSION_TYPE && t.SessionKey == Paras[2].SESSION_KEY);

            if (SubKPSession == null)
            {
                SubKPSession = new MESStationSession()
                {
                    MESDataType = Paras[2].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[2].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(SubKPSession);
            }
            MESStationSession MainKPSession = Station.StationSession.Find(t => t.MESDataType == Paras[3].SESSION_TYPE && t.SessionKey == Paras[3].SESSION_KEY);

            if (MainKPSession == null)
            {
                MainKPSession = new MESStationSession()
                {
                    MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(MainKPSession);
            }
            MESStationSession KPListSession = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (KPListSession == null)
            {
                KPListSession = new MESStationSession()
                {
                    MESDataType = Paras[4].SESSION_TYPE, SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(KPListSession);
            }

            KPListSession.Value = KPList;
            //SN sn = null;
            //WorkOrder wo = null;
            SN        sn = new SN();
            WorkOrder wo = new WorkOrder();

            wo = (WorkOrder)WOSession.Value;
            T_C_KEYPART tck = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            //sn.Load(Sn,Station.SFCDB,DB_TYPE_ENUM.Oracle);
            //wo.Init(sn.WorkorderNo,Station.SFCDB,DB_TYPE_ENUM.Oracle);
            List <C_KEYPART> keyparts = tck.GetKeypartListByWOAndStation(Station.SFCDB, wo.WorkorderNo, Station.StationName);

            if (keyparts.Count > 0)
            {
                SeqNo = (int)((C_KEYPART)keyparts[0]).SEQ_NO;
                SubKPSession.Value  = keyparts.Where(s => s.SEQ_NO == SeqNo).ToList();
                MainKPSession.Value = keyparts.Where(s => s.SEQ_NO > SeqNo).ToList();
            }
            else
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000190");
                throw new MESReturnMessage(errMsg);
            }
        }