Exemplo n.º 1
0
        /// <summary>
        /// 維修輸入加載TR_SN的DataRow對象,并把KP_NO,MFR_Name,Date_Code,Lot_Code到加載到對應輸入框的值
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void RepairTRSNObjDataLoader(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"));
            }
            string            inputValue  = Input.Value.ToString();
            MESStationSession sessionTRSN = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (sessionTRSN == null)
            {
                sessionTRSN = new MESStationSession()
                {
                    MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input
                };
                Station.StationSession.Add(sessionTRSN);
            }
            try
            {
                AP_DLL         APDLL    = new AP_DLL();
                List <DataRow> TRSNlist = APDLL.R_TR_SN_GetBYTR_SN(inputValue, Station.APDB);
                if (TRSNlist.Count == 0)
                {
                    Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value     = "";
                    Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value  = "";
                    Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = "";
                    Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value  = "";
                    Station.Inputs.Find(input => input.DisplayName == "TR_SN").Value     = "";
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + inputValue, "R_TR_SN" }));
                }
                else
                {
                    Station.Inputs.Find(input => input.DisplayName == "KP_NO").Value     = TRSNlist[0]["CUST_KP_NO"].ToString();
                    Station.Inputs.Find(input => input.DisplayName == "MFR_Name").Value  = TRSNlist[0]["MFR_KP_NO"].ToString();
                    Station.Inputs.Find(input => input.DisplayName == "Date_Code").Value = TRSNlist[0]["DATE_CODE"].ToString();
                    Station.Inputs.Find(input => input.DisplayName == "Lot_Code").Value  = TRSNlist[0]["Lot_Code"].ToString();
                    Dictionary <string, DataRow> TRSNInfo = new Dictionary <string, DataRow>();
                    TRSNInfo.Add("TR_SN", TRSNlist[0]);
                    sessionTRSN.Value      = TRSNlist[0];
                    sessionTRSN.InputValue = inputValue;
                    sessionTRSN.ResetInput = Input;
                    Station.NextInput      = Station.Inputs.Find(input => input.DisplayName == "Description");
                    Station.AddMessage("MES00000001", new string[] { inputValue }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// TR_SN數據加載,查詢R_TR_SN,R_TR_SN_WIP的數據保存到Dictionary<string_Datarow>中,key為表名 "R_TR_SN","R_TR_SN_WIP"
        /// 2018/1/3 肖倫
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void TRSNDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            Dictionary <string, DataRow> APInfo = new Dictionary <string, DataRow>();
            string  strTRSN    = "";
            string  ErrMessage = "";
            OleExec apdb       = null;

            if (Paras.Count != 1)
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000057");
                throw new MESReturnMessage(errMsg);
            }

            strTRSN = Input.Value.ToString();
            MESStationSession TRSN_Session = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

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

            //獲取ALLPART數據
            APInfo = new Dictionary <string, DataRow>();
            AP_DLL APDLL = new AP_DLL();

            try
            {
                apdb = Station.APDB;
                List <DataRow> TRSNlist = APDLL.R_TR_SN_GetBYTR_SN(strTRSN, apdb);
                if (TRSNlist.Count <= 0)
                {
                    //throw new Exception("TRSN:" + "不存在ALLPART系統R_TR_SN中");
                    throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + strTRSN, "R_TR_SN" }));
                }
                else
                {
                    APInfo.Add("R_TR_SN", TRSNlist[0]);
                }
                List <DataRow> TRSNWIPlist = APDLL.R_TR_SN_WIP_GetBYTR_SN(strTRSN, apdb);
                if (TRSNWIPlist.Count <= 0)
                {
                    //throw new Exception("TRSN:" + "不存在ALLPART系統R_TR_SN_WIP中");
                    //throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000072", new string[] { "TRSN:" + strTRSN, "R_TR_SN_WIP" }));
                    APInfo.Add("R_TR_SN_WIP", null);
                }
                else
                {
                    APInfo.Add("R_TR_SN_WIP", TRSNWIPlist[0]);
                }
                TRSN_Session.Value = APInfo;

                Station.AddMessage("MES00000001", new string[] { TRSN_Session.Value.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch (Exception ex)
            {
                if (apdb != null)
                {
                }
                throw ex;
            }
        }