Esempio n. 1
0
        /// <summary>
        /// 檢查SN條碼或SN對象的KEYPART
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void SNStationKeypartDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            OleExec           SFCDB     = Station.SFCDB;
            SN snObject = null;

            if (SNSession.Value is string)
            {
                snObject = new SN(SNSession.Value.ToString(), Station.SFCDB, Station.DBType);
            }
            else
            {
                snObject = (SN)SNSession.Value;
            }

            if (snObject == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { SNSession.Value.ToString() }));
            }

            T_R_SN_KP      TRKP = new T_R_SN_KP(SFCDB, DB_TYPE_ENUM.Oracle);
            List <R_SN_KP> snkp = TRKP.GetKPRecordBySnIDStation(snObject.ID, Station.StationName, SFCDB);

            List <R_SN_KP> kpwait = snkp.FindAll(T => T.VALUE == "" || T.VALUE == null);

            if (kpwait.Count > 0)
            {
                Station.AddKPScan(snObject.SerialNo, snObject.WorkorderNo, Station.StationName);
                throw new Exception($@"{snObject.SerialNo} 缺少Keypart");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 從輸入加載工單數據
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void LoadWoFromInput(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            //if (Paras.Count == 0)
            //{
            //    throw new Exception("參數數量不正確!");

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

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

            //dStation.NextInput = Station.Inputs[1];
            //Station.DBS["APDB"].Borrow()
            LogicObject.WorkOrder WO = new LogicObject.WorkOrder();
            WO.Init(Input.Value.ToString(), Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            s.Value      = WO;
            s.InputValue = Input.Value.ToString();
            s.ResetInput = Input;
            Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESReturnView.Station.StationMessageState.Pass);
        }
Esempio n. 3
0
        /// <summary>
        /// REPAIR_CHECK_OUT狀態檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void RepairOutStatusChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionSN == null || sessionSN.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[2].SESSION_TYPE }));
            }
            SN snObject = (SN)sessionSN.Value;
            T_R_REPAIR_TRANSFER t_r_repair = new T_R_REPAIR_TRANSFER(Station.SFCDB, Station.DBType);

            if (!t_r_repair.SNIsRepairIn(snObject.SerialNo, Station.SFCDB))
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180619154342", new string[] { snObject.SerialNo }));
            }

            T_R_REPAIR_MAIN t_r_repair_main = new T_R_REPAIR_MAIN(Station.SFCDB, Station.DBType);

            if (!t_r_repair_main.SNIsRepaired(snObject.SerialNo, Station.SFCDB))
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000071", new string[] { snObject.SerialNo }));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 打開卡通或棧板
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void OpenPackingAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

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

            if (sessionPackObject == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            try
            {
                string result = "";
                LogicObject.Packing packObject  = (LogicObject.Packing)sessionPackObject.Value;
                T_R_PACKING         t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType);
                result = t_r_packing.UpdateCloseFlagByPackID(packObject.PackID, "0", Station.SFCDB);
                if (Convert.ToInt32(result) == 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180612154414", new string[] { packObject.PackNo }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public static void SetNextInputAction(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            //参数1,获取一个内存变量,检查它的值是否为配置值,
            //如是,设置next为配置2的
            //
            R_Station_Action_Para P1 = Paras[0];
            MESStationSession     s  = Station.StationSession.Find(t => t.MESDataType == P1.SESSION_TYPE && t.SessionKey == P1.SESSION_KEY);

            if (s == null)
            {
                return;
            }
            if (s.Value.ToString() == P1.VALUE.ToString())
            {
                R_Station_Action_Para P2 = Paras[1];
                MESStationInput       i  = Station.Inputs.Find(t => t.DisplayName == P2.VALUE.ToString());
                if (i != null)
                {
                    Station.NextInput = i;
                }
            }
            else
            {
                R_Station_Action_Para P2 = Paras[2];
                MESStationInput       i  = Station.Inputs.Find(t => t.DisplayName == P2.VALUE.ToString());
                if (i != null)
                {
                    Station.NextInput = i;
                }
            }
        }
Esempio n. 6
0
        public static void RepairPCBASNChecker(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession SNSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SNSession == null || SNSession.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "PCBASNSession" }));
            }
            MESStationSession PCBASNSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (PCBASNSession == null || PCBASNSession.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000045", new string[] { "PCBASNSession" }));
            }
            try
            {
                LogicObject.SN snObject = (LogicObject.SN)SNSession.Value;
                if (snObject.SerialNo != PCBASNSession.Value.ToString() && snObject.BoxSN != PCBASNSession.Value.ToString())
                {
                    T_R_SN_KP t_sn_kp = new T_R_SN_KP(Station.SFCDB, Station.DBType);
                    if (!t_sn_kp.KpIsLinkBySN(snObject.ID, PCBASNSession.Value.ToString(), Station.SFCDB))
                    {
                        throw new Exception(MESReturnMessage.GetMESReturnMessage("MSGCODE20180616081316", new string[] { PCBASNSession.Value.ToString(), snObject.SerialNo }));
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        public static void LoadPanelWaitReplaceSn(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

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

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

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

            if (sessionSN == null)
            {
                sessionSN = new MESStationSession {
                    MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY, Value = "", InputValue = "", ResetInput = Input
                };
                Station.StationSession.Add(sessionSN);
            }
            T_R_SN r_sn = new T_R_SN(Station.SFCDB, Station.DBType);

            sessionSN.Value = r_sn.GetPanelWaitReplaceSn(sessionPanel.InputValue.ToString(), Station.SFCDB);
            Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
        }
Esempio n. 8
0
        /// <summary>
        /// 檢查panel對象中的SN的NextStation是否等於當前工站
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void PanleNextStationChecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionPanle = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionPanle == null || sessionPanle.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }
            Panel panel = new Panel();

            Panel            panleObject      = (Panel)sessionPanle.Value;
            T_C_ROUTE_DETAIL t_c_route_detail = new T_C_ROUTE_DETAIL(Station.SFCDB, Station.DBType);

            List <R_SN> snList = panel.GetSnDetail(panleObject.PanelNo, Station.SFCDB, Station.DBType);

            foreach (R_SN sn in snList)
            {
                if (!t_c_route_detail.StationInRoute(sn.ROUTE_ID, Station.StationName, Station.SFCDB))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180621172210", new string[] { Station.StationName, sn.SN }));
                }
                if (!sn.NEXT_STATION.Equals(Station.StationName))
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000136", new string[] { sn.NEXT_STATION }));
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 根據工號檢查密碼是否正確
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void EmpPasswordChecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession sessionEmp = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionEmp == null || sessionEmp.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE }));
            }
            MESStationSession sessionPwd = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (sessionPwd == null || sessionPwd.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE }));
            }
            T_c_user   t_c_user = new T_c_user(Station.SFCDB, Station.DBType);
            Row_c_user rowUser  = t_c_user.getC_Userbyempno(sessionEmp.Value.ToString(), Station.SFCDB, Station.DBType);

            if (rowUser == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180620163103", new string[] { sessionEmp.Value.ToString() }));
            }
            if (!rowUser.EMP_PASSWORD.Equals(sessionPwd.Value.ToString()))
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180813154717", new string[] { sessionEmp.Value.ToString() }));
            }
        }
