From 7d22089afbd9337af760146f279cc26237daca14 Mon Sep 17 00:00:00 2001 From: lichuanyang <1176537920@qq.com> Date: Mon, 16 Dec 2024 11:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9E=8B=E5=8F=B7:BC-5120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.config | 5 +++- deviceAnalysis.cs | 72 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/app.config b/app.config index cbf8617..04e4706 100644 --- a/app.config +++ b/app.config @@ -63,9 +63,12 @@ + + + - + diff --git a/deviceAnalysis.cs b/deviceAnalysis.cs index b0941ed..672f62a 100644 --- a/deviceAnalysis.cs +++ b/deviceAnalysis.cs @@ -2174,6 +2174,52 @@ namespace FlyDockTool else dataOutPutShow("数据和图像提交失败:" + jsonStr, null); + } + if (apiOptions.CurrentDevice == "BC-5120")//BC-5120 + { + string MachineCode = apiOptions.MachineCode; + string MachineID = apiOptions.MachineID; + deviceDataStr = deviceDataStr.Replace("\r", "").Replace("\n", ""); + //string[] resulteArray = deviceDataStr.Split('\n'); + string sampleNo1 = string.Empty;//样本号 + + List ermList = new List(); + string[] itemArray = new string[] { "WBC", "BAS#", "BAS%", "NEU#", "NEU%", "EOS#", "EOS%", "LYM#", "LYM%", "MON#", "MON%", "RBC", "HGB", "MCV", "MCH", "MCHC", "RDW-CV", "RDW-SD", "HCT", "PLT", "MPV", "PDW", "PCT", "PLCC", "PLCR" }; + string[] itemArray_2 = new string[] { "PCT", "PLCC", "PLCR" }; + + for (int i = 0; i < itemArray.Length; i++) + { + string itemStr = string.Empty; + if (itemArray_2.Contains(itemArray[i])) + itemStr = itemArray[i] + "^99MRC||"; + else + itemStr = itemArray[i] + "^LN||"; + + string val1 = deviceDataStr.Substring(deviceDataStr.IndexOf("OBR"), 30); + sampleNo1 = val1.Split('|')[3]; + string testDate1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + examResultMode erm1 = new examResultMode(); + erm1.machineCode = MachineCode; + erm1.machineID = MachineID; + erm1.sampleNo = sampleNo1; + erm1.testDate = testDate1; + erm1.chanelNo = itemArray[i];//项目代号 + //项目结果 + erm1.itemValue = jiexiVal(deviceDataStr.IndexOf(itemStr), itemStr, deviceDataStr).ToString(); + erm1.itemUnit = ""; + ermList.Add(erm1); + } + + string jsonStr = JsonConvert.SerializeObject(ermList); + + //将结果提交到LIS系统 + baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList); + if (bmm1.code == 200) + dataOutPutShow("数据提交成功:" + jsonStr, null); + else + dataOutPutShow("数据提交失败:" + jsonStr, null); + } return rerultJson; } @@ -2670,7 +2716,22 @@ namespace FlyDockTool } _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 } - + if (apiOptions.CurrentDevice == "BC-5120")//BC-5120 + { + // 设置IP地址和端口号 + string tcp_ip = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[3]; + string tcp_port = ConfigurationManager.AppSettings[apiOptions.CurrentDevice].Split(',')[4]; + IPAddress ipAddress = IPAddress.Parse(tcp_ip); + // IPAddress ipAddress = IPAddress.Any; + //// 创建一个监听Socket + if (listener == null) + { + listener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + listener.Bind(new IPEndPoint(ipAddress, int.Parse(tcp_port))); + listener.Listen(10000); + } + _tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率 + } } /// @@ -2800,6 +2861,10 @@ namespace FlyDockTool tempData = string.Empty;//执行完以后 将临时积累数据清空 以便接收下一个样本数据 } } + if (apiOptions.CurrentDevice == "BC-5120")//BC-5120 + { + _tResult.Change(5000, 5000);// 数据处理:延迟5秒开始 5秒计时 + } } /// @@ -3128,6 +3193,11 @@ namespace FlyDockTool _tcpResult.Change(-1, 10);//停止tcp数据接收 clientSocket.Close(); } + if (apiOptions.CurrentDevice == "BC-5120")//BC-5120 + { + _tcpResult.Change(-1, 10);//停止tcp数据接收 + clientSocket.Close(); + } } /////