增加修改删除页面,增加COM口的配置等
This commit is contained in:
1 parent
f3110791a7
commit
e96e2d3651
89 files changed
+10692
-727
No files matched your search
+295
-109
@@ -27,23 +27,8 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private Thread thread_plc1;
|
||||
private Thread thread_plc2;
|
||||
private SerialPort ScanPort;
|
||||
/*
|
||||
*
|
||||
* COM1 -- COM口名称
|
||||
* 9600 波特率
|
||||
* 校验位 Parity.None == 无
|
||||
* 数据位 :8
|
||||
*
|
||||
* 测试称重
|
||||
* 解除注释
|
||||
* //port.DataReceived += new SerialDataReceivedEventHandler(port_Receive);
|
||||
* //port.Open();
|
||||
* //port.WriteLine("SI");
|
||||
*
|
||||
*/
|
||||
//private Thread thread_plc1;
|
||||
//private Thread thread_plc2;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@@ -57,17 +42,15 @@ namespace WindowsFormsApp1
|
||||
LogExecute.PlclogNet.BeforeSaveToFile += LogNet_BeforeSaveToFile;
|
||||
LogExecute.ApilogNet.BeforeSaveToFile += LogNet_BeforeSaveToFile;
|
||||
|
||||
Formrecover();
|
||||
|
||||
|
||||
|
||||
|
||||
FormRecover();
|
||||
|
||||
线别.Text = "线别:" + Init.t_Line.linename;
|
||||
段别.Text = "段别:" + Init.t_Line.linemode;
|
||||
段别.Text = "段别:" + Init.t_Line.linemode;
|
||||
机台编号.Text = "机台编号:" + Init.t_Line.linecode;
|
||||
操作人员ID.Text = "操作人员ID:" + Init.t_User.username;
|
||||
}
|
||||
|
||||
|
||||
public void build(t_plc Plc, CancellationToken token)
|
||||
{
|
||||
while (true)
|
||||
@@ -98,6 +81,10 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
|
||||
List<t_plcaddress> plcaddress = Init.t_Plcaddresses.FindAll(a => a.plcid == Plc.id);
|
||||
List<t_angleaddress> angleaddress = Init.t_Angleaddresses.FindAll(a => a.plcid == Plc.id);
|
||||
List<t_torqueaddress> torqueaddress = Init.t_Torqueaddresses.FindAll(a => a.plcid == Plc.id);
|
||||
|
||||
|
||||
plcdata PlcData = new plcdata();
|
||||
|
||||
var resdresult = siemensHelp.ReadAddress(plcaddress, PlcData);
|
||||
@@ -161,6 +148,9 @@ namespace WindowsFormsApp1
|
||||
MES链接状态.Text = "MES链接状态:NG";
|
||||
MES链接状态.BackColor = Color.Red;
|
||||
LogExecute.logNet.WriteError($"MES通讯异常!");
|
||||
PlcData.Write_Status = 1002;
|
||||
var errresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//机台报警
|
||||
@@ -195,6 +185,8 @@ namespace WindowsFormsApp1
|
||||
MES链接状态.Text = "MES链接状态:NG";
|
||||
MES链接状态.BackColor = Color.Red;
|
||||
LogExecute.logNet.WriteError($"MES通讯异常!");
|
||||
PlcData.Write_Status = 1002;
|
||||
siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -238,21 +230,69 @@ namespace WindowsFormsApp1
|
||||
continue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(nowinterface.code == "SN_CheckIN")
|
||||
#region 根据流程,判断是否需要扫码、气密、扭力等
|
||||
if (nowflow.scan)
|
||||
{
|
||||
请扫描LOT号.Enabled = true;
|
||||
//ScanPort.Read();
|
||||
|
||||
|
||||
//扫码
|
||||
ScanForm scanForm = new ScanForm();
|
||||
DialogResult scan_result = scanForm.ShowDialog();
|
||||
if (scan_result == DialogResult.OK)
|
||||
{
|
||||
string returnValue = scanForm.ReturnValue;
|
||||
otherdata.JS_SN = returnValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (nowflow.finalpressurecurve)
|
||||
{
|
||||
//压力曲线
|
||||
}
|
||||
//if (nowflow.finaltorquecurve)
|
||||
//{
|
||||
// //扭力曲线(这里不处理,后端API获取)
|
||||
//}
|
||||
if (nowflow.finaltorquevalue)
|
||||
{
|
||||
//螺丝枪扭力数据
|
||||
var finaltorquevalue_result = siemensHelp.ReadAddress(torqueaddress);
|
||||
if (!finaltorquevalue_result.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪扭力数据地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
otherdata.FinalTorqueValue = finaltorquevalue_result.Data;
|
||||
}
|
||||
if (nowflow.airtight)
|
||||
{
|
||||
//气密参数
|
||||
otherdata.FinalAirtightValue = Init.airtight;
|
||||
}
|
||||
if (nowflow.finalanglevaluue)
|
||||
{
|
||||
//螺丝枪角度
|
||||
var finalanglevaluue_result = siemensHelp.ReadAddress(angleaddress);
|
||||
if (!finalanglevaluue_result.Success)
|
||||
{
|
||||
PLC链接状态.Text = "PLC链接状态:NG";
|
||||
PLC链接状态.BackColor = Color.Red;
|
||||
LogExecute.logNet.WriteError($"{Plc.plcip}螺丝枪角度数据地址处理错误:处理停止");
|
||||
continue;
|
||||
}
|
||||
otherdata.FinalAngleValue = finalanglevaluue_result.Data;
|
||||
}
|
||||
if (nowflow.fileupload)
|
||||
{
|
||||
//文件上传
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var result = apiClient.CallFunctionByName(nowinterface.code,PlcData, otherdata);
|
||||
#region 调用后端接口
|
||||
var result = apiClient.CallFunctionByName(nowinterface.code, PlcData, otherdata);
|
||||
if (result.Success)
|
||||
{
|
||||
var writeresult = siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
@@ -281,7 +321,10 @@ namespace WindowsFormsApp1
|
||||
MES链接状态.Text = "MES链接状态:NG";
|
||||
MES链接状态.BackColor = Color.Red;
|
||||
LogExecute.logNet.WriteError($"MES通讯异常!");
|
||||
PlcData.Write_Status = 1002;
|
||||
siemensHelp.WriteAddress(plcaddress, PlcData);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -302,22 +345,14 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
|
||||
SQLiteHelper<t_plc> sQLiteHelper_plc = new db.SQLiteHelper<t_plc>();
|
||||
BllResult<t_plc> plc_result = sQLiteHelper_plc.QuerySingle(a => a.id == Init.t_Line.plcid1);
|
||||
BllResult<t_plc> plc_result2 = new BllResult<t_plc>(false, "", null);
|
||||
if (!plc_result.Success)
|
||||
var plc_sqlresult = sQLiteHelper_plc.QueryAll();
|
||||
if (!plc_sqlresult.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化PLC1信息,无法开始处理!");
|
||||
MessageBox.Show("无法初始化PLC信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
if (Init.t_Line.plcid2 != 0)
|
||||
{
|
||||
plc_result2 = sQLiteHelper_plc.QuerySingle(a => a.id == Init.t_Line.plcid2);
|
||||
if (!plc_result2.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化PLC2信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
var plc_result = plc_sqlresult.Data.FindAll(a => Init.t_Lineplcs.Select(p => p.plcid).Contains(a.id));
|
||||
|
||||
|
||||
SQLiteHelper<t_flow> sQLiteHelper_flow = new db.SQLiteHelper<t_flow>();
|
||||
var flow_result = sQLiteHelper_flow.Query(a => a.flowid == Init.t_Line.flowid);
|
||||
@@ -335,6 +370,22 @@ namespace WindowsFormsApp1
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_torqueaddress> sQLiteHelper_torqueaddress = new db.SQLiteHelper<t_torqueaddress>();
|
||||
var torqueaddress_result = sQLiteHelper_torqueaddress.QueryAll();
|
||||
if (!torqueaddress_result.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化螺丝枪扭力信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_angleaddress> sQLiteHelper_angleaddress = new db.SQLiteHelper<t_angleaddress>();
|
||||
var angleaddress_result = sQLiteHelper_angleaddress.QueryAll();
|
||||
if (!angleaddress_result.Success)
|
||||
{
|
||||
MessageBox.Show("无法初始化螺丝枪角度信息,无法开始处理!");
|
||||
return;
|
||||
}
|
||||
|
||||
SQLiteHelper<t_interface> sQLiteHelper_interface = new db.SQLiteHelper<t_interface>();
|
||||
var interface_result = sQLiteHelper_interface.QueryAll();
|
||||
if (!interface_result.Success)
|
||||
@@ -343,7 +394,6 @@ namespace WindowsFormsApp1
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SQLiteHelper<t_serialport> sQLiteHelper_serialport = new db.SQLiteHelper<t_serialport>();
|
||||
var serialport_result = sQLiteHelper_serialport.QueryAll();
|
||||
if (!serialport_result.Success)
|
||||
@@ -352,61 +402,83 @@ namespace WindowsFormsApp1
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 初始化全局变量
|
||||
|
||||
Init.t_Flows = flow_result.Data;
|
||||
Init.t_Plcaddresses = address_result.Data;
|
||||
Init.t_Angleaddresses = angleaddress_result.Data;
|
||||
Init.t_Torqueaddresses = torqueaddress_result.Data;
|
||||
Init.t_Interfaces = interface_result.Data;
|
||||
#endregion
|
||||
#region 初始化COM口服务
|
||||
try
|
||||
{
|
||||
var scanport = serialport_result.Data.FirstOrDefault(a=>a.name == "Scan");
|
||||
var scanport = serialport_result.Data.FirstOrDefault(a => a.name == "Scan");
|
||||
if (scanport != null)
|
||||
{
|
||||
if (scanport.enable)
|
||||
{
|
||||
Enum.TryParse(scanport.parity, out Parity parity);
|
||||
ScanPort = new SerialPort(scanport.portName, scanport.baudRate, parity, scanport.dataBits);
|
||||
if (!ScanPort.IsOpen)
|
||||
Init.ScanPort = new SerialPort(scanport.portName, scanport.baudRate, parity, scanport.dataBits);
|
||||
if (!Init.ScanPort.IsOpen)
|
||||
{
|
||||
//port?.Open();
|
||||
Init.ScanPort?.Open();
|
||||
底部注释1.Text = "扫码枪COM-Ready";
|
||||
底部注释1.Visible = true;
|
||||
// 订阅 DataReceived 事件
|
||||
胶水上下线.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("无法开启扫码枪,无法开始处理!" + ex.Message);
|
||||
MessageBox.Show("无法开启扫码枪COM,无法开始处理!" + ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Init.t_Plc1 = plc_result.Data;
|
||||
Init.t_Plc1.plchelp = new SiemensHelp(Init.t_Plc1.plcip, Init.t_Plc1.timeout);
|
||||
Init.t_Plc2 = plc_result2.Data;
|
||||
if (Init.t_Plc2 != null)
|
||||
try
|
||||
{
|
||||
Init.t_Plc2.plchelp = new SiemensHelp(Init.t_Plc2.plcip, Init.t_Plc2.timeout);
|
||||
var scanport = serialport_result.Data.FirstOrDefault(a => a.name == "Airtight");
|
||||
if (scanport != null)
|
||||
{
|
||||
if (scanport.enable)
|
||||
{
|
||||
Enum.TryParse(scanport.parity, out Parity parity);
|
||||
Init.AirtightPort = new SerialPort(scanport.portName, scanport.baudRate, parity, scanport.dataBits);
|
||||
if (!Init.AirtightPort.IsOpen)
|
||||
{
|
||||
Init.AirtightPort?.Open();
|
||||
Init.AirtightPort.DataReceived += AirtightPort_DataReceived;
|
||||
底部注释2.Text = "气密仪COM-Ready";
|
||||
底部注释2.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Init.t_Flows = flow_result.Data;
|
||||
|
||||
Init.t_Plcaddresses = address_result.Data;
|
||||
Init.t_Interfaces = interface_result.Data;
|
||||
|
||||
if (!Init.isrunning1)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Init.cancellationTokenSource1 = new CancellationTokenSource();
|
||||
thread_plc1 = new Thread(() => build(Init.t_Plc1, Init.cancellationTokenSource1.Token));
|
||||
thread_plc1.Start();
|
||||
Init.isrunning1 = true;
|
||||
MessageBox.Show("无法开启气密仪COM,无法开始处理!" + ex.Message);
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//if (!Init.isrunning2)
|
||||
//{
|
||||
// Init.cancellationTokenSource2 = new CancellationTokenSource();
|
||||
// thread_plc2 = new Thread(() => build(Init.t_Plc2, Init.cancellationTokenSource2.Token));
|
||||
// thread_plc2.Start();
|
||||
// Init.isrunning2 = true;
|
||||
//}
|
||||
Init.threadHelps = new List<ThreadHelp>();
|
||||
foreach (var plc in plc_result)
|
||||
{
|
||||
plc.plchelp = new SiemensHelp(plc.plcip, plc.timeout);
|
||||
ThreadHelp threadHelp = new ThreadHelp();
|
||||
if (!threadHelp.isrunning1)
|
||||
{
|
||||
threadHelp.cancellationTokenSource1 = new CancellationTokenSource();
|
||||
threadHelp.Thread = new Thread(() => build(plc, threadHelp.cancellationTokenSource1.Token));
|
||||
threadHelp.Thread.Start();
|
||||
threadHelp.isrunning1 = true;
|
||||
}
|
||||
Init.threadHelps.Add(threadHelp);
|
||||
}
|
||||
|
||||
开始处理.Text = "停止处理";
|
||||
开始处理.BackColor = Color.Red;
|
||||
@@ -414,57 +486,79 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
else
|
||||
{
|
||||
if (thread_plc1 != null && thread_plc1.IsAlive)
|
||||
foreach (var thread in Init.threadHelps)
|
||||
{
|
||||
// 请求取消线程
|
||||
Init.cancellationTokenSource1?.Cancel();
|
||||
thread_plc1.Join(); // 等待线程完成
|
||||
if (thread.Thread.IsAlive)
|
||||
{
|
||||
// 请求取消线程
|
||||
thread.cancellationTokenSource1?.Cancel();
|
||||
thread.Thread.Join(); // 等待线程完成
|
||||
}
|
||||
thread.isrunning1 = false;
|
||||
}
|
||||
Init.isrunning1 = false;
|
||||
|
||||
if (thread_plc2 != null && thread_plc2.IsAlive)
|
||||
if (Init.ScanPort != null && Init.ScanPort.IsOpen)
|
||||
{
|
||||
// 请求取消线程
|
||||
Init.cancellationTokenSource2?.Cancel();
|
||||
thread_plc2.Join(); // 等待线程完成
|
||||
Init.ScanPort?.Close();
|
||||
}
|
||||
Init.isrunning2 = false;
|
||||
|
||||
ScanPort?.Close();
|
||||
if (Init.AirtightPort != null && Init.AirtightPort.IsOpen)
|
||||
{
|
||||
Init.AirtightPort?.Close();
|
||||
}
|
||||
|
||||
|
||||
Thread.Sleep(500);
|
||||
开始处理.Text = "开始处理";
|
||||
开始处理.BackColor = Color.Green;
|
||||
|
||||
Formrecover();
|
||||
//Thread.Sleep(500);
|
||||
FormRecover();
|
||||
|
||||
LogExecute.logNet.WriteInfo($"用户{Init.t_User.username},停止处理!");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 页面按钮-跳转
|
||||
private void 扭力角度扭矩设置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Angleaddress_Manage angleaddress_Manage = new Angleaddress_Manage();
|
||||
angleaddress_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
private void 螺丝枪扭力设置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Torqueaddress_Manage torqueaddress_Manage = new Torqueaddress_Manage();
|
||||
torqueaddress_Manage.ShowDialog();
|
||||
}
|
||||
private void 流程管理ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
FLOW_Manage fLOW_Mange = new FLOW_Manage();
|
||||
Flow_Manage fLOW_Mange = new Flow_Manage();
|
||||
fLOW_Mange.ShowDialog();
|
||||
}
|
||||
|
||||
private void 产线管理ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void 产线基础信息管理ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LINE_Manage lINE_Manage = new LINE_Manage();
|
||||
Line_Manage lINE_Manage = new Line_Manage();
|
||||
lINE_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
private void 产线关联PLC管理ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
LinePLC_Manage lINEPLC_Manage = new LinePLC_Manage();
|
||||
lINEPLC_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
private void 系统参数配置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
KeyValue keyValue = new KeyValue();
|
||||
keyValue.ShowDialog();
|
||||
}
|
||||
|
||||
private void pLC通讯设置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PLC_Manage pLC_Manage = new PLC_Manage();
|
||||
Plc_Manage pLC_Manage = new Plc_Manage();
|
||||
pLC_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
private void pLC地址设置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PLCADDRESS_Manage pLCADDRESS_Manage = new PLCADDRESS_Manage();
|
||||
PlcAddress_Manage pLCADDRESS_Manage = new PlcAddress_Manage();
|
||||
pLCADDRESS_Manage.ShowDialog();
|
||||
}
|
||||
private void 切换用户ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -474,19 +568,19 @@ namespace WindowsFormsApp1
|
||||
|
||||
private void mES接口配置ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MES_URL mES_URL = new MES_URL();
|
||||
MESUrl mES_URL = new MESUrl();
|
||||
mES_URL.ShowDialog();
|
||||
}
|
||||
|
||||
private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
USER_ChangeP uSER_ChangeP = new USER_ChangeP();
|
||||
UserChangeP uSER_ChangeP = new UserChangeP();
|
||||
uSER_ChangeP.ShowDialog();
|
||||
}
|
||||
|
||||
private void 用户管理ToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
USER_Manage uSER_Manage = new USER_Manage();
|
||||
User_Manage uSER_Manage = new User_Manage();
|
||||
uSER_Manage.ShowDialog();
|
||||
}
|
||||
|
||||
@@ -543,8 +637,11 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
当前时间.Text = "当前时间:" + DateTime.Now.ToString("MM-dd HH:mm:ss");
|
||||
}
|
||||
public void Formrecover()
|
||||
public void FormRecover()
|
||||
{
|
||||
开始处理.Text = "开始处理";
|
||||
开始处理.BackColor = Color.Green;
|
||||
|
||||
MES链接状态.Text = "MES链接状态:None";
|
||||
MES链接状态.BackColor = SystemColors.Control;
|
||||
|
||||
@@ -560,8 +657,9 @@ namespace WindowsFormsApp1
|
||||
机台状态.Text = "机台状态:None";
|
||||
机台状态.BackColor = SystemColors.Control;
|
||||
|
||||
胶水上下线.Enabled = false;
|
||||
|
||||
请扫描LOT号.Enabled = false;
|
||||
MES提示信息.Visible = false;
|
||||
LOT号.Visible = false;
|
||||
Tray盘二维码.Visible = false;
|
||||
|
||||
@@ -699,5 +797,93 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 其他业务处理
|
||||
private void 胶水上下线_Click(object sender, EventArgs e)
|
||||
{
|
||||
ScanForm scanForm = new ScanForm();
|
||||
DialogResult result = scanForm.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
string returnValue = scanForm.ReturnValue;
|
||||
MessageBox.Show($"返回值是:{returnValue}");
|
||||
//调用三防漆之类的接口
|
||||
}
|
||||
}
|
||||
public void AirtightPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!Init.AirtightPort.IsOpen)
|
||||
{
|
||||
Init.AirtightPort?.Open();
|
||||
}
|
||||
// 读取串口接收到的数据
|
||||
string ReturnValue = Init.AirtightPort.ReadExisting();
|
||||
|
||||
int index1 = 1;
|
||||
int index2 = 1;
|
||||
string press = string.Empty;
|
||||
string leakage = string.Empty;
|
||||
//pressure选择为yes// export选择为yes(非常重要)
|
||||
var dataArray = ReturnValue.Trim('\r', '\n').Split('\t');
|
||||
float[] sealFloat = new float[2];
|
||||
|
||||
//充气压力
|
||||
if (dataArray[3] == "")
|
||||
{
|
||||
sealFloat[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dataArray[3].Contains("-"))
|
||||
{
|
||||
press = dataArray[3].Remove(0, 1);
|
||||
index1 = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
press = dataArray[3];
|
||||
index1 = 1;
|
||||
}
|
||||
sealFloat[0] = float.Parse(press);
|
||||
}
|
||||
|
||||
//测试泄露结果
|
||||
if (dataArray[5] == "")
|
||||
sealFloat[1] = 0;
|
||||
else
|
||||
{
|
||||
if (dataArray[5].Contains("-"))
|
||||
{
|
||||
leakage = dataArray[5].Remove(0, 1);
|
||||
index2 = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
leakage = dataArray[5];
|
||||
index2 = 1;
|
||||
}
|
||||
sealFloat[1] = float.Parse(leakage);
|
||||
}
|
||||
|
||||
int[] sealInt = new int[2];
|
||||
sealInt[0] = Convert.ToInt32(sealFloat[1] * 1000) * (index2);
|
||||
sealInt[1] = Convert.ToInt32(sealFloat[0] * 1000) * (index1);
|
||||
Init.airtight.Airtight_Value = sealInt[0].ToString();
|
||||
Init.airtight.Leak_Value = sealInt[1].ToString();
|
||||
Init.airtight.LastTime = DateTime.Now;
|
||||
LogExecute.logNet.WriteDebug($"通过气密仪获取到 压力值:{Init.airtight.Airtight_Value},泄露值:{Init.airtight.Leak_Value}");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogExecute.logNet.WriteError($"通过气密仪获取到压力参数失败,错误原因{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user