Пример #1
0
        public int GetStationPassCount(string StationName, bool isContailFail, OleExec sfcdb)
        {
            int result = 0;
            T_R_SN_STATION_DETAIL TR_SN_STATION_DETAIL = new T_R_SN_STATION_DETAIL(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle);

            if (isContailFail)
            {
                result = TR_SN_STATION_DETAIL.GetCountByWOAndStation(WO.WORKORDERNO, StationName, sfcdb);
            }
            else
            {
                result = TR_SN_STATION_DETAIL.GetCountByWOAndStationNotContailFail(WO.WORKORDERNO, StationName, sfcdb);
            }
            return(result);
        }
Пример #2
0
        public static void SNLinkPassAction_Old(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            SN     SN         = 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("參數數量不正確!");
            }
            MESStationSession SNLoadPoint = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            T_R_SN   TRS = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Row_R_SN RRS = (Row_R_SN)TRS.NewRow();
            T_R_SN_STATION_DETAIL   tr_sd = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Row_R_SN_STATION_DETAIL rr_sd = (Row_R_SN_STATION_DETAIL)tr_sd.NewRow();

            RRS = TRS.getR_SNbySN(sn, Station.SFCDB);
            RRS.CURRENT_STATION = Station.StationName;
            RRS.NEXT_STATION    = TRS.GetNextStation(SN.RouteID, Station.StationName, Station.SFCDB);
            RRS.VALID_FLAG      = "0";
            RRS.EDIT_EMP        = Station.LoginUser.EMP_NO;
            RRS.EDIT_TIME       = DateTime.Now;
            if (RRS.NEXT_STATION.ToUpper() == "JOBFINISH")
            {
                RRS.COMPLETED_FLAG = "1";
                RRS.COMPLETED_TIME = DateTime.Now;
            }
            Station.SFCDB.ExecSQL(RRS.GetUpdateString(DB_TYPE_ENUM.Oracle));
            TRS.RecordPassStationDetail(sn, Station.Line, Station.StationName, Station.StationName, Station.BU, Station.SFCDB);
        }
Пример #3
0
 public override void init()
 {
     try
     {
         BU    = ConfigGet("BU");
         Plant = ConfigGet("PLANT");
         DB    = ConfigGet("DB");
         List <System.Net.IPAddress> temp = HWDNNSFCBase.HostInfo.IP.Where(ipv4 => ipv4.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToList();
         ip                    = temp[0].ToString();
         SFCDB                 = new OleExec(DB, false);
         zcmm_nsbg_0051        = new ZCMM_NSBG_0051(BU);
         synLock               = new T_R_SYNC_LOCK(SFCDB, DB_TYPE_ENUM.Oracle);
         t_r_sap_temp          = new T_R_SAP_TEMP(SFCDB, DB_TYPE_ENUM.Oracle);
         t_r_saplog            = new T_R_SAPLOG(SFCDB, DB_TYPE_ENUM.Oracle);
         t_c_control           = new T_C_CONTROL(SFCDB, DB_TYPE_ENUM.Oracle);
         t_r_sn_station_detail = new T_R_SN_STATION_DETAIL(SFCDB, DB_TYPE_ENUM.Oracle);
         Output.UI             = new StockInBackFlush_UI(this);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #4
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);
            }
        }
Пример #5
0
        public static void HWDBIPSNFailAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string     ErrMessage  = "";
            string     StrSn       = "";
            string     APVirtualSn = "";
            string     VirtualSn   = "";
            AP_DLL     APObj       = new AP_DLL();
            OleExec    APDB        = null;
            R_PANEL_SN PANELObj    = null;
            Int16      FailCount   = 0;
            List <Dictionary <string, string> > FailList = null;
            string        R_SN_STATION_DETAIL_ID         = "";
            StringBuilder ReturnMessage = new StringBuilder();
            string        RepairmainID  = "";//add by LLF 2018-04-12

            if (Paras.Count < 5)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

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

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

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

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

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

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

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

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

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

            if (StatusSession == null)
            {
                StatusSession = new MESStationSession()
                {
                    MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), Value = Paras[4].VALUE, SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(StatusSession);
                if (StatusSession.Value.ToString() == "")
                {
                    StatusSession.Value = "FAIL";
                }
            }

            MESStationSession ClearInputSession = null;

            if (Paras.Count >= 6)
            {
                ClearInputSession = Station.StationSession.Find(t => t.MESDataType.Equals(Paras[5].SESSION_TYPE) && t.SessionKey.Equals(Paras[5].SESSION_KEY));
                if (ClearInputSession == null)
                {
                    ClearInputSession = new MESStationSession()
                    {
                        MESDataType = Paras[5].SESSION_TYPE, SessionKey = Paras[5].SESSION_KEY
                    };
                    Station.StationSession.Add(ClearInputSession);
                }
            }

            FailCount = Convert.ToInt16(FailCountSession.Value.ToString());
            FailList  = (List <Dictionary <string, string> >)FailListSession.Value;

            T_R_SN   rSn      = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            DateTime FailTime = rSn.GetDBDateTime(Station.SFCDB);

            StrSn = SNSession.Value.ToString();
            if (FailList.Count >= FailCount && FailCount != 0) //允許掃描多個Fail
            {
                #region 業務邏輯

                OleExec oleDB = null;
                oleDB = Station.SFCDB;
                //oleDB = this.DBPools["SFCDB"].Borrow();
                //oleDB.BeginTrain();
                //OleExecPool APDBPool = Station.DBS["APDB"];
                //APDB = APDBPool.Borrow();
                //APDB.BeginTrain();
                APDB = Station.APDB;
                try
                {
                    Row_R_SN rrSn = (Row_R_SN)rSn.NewRow();
                    for (int i = 0; i < FailList.Count; i++)
                    {
                        //獲取頁面傳過來的數據
                        string failCode        = FailList[i]["FailCode"].ToString();
                        string failLocation    = FailList[i]["FailLocation"].ToString();
                        string failProcess     = FailList[i]["FailProcess"].ToString();
                        string failDescription = FailList[i]["FailDesc"].ToString();



                        //黃楊盛 2018年4月24日14:14:28 模擬自動做維修的動作,修正時間
                        //更新R_SN REPAIR_FAILED_FLAG=’1’
                        //modify by ZGJ 2018-03-22 BIP Fail 的產品自動清除待維修狀態,但是記錄不良

                        PANELObj = (R_PANEL_SN)PanelVitualSNSession.Value;
                        if (i == 0)
                        {
                            VirtualSn = PANELObj.SN.ToString();
                            R_SN r = rSn.GetDetailBySN(VirtualSn, Station.SFCDB);
                            rrSn = (Row_R_SN)rSn.GetObjByID(r.ID, Station.SFCDB);
                            //rrSn.REPAIR_FAILED_FLAG = "0";
                            rrSn.REPAIR_FAILED_FLAG = "1";
                            rrSn.SN        = StrSn;
                            rrSn.EDIT_EMP  = Station.LoginUser.EMP_NO; //add by LLF 2018-03-17
                            rrSn.EDIT_TIME = FailTime;                 //add by LLF 2018-03-17
                            string strRet = (Station.SFCDB).ExecSQL(rrSn.GetUpdateString(DB_TYPE_ENUM.Oracle));
                            if (!(Convert.ToInt32(strRet) > 0))
                            {
                                throw new MESReturnMessage("update repair failed flag error!");
                            }

                            // Update R_PANEL_SN
                            T_R_PANEL_SN   RPanelSN  = new T_R_PANEL_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                            Row_R_PANEL_SN Row_Panel = (Row_R_PANEL_SN)RPanelSN.NewRow();
                            Row_Panel    = (Row_R_PANEL_SN)RPanelSN.GetObjByID(PANELObj.ID, Station.SFCDB);
                            Row_Panel.SN = StrSn;
                            strRet       = (Station.SFCDB).ExecSQL(Row_Panel.GetUpdateString(DB_TYPE_ENUM.Oracle));
                            if (!(Convert.ToInt32(strRet) > 0))
                            {
                                throw new MESReturnMessage("update r_panel_sn error!");
                            }

                            //Update AP

                            //黄杨盛 2018年4月14日09:10:50 修正不能超过9连板的情况.同时加上不支持3位数连板的约束
                            //APVirtualSn = PANELObj.PANEL + "0" + PANELObj.SEQ_NO.ToString();
                            if (PANELObj.SEQ_NO > 99)
                            {
                                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000226",
                                                                                                new string[] { DB_TYPE_ENUM.Oracle.ToString() }));
                            }
                            APVirtualSn = PANELObj.PANEL + Convert.ToInt16(PANELObj.SEQ_NO).ToString("00");


                            string result = APObj.APUpdatePanlSN(APVirtualSn, StrSn, APDB);
                            //APDBPool.Return(APDB);
                            if (!result.Equals("OK"))
                            {
                                //2018年4月24日13:56:14 黃楊盛
                                //throw new MESReturnMessage("already be binded to other serial number");
                                throw new MESReturnMessage(result);
                            }


                            //新增一筆FAIL記錄到R_SN_STATION_DETAIL
                            T_R_SN_STATION_DETAIL rSnStationDetail =
                                new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                            //Add by LLF 2018-03-19
                            R_SN_STATION_DETAIL_ID = rSnStationDetail.GetNewID(Station.BU, Station.SFCDB);
                            //string detailResult = rSnStationDetail.AddDetailToRSnStationDetail(R_SN_STATION_DETAIL_ID,rrSn.GetDataObject(), Station.Line, Station.StationName, Station.StationName, Station.SFCDB);
                            string detailResult = rSnStationDetail.AddDetailToBipStationFailDetail(
                                R_SN_STATION_DETAIL_ID, rrSn.GetDataObject(), Station.Line, Station.StationName,
                                Station.StationName, Station.SFCDB, "1");
                            if (!(Convert.ToInt32(detailResult) > 0))
                            {
                                throw new MESReturnMessage("Insert sn station detail error!");
                            }

                            //update R_SN_STATION_DETAIL
                            rSnStationDetail.UpdateRSnStationDetailBySNID(StrSn, PANELObj.SN, Station.SFCDB);

                            //新增一筆到R_REPAIR_MAIN
                            T_R_REPAIR_MAIN   tRepairMain = new T_R_REPAIR_MAIN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                            Row_R_REPAIR_MAIN rRepairMain = (Row_R_REPAIR_MAIN)tRepairMain.NewRow();

                            RepairmainID = tRepairMain.GetNewID(Station.BU, Station.SFCDB);
                            //rRepairMain.ID = tRepairMain.GetNewID(Station.BU, Station.SFCDB);
                            rRepairMain.ID           = RepairmainID;
                            rRepairMain.SN           = StrSn;
                            rRepairMain.WORKORDERNO  = rrSn.WORKORDERNO;
                            rRepairMain.SKUNO        = rrSn.SKUNO;
                            rRepairMain.FAIL_LINE    = Station.Line;
                            rRepairMain.FAIL_STATION = Station.StationName;
                            rRepairMain.FAIL_EMP     = Station.LoginUser.EMP_NO;
                            //rRepairMain.FAIL_TIME = Station.GetDBDateTime();//Modify by LLF 2018-03-17
                            rRepairMain.FAIL_TIME   = FailTime; //Modify by LLF 2018-03-17
                            rRepairMain.EDIT_EMP    = Station.LoginUser.EMP_NO;
                            rRepairMain.EDIT_TIME   = Station.GetDBDateTime();
                            rRepairMain.CLOSED_FLAG = "1";
                            string insertResult =
                                (Station.SFCDB).ExecSQL(rRepairMain.GetInsertString(DB_TYPE_ENUM.Oracle));
                            if (!(Convert.ToInt32(insertResult) > 0))
                            {
                                throw new Exception("Insert repair main error!");
                            }
                        }

                        //新增一筆到R_REPAIR_FAILCODE
                        T_R_REPAIR_FAILCODE tRepairFailCode =
                            new T_R_REPAIR_FAILCODE(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                        Row_R_REPAIR_FAILCODE rRepairFailCode = (Row_R_REPAIR_FAILCODE)tRepairFailCode.NewRow();
                        rRepairFailCode.ID = tRepairFailCode.GetNewID(Station.BU, Station.SFCDB);
                        //rRepairFailCode.REPAIR_MAIN_ID = rRepairMain.ID; //Modify by LLF 2018-04-11 多筆FAIL 取1一個RepairMainID
                        rRepairFailCode.REPAIR_MAIN_ID = RepairmainID;
                        rRepairFailCode.SN             = StrSn;
                        rRepairFailCode.FAIL_CODE      = failCode;
                        rRepairFailCode.FAIL_EMP       = Station.LoginUser.EMP_NO;
                        rRepairFailCode.FAIL_TIME      = FailTime;
                        rRepairFailCode.FAIL_CATEGORY  = "SYMPTOM";
                        rRepairFailCode.FAIL_LOCATION  = failLocation;
                        rRepairFailCode.FAIL_PROCESS   = failProcess;
                        rRepairFailCode.DESCRIPTION    = failDescription;
                        rRepairFailCode.REPAIR_FLAG    = "1";
                        rRepairFailCode.EDIT_EMP       = Station.LoginUser.EMP_NO;
                        rRepairFailCode.EDIT_TIME      = Station.GetDBDateTime();

                        string strResult =
                            (Station.SFCDB).ExecSQL(rRepairFailCode.GetInsertString(DB_TYPE_ENUM.Oracle));
                        if (!(Convert.ToInt32(strResult) > 0))
                        {
                            throw new MESReturnMessage("Insert repair failcode error!");
                        }


                        //oleDB.CommitTrain();

                        ReturnMessage.Append(failDescription).Append("|");
                    }


                    //黃楊盛 2018年4月24日14:11:42 做一筆出來的記錄
                    R_SN snOut = rSn.GetDetailBySN(StrSn, Station.SFCDB);
                    rrSn = (Row_R_SN)rSn.GetObjByID(snOut.ID, Station.SFCDB);
                    rrSn.CURRENT_STATION    = rrSn.NEXT_STATION;
                    rrSn.NEXT_STATION       = rSn.GetNextStation(snOut.ROUTE_ID, snOut.NEXT_STATION, oleDB);
                    rrSn.REPAIR_FAILED_FLAG = "0";
                    rrSn.SN        = StrSn;
                    rrSn.EDIT_EMP  = Station.LoginUser.EMP_NO;
                    rrSn.EDIT_TIME = FailTime;
                    var count = (Station.SFCDB).ExecSQL(rrSn.GetUpdateString(DB_TYPE_ENUM.Oracle));
                    if (!(Convert.ToInt32(count) > 0))
                    {
                        throw new MESReturnMessage("update rsn failed flag error!");
                    }

                    // 方國剛 2018.05.02 11:45:30
                    // 因拋賬計算過站數量時,不計算REPAIR_FAILED_FLAG=1的數量,故BIP Fail 的產品自動清除待維修狀態后再在過站記錄表記錄一筆REPAIR_FAILED_FLAG=0的記錄
                    T_R_SN_STATION_DETAIL rSnStationDetailRepaired = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                    R_SN_STATION_DETAIL_ID = rSnStationDetailRepaired.GetNewID(Station.BU, Station.SFCDB);
                    string detailResultRepaired = rSnStationDetailRepaired.AddDetailToBipStationFailDetail(
                        R_SN_STATION_DETAIL_ID, rrSn.GetDataObject(), Station.Line, Station.StationName,
                        Station.StationName, Station.SFCDB, "0");
                    if (!(Convert.ToInt32(detailResultRepaired) > 0))
                    {
                        throw new MESReturnMessage("Insert sn station detail error!");
                    }
                }
                catch (Exception e)
                {
                    try
                    {
                        //APDB.RollbackTrain();
                        //oleDB.RollbackTrain();
                    }
                    catch (Exception x)
                    {
                        ;
                    }

                    throw new MESReturnMessage(e.Message + e.StackTrace);
                }
                finally
                {
                    //APDBPool.Return(APDB);
                }



                #endregion
                //add by zgj 2018-03-14
                //當記錄完當前 SN 不良後,清除保存在 session 中的不良信息
                //((List<Dictionary<string, string>>)FailListSession.Value).Clear();

                if (ClearInputSession != null)
                {
                    ClearInputSession.Value = "true";
                }

                ReturnMessage.Remove(ReturnMessage.Length - 1, 1);
                Station.NextInput = Station.FindInputByName("PanelSn");
                Station.AddMessage("MES00000158", new string[] { StrSn, ReturnMessage.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            }
            else
            {
                Station.NextInput = Station.FindInputByName("Location");
                Station.AddMessage("MES00000162", new string[] { StrSn, FailCount.ToString(), FailList.Count.ToString() }, MESReturnView.Station.StationMessageState.Message);
            }
        }
