Ejemplo n.º 1
0
        public static void SnSKUDataloader(MESPubLab.MESStation.MESStationBase Station, MESPubLab.MESStation.MESStationInput Input, List <MESDataObject.Module.R_Station_Action_Para> Paras)
        {
            if (Paras.Count != 2)
            {
                throw new Exception(MESReturnMessage.GetMESReturnMessage("MES00000050"));
            }
            //加載SnPoint位置
            MESStationSession SnSession = Station.StationSession.Find(t => t.MESDataType == Paras[0].SESSION_TYPE && t.SessionKey == Paras[0].SESSION_KEY);

            if (SnSession == null)
            {
                //modify by 張官軍 2018-03-15
                //根據該方法的定義:從 SN 對象加載機種對象,SnSession 不能為空
                //SnSession = new MESStationSession() { MESDataType = Paras[0].SESSION_TYPE, InputValue = Input.Value.ToString(), SessionKey = Paras[0].SESSION_KEY, ResetInput = Input };
                //Station.StationSession.Add(SnSession);
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000170"));
            }
            //加載SkunoPoint
            MESStationSession SkuSession = Station.StationSession.Find(t => t.MESDataType == Paras[1].SESSION_TYPE && t.SessionKey == Paras[1].SESSION_KEY);

            if (SkuSession == null)
            {
                SkuSession = new MESStationSession()
                {
                    MESDataType = Paras[1].SESSION_TYPE, SessionKey = Paras[1].SESSION_KEY
                };
                Station.StationSession.Add(SkuSession);
                //throw new MESReturnMessage("Skuno參數不存在");
            }

            // BY SDL 20180320  SN SnObject = (SN)SkuSession.Value;.

            SN SnObject = (SN)SnSession.Value;

            //SnObject.SerialNo

            SKU sku = new SKU();

            try
            {
                MESDBHelper.OleExec ole = Station.SFCDB;
                sku = sku.InitBySn(SnObject.SerialNo, ole, MESDataObject.DB_TYPE_ENUM.Oracle);
                SkuSession.Value = sku;
                Station.AddMessage("MES00000029", new string[] { "SN", sku.ToString() }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Pass);
            }
            catch
            {
                //Station.AddMessage("MES00000007", new string[] { "SN" }, MESPubLab.MESStation.MESReturnView.Station.StationMessageState.Fail);
                throw new MESReturnMessage(MESReturnMessage.GetMESReturnMessage("MES00000007", new string[] { "SN" }));
            }
        }