void DataParse_OnReceiveBoxData(string BN_NO, LogInfo.ReceiveDataType iType, string data, bool bFront) { if (iType == LogInfo.ReceiveDataType.指静脉数据_传输) { SetLog(BN_NO + "," + iType.ToString() + "," + data); if (data == "当前设备已经准备好接受指静脉模板数据") { iState = 1; } else if (data == "本次数据传输验证成功") { iState = 1; } else if (data == "error") { iState = 0; } } if (iType == LogInfo.ReceiveDataType.指静脉数据_写入) { SetLog(BN_NO + "," + iType.ToString() + "," + data); if (data == "写特征数据成功") { iState = 1; } else if (data == "写特征数据失败") { iState = 0; } } if (iType == LogInfo.ReceiveDataType.指静脉数据_验证) { SetLog(BN_NO + ",指静脉数据_验证,UserId:" + data); } }
void DataParse_OnReceiveBoxData(string BN_NO, LogInfo.ReceiveDataType iType, string data, bool bFront) { if (this.InvokeRequired) { BoxDataParse.d_ReceiveBoxData d = new BoxDataParse.d_ReceiveBoxData(DataParse_OnReceiveBoxData); this.Invoke(d, new object[] { BN_NO, iType, data, bFront }); return; } if (iType != LogInfo.ReceiveDataType.主箱连接 && iType != LogInfo.ReceiveDataType.主箱连接_Version) { string gBN = BN_NO.Substring(0, 5); SetLogText(BN_NO + "\t" + iType.ToString() + "\t外侧:" + bFront.ToString() + "\t" + data); if (bInBllTest) { #region 业务测试 if (iType == LogInfo.ReceiveDataType.光电 && (BN_NO.Substring(5) == "00" || BN_NO.Substring(5) == "98")) { if (!m_Group.ContainsKey(gBN)) { GroupStatus g = new GroupStatus(); m_Group.Add(gBN, g); } if (data == "触发光电遮挡") { if (!m_Group[gBN].m_ChuFaGD && m_Group[gBN].m_Idle && Environment.TickCount - m_Group[gBN].m_CurrentDT > 5000) { BoxDataParse.DataParse.CmdBoxScan(BN_NO, true, bFront); m_Group[gBN].m_CurrentDT = Environment.TickCount; } m_Group[gBN].m_ChuFaGD = true; } else if (data == "触发光电未遮挡") { m_Group[gBN].m_ChuFaGD = false; } } else if (iType == LogInfo.ReceiveDataType.条码信息 && data != "") { #region 条码信息 BoxDataParse.DataParse.CmdBoxScan(BN_NO, false, bFront); if (BN_NO.Substring(5) == "00") { int count = 0; if (m_BoxCount.ContainsKey(BN_NO)) { count = m_BoxCount[BN_NO]; } else { m_BoxCount.Add(BN_NO, count); } BoxDataParse.DataParse.CmdPreGetLetter(BN_NO, 1, 5, count, bFront); if (!m_Group.ContainsKey(gBN)) { GroupStatus gs = new GroupStatus(); m_Group.Add(gBN, gs); } m_Group[gBN].m_Idle = false; m_Group[gBN].m_ChuFaGD = false; } else { foreach (ListViewItem it in lv_Select.Items) { if (it.Text.Substring(0, 5) == BN_NO.Substring(0, 5) && it.Text.Substring(5) != "98") { int count = 0; if (m_BoxCount.ContainsKey(BN_NO)) { count = m_BoxCount[BN_NO]; } else { m_BoxCount.Add(BN_NO, count); } BoxDataParse.DataParse.CmdPreGetLetter(it.Text, 0, 5, count, bFront); if (!m_Group.ContainsKey(gBN)) { GroupStatus gs = new GroupStatus(); m_Group.Add(gBN, gs); } m_Group[gBN].m_Idle = false; m_Group[gBN].m_ChuFaGD = false; } } } #endregion } else if (iType == LogInfo.ReceiveDataType.投件投入) { #region 投件投入 int count = 1; if (m_BoxCount.ContainsKey(BN_NO)) { m_BoxCount[BN_NO]++; count = m_BoxCount[BN_NO]; } else { m_BoxCount.Add(BN_NO, count); } if (m_Group.ContainsKey(gBN)) { m_Group[gBN].m_Idle = true; } foreach (ListViewItem it in lv_Select.Items) { if (it.Text.Substring(0, 5) == gBN) { count = 0; if (m_BoxCount.ContainsKey(it.Text)) { count = m_BoxCount[it.Text]; } BoxDataParse.DataParse.CmdBoxLED(it.Text, 1, count, LogInfo.enum_LedColor.绿色, bFront); BoxDataParse.DataParse.CmdBoxToIdle(it.Text, bFront); } } #endregion } else if (iType == LogInfo.ReceiveDataType.投件抽出) { #region 投件抽出 if (m_Group.ContainsKey(gBN)) { m_Group[gBN].m_Idle = true; } foreach (ListViewItem it in lv_Select.Items) { if (it.Text.Substring(0, 5) == gBN) { int count = 0; if (m_BoxCount.ContainsKey(it.Text)) { count = m_BoxCount[it.Text]; } BoxDataParse.DataParse.CmdBoxLED(it.Text, 1, count, LogInfo.enum_LedColor.绿色, bFront); BoxDataParse.DataParse.CmdBoxToIdle(it.Text, bFront); } } #endregion } else if (iType == LogInfo.ReceiveDataType.证卡信息 && data != "") { #region 证卡信息 foreach (ListViewItem it in lv_Select.Items) { if (it.Text.Substring(0, 5) == gBN && it.Text.Substring(5) != "98") { int count = 0; if (m_BoxCount.ContainsKey(it.Text)) { m_BoxCount[it.Text] = 0; } else { m_BoxCount.Add(it.Text, count); } BoxDataParse.DataParse.CmdBoxLED(it.Text, 1, count, LogInfo.enum_LedColor.绿色, bFront); BoxDataParse.DataParse.CmdOpenDoor(it.Text, bFront); System.Threading.Thread.Sleep(310); } } #endregion } else if (iType == LogInfo.ReceiveDataType.门锁) { #region 门锁 int count = 0; if (m_BoxCount.ContainsKey(BN_NO)) { count = m_BoxCount[BN_NO]; } else { m_BoxCount.Add(BN_NO, count); } BoxDataParse.DataParse.CmdBoxLED(BN_NO, 1, count, LogInfo.enum_LedColor.绿色, bFront); #endregion } else if (iType == LogInfo.ReceiveDataType.门禁) { #region 门禁 if (data == "Closed") { if (m_Group.ContainsKey(gBN)) { //m_Group[gBN].m_Idle = true; if (m_Group[gBN].m_ChuFaGD) { BoxDataParse.DataParse.CmdBoxScan(BN_NO, true, bFront); m_Group[gBN].m_CurrentDT = Environment.TickCount; } else { m_Group[gBN].m_ChuFaGD = false; } } } #endregion } #endregion } if (bInKeyOpenDoor) { if (iType == LogInfo.ReceiveDataType.键) { BoxDataParse.DataParse.CmdOpenDoor(BN_NO, bFront); } } } else if (iType == LogInfo.ReceiveDataType.主箱连接) { if (data == "Start") { //初次连接 SetLogText(BN_NO + "\t主箱初次连接。"); } #region 主箱连接 ListViewItem it = null; if (!lv_All.Items.ContainsKey(BN_NO)) { int ibn = Int32.Parse(BN_NO.Substring(2)); for (int j = 0; j < lv_All.Items.Count; j++) { string bn = lv_All.Items[j].Text; if (Int32.Parse(bn.Substring(2)) > ibn) { it = lv_All.Items.Insert(j, BN_NO, BN_NO, 0); it.SubItems.Add("断开"); break; } } if (it == null) { it = lv_All.Items.Insert(lv_All.Items.Count, BN_NO, BN_NO, 0); it.SubItems.Add("断开"); } } else { it = lv_All.Items[BN_NO]; if (data == "Start") { it.SubItems[1].Text = "断开"; } } it.Tag = Environment.TickCount; //单位名称 lock (it) { if (it.SubItems[1].Text == "断开") { //重新连接 SetLogText(BN_NO + "\t主箱重新连接。"); BoxDataParse.DataParse.CmdBoxToIdle(BN_NO); BoxDataParse.DataParse.CmdBoxToIdle(BN_NO, false); BoxDataParse.DataParse.CmdLCDText(it.Text, 0, LogInfo.enum_TextType.显示附带的文本, 0, 255, BN_NO.Substring(2)); BoxDataParse.DataParse.CmdLCDText(it.Text, 0, LogInfo.enum_TextType.显示附带的文本, 0, 255, BN_NO.Substring(2), false); if (BN_NO.Substring(5) == "98") { BoxDataParse.DataParse.CmdLCDText_Com(it.Text, 0, LogInfo.enum_TextType.显示附带的文本, 0, 255, 0, 0, BN_NO.Substring(2) + "\r\n请扫描条码..."); } BoxDataParse.DataParse.CmdBoxLED(BN_NO, 1, 0, LogInfo.enum_LedColor.绿色); BoxDataParse.DataParse.CmdBoxLED(BN_NO, 1, 0, LogInfo.enum_LedColor.绿色, false); it.SubItems[1].Text = ""; } } #endregion } else if (iType == LogInfo.ReceiveDataType.主箱连接_Version) { #region 主箱版本 ListViewItem it = null; if (!lv_All.Items.ContainsKey(BN_NO)) { int ibn = Int32.Parse(BN_NO.Substring(2)); for (int j = 0; j < lv_All.Items.Count; j++) { string bn = lv_All.Items[j].Text; if (Int32.Parse(bn.Substring(2)) > ibn) { it = lv_All.Items.Insert(j, BN_NO, BN_NO, 0); it.SubItems.Add("断开"); break; } } if (it == null) { it = lv_All.Items.Insert(lv_All.Items.Count, BN_NO, BN_NO, 0); it.SubItems.Add("断开"); } } else { it = lv_All.Items[BN_NO]; } try { it.SubItems[2].Text = data; } catch { it.SubItems.Add(data); } #endregion } }