Esempio n. 10
0
        public static void WoInputCountDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession count = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

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

            MESStation.LogicObject.WorkOrder   worder = new LogicObject.WorkOrder();
            MESDataObject.Module.T_R_WO_BASE   trwb   = new MESDataObject.Module.T_R_WO_BASE(Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            MESDataObject.Module.Row_R_WO_BASE rrwb   = (MESDataObject.Module.Row_R_WO_BASE)trwb.NewRow();
            rrwb = worder.GetWoMode(workorder, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            Station.AddMessage("MES00000029", new string[] { "Workorder", wo.ToString() }, MESReturnView.Station.StationMessageState.Message);
        }
Esempio n. 11
0
        /// <summary>
        /// 檢查輸入的Action_code是否存在
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void ActionCodeDataChecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            string            ActionCodeInput   = "";
            MESStationSession sessionActionCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionActionCode == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionActionCode.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            try
            {
                T_C_ACTION_CODE t_c_action_code = new T_C_ACTION_CODE(Station.SFCDB, Station.DBType);
                C_ACTION_CODE   c_action_code   = new C_ACTION_CODE();
                c_action_code = t_c_action_code.GetByActionCode(sessionActionCode.Value.ToString(), Station.SFCDB);
                if (c_action_code == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "ActionCode", ActionCodeInput }));
                }
                Station.AddMessage("MES00000026", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 12
0
        //Add by LLF 2017-01-26 End

        /// <summary>
        /// TR_SN數據對象加載其中每個欄位
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void LoadDataFromTRSNDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            object TRSN_SessionObject;

            if (Paras.Count == 0)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            try
            {
                MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
                if (TRSN_Session == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
                }
                else if (TRSN_Session.Value == null)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
                }
                TRSN_SessionObject = TRSN_Session.Value;

                //獲取TR_SN 欄位數據
                Dictionary <string, DataRow> dd = (Dictionary <string, DataRow>)TRSN_SessionObject;
                DataRow tr;
                dd.TryGetValue("R_TR_SN", out tr);

                MESStationInput I   = Station.Inputs.Find(t => t.DisplayName == "KP_NO");
                List <object>   ret = I.DataForUse;
                ret.Clear();
                if (I != null)
                {
                    ret.Add(tr["CUST_KP_NO"].ToString());
                }

                MESStationInput I1   = Station.Inputs.Find(t => t.DisplayName == "MFR_Name");
                List <object>   ret1 = I1.DataForUse;
                if (I1 != null)
                {
                    ret1.Add(tr["MFR_KP_NO"].ToString());
                }
                MESStationInput I2   = Station.Inputs.Find(t => t.DisplayName == "Date_Code");
                List <object>   ret2 = I2.DataForUse;
                if (I2 != null)
                {
                    ret2.Add(tr["DATE_CODE"].ToString());
                }
                MESStationInput I3   = Station.Inputs.Find(t => t.DisplayName == "Lot_Code");
                List <object>   ret3 = I3.DataForUse;
                if (I3 != null)
                {
                    ret3.Add(tr["LOT_CODE"].ToString());
                }
                Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 從輸入加載RootCause
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input">RootCause輸入值轉換為大寫</param>
        /// <param name="Paras">ErrorCode</param>
        public static void RootCauseDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            string RootCauseInput = Input.Value.ToString();// = Station.StationSession[0].Value.ToString();
            //Modify by LLF 2018-02-03
            //MESStationSession strInput = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //if (strInput == null)
            //{
            //    //Station.AddMessage("MES00000076", new string[] { "Sn", Sn }, MESReturnView.Station.StationMessageState.Fail);
            //}
            //else
            //{
            //    RootCauseInput = strInput.Value.ToString();
            //}
            //string strSql = $@"SELECT * FROM C_ERROR_CODE WHERE ERROR_CODE = '{RootCauseInput.Replace("'", "''")}'";
            //OleDbParameter[] paramet = new OleDbParameter[] { new OleDbParameter(":RootCause", RootCauseInput) };
            //DataTable res = Station.SFCDB.ExecuteDataTable(strSql, CommandType.Text, paramet);
            MESStationSession ErrorCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            T_C_ERROR_CODE Obj_C_ERROR_CODE = new T_C_ERROR_CODE(Station.SFCDB, DB_TYPE_ENUM.Oracle);
            C_ERROR_CODE   ObjErrorCode     = Obj_C_ERROR_CODE.GetByErrorCode(RootCauseInput, Station.SFCDB);

            if (ObjErrorCode == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000142", new string[] { RootCauseInput }));
            }
            else
            {
                ErrorCode.Value = RootCauseInput;
                Station.Inputs[Station.Inputs.Count - 1].Value = ObjErrorCode.ENGLISH_DESCRIPTION.ToString();
            }
            //Modify by LLF 2018-02-03
            //if (res.Rows.Count <= 0)
            //{
            //    Station.NextInput = Input;
            //    Station.AddMessage("MES00000007", new string[] { "RootCause", RootCauseInput }, MESReturnView.Station.StationMessageState.Fail);
            //}
            //else
            //{
            //    MESStationSession ErrorCode = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);
            //    if (ErrorCode == null)
            //    {
            //        ErrorCode = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input };
            //        Station.StationSession.Add(ErrorCode);
            //    }
            //    ErrorCode.Value = RootCauseInput;
            //}
        }
