示例#1
0
        public MESServiceRes PassTestStation_Test(string WO, string SN, string STATION, string TESTLINE)
        {
            CallWebService c = new CallWebService(VertivSfbDbPool, VertivApDbPool);

            resObj = new MESServiceRes {
                Message = "", Statusvalue = (int)StatusValue.success, MessageCode = ""
            };
            MESStationReturn s = new MESStationReturn();

            try
            {
                #region StationPara setting
                StationPara sp = new StationPara {
                    Station = STATION, Line = TESTLINE, Bu = "VERTIV"
                };
                #endregion

                #region InitStation
                c.InitStation(s, sp);
                #endregion

                #region Setting Inputs Value
                MESPubLab.MESStation.MESReturnView.Station.CallStationReturn ret = (MESPubLab.MESStation.MESReturnView.Station.CallStationReturn)s.Data;
                ret.Station.Inputs[0].Value = "002328000011";
                #endregion

                #region Doing Inputs Events
                c.StationInput(s, "PASS", "WO");
                ret.Station.Inputs[1].Value = SN;
                c.StationInput(s, "PASS", "SN");
                #endregion

                #region setting run results
                foreach (var stationRes in ret.Station.StationMessages)
                {
                    if (stationRes.State == StationMessageState.Fail)
                    {
                        resObj = new MESServiceRes {
                            Message = stationRes.Message, Statusvalue = (int)StatusValue.fail, MessageCode = "MES00011"
                        };
                        break;
                    }
                }
                #endregion
            }
            catch (Exception e)
            {
                resObj = new MESServiceRes {
                    Message = s.Message, Statusvalue = (int)StatusValue.fail, MessageCode = "MES00012"
                };
            }

            return(resObj);
        }
示例#2
0
        public MESStationReturn InitStation(MESPubLab.MESStation.MESStationReturn StationReturn, StationPara sp)
        {
            MESReturnMessage.SetSFCDBPool(this.DBPools["SFCDB"]);
            //string Token = requestValue["Token"]?.ToString();
            OleExec SFCDB = this.DBPools["SFCDB"].Borrow();

            //OleExec SFCDB = new OleExec("VERTIVTESTDB", true);
            try
            {
                MESStationBase retStation = retStation = new MESStationBase();

                retStation.StationOutputs.Clear();
                retStation.StationMessages.Clear();
                retStation.StationSession.Clear();
                retStation.DisplayOutput.Clear();
                retStation.Inputs.Clear();
                retStation.IP = this.IP;

                //add by 張官軍 2018-1-4 不添加的話,後面獲取該信息的時候回傳空
                User User = new User();
                User.EMP_NO          = "Webservice";
                User.EMP_NAME        = "Webservice";
                retStation.LoginUser = User;
                //給工站對象賦公共值
                retStation.Init(sp.Station, sp.Line, sp.Bu, SFCDB);
                MESPubLab.MESStation.MESReturnView.Station.CallStationReturn ret = new MESPubLab.MESStation.MESReturnView.Station.CallStationReturn();
                ret.Station = retStation;
                //用以執行InitInput.Run()  2018/01/30 SDL
                retStation.SFCDB = SFCDB;
                //調用工站初始配置
                MESStationInput InitInput = retStation.Inputs.Find(t => t.Name == "StationINIT");
                if (InitInput != null)
                {
                    InitInput.Run();
                    retStation.Inputs.Remove(InitInput);
                }
                if (retStation.FailStation != null)
                {
                    InitInput = null;
                    InitInput = retStation.FailStation.Inputs.Find(t => t.Name == "StationINIT");
                    if (InitInput != null)
                    {
                        InitInput.Run();
                        retStation.FailStation.Inputs.Remove(InitInput);
                    }
                }

                StationReturn.Data    = ret;
                StationReturn.Status  = StationReturnStatusValue.Pass;
                StationReturn.Message = "Station '" + sp.Station + "'Init successfull.";
            }
            catch (Exception ee)
            {
                StationReturn.Data    = null;
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = "Station '" + sp.Station + "'Init Fail! " + ee.Message;
                throw ee;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(SFCDB);
            }
            return(StationReturn);
        }