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(); })); } //} }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void but_save_Click(object sender, EventArgs e) { int bindOneselfNum = 0; for (int i = 0; i < dgv_01.Rows.Count; i++) { if (dgv_01.Rows[i].Cells["ca_type"].Value.ToString() == "1") { bindOneselfNum++; } } //判断绑定数量,排除自身已经绑定的器械 if (dgv_01.RowCount > int.Parse(tb_iNumber.Text) - int.Parse(tb_rNumber.Text) + bindOneselfNum) { if (MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("saveTooMuch", EnumPromptMessage.warning, new string[] { "RFID" }), "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK) { rfidCode.DicAddData(_uRfid, 2); _uRfid.Clear(); dgv_01.Rows.Clear(); return; } return; } for (int i = 0; i < dgv_01.RowCount; i++) { if (dgv_01.Rows[i].Cells["ca_type"].Value.ToString() == "3" || dgv_01.Rows[i].Cells["ca_type"].Value.ToString() == "2") { if (MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("alreadyEexist", EnumPromptMessage.warning, new string[] { "RFID" }), "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK) { rfidCode.DicAddData(_uRfid, 2); _uRfid.Clear(); dgv_01.Rows.Clear(); return; } return; } } CnasRemotCall remoteClient = new CnasRemotCall(); SortedList condition = new SortedList(); for (int i = 0; i < dgv_01.Rows.Count; i++) { if (dgv_01.Rows[i].Cells["ca_type"].Value.ToString() == "1") { continue; } SortedList sltmp01 = new SortedList(); sltmp01.Add(1, set_id); sltmp01.Add(2, set_code); sltmp01.Add(3, dgv_01.Rows[i].Cells["RFID"].Value.ToString()); sltmp01.Add(4, CnasBaseData.UserID); sltmp01.Add(5, instruments_id); condition.Add(i + 1, sltmp01); // string sql = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-set-rfid-mapping-add001", sltmp, null); //int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-set-rfid-mapping-add001", sltmp, null); //if (recint > -1) //{ // MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "RFID" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); // this.Close(); //} } if (condition.Count > 0) { //string testSql = remoteClient.RemotInterface.CheckUPDataList("HCS-set-rfid-mapping-add001", condition); int result = remoteClient.RemotInterface.UPDataList("HCS-set-rfid-mapping-add001", condition); if (result > 0) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "RFID" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } //selBindingRFID(); //repeatData = LoadRepeatRfidTable(); //repeatRFID = LoadRepeatRfid(); }