Esempio n. 14
0
        public static void LoadSn(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

            string NewSN = Input.Value.ToString();

            if (NewSN.Length != 8 && NewSN.Length != 9)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000022", new string[] { "SN" }));
            }
            else
            {
                Input.Value = NewSN.Substring(0, 8);
            }
            MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (s == null)
            {
                s = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(s);
            }
        }
Esempio n. 15
0
        public static void loaderBox(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession PackNoSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);


            T_R_PACKING t_R_PACKING = new T_R_PACKING(Station.SFCDB, DB_TYPE_ENUM.Oracle);


            List <R_PACKING> list = new List <R_PACKING>();

            if (Input.Value != null)
            {
                list = t_R_PACKING.GetListPackByPackno((string)Input.Value, Station.SFCDB);
                if (list.Count > 0)
                {
                    PackNoSession = new MESStationSession()
                    {
                        MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input, Value = list[0]
                    };
                }

                Station.StationSession.Add(PackNoSession);
            }
        }
Esempio n. 16
0
        //計數器初始化
        public static void CounterInitDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession CounterSavePoint = Station.StationSession.Find(t => t.MESDataType == "COUNT" && t.SessionKey == "1");

            if (CounterSavePoint == null)
            {
                CounterSavePoint = new MESStationSession()
                {
                    MESDataType = "COUNT", InputValue = Input.Value.ToString(), SessionKey = "1", ResetInput = Input
                };
                Station.StationSession.Add(CounterSavePoint);
            }
            //CounterSavePoint.Value = Paras.Find(p => p.SESSION_TYPE == "COUNT").VALUE;
            R_Station_Action_Para para = Paras.Where(p => p.SESSION_TYPE == "COUNT").FirstOrDefault();

            if (para == null)
            {
                CounterSavePoint.Value = 0;
            }
            else
            {
                CounterSavePoint.Value = int.Parse(Paras.Where(p => p.SESSION_TYPE == "COUNT").FirstOrDefault().VALUE);
            }
            Station.AddMessage("MES00000029", new string[] { "COUNT", "InitCount" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }
Esempio n. 17
0
        public static void SkuDataLoader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            MESStationSession s = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            try
            {
                MESDBHelper.OleExec ole = Station.SFCDB;
                sku     = sku.Init(Input.Value.ToString(), ole, MESDataObject.DB_TYPE_ENUM.Oracle);
                s.Value = sku;
                Station.AddMessage("MES00000029", new string[] { "Skuno", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch
            {
                //Station.AddMessage("MES00000052", new string[] { "Skuno"+ ":"+ Input.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { "Skuno" + ":" + Input.Value.ToString() }));
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 檢查棧板或卡通是否關閉
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackCloseStatus(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

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

            if (sessionPackObject == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            if (sessionPackObject.Value == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            try
            {
                LogicObject.Packing packObject = (LogicObject.Packing)sessionPackObject.Value;
                if (packObject.ClosedFlag == "0")
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180611104338", new string[] { packObject.PackNo }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 棧板或卡通是否存在
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void CheckPackingIsExist(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 1)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000057", new string[] { }));
            }

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

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

            T_R_PACKING t_r_packing = new T_R_PACKING(Station.SFCDB, Station.DBType);

            if (!t_r_packing.PackNoIsExist(sessionPackObject.Value.ToString(), Station.SFCDB))
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180613093329", new string[] { sessionPackObject.Value.ToString() }));
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 1.檢查SN 在r_repair_failcode 表中是否已经维修完成
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void SNFailCodeReapirDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            T_R_REPAIR_FAILCODE   RepairFailcode = new T_R_REPAIR_FAILCODE(Station.SFCDB, Station.DBType);
            Row_R_REPAIR_FAILCODE FailCodeRow;

            if (Paras.Count != 1)
            {
                throw new Exception("參數數量不正確!");
            }
            MESStationSession SNFailCodeSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SNFailCodeSession == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].SESSION_KEY }));
            }
            else
            {
                if (SNFailCodeSession.Value != null)
                {
                    FailCodeRow = RepairFailcode.GetByFailCodeID(SNFailCodeSession.Value.ToString(), Station.SFCDB);
                    if (FailCodeRow == null)
                    {
                        throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000192", new string[] {  }));
                    }
                }
                else
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[0].SESSION_TYPE + Paras[0].VALUE }));
                }
            }
        }
