コード例 #1
0
        //Add by LLF 2018-02-19 Begin
        public static void PTHTrCodeDataloader(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.MESStationInput Input, List <R_Station_Action_Para> Paras)
        {
            string  Message       = "";
            string  StrWO         = "";
            string  StrCode       = "";
            string  StationName   = string.Empty;
            string  StrStationNum = string.Empty;
            OleExec APDB          = 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 StationNumSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

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

            StationName = Station.Line + Station.StationName + StrStationNum;
            try
            {
                APDB    = Station.APDB;
                StrCode = Table.GetAPPTHTrCode(StrWO, StationName, APDB);


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

                PTHTrSnSession.Value = StrCode;
                Station.AddMessage("MES00000001", new string[] { PTHTrSnSession.Value.ToString() }, MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }