예제 #1
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);
            }
        }
예제 #2
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);
            }
        }
예제 #3
0
        /// <summary>
        /// 通過SN獲取r_sn_keypart_detail表的LINK信息
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void BySnObjectGetLinkKeypartDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }

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

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

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

            if (SNSession == null)
            {
                throw new Exception("Can Not Find " + Paras[1].SESSION_TYPE + " 'Information ' !");
            }
            else
            {
                SN Objsn = (SN)SNSession.Value;
                T_R_SN_KEYPART_DETAIL      stk         = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                List <R_SN_KEYPART_DETAIL> KeyPartList = stk.GetKeypartBySN(Station.SFCDB, Objsn.SerialNo);

                LinkSnSession.Value = KeyPartList;

                Station.AddMessage("MES00000029", new string[] { "KeyPartList", KeyPartList.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
        }
예제 #4
0
        /// <summary>
        /// 檢查HWD Link Keypart檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        //public static void SNCallHWWSchecker(MESStationBase Station, MESStationInput Input, List<R_Station_Action_Para> Paras)
        public static void SNSubKPchecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            List <Dictionary <string, string> > KPList      = new List <Dictionary <string, string> >();
            List <Dictionary <string, string> > KPList_Temp = new List <Dictionary <string, string> >();
            Dictionary <string, string>         DicKP       = new Dictionary <string, string>();
            List <C_KEYPART> SubKP = new List <C_KEYPART>();
            string           KpSN  = Input.Value.ToString();

            //C_KEYPART SUBKP = null;
            if (Paras.Count != 3)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

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

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

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

            if (SubKPSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }

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

            if (KPListSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }));
            }

            SN Sn = new SN(KpSN, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            if (Sn == null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000048", new string[] { KpSN }));
            }

            KPListSession.Value = null;
            SubSNSession.Value  = Sn;

            T_R_SN_KEYPART_DETAIL      _R_SN_KEYPART_DETAIL = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            T_C_KEYPART                _C_KEYPART           = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <R_SN_KEYPART_DETAIL> KEYPARTDETAIL        = new List <R_SN_KEYPART_DETAIL>();

            if (Sn.ShippedFlag == "1")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000070", new string[] { KpSN }));
            }

            if (Sn.RepairFailedFlag == "1")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000071", new string[] { KpSN }));
            }

            if (Sn.CompletedFlag == "0")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000144", new string[] { KpSN }));
            }

            if (Sn.CurrentStation == "MRB")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000174", new string[] { KpSN }));
            }
            else
            {
                //Modify by LLF 2018-04-01,有多階綁定
                //KEYPARTDETAIL = _R_SN_KEYPART_DETAIL.GetKeypartBySN(Station.SFCDB, KpSN, Station.StationName);
                //R_SN_KEYPART_DETAIL kpl = KEYPARTDETAIL.Find(z=>z.VALID=="1");
                //if (kpl != null)
                //{
                //    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000165", new string[] { KpSN }));
                //}
                //else
                //{
                SubKP = (List <C_KEYPART>)SubKPSession.Value;
                C_KEYPART ckp = SubKP.Find(c => c.PART_NO == Sn.SkuNo);
                if (ckp == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000175", new string[] { Sn.SkuNo }));
                }
                //}
            }
        }
예제 #5
0
        /// <summary>
        /// 檢查HWD Link Keypart檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNMainKPchecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            List <Dictionary <string, string> > KPList      = new List <Dictionary <string, string> >();
            List <Dictionary <string, string> > KPList_Temp = new List <Dictionary <string, string> >();
            Dictionary <string, string>         DicKP       = new Dictionary <string, string>();
            List <C_KEYPART> MainKP = new List <C_KEYPART>();
            string           MainSN = Input.Value.ToString();

            if (Paras.Count != 3)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

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

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

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

            if (MainKPSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }

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

            if (KPListSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }));
            }

            SN Sn = new SN(MainSN, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            if (Sn == null)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000048", new string[] { MainSN }));
            }

            MainSNSession.Value = Sn;

            T_R_SN_KEYPART_DETAIL      _R_SN_KEYPART_DETAIL = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            T_C_KEYPART                _C_KEYPART           = new T_C_KEYPART(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            List <R_SN_KEYPART_DETAIL> KEYPARTDETAIL        = new List <R_SN_KEYPART_DETAIL>();

            if (Sn.ShippedFlag == "1")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000070", new string[] { MainSN }));
            }

            if (Sn.RepairFailedFlag == "1")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000071", new string[] { MainSN }));
            }

            if (Sn.CompletedFlag == "0")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000144", new string[] { MainSN }));
            }

            if (Sn.CurrentStation == "MRB")
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000174", new string[] { MainSN }));
            }
            else
            {
                KEYPARTDETAIL = _R_SN_KEYPART_DETAIL.GetKeypartBySN(Station.SFCDB, MainSN, Station.StationName);
                R_SN_KEYPART_DETAIL KP_Main = KEYPARTDETAIL.Find(z => z.VALID == "1");
                if (KP_Main != null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000165", new string[] { MainSN }));
                }
                else
                {
                    MainKP = (List <C_KEYPART>)MainKPSession.Value;
                    C_KEYPART ckp = MainKP.Find(c => c.PART_NO == Sn.SkuNo);
                    if (ckp == null)
                    {
                        throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000175", new string[] { Sn.SkuNo }));
                    }
                    else
                    {
                        KPList_Temp = (List <Dictionary <string, string> >)KPListSession.Value;
                        if (KPList_Temp.Count > 0)
                        {
                            DicKP = KPList_Temp.Find(a => a.ContainsValue(Sn.SerialNo));
                            if (DicKP != null)
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000193", new string[] { MainSN }));
                            }
                        }

                        Station.AddMessage("MES00000067", new string[] { MainSN }, StationMessageState.Pass);
                    }
                }
            }
        }
예제 #6
0
        public static void SNLinkPassAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string                SubSn                = "";
            SN                    SubSNObj             = new SN();
            SN                    SnObj                = new SN();
            WorkOrder             WO                   = new WorkOrder();
            T_R_SN                Table_R_SN           = new T_R_SN(Station.SFCDB, Station.DBType);
            T_R_SN_STATION_DETAIL Table_SnDetail       = new T_R_SN_STATION_DETAIL(Station.SFCDB, Station.DBType);
            T_R_SN_KEYPART_DETAIL Table_R_Keypart      = new T_R_SN_KEYPART_DETAIL(Station.SFCDB, Station.DBType);
            string                ErrMessage           = string.Empty;
            List <C_KEYPART>      SubKPList            = new List <C_KEYPART>();
            List <C_KEYPART>      MainKPList           = new List <C_KEYPART>();
            string                StrNextStation       = "";
            string                Status               = "";
            R_SN                  R_Sn                 = null;
            T_R_WO_BASE           WoTable              = null; //add by LLF
            List <Dictionary <string, string> > KPList = new List <Dictionary <string, string> >();
            string result = "";

            if (Paras.Count == 0)
            {
                throw new Exception("參數數量不正確!");
            }

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

            if (SubSNSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }

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

            if (SubKPSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            }

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

            if (MainKPSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE + Paras[2].SESSION_KEY }));
            }

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

            if (KPListSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[3].SESSION_TYPE + Paras[3].SESSION_KEY }));
            }

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

            if (WOSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[4].SESSION_TYPE + Paras[4].SESSION_KEY }));
            }

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

            if (NextStationSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[5].SESSION_TYPE + Paras[5].SESSION_KEY }));
            }

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

            if (StatusSession == null)
            {
                StatusSession = new MESStationSession()
                {
                    MESDataType = Paras[6].SESSION_TYPE, SessionKey = Paras[6].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(StatusSession);
                if (string.IsNullOrEmpty(Paras[0].VALUE))
                {
                    StatusSession.Value = "PASS";
                }
            }
            Status = StatusSession.Value.ToString();

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

            if (ClearFlagGSession == null)
            {
                ClearFlagGSession = new MESStationSession()
                {
                    MESDataType = Paras[7].SESSION_TYPE, SessionKey = Paras[7].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(ClearFlagGSession);
            }
            ClearFlagGSession.Value = "false";

            StrNextStation = SnObj.StringListToString((List <string>)NextStationSession.Value);
            //StrNextStation = NextStationSession.Value.ToString();
            SubKPList  = (List <C_KEYPART>)SubKPSession.Value;
            MainKPList = (List <C_KEYPART>)MainKPSession.Value;
            KPList     = (List <Dictionary <string, string> >)KPListSession.Value;
            SubSNObj   = (SN)SubSNSession.Value;
            WO         = (WorkOrder)WOSession.Value;
            SubSn      = SubSNObj.SerialNo;
            R_Sn       = Table_R_SN.GetById(SubSNObj.ID, Station.SFCDB);
            if (SubKPList.Count + MainKPList.Count == KPList.Count)
            {
                Table_R_SN.UpdateSNKeyparStatus(SubSNObj.ID, Station.LoginUser.EMP_NO, "0", Station.SFCDB);
                Table_R_SN.InsertLinkSN(SubSn, WO.WorkorderNo, WO.SkuNO, WO.RouteID, WO.KP_LIST_ID, Station.StationName, StrNextStation, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB, SubSNObj.Plant);
                //更新Main KP SN
                foreach (Dictionary <string, string> DicMainKP in KPList)
                {
                    int SeqNo = Convert.ToInt16(DicMainKP["SEQ_NO"]);
                    if (DicMainKP["KP_TYPE"] == "MAIN_SN")
                    {
                        Table_R_SN.UpdateSNKeyparStatus(DicMainKP["KP_SN_ID"], Station.LoginUser.EMP_NO, "1", Station.SFCDB);
                    }
                    //写KP
                    Table_R_Keypart.INSN_KEYPART_DETAIL(Station.SFCDB, Station.BU, SubSNObj.ID, DicMainKP["SN"], DicMainKP["KEYPART_SN"], Station.StationName, DicMainKP["PART_NO"], SeqNo, DicMainKP["CATEGORY_NAME"], DicMainKP["CATEGORY"], Station.LoginUser.EMP_NO);
                }

                //寫過站記錄
                result = Table_R_SN.LinkPassStationDetail(R_Sn, WO.WorkorderNo, WO.SkuNO, WO.RouteID, Station.Line, Station.StationName, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB);
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "STATION DETAIL" }));
                }
                //add by LLF
                WoTable = new T_R_WO_BASE(Station.SFCDB, Station.DBType);
                result  = WoTable.AddCountToWo(WO.WorkorderNo, 1, Station.SFCDB); // 更新 R_WO_BASE 中的數據
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000025", new string[] { "WO QTY" }));
                }
                //寫良率,UPH
                result = Table_R_SN.RecordUPH(WO.WorkorderNo, 1, SubSn, Status, Station.Line, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB);
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "UPH" }));
                }
                result = Table_R_SN.RecordYieldRate(WO.WorkorderNo, 1, SubSn, Status, Station.Line, Station.StationName, Station.LoginUser.EMP_NO, Station.BU, Station.SFCDB);
                if (Convert.ToInt32(result) <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000021", new string[] { "YIELD" }));
                }
                KPListSession.Value     = null;
                ClearFlagGSession.Value = "true";
                Station.AddMessage("MES00000195", new string[] { SubSn, StrNextStation }, StationMessageState.Pass);
            }
        }