Esempio n. 21
0
        ///Add by LLF 2018-01-28 AOI1&AOI2,Print1&Print2,VI1&VI2  工站可以相互轉換
        public static void ChangeCurrentStationDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            string StrStation       = Paras[0].VALUE.ToString();
            string StrChangeStation = Paras[1].VALUE.ToString();

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

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

            List <string> ListNextStation = new List <string>();

            ListNextStation = (List <string>)NextStationSession.Value;

            if (Station.StationName == StrStation && Station.StationName != StrChangeStation && ListNextStation.Contains(StrChangeStation))
            {
                Station.StationName = StrChangeStation;
            }
            else if (Station.StationName == StrChangeStation && Station.StationName != StrStation && ListNextStation.Contains(StrStation))
            {
                Station.StationName = StrStation;
            }

            Station.AddMessage("MES00000001", new string[] { }, MESReturnView.Station.StationMessageState.Pass);
        }
Esempio n. 22
0
        /// <summary>
        /// 從SN對象LOADER BACK STATION
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void GetBackStationDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }
            MESStationSession SnSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            //MESStationSession SnSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);
            //if (SnSession == null)
            //{
            //    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY }));
            //}
            //SN ObjSn = (SN)Input.Value;
            //try
            //{

            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
Esempio n. 23
0
        public static void PanelVitualSNDataloader(MESStationBase Station, MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string     PanelSN  = "";
            SN         SNObj    = new SN();
            R_PANEL_SN PanelObj = null;

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

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

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

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

            VirtualSN.InputValue = Input.Value.ToString();
            VirtualSN.ResetInput = Input;
            PanelSN         = PANEL.InputValue.ToString();
            PanelObj        = SNObj.GetPanelVirtualSN(PanelSN, Station.SFCDB, DB_TYPE_ENUM.Oracle);
            VirtualSN.Value = PanelObj;
        }
