private void AddInstrumentData(Dictionary <string, string> dic, RFIDCommand cmd = RFIDCommand.Datas)
 {
     if (cmd != RFIDCommand.Datas)
     {
         return;
     }
     //lock (lockMyObj)
     //{
     if (dic != null && dic.Count > 0 && _isShow)
     {
         this.BeginInvoke(new Action(() =>
         {
             isChanged       = !isChanged;
             string iconName = isChanged ? "mGreenLight50" : "mRedLight50";
             lightBox.Image  = ResourcesImageHelper.Instance.GetResourcesImage("Common.Buttom.WorkSpace", iconName, EnumImageType.PNG);
             InitNewRfidDataDic(dic);
             CheckInInstrumentData(_newRfid);
             if (_illegalRfid.Count > 0)
             {
                 MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("warnRFIDData ", EnumPromptMessage.warning), "信息提示", MessageBoxButtons.OK);
                 rfidCode.DicAddData(_illegalRfid, 2);
             }
             _new_uRfid   = new Dictionary <string, string>();
             _newRfid     = new Dictionary <string, string>();
             _illegalRfid = new Dictionary <string, string>();
             rfidCode.SetTagToZero();
         }));
     }
     //}
 }
        private void AddInstrumentData(Dictionary <string, string> dic, RFIDCommand cmd = RFIDCommand.Datas)
        {
            if (cmd != RFIDCommand.Datas)
            {
                return;
            }
            if (dic != null && dic.Count > 0 && IsShow)
            {
                this.BeginInvoke(new Action(() =>
                {
                    InitNewRfidDataDic(dic);

                    foreach (string key in _newRfid.Keys)
                    {
                        int repeat = 0;
                        for (int i = 0; i < dgv_01.RowCount; i++)
                        {
                            if (key == dgv_01.Rows[i].Cells["RFID"].Value.ToString())
                            {
                                repeat++;
                            }
                        }
                        if (repeat == 0)//判断是否重复,大于0代表重复
                        {
                            bool Isrepeat           = true;
                            GridViewRowInfo row     = dgv_01.Rows.AddNew();
                            row.Cells["id"].Value   = dgv_01.RowCount;
                            row.Cells["RFID"].Value = key;
                            if (!_uRfid.ContainsKey(key))
                            {
                                _uRfid.Add(key, string.Empty);
                            }
                            if (repeatData != null)
                            {
                                DataRow[] secData = repeatData.Select("set_id=" + set_id);
                                for (int i = 0; i < secData.Length; i++)
                                {
                                    if (key == secData[i]["RFID"].ToString())
                                    {
                                        if (secData[i]["instrument_id"].ToString() == instruments_id)
                                        {
                                            row.Cells["repeat"].Value  = "已与本包本器械做绑定";
                                            row.Cells["ca_type"].Value = 1;
                                            Isrepeat = false;
                                            break;
                                        }
                                        else
                                        {
                                            row.Cells["repeat"].Value           = "已与本包其他器械做绑定";
                                            row.Cells["ca_type"].Value          = 2;
                                            row.Cells["repeat"].Style.ForeColor = Color.Red;
                                            Isrepeat = false;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        Isrepeat = true;
                                    }
                                }
                                if (Isrepeat)
                                {
                                    bool isReapt = repeatRFID.Contains(key);//判断这个RFID是否绑定过了
                                    if (isReapt == true)
                                    {
                                        row.Cells["repeat"].Value           = "已被其他包绑定";
                                        row.Cells["ca_type"].Value          = 3;
                                        row.Cells["repeat"].Style.ForeColor = Color.Red;
                                    }
                                    else
                                    {
                                        row.Cells["repeat"].Value  = "未绑定";
                                        row.Cells["ca_type"].Value = 4;
                                    }
                                }
                            }
                            else
                            {
                                row.Cells["repeat"].Value  = "未绑定";
                                row.Cells["ca_type"].Value = 4;
                            }
                        }
                    }
                    _newRfid = new Dictionary <string, string>();
                    rfidCode.SetTagToZero();
                }));
            }
            //}
        }