Пример #6
0
        public static void SNFailAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string ErrMessage             = "";
            Int16  FailCount              = 0;
            string StrSn                  = "";
            string R_SN_STATION_DETAIL_ID = "";
            List <Dictionary <string, string> > FailList = null;

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

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

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

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

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

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

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

            if (StatusSession == null)
            {
                StatusSession = new MESStationSession()
                {
                    MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), Value = Paras[3].VALUE, SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
                };
                //      Station.StationSession.Add(StatusSession);
                if (StatusSession.Value == null)
                {
                    StatusSession.Value = "FAIL";
                }
                Station.StationSession.Add(StatusSession);
            }

            FailCount = Convert.ToInt16(FailCountSession.Value.ToString());
            FailList  = (List <Dictionary <string, string> >)FailListSession.Value;

            T_R_SN   rSn      = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            DateTime FailTime = rSn.GetDBDateTime(Station.SFCDB);

            if (FailList.Count >= FailCount && FailCount != 0) //允許掃描多個Fail
            {
                StrSn = SNSession.InputValue.ToString();
                string repairMainId = "";
                for (int i = 0; i < FailList.Count; i++)
                {
                    //獲取頁面傳過來的數據
                    string failCode        = FailList[i]["FailCode"].ToString();
                    string failLocation    = FailList[i]["FailLocation"].ToString();
                    string failProcess     = FailList[i]["FailProcess"].ToString();
                    string failDescription = FailList[i]["FailDesc"].ToString();

                    OleExec oleDB = null;
                    oleDB = Station.SFCDB;
                    //oleDB.BeginTrain();  //以下執行 要么全成功,要么全失敗
                    T_R_REPAIR_MAIN   tRepairMain = new T_R_REPAIR_MAIN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                    Row_R_REPAIR_MAIN rRepairMain = (Row_R_REPAIR_MAIN)tRepairMain.NewRow();

                    Row_R_SN rrSn = (Row_R_SN)rSn.NewRow();
                    if (i == 0)
                    {
                        //更新R_SN REPAIR_FAILED_FLAG=’1’
                        R_SN r = rSn.GetDetailBySN(StrSn, Station.SFCDB);
                        rrSn = (Row_R_SN)rSn.GetObjByID(r.ID, Station.SFCDB);
                        rrSn.REPAIR_FAILED_FLAG = "1";
                        rrSn.EDIT_EMP           = Station.LoginUser.EMP_NO;
                        rrSn.EDIT_TIME          = FailTime;
                        string strRet = (Station.SFCDB).ExecSQL(rrSn.GetUpdateString(DB_TYPE_ENUM.Oracle));
                        if (!(Convert.ToInt32(strRet) > 0))
                        {
                            throw new Exception("update repair failed flag error!");
                        }

                        //新增一筆FAIL記錄到R_SN_STATION_DETAIL
                        T_R_SN_STATION_DETAIL rSnStationDetail = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                        R_SN_STATION_DETAIL_ID = rSnStationDetail.GetNewID(Station.BU, Station.SFCDB);
                        string detailResult = rSnStationDetail.AddDetailToRSnStationDetail(R_SN_STATION_DETAIL_ID, rrSn.GetDataObject(), Station.Line, Station.StationName, Station.StationName, Station.SFCDB);
                        if (!(Convert.ToInt32(detailResult) > 0))
                        {
                            throw new Exception("Insert sn station detail error!");
                        }

                        //新增一筆到R_REPAIR_MAIN
                        repairMainId             = tRepairMain.GetNewID(Station.BU, Station.SFCDB);
                        rRepairMain.ID           = repairMainId;
                        rRepairMain.SN           = StrSn;
                        rRepairMain.WORKORDERNO  = rrSn.WORKORDERNO;
                        rRepairMain.SKUNO        = rrSn.SKUNO;
                        rRepairMain.FAIL_LINE    = Station.Line;
                        rRepairMain.FAIL_STATION = Station.StationName;
                        rRepairMain.FAIL_EMP     = Station.LoginUser.EMP_NO;
                        //rRepairMain.FAIL_TIME = Station.GetDBDateTime();//Mpdofy by LLF 2018-03-17
                        rRepairMain.FAIL_TIME   = FailTime;
                        rRepairMain.CREATE_TIME = Station.GetDBDateTime();
                        rRepairMain.EDIT_EMP    = Station.LoginUser.EMP_NO;
                        rRepairMain.EDIT_TIME   = Station.GetDBDateTime();
                        rRepairMain.CLOSED_FLAG = "0";
                        string insertResult = (Station.SFCDB).ExecSQL(rRepairMain.GetInsertString(DB_TYPE_ENUM.Oracle));
                        if (!(Convert.ToInt32(insertResult) > 0))
                        {
                            throw new Exception("Insert repair main error!");
                        }
                    }

                    ////新增一筆到R_REPAIR_MAIN
                    //T_R_REPAIR_MAIN tRepairMain = new T_R_REPAIR_MAIN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                    //Row_R_REPAIR_MAIN rRepairMain = (Row_R_REPAIR_MAIN)tRepairMain.NewRow();
                    //rRepairMain.ID = tRepairMain.GetNewID(Station.BU, Station.SFCDB);
                    //rRepairMain.SN = StrSn;
                    //rRepairMain.WORKORDERNO = rrSn.WORKORDERNO;
                    //rRepairMain.SKUNO = rrSn.SKUNO;
                    //rRepairMain.FAIL_LINE = Station.Line;
                    //rRepairMain.FAIL_STATION = Station.StationName;
                    //rRepairMain.FAIL_EMP = Station.LoginUser.EMP_NO;
                    //rRepairMain.FAIL_TIME = FailTime.ToString();
                    //rRepairMain.CLOSED_FLAG = "0";
                    //string insertResult = (Station.SFCDB).ExecSQL(rRepairMain.GetInsertString(DB_TYPE_ENUM.Oracle));
                    //if (!(Convert.ToInt32(insertResult) > 0))
                    //{
                    //    throw new Exception("Insert repair main error!");
                    //}

                    //新增一筆到R_REPAIR_FAILCODE
                    T_R_REPAIR_FAILCODE   tRepairFailCode = new T_R_REPAIR_FAILCODE(Station.SFCDB, DB_TYPE_ENUM.Oracle);
                    Row_R_REPAIR_FAILCODE rRepairFailCode = (Row_R_REPAIR_FAILCODE)tRepairFailCode.NewRow();
                    rRepairFailCode.ID             = tRepairFailCode.GetNewID(Station.BU, Station.SFCDB);
                    rRepairFailCode.REPAIR_MAIN_ID = repairMainId;
                    rRepairFailCode.SN             = StrSn;
                    rRepairFailCode.FAIL_CODE      = failCode;
                    rRepairFailCode.FAIL_EMP       = Station.LoginUser.EMP_NO;
                    rRepairFailCode.FAIL_TIME      = FailTime;
                    rRepairFailCode.FAIL_CATEGORY  = "SYMPTOM";
                    rRepairFailCode.FAIL_LOCATION  = failLocation;
                    rRepairFailCode.FAIL_PROCESS   = failProcess;
                    rRepairFailCode.DESCRIPTION    = failDescription;
                    rRepairFailCode.REPAIR_FLAG    = "0";
                    rRepairFailCode.CREATE_TIME    = Station.GetDBDateTime();
                    rRepairFailCode.EDIT_EMP       = Station.LoginUser.EMP_NO;
                    rRepairFailCode.EDIT_TIME      = Station.GetDBDateTime();

                    string strResult = (Station.SFCDB).ExecSQL(rRepairFailCode.GetInsertString(DB_TYPE_ENUM.Oracle));
                    if (!(Convert.ToInt32(strResult) > 0))
                    {
                        throw new Exception("Insert repair failcode error!");
                    }

                    //oleDB.CommitTrain();
                }
                ((List <Dictionary <string, string> >)FailListSession.Value).Clear();
                Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Pass);
            }
        }
Пример #7
0
        public static void SNFailAction_Old(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string R_SN_STATION_DETAIL_ID = "";

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

            if (SNLoadPoint == null)
            {
                SNLoadPoint = new MESStationSession()
                {
                    MESDataType = "SN", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input
                };
                Station.StationSession.Add(SNLoadPoint);
            }

            //獲取頁面傳過來的數據
            string failCode        = Station.Inputs.Find(s => s.DisplayName == "Fail_Code").Value.ToString();
            string failLocation    = Station.Inputs.Find(s => s.DisplayName == "Fail_Location").Value.ToString();
            string failProcess     = Station.Inputs.Find(s => s.DisplayName == "Fail_Process").Value.ToString();
            string failDescription = Station.Inputs.Find(s => s.DisplayName == "Description").Value.ToString();
            string strSn           = Input.Value.ToString();

            OleExec oleDB = null;

            oleDB = Station.SFCDB;
            //oleDB = this.DBPools["SFCDB"].Borrow();
            oleDB.BeginTrain();  //以下執行 要么全成功,要么全失敗

            //更新R_SN REPAIR_FAILED_FLAG=’1’
            T_R_SN   rSn  = new T_R_SN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Row_R_SN rrSn = (Row_R_SN)rSn.NewRow();
            R_SN     r    = rSn.GetDetailBySN(strSn, Station.SFCDB);

            rrSn = (Row_R_SN)rSn.GetObjByID(r.ID, Station.SFCDB);
            rrSn.REPAIR_FAILED_FLAG = "1";
            string strRet = (Station.SFCDB).ExecSQL(rrSn.GetUpdateString(DB_TYPE_ENUM.Oracle));

            if (!(Convert.ToInt32(strRet) > 0))
            {
                throw new Exception("update repair failed flag error!");
            }

            //新增一筆FAIL記錄到R_SN_STATION_DETAIL
            T_R_SN_STATION_DETAIL rSnStationDetail = new T_R_SN_STATION_DETAIL(Station.SFCDB, DB_TYPE_ENUM.Oracle);

            R_SN_STATION_DETAIL_ID = rSnStationDetail.GetNewID(Station.BU, Station.SFCDB);
            string detailResult = rSnStationDetail.AddDetailToRSnStationDetail(R_SN_STATION_DETAIL_ID, rrSn.GetDataObject(), Station.Line, Station.StationName, Station.StationName, Station.SFCDB);

            if (!(Convert.ToInt32(detailResult) > 0))
            {
                throw new Exception("Insert sn station detail error!");
            }

            //新增一筆到R_REPAIR_MAIN
            T_R_REPAIR_MAIN   tRepairMain = new T_R_REPAIR_MAIN(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Row_R_REPAIR_MAIN rRepairMain = (Row_R_REPAIR_MAIN)tRepairMain.NewRow();

            rRepairMain.ID           = tRepairMain.GetNewID(Station.BU, Station.SFCDB);
            rRepairMain.SN           = strSn;
            rRepairMain.WORKORDERNO  = rrSn.WORKORDERNO;
            rRepairMain.SKUNO        = rrSn.SKUNO;
            rRepairMain.FAIL_LINE    = Station.Line;
            rRepairMain.FAIL_STATION = Station.StationName;
            rRepairMain.FAIL_EMP     = Station.User.EMP_NO;
            rRepairMain.FAIL_TIME    = Station.GetDBDateTime();
            rRepairMain.CLOSED_FLAG  = "0";
            string insertResult = (Station.SFCDB).ExecSQL(rRepairMain.GetInsertString(DB_TYPE_ENUM.Oracle));

            if (!(Convert.ToInt32(insertResult) > 0))
            {
                throw new Exception("Insert repair main error!");
            }

            //新增一筆到R_REPAIR_FAILCODE
            T_R_REPAIR_FAILCODE   tRepairFailCode = new T_R_REPAIR_FAILCODE(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            Row_R_REPAIR_FAILCODE rRepairFailCode = (Row_R_REPAIR_FAILCODE)tRepairFailCode.NewRow();

            rRepairFailCode.ID             = tRepairFailCode.GetNewID(Station.BU, Station.SFCDB);
            rRepairFailCode.REPAIR_MAIN_ID = rRepairMain.ID;
            rRepairFailCode.SN             = strSn;
            rRepairFailCode.FAIL_CODE      = failCode;
            rRepairFailCode.FAIL_EMP       = Station.User.EMP_NO;
            rRepairFailCode.FAIL_TIME      = DateTime.Now;
            rRepairFailCode.FAIL_CATEGORY  = "SYMPTON";
            rRepairFailCode.FAIL_LOCATION  = failLocation;
            rRepairFailCode.FAIL_PROCESS   = failProcess;
            rRepairFailCode.DESCRIPTION    = failDescription;
            rRepairFailCode.REPAIR_FLAG    = "0";
            string strResult = (Station.SFCDB).ExecSQL(rRepairFailCode.GetInsertString(DB_TYPE_ENUM.Oracle));

            if (!(Convert.ToInt32(strResult) > 0))
            {
                throw new Exception("Insert repair failcode error!");
            }

            oleDB.CommitTrain();

            Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Pass);
        }
Пример #8
0
        /// <summary>
        /// 工單信息加載器,加載工單信息到指定位置,主要用來給界面做輸出. 2018/1/2 肖倫
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">
        /// InputQTYSave	工單已投數量保存位置	{SESSION_TYPE:"INPUTQTY",SSION_KEY:"1",VALUE:""}
        /// FinishQTYSave 工單已完成數量保存位置 { SESSION_TYPE:"FINISHQTY",SSION_KEY:"1",VALUE:""}
        /// StationQTYSave 本工站過站數量保存位置 { SESSION_TYPE:"STATIONQTY",SSION_KEY:"1",VALUE:""}
        /// WOLoadPoint 工單的保存位置 { SESSION_TYPE:"WO",SSION_KEY:"1",VALUE:""}
        /// </param>
        public static void WoInfoDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            MESStation.LogicObject.WorkOrder wo = new MESStation.LogicObject.WorkOrder();
            string strWONO = "";

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

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

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

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

            if (Wo_Session == null)
            {
                strWONO    = Input.Value.ToString();
                Wo_Session = new MESStationSession()
                {
                    MESDataType = Paras[3].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[3].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(Wo_Session);
            }
            strWONO = Wo_Session.Value.ToString();
            //add by LLF 2018-03-26 增加工單數量Sesstion
            MESStationSession WoQty_Session = Station.StationSession.Find(t => t.MESDataType == Paras[4].SESSION_TYPE && t.SessionKey == Paras[4].SESSION_KEY);

            if (WoQty_Session == null)
            {
                WoQty_Session = new MESStationSession()
                {
                    MESDataType = Paras[4].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[4].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(WoQty_Session);
            }
            else
            {
                //wo = (WorkOrder)Wo_Session.Value;
                //if (wo != null && wo.WorkorderNo != null && wo.WorkorderNo.Length > 0)
                //{
                //    strWONO = wo.WorkorderNo;
                //   // wo.Init(wo.WorkorderNo, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                //}
                //else
                //{
                //    wo = new MESStation.LogicObject.WorkOrder();
                //    strWONO = Input.Value.ToString();
                //   // wo.Init(Input.Value.ToString(), Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
                //}
                //  Wo_Session.Value = wo;
                //strWONO = Wo_Session.Value.ToString();
                Wo_Session.InputValue = Input.Value.ToString();
                Wo_Session.ResetInput = Input;
            }
            try
            {
                wo.Init(strWONO, Station.SFCDB, Station.DBType);
                Wo_Session.Value        = wo;
                InputQTY_Session.Value  = wo.INPUT_QTY;
                FinishQTY_Session.Value = wo.FINISHED_QTY;
                WoQty_Session.Value     = wo.WORKORDER_QTY;
                T_R_SN_STATION_DETAIL TR_SN_STATION_DETAIL = new T_R_SN_STATION_DETAIL(Station.SFCDB, Station.DBType);
                StationQTY_Session.Value = TR_SN_STATION_DETAIL.GetCountByWOAndStation(wo.ToString(), Station.StationName, Station.SFCDB);
                Station.AddMessage("MES00000001", new string[] { Input.Value.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                Wo_Session.Value         = null;
                InputQTY_Session.Value   = 0;
                FinishQTY_Session.Value  = 0;
                StationQTY_Session.Value = 0;
                WoQty_Session.Value      = 0;
                throw ex;
            }
        }