Esempio n. 24
0
        /// <summary>
        /// add by fgg 2018.05.12
        /// 工單類型檢查
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void WOTypeDataChecker(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            OleExec sfcdb = Station.SFCDB;

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

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

            try
            {
                WorkOrder objWorkorder = new WorkOrder();
                objWorkorder = (WorkOrder)sessionWO.Value;
                if (objWorkorder.WO_TYPE.Equals("REWORK"))
                {
                    throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000249", new string[] { objWorkorder.WorkorderNo, objWorkorder.WO_TYPE }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// 獲取Panel未分板數量
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void PanelNoBIPQtyDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            Panel        PanelObj   = new Panel();
            T_R_PANEL_SN TablePanel = new T_R_PANEL_SN(Station.SFCDB, Station.DBType);

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

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

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

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

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

            int PanelNoBipQty = TablePanel.PanelNoBIPQty(PanelObj.PanelNo, Station.SFCDB, Station.DBType);

            PanelNoBIPQtySession.Value = PanelNoBipQty;
        }
Esempio n. 26
0
        public static void PanelNoToSelectDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            Panel             PanelObj     = new Panel();
            MESStationSession PanelSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            string InputName = Paras[1].VALUE;

            var input = Station.Inputs.Find(t => t.DisplayName == InputName);

            input.DataForUse.Clear();
            var sns = PanelObj.GetSnDetail(PanelObj.PanelNo, Station.SFCDB, DB_TYPE_ENUM.Oracle);

            input.DataForUse.Add("");
            for (int i = 0; i < sns.Count; i++)
            {
                input.DataForUse.Add(sns[i].SN);
            }
            //input.RefershType = "EveryTime";
        }
Esempio n. 27
0
        /// <summary>
        /// Sn條碼長度如果是9位,則取前8位
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void LoadSnFromInput(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count == 0)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }

            string NewSN = Input.Value.ToString();

            if (NewSN.Length != 8 && NewSN.Length != 9)
            {
                // Station.AddMessage("MES00000022", new string[] { "SN" }, MESReturnView.Station.StationMessageState.Fail);
                //Station.NextInput = Station.Inputs[2];
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000022", new string[] { "SN" }));
            }
            else
            {
                Input.Value = NewSN.Substring(0, 8);
            }


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

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


            //if (Input.Value.ToString().Length == 8)
            //{
            //    //Station.AddMessage("MES00000029", new string[] { "Sn", Input.Value.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            //    //Station.NextInput = Station.Inputs[1];
            //}
            //else if (NewSN)
            //{
            //    Station.AddMessage("MES00000029", new string[] { "LinkQTY", LinkNum.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            //    Station.NextInput = Station.Inputs[1];
            //}
            //else
            //{
            //    Station.AddMessage("MES00000020", new string[] { "LinkQTY", "Number" }, MESReturnView.Station.StationMessageState.Message);
            //    Station.NextInput = Station.Inputs[3];
            //}
            //Station.NextInput = Station.Inputs[2];
            ////Station.DBS["APDB"].Borrow()
            //LogicObject.WorkOrder WO = new LogicObject.WorkOrder();
            //WO.WO = Input.Value.ToString();
            //s.Value = WO;
            //s.InputValue = Input.Value.ToString();
            //s.ResetInput = Input;
            //Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESReturnView.Station.StationMessageState.Message);
            //Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            //Station.AddMessage("MES00000029", new string[] { "Workorder", WO.ToString() }, MESReturnView.Station.StationMessageState.Fail);
        }
