Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
        /// HWD PTH Allpart扣料,add by LLF 2018-02-19

        /// <summary>
        /// 更新TR_SN數據加載,查詢R_TR_SN,R_TR_SN_WIP的數據保存到Dictionary<string_Datarow>中,key為表名 "R_TR_SN","R_TR_SN_WIP"
        /// </summary>
        /// <param name="Station"></param>
        /// <param name="Input"></param>
        /// <param name="Paras"></param>
        public static void TRSNDataSessionUpdateAction(MESStation.BaseClass.MESStationBase Station, MESStation.BaseClass.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;
            int     LinkQty    = 0;
            int     TrSNExtQty = 0;

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

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

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

            strTRSN = TRSN_Session.InputValue.ToString();

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

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

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

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

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

            if (LinkQty_Session != null)
            {
                int.TryParse(LinkQty_Session.Value.ToString(), out LinkQty);
            }

            //獲取ALLPART數據
            AP_DLL APDLL = new AP_DLL();

            try
            {
                apdb = Station.APDB;

                List <DataRow> TRSNWIPlist = APDLL.R_TR_SN_WIP_GetBYTR_SN(strTRSN, apdb);
                if (TRSNWIPlist.Count > 0)
                {
                    TRSNExtQty_Session.Value = TRSNWIPlist[0]["EXT_QTY"];
                    TRSNPcbSku_Session.Value = TRSNWIPlist[0]["KP_NO"];
                }
                else
                {
                    TRSNExtQty_Session.Value = 0;
                }

                //Station.DBS["APDB"].Return(apdb);

                int.TryParse(TRSNExtQty_Session.Value.ToString(), out TrSNExtQty);
                if (TrSNExtQty < LinkQty)
                {
                    MESStationInput StationInput = Station.Inputs.Find(t => t.DisplayName == "TR_SN");
                    StationInput.Enable = true;
                    Station.NextInput   = StationInput;
                }
            }
            catch (Exception ex)
            {
                if (apdb != null)
                {
                    //Station.DBS["APDB"].Return(apdb);
                }
                throw ex;
            }
        }