public void SendS6F3(string EQPID, string LOTID, string CSTID, string GLSID, string TYPE, string DATA)
 {
     foreach (CHSMS oHSMS in HSMSCollection.Values)
     {
         if (oHSMS.CurrentState == HsmsStateConst.Selected)
         {
             oHSMS.S6F3.LOT_ID(LOTID);
             oHSMS.S6F3.CST_ID(CSTID);
             oHSMS.S6F3.GLASS_ID(GLSID);
             oHSMS.S6F3.TYPE(TYPE);
             oHSMS.S6F3.DATA(DATA);
             oHSMS.S6F3.Send();
         }
         else
         {
             //Queuing
             CLamiSendData oData = new CLamiSendData();
             oData.EQPID = EQPID;
             oData.LOTID = LOTID;
             oData.CSTID = CSTID;
             oData.GLSID = GLSID;
             oData.TYPE  = TYPE;
             oData.DATA  = DATA;
             oData.HSMS  = oHSMS;
             _waitQueue.Enqueue(oData);
         }
     }
 }
        private void DoWork()
        {
            while (true)
            {
                if (_waitQueue.Count == 0)
                {
                    if (_isEnd)
                    {
                        return;
                    }
                }
                else if (_waitQueue.Count > 0)
                {
                    lock (_thisLock)
                    {
                        CLamiSendData oSendData = _waitQueue.Dequeue();
                        if (oSendData.HSMS.CurrentState == HsmsStateConst.Selected)
                        {
                            SendS6F3(oSendData.EQPID, oSendData.LOTID, oSendData.CSTID, oSendData.GLSID, oSendData.TYPE, oSendData.DATA, oSendData.HSMS);
                        }
                        else
                        {
                            _waitQueue.Enqueue(oSendData);
                        }

                        Thread.Sleep(100);
                    }
                }

                if (_isEnd == false)
                {
                    Thread.Sleep(100);
                }
            }
        }