Esempio n. 28
0
        //Add by LLF 2017-01-26 Begin
        public static void TrCodeDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string  Process = "";
            string  Message = "";
            string  StrWO   = "";
            string  StrCode = "";
            string  IP      = string.Empty;
            OleExec APDB    = null;

            Dictionary <string, DataRow> TrSnTable = null;
            T_R_SN Table = new T_R_SN(Station.SFCDB, Station.DBType);

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

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

            //獲取 TRSN 對象
            MESStationSession TrSnSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (TrSnSession == null)
            {
                Message = MESReturnMessage.GetMESReturnMessage("MES00000052", new string[] { Paras[1].SESSION_TYPE + Paras[1].SESSION_KEY });
                throw new MESReturnMessage(Message);
            }
            TrSnTable = (Dictionary <string, DataRow>)TrSnSession.Value;

            Process = Paras[2].VALUE.ToString();

            IP = Paras[3].VALUE.ToString();

            try
            {
                APDB    = Station.APDB;
                StrCode = Table.GetAPTrCode(StrWO, TrSnTable["R_TR_SN"]["TR_SN"].ToString(), Process, Station.LoginUser.EMP_NO, IP, APDB);


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

                TrCodeSession.Value = StrCode;
                Station.AddMessage("MES00000001", new string[] { TrCodeSession.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// 1.檢查输入的Location位置是否是在数据库中存在,不存在则报错
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras">1個參數,WO保存的位置</param>
        public static void ReapirLocationDatachecker(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            OleExec       apdb         = null;
            List <string> LocationList = new List <string>();

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

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

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

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

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

            //獲取ALLPART數據
            AP_DLL          APDLL = new AP_DLL();
            MESStationInput I     = Station.Inputs.Find(t => t.DisplayName == "Location");
            List <object>   ret   = I.DataForUse;

            ret.Clear();
            try
            {
                apdb         = Station.DBS["APDB"].Borrow();
                LocationList = APDLL.CheckLocationExist(ObjSN.SkuNo, StrLocation, apdb);
                if (LocationList.Count <= 0)
                {
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { StrLocation, ObjSN.SkuNo }));
                }
                else
                {
                    foreach (object item in LocationList)
                    {
                        ret.Add(item);
                    }
                }
                Station.DBS["APDB"].Return(apdb);
                Station.AddMessage("MES00000001", new string[] { }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                if (apdb != null)
                {
                    Station.DBS["APDB"].Return(apdb);
                }
                throw ex;
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 加載工站Pass下一站
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        /// add by LLF 2018-01-29
        public static void StationNextDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string            NextStation     = "";
            MESStationSession StationNextSave = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            //Marked by LLF 2018-02-22 begin
            //sn.PanelSN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            try
            {
                sn.PanelSN(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            }
            catch
            {
                sn.Load(strSn, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            }
            //Marked by LLF 2018-02-22 end

            Route              routeDetail     = new Route(sn.RouteID, GetRouteType.ROUTEID, Station.SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle);
            List <string>      snStationList   = new List <string>();
            List <RouteDetail> routeDetailList = routeDetail.DETAIL;
            RouteDetail        R = routeDetailList.Where(r => r.STATION_NAME == Station.StationName).FirstOrDefault();

            if (R == null)
            {
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MSGCODE20180724154541", new string[] { Station.StationName }));
            }

            if (routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault() == null)//當前工站為最後一個工站時
            {
                NextStation = routeDetailList.Where(r => r.SEQ_NO == R.SEQ_NO).FirstOrDefault().STATION_TYPE;
            }
            else
            {
                NextStation = routeDetailList.Where(r => r.SEQ_NO > R.SEQ_NO).FirstOrDefault().STATION_NAME;
            }

            snStationList.Add(NextStation);
            if (R.DIRECTLINKLIST != null)
            {
                foreach (var item in R.DIRECTLINKLIST)
                {
                    snStationList.Add(item.STATION_NAME);
                }
            }
            StationNextSave.Value = snStationList;
            Station.AddMessage("MES00000029", new string[] { "StationNext", "StationNextList" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
        }