新增设备BC-6800
This commit is contained in:
parent
db80ab7789
commit
6e1aa12894
@ -90,6 +90,8 @@
|
||||
<add key="BH-5390" value="PC-202106061449,BH-5390,121,127.0.0.1,5600,GB18030" />
|
||||
<!-- 尿常规URIT-560 -->
|
||||
<add key="URIT-560" value="wstwsy-PC,MA-4210,90,COM1,9600,NONE,8,1" />
|
||||
<add key="CurrentDevice" value="URIT-560"/>
|
||||
<!-- BC-6800 -->
|
||||
<add key="BC-6800" value="PC-202106061449,BC-6800,121,127.0.0.1,5600,GB18030" />
|
||||
<add key="CurrentDevice" value="BC-6800"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
@ -2219,6 +2219,140 @@ namespace FlyDockTool
|
||||
else
|
||||
dataOutPutShow("数据提交失败:" + jsonStr, null);
|
||||
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "BC-6800")//BC-6800
|
||||
{
|
||||
//string filePath = @"D:\FLOW\网络接受工具\Debug\txt.txt";
|
||||
|
||||
//// 追加模式写入
|
||||
//using (StreamWriter sw = new StreamWriter(filePath, true))
|
||||
//{
|
||||
// sw.WriteLine("----------------------------------------");
|
||||
// sw.WriteLine($"时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
// sw.WriteLine(deviceDataStr);
|
||||
// sw.WriteLine("----------------------------------------");
|
||||
//}
|
||||
List<examResultMode> ermList = new List<examResultMode>();
|
||||
string MachineCode = apiOptions.MachineCode;
|
||||
string MachineID = apiOptions.MachineID;
|
||||
// 分割消息为行
|
||||
// 分割消息为行,并处理特殊字符
|
||||
// string[] lines = deviceDataStr.Replace("\r", "").Split('\n');
|
||||
string[] lines = deviceDataStr.Replace("\r", "")
|
||||
.Replace("\n", "")
|
||||
.Split(new[] { "OBX|", "MSH|", "PID|", "PV1|", "OBR|" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
//// 记录拆分后的内容
|
||||
//string filePath2 = @"D:\FLOW\网络接受工具\Debug\split_lines.txt";
|
||||
//using (StreamWriter sw = new StreamWriter(filePath2, true))
|
||||
//{
|
||||
// sw.WriteLine("==========================================");
|
||||
// sw.WriteLine($"记录时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
// sw.WriteLine($"拆分后行数: {lines.Length}");
|
||||
// sw.WriteLine("------------------------------------------");
|
||||
|
||||
// // 记录每一行内容
|
||||
// for (int i = 0; i < lines.Length; i++)
|
||||
// {
|
||||
// sw.WriteLine($"第{i + 1}行: {lines[i]}");
|
||||
// }
|
||||
|
||||
// sw.WriteLine("==========================================");
|
||||
// sw.WriteLine();
|
||||
//}
|
||||
// 获取样本号(从OBR段)
|
||||
string sampleNo = "";
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.Contains("^Automated Count^99MRC")) // 检查是否包含样本号的行
|
||||
{
|
||||
string[] obrParts = line.Split('|');
|
||||
if (obrParts.Length > 2)
|
||||
{
|
||||
sampleNo = obrParts[2].Trim(); // 获取样本号
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 解析OBX段(检测结果)
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (char.IsDigit(line[0]))
|
||||
{
|
||||
string[] parts = line.Split('|');
|
||||
if (parts.Length >= 6)
|
||||
{
|
||||
// 获取OBX序号
|
||||
int obxNumber = int.Parse(parts[0]);
|
||||
|
||||
// 只解析序号11及以后的OBX(从WBC开始)
|
||||
if (obxNumber >= 11)
|
||||
{
|
||||
examResultMode erm = new examResultMode();
|
||||
|
||||
// 设置基本信息
|
||||
erm.machineCode = MachineCode; // 固定值
|
||||
erm.machineID = MachineID; // 固定值
|
||||
erm.sampleNo = sampleNo;
|
||||
erm.testDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 解析项目代号和名称
|
||||
string[] itemInfo = parts[2].Split('^');
|
||||
if (itemInfo.Length >= 2)
|
||||
{
|
||||
string itemCode = itemInfo[0]; // 获取代码
|
||||
string itemName = itemInfo[1]; // 获取名称
|
||||
|
||||
// 处理特殊字符
|
||||
if (itemName.Contains("InR"))
|
||||
{
|
||||
if (itemCode == "10033")
|
||||
{
|
||||
itemName = "InR%";
|
||||
}
|
||||
else if (itemCode == "10032")
|
||||
{
|
||||
itemName = "InR#";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
erm.chanelNo = itemName; // 项目名称
|
||||
}
|
||||
|
||||
// 解析结果值
|
||||
erm.itemValue = parts[4];
|
||||
erm.itemUnit = "";
|
||||
ermList.Add(erm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// string filePath1 = @"D:\FLOW\网络接受工具\Debug\txt1.txt";
|
||||
|
||||
//using (StreamWriter sw = new StreamWriter(filePath1, true))
|
||||
//{
|
||||
// sw.WriteLine("==========================================");
|
||||
// sw.WriteLine($"记录时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
// sw.WriteLine($"数据条数: {ermList.Count}");
|
||||
// sw.WriteLine("------------------------------------------");
|
||||
|
||||
// foreach (var item in ermList)
|
||||
// {
|
||||
// sw.WriteLine($"项目: {item.chanelNo}, 值: {item.itemValue}, 单位: {item.itemUnit}");
|
||||
// }
|
||||
|
||||
// sw.WriteLine("==========================================");
|
||||
// sw.WriteLine(); // 空行
|
||||
//}
|
||||
string jsonStr = JsonConvert.SerializeObject(ermList);
|
||||
|
||||
//将结果提交到LIS系统
|
||||
baseMsgModel bmm1 = apiOptions.CreateInstance().upLoadExamResult(ermList);
|
||||
if (bmm1.code == 200)
|
||||
dataOutPutShow("数据提交成功:" + jsonStr, null);
|
||||
else
|
||||
dataOutPutShow("数据提交失败:" + jsonStr, null);
|
||||
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "URIT-8460")//URIT-8460
|
||||
{
|
||||
@ -3904,6 +4038,22 @@ namespace FlyDockTool
|
||||
clientSocket.Connect(ipAddress, int.Parse(tcp_port));
|
||||
_tcpResult.Change(0, 10);//开始tcp数据接收,10毫秒频率
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "BC-6800")//BC-6800
|
||||
{
|
||||
// 设置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毫秒频率
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "URIT-8460")//URIT-8460
|
||||
{
|
||||
// 设置IP地址和端口号
|
||||
@ -4222,6 +4372,20 @@ namespace FlyDockTool
|
||||
deviceAnalysisOption(tempData_temp);
|
||||
}
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "BC-6800")//BC-6800
|
||||
{
|
||||
if (tempData.Contains("MSH|")&&tempData.Contains("OBX|46|"))//OBX|22| 为结束符 说明字符串完整了 OBX|17|
|
||||
{
|
||||
|
||||
string tempData_temp = tempData;
|
||||
tempData = string.Empty;
|
||||
deviceAnalysisOption(tempData_temp);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (apiOptions.CurrentDevice == "URIT-8460")//URIT-8460
|
||||
{
|
||||
string tempData_temp = tempData;
|
||||
@ -4638,6 +4802,11 @@ namespace FlyDockTool
|
||||
_tcpResult.Change(-1, 10);//停止tcp数据接收
|
||||
clientSocket.Close();
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "BC-6800")//BC-6800
|
||||
{
|
||||
_tcpResult.Change(-1, 10);//停止tcp数据接收
|
||||
clientSocket.Close();
|
||||
}
|
||||
if (apiOptions.CurrentDevice == "URIT-8460")//URIT-8460
|
||||
{
|
||||
_tcpResult.Change(-1, 10);//停止tcp数据接收
|
||||
|
2
mainForm.Designer.cs
generated
2
mainForm.Designer.cs
generated
@ -200,7 +200,7 @@
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "mainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "福乐云软硬件数据对接工具V1.1(2025050701)";
|
||||
this.Text = "福乐云软硬件数据对接工具V1.1(2025052801)";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.mainForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
|
@ -38,8 +38,8 @@ namespace FlyDockTool
|
||||
apiOptions.MachineID = ConfigurationManager.AppSettings[CurrentDevice].Split(',')[2];
|
||||
lb_currentDeviceInfo.Text = CurrentDevice;
|
||||
//////测试代码 测试完毕后注释调一下两行代码
|
||||
// string resultDataStr = File.ReadAllText(@"D:\工作\接受数据工具 list\尿常规URIT-560.txt", Encoding.GetEncoding("GB18030"));
|
||||
// deviceAnalysis.CreateInstance().deviceAnalysisOption(resultDataStr);
|
||||
// string resultDataStr = File.ReadAllText(@"D:\工作\接受数据工具 list\BC-6800.txt", Encoding.GetEncoding("GB18030"));
|
||||
// deviceAnalysis.CreateInstance().deviceAnalysisOption(resultDataStr);
|
||||
btn_start_or_stop_Click(null, null);//启动数据接收
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user