コード例 #1
0
        public TIC_BIN_DATA GetUTICMachineNumber(string Sn)
        {
            //"TIC_EQUIP_ID" = 58
            //"TIC_EVENT_DATE" = 59
            TIC_BIN_DATA ticdata = new TIC_BIN_DATA();

            lock (_lockObject)
            {
                string returnMcNo = string.Empty;
                int    autoretry  = 1;

                while (autoretry > 0)
                {
                    try
                    {
                        FisSession ses = _server.FisSessions();
                        ses.UnitType = FisApiServer.UNIT_HGA;

                        if (Sn == string.Empty)
                        {
                            Sn = "";
                        }

                        Recordset rec = ses.RequestRecordset(FisSession.REQUEST_ATTRIBUTE, Sn, "NA");
                        if (rec.RecordCount() > 0)
                        {
                            bool end                 = false;
                            bool isEquipfound        = false;
                            bool isEventDataFound    = false;
                            bool isDockSideDataFound = false;

                            rec.MoveTo(15);

                            while (!rec.Eof() && !end)
                            {
                                if (rec.Fields(rec.GetColumnName(0)).Value.ToUpper().Equals(TIC_BIN_DATA.TIC_PARAM_BIN.TIC_EQUIP_ID.ToString()))
                                {
                                    ticdata.EQUIP_ID = rec.Fields(rec.GetColumnName(1)).Value;
                                    isEquipfound     = true;
                                }
                                else if (rec.Fields(rec.GetColumnName(0)).Value.ToUpper().Equals(TIC_BIN_DATA.TIC_PARAM_BIN.TIC_EVENT_DATE.ToString()))
                                {
                                    ticdata.EVENT_DATE = rec.Fields(rec.GetColumnName(1)).Value;
                                    isEventDataFound   = true;
                                }
                                else if (rec.Fields(rec.GetColumnName(0)).Value.ToUpper().Equals(TIC_BIN_DATA.TIC_PARAM_BIN.DOCKSIDE.ToString()))
                                {
                                    ticdata.DOCK_SIDE   = rec.Fields(rec.GetColumnName(1)).Value;
                                    isDockSideDataFound = true;
                                    rec.MoveTo(50);
                                }
                                if (isEquipfound && isEventDataFound && isDockSideDataFound)
                                {
                                    rec.MoveLast();
                                    rec.Eof();
                                    end       = true;
                                    autoretry = 0;
                                }
                                else
                                {
                                    rec.MoveNext();
                                }
                                Thread.Sleep(10);
                            }
                        }
                        ses.CloseSession();
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    autoretry--;
                }
                return(ticdata);
            }
        }