Commit 1085a985 authored by liu's avatar liu

辅助工具添加校零标阀rl11 12开关的功能,修改了外部通讯协议

parent 129cc874
This diff is collapsed.
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtyuzhi = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.cListBoxSign = new System.Windows.Forms.CheckedListBox(); this.cListBoxSign = new System.Windows.Forms.CheckedListBox();
this.cBox自动点火 = new System.Windows.Forms.CheckBox(); this.cBox自动点火 = new System.Windows.Forms.CheckBox();
this.cBox自动调零 = new System.Windows.Forms.CheckBox(); this.cBox自动调零 = new System.Windows.Forms.CheckBox();
...@@ -59,8 +61,6 @@ ...@@ -59,8 +61,6 @@
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.txtyuzhi = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -105,6 +105,22 @@ ...@@ -105,6 +105,22 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "FID设置"; this.groupBox1.Text = "FID设置";
// //
// txtyuzhi
//
this.txtyuzhi.Location = new System.Drawing.Point(423, 84);
this.txtyuzhi.Name = "txtyuzhi";
this.txtyuzhi.Size = new System.Drawing.Size(62, 21);
this.txtyuzhi.TabIndex = 12;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(388, 91);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 11;
this.label5.Text = "阈值";
//
// cListBoxSign // cListBoxSign
// //
this.cListBoxSign.BackColor = System.Drawing.SystemColors.Control; this.cListBoxSign.BackColor = System.Drawing.SystemColors.Control;
...@@ -188,6 +204,7 @@ ...@@ -188,6 +204,7 @@
this.tb空气压力设定.Name = "tb空气压力设定"; this.tb空气压力设定.Name = "tb空气压力设定";
this.tb空气压力设定.Size = new System.Drawing.Size(62, 21); this.tb空气压力设定.Size = new System.Drawing.Size(62, 21);
this.tb空气压力设定.TabIndex = 2; this.tb空气压力设定.TabIndex = 2;
this.tb空气压力设定.TextChanged += new System.EventHandler(this.Tb空气压力设定_TextChanged);
this.tb空气压力设定.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress); this.tb空气压力设定.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress);
// //
// tb尾吹气压力设定 // tb尾吹气压力设定
...@@ -223,6 +240,7 @@ ...@@ -223,6 +240,7 @@
this.tb氢气压力设定.Name = "tb氢气压力设定"; this.tb氢气压力设定.Name = "tb氢气压力设定";
this.tb氢气压力设定.Size = new System.Drawing.Size(62, 21); this.tb氢气压力设定.Size = new System.Drawing.Size(62, 21);
this.tb氢气压力设定.TabIndex = 2; this.tb氢气压力设定.TabIndex = 2;
this.tb氢气压力设定.TextChanged += new System.EventHandler(this.Tb氢气压力设定_TextChanged);
this.tb氢气压力设定.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress); this.tb氢气压力设定.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxDec_KeyPress);
// //
// cBox空气 // cBox空气
...@@ -395,22 +413,6 @@ ...@@ -395,22 +413,6 @@
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "FID"; this.label1.Text = "FID";
// //
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(388, 91);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 11;
this.label5.Text = "阈值";
//
// txtyuzhi
//
this.txtyuzhi.Location = new System.Drawing.Point(423, 84);
this.txtyuzhi.Name = "txtyuzhi";
this.txtyuzhi.Size = new System.Drawing.Size(62, 21);
this.txtyuzhi.TabIndex = 12;
//
// FID // FID
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
...@@ -25,6 +25,12 @@ namespace GcDevicePc.ConfigMethod ...@@ -25,6 +25,12 @@ namespace GcDevicePc.ConfigMethod
this.methodconfig = methodconfig; this.methodconfig = methodconfig;
} }
public FID()
{
InitializeComponent();
}
int configTemp; int configTemp;
public void reflashContent(int index) public void reflashContent(int index)
...@@ -207,5 +213,72 @@ namespace GcDevicePc.ConfigMethod ...@@ -207,5 +213,72 @@ namespace GcDevicePc.ConfigMethod
} }
} }
} }
private double hlastnum;
private void hText_KeyDown(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
hlastnum = Convert.ToDouble((sender as TextBox).Text);
}
else
{
hlastnum = 0;
}
}
private void hText_KeyUp(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
double nextnum = Convert.ToDouble((sender as TextBox).Text);
if (nextnum < 5)
{
MessageBox.Show("流量设置不能小于5");
(sender as TextBox).Text = hlastnum.ToString();
}
if (nextnum > 200)
{
MessageBox.Show("流量设置不能大于200");
(sender as TextBox).Text = hlastnum.ToString();
}
}
}
private void Tb空气压力设定_TextChanged(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty((sender as TextBox).Text))
//{
// double nextnum = Convert.ToDouble((sender as TextBox).Text);
// if (nextnum < 50)
// {
// MessageBox.Show("空气流量设置不能小于50");
// (sender as TextBox).Text = "50";
// }
// if (nextnum > 500)
// {
// MessageBox.Show("空气流量设置不能大于500");
// (sender as TextBox).Text = "50";
// }
//}
}
private void Tb氢气压力设定_TextChanged(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty((sender as TextBox).Text))
//{
// double nextnum = Convert.ToDouble((sender as TextBox).Text);
// if (nextnum < 5)
// {
// MessageBox.Show("氢气流量设置不能小于5");
// (sender as TextBox).Text = hlastnum.ToString();
// }
// if (nextnum > 200)
// {
// MessageBox.Show("氢气流量设置不能大于200");
// (sender as TextBox).Text = hlastnum.ToString();
// }
//}
}
} }
} }
...@@ -77,13 +77,12 @@ ...@@ -77,13 +77,12 @@
this.cbHeater.Checked = true; this.cbHeater.Checked = true;
this.cbHeater.CheckState = System.Windows.Forms.CheckState.Checked; this.cbHeater.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbHeater.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cbHeater.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbHeater.Location = new System.Drawing.Point(67, 153); this.cbHeater.Location = new System.Drawing.Point(99, 155);
this.cbHeater.Name = "cbHeater"; this.cbHeater.Name = "cbHeater";
this.cbHeater.Size = new System.Drawing.Size(71, 19); this.cbHeater.Size = new System.Drawing.Size(71, 19);
this.cbHeater.TabIndex = 3; this.cbHeater.TabIndex = 3;
this.cbHeater.Text = "加热器"; this.cbHeater.Text = "加热器";
this.cbHeater.UseVisualStyleBackColor = true; this.cbHeater.UseVisualStyleBackColor = true;
this.cbHeater.Visible = false;
// //
// txtHeater // txtHeater
// //
...@@ -111,8 +110,7 @@ ...@@ -111,8 +110,7 @@
this.txtFlow.Name = "txtFlow"; this.txtFlow.Name = "txtFlow";
this.txtFlow.Size = new System.Drawing.Size(100, 24); this.txtFlow.Size = new System.Drawing.Size(100, 24);
this.txtFlow.TabIndex = 8; this.txtFlow.TabIndex = 8;
this.txtFlow.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text_KeyDown); this.txtFlow.TextChanged += new System.EventHandler(this.TxtFlow_TextChanged);
this.txtFlow.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_KeyUp);
// //
// txtPressure // txtPressure
// //
...@@ -121,8 +119,7 @@ ...@@ -121,8 +119,7 @@
this.txtPressure.Name = "txtPressure"; this.txtPressure.Name = "txtPressure";
this.txtPressure.Size = new System.Drawing.Size(100, 24); this.txtPressure.Size = new System.Drawing.Size(100, 24);
this.txtPressure.TabIndex = 9; this.txtPressure.TabIndex = 9;
this.txtPressure.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text_KeyDown); this.txtPressure.TextChanged += new System.EventHandler(this.TxtFlow_TextChanged);
this.txtPressure.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_KeyUp);
// //
// txtSeptumBlowingflow // txtSeptumBlowingflow
// //
......
...@@ -387,7 +387,7 @@ namespace GcDevicePc.ConfigMethod.injectionport ...@@ -387,7 +387,7 @@ namespace GcDevicePc.ConfigMethod.injectionport
private double lastnum; private double lastnum;
private void Text_KeyDown(object sender, KeyEventArgs e) private void Text_KeyDown(object sender, KeyEventArgs e)
{ {
if (!string.IsNullOrEmpty((sender as TextBox).Text)) if (!string.IsNullOrEmpty((sender as TextBox).Text))
{ {
lastnum = Convert.ToDouble((sender as TextBox).Text); lastnum = Convert.ToDouble((sender as TextBox).Text);
} }
...@@ -402,9 +402,14 @@ namespace GcDevicePc.ConfigMethod.injectionport ...@@ -402,9 +402,14 @@ namespace GcDevicePc.ConfigMethod.injectionport
if (!string.IsNullOrEmpty((sender as TextBox).Text)) if (!string.IsNullOrEmpty((sender as TextBox).Text))
{ {
double nextnum = Convert.ToDouble((sender as TextBox).Text); double nextnum = Convert.ToDouble((sender as TextBox).Text);
if (nextnum > 100) if (nextnum < 5)
{
MessageBox.Show("流量设置不能小于5");
(sender as TextBox).Text = lastnum.ToString();
}
if (nextnum > 200)
{ {
MessageBox.Show("流量设置不能大于100"); MessageBox.Show("流量设置不能大于200");
(sender as TextBox).Text = lastnum.ToString(); (sender as TextBox).Text = lastnum.ToString();
} }
} }
...@@ -438,6 +443,24 @@ namespace GcDevicePc.ConfigMethod.injectionport ...@@ -438,6 +443,24 @@ namespace GcDevicePc.ConfigMethod.injectionport
} }
} }
private void TxtFlow_TextChanged(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty((sender as TextBox).Text))
//{
// double nextnum = Convert.ToDouble((sender as TextBox).Text);
// if (nextnum < 5)
// {
// MessageBox.Show("流量设置不能小于5");
// (sender as TextBox).Text = "10";
// }
// if (nextnum > 200)
// {
// MessageBox.Show("流量设置不能大于200");
// (sender as TextBox).Text = "10";
// }
//}
}
//private void combControlMode_SelectedIndexChanged(object sender, EventArgs e) //private void combControlMode_SelectedIndexChanged(object sender, EventArgs e)
//{ //{
// if (combControlMode.SelectedIndex == 0) // if (combControlMode.SelectedIndex == 0)
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
// button1 // button1
// //
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(176)))), ((int)(((byte)(197))))); this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(176)))), ((int)(((byte)(197)))));
this.button1.Location = new System.Drawing.Point(70, 133); this.button1.Location = new System.Drawing.Point(97, 137);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "EPCTips"; this.Name = "EPCTips";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "EPCTips"; this.Text = "警 告";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
......
...@@ -60,6 +60,8 @@ namespace GcDevicePc ...@@ -60,6 +60,8 @@ namespace GcDevicePc
// MessageBox.Show("点火操作禁止,FID已经点火成功"); // MessageBox.Show("点火操作禁止,FID已经点火成功");
} }
CKVocAnalyzer.AutoAdjust auto;
//自动校准 //自动校准
private void buttonauto_Click(object sender, EventArgs e) private void buttonauto_Click(object sender, EventArgs e)
{ {
...@@ -69,9 +71,28 @@ namespace GcDevicePc ...@@ -69,9 +71,28 @@ namespace GcDevicePc
//{ //{
// if (CK_UI.LandIn.Island) // if (CK_UI.LandIn.Island)
{ {
//CKVocAnalyzer.CtrlUserAdjust auto = new CKVocAnalyzer.CtrlUserAdjust(CKVocAnalyzer.CtrlUserAdjust.AdjustType.AT_Yang); //CKVocAnalyzer.CtrlUserAdjust auto = new CKVocAnalyzer.CtrlUserAdjust(CKVocAnalyzer.CtrlUserAdjust.AdjustType.AT_Yang);
CKVocAnalyzer.AutoAdjust auto = new CKVocAnalyzer.AutoAdjust(); if (auto == null)
{
auto = new CKVocAnalyzer.AutoAdjust();
auto.Show();
}
else if (auto.IsDisposed)
{
auto = null;
auto = new CKVocAnalyzer.AutoAdjust();
auto.Show(); auto.Show();
}
else
{
auto.Activate();
}
//if (!globaldata.usable)//表示上位机处于运行状态下不可进行自动校准
//{
//}
//Trace.WriteLine(string.Format("用户{0},进入自动校准模式", "calibration"), "sys"); //Trace.WriteLine(string.Format("用户{0},进入自动校准模式", "calibration"), "sys");
} }
//else //else
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
this.toolStripStatusLabelText = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelText = new System.Windows.Forms.ToolStripStatusLabel();
this.HmiStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.HmiStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip = new System.Windows.Forms.StatusStrip(); this.statusStrip = new System.Windows.Forms.StatusStrip();
this.AdjustStat = new System.Windows.Forms.ToolStripStatusLabel();
this.workProgress = new System.Windows.Forms.ToolStripProgressBar(); this.workProgress = new System.Windows.Forms.ToolStripProgressBar();
this.timer2 = new System.Windows.Forms.Timer(this.components); this.timer2 = new System.Windows.Forms.Timer(this.components);
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
...@@ -347,7 +348,7 @@ ...@@ -347,7 +348,7 @@
this.toolStripStatusLabelusertime.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripStatusLabelusertime.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripStatusLabelusertime.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); this.toolStripStatusLabelusertime.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.toolStripStatusLabelusertime.Name = "toolStripStatusLabelusertime"; this.toolStripStatusLabelusertime.Name = "toolStripStatusLabelusertime";
this.toolStripStatusLabelusertime.Size = new System.Drawing.Size(200, 27); this.toolStripStatusLabelusertime.Size = new System.Drawing.Size(190, 27);
this.toolStripStatusLabelusertime.Text = "toolStripStatusLabel1"; this.toolStripStatusLabelusertime.Text = "toolStripStatusLabel1";
// //
// toolStripStatusLabelText // toolStripStatusLabelText
...@@ -356,16 +357,17 @@ ...@@ -356,16 +357,17 @@
this.toolStripStatusLabelText.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right))); this.toolStripStatusLabelText.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.toolStripStatusLabelText.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); this.toolStripStatusLabelText.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.toolStripStatusLabelText.Name = "toolStripStatusLabelText"; this.toolStripStatusLabelText.Name = "toolStripStatusLabelText";
this.toolStripStatusLabelText.Size = new System.Drawing.Size(320, 27); this.toolStripStatusLabelText.Size = new System.Drawing.Size(300, 27);
this.toolStripStatusLabelText.Text = "toolStripStatusLabel1"; this.toolStripStatusLabelText.Text = "toolStripStatusLabel1";
this.toolStripStatusLabelText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.toolStripStatusLabelText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// HmiStatus // HmiStatus
// //
this.HmiStatus.AutoSize = false; this.HmiStatus.AutoSize = false;
this.HmiStatus.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.HmiStatus.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); this.HmiStatus.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.HmiStatus.Name = "HmiStatus"; this.HmiStatus.Name = "HmiStatus";
this.HmiStatus.Size = new System.Drawing.Size(200, 27); this.HmiStatus.Size = new System.Drawing.Size(190, 27);
this.HmiStatus.Text = "HmiStatus"; this.HmiStatus.Text = "HmiStatus";
this.HmiStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.HmiStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
...@@ -376,6 +378,7 @@ ...@@ -376,6 +378,7 @@
this.toolStripStatusLabelusertime, this.toolStripStatusLabelusertime,
this.toolStripStatusLabelText, this.toolStripStatusLabelText,
this.HmiStatus, this.HmiStatus,
this.AdjustStat,
this.workProgress}); this.workProgress});
this.statusStrip.Location = new System.Drawing.Point(0, 487); this.statusStrip.Location = new System.Drawing.Point(0, 487);
this.statusStrip.Name = "statusStrip"; this.statusStrip.Name = "statusStrip";
...@@ -383,6 +386,16 @@ ...@@ -383,6 +386,16 @@
this.statusStrip.TabIndex = 2; this.statusStrip.TabIndex = 2;
this.statusStrip.Text = "StatusStrip"; this.statusStrip.Text = "StatusStrip";
// //
// AdjustStat
//
this.AdjustStat.AutoSize = false;
this.AdjustStat.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
this.AdjustStat.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F);
this.AdjustStat.Name = "AdjustStat";
this.AdjustStat.Size = new System.Drawing.Size(131, 27);
this.AdjustStat.Text = "toolStripStatusLabel1";
this.AdjustStat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// workProgress // workProgress
// //
this.workProgress.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.workProgress.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
...@@ -461,6 +474,7 @@ ...@@ -461,6 +474,7 @@
private System.Windows.Forms.ToolStripProgressBar workProgress; private System.Windows.Forms.ToolStripProgressBar workProgress;
private System.Windows.Forms.Timer timer2; private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.ToolStripMenuItem changeVsi; private System.Windows.Forms.ToolStripMenuItem changeVsi;
private System.Windows.Forms.ToolStripStatusLabel AdjustStat;
} }
} }
......
...@@ -799,7 +799,38 @@ namespace GcDevicePc ...@@ -799,7 +799,38 @@ namespace GcDevicePc
// Trace.WriteLine(string.Format("时间{0},状态{1}", getIdleTick(),LandIn.Island),"sys"); // Trace.WriteLine(string.Format("时间{0},状态{1}", getIdleTick(),LandIn.Island),"sys");
//Console.WriteLine(t2.ToString()); //Console.WriteLine(t2.ToString());
//下方状态显示
if (CKVocAnalyzer.GlobalCKV.FarNear == 0)
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
AdjustStat.Text = "近端校零";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
AdjustStat.Text = "近端校标";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
AdjustStat.Text = "走样";
break;
}
}
else
{
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
AdjustStat.Text = "远端校零";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
AdjustStat.Text = "远端校标";
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
AdjustStat.Text = "走样";
break;
}
}
//监视界面活动 //监视界面活动
if (getIdleTick()>60*30 && LandIn.Island) if (getIdleTick()>60*30 && LandIn.Island)
...@@ -1333,6 +1364,8 @@ namespace GcDevicePc ...@@ -1333,6 +1364,8 @@ namespace GcDevicePc
Connect_Status.Start(); Connect_Status.Start();
} }
bool isone_openos = false;
/// <summary> /// <summary>
/// HMI状态监控线程实现 /// HMI状态监控线程实现
/// </summary> /// </summary>
...@@ -1462,6 +1495,7 @@ namespace GcDevicePc ...@@ -1462,6 +1495,7 @@ namespace GcDevicePc
{ {
globaldata.IsStopOs = !globaldata.IsStopOs; globaldata.IsStopOs = !globaldata.IsStopOs;
globaldata.OS_STOP = true; globaldata.OS_STOP = true;
isone_openos = true;
hmiopt.WriteEndVal(); hmiopt.WriteEndVal();
WaitHMIFree(); WaitHMIFree();
(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 0; (this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 0;
...@@ -1470,6 +1504,14 @@ namespace GcDevicePc ...@@ -1470,6 +1504,14 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0;
} }
} }
else
{
if (isone_openos)
{
isone_openos = !isone_openos;
open();
}
}
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2) if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2)
{ {
...@@ -3025,6 +3067,21 @@ namespace GcDevicePc ...@@ -3025,6 +3067,21 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = true;//仪器进入校准环境 SharedSpace.MControl.SetRun = true;//仪器进入校准环境
CurveDisPlay.forcePurge = true;//强制清除数据 CurveDisPlay.forcePurge = true;//强制清除数据
AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend); AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend);
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
hmiopt.Adjust_ling_biao(0, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
hmiopt.Adjust_ling_biao(1, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
hmiopt.Adjust_ling_biao(0, 0);
break;
default:
break;
}
} }
if (SharedSpace.MControl.MethodType == 2) if (SharedSpace.MControl.MethodType == 2)
{ {
...@@ -3032,26 +3089,24 @@ namespace GcDevicePc ...@@ -3032,26 +3089,24 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = true;//仪器进入校准环境 SharedSpace.MControl.SetRun = true;//仪器进入校准环境
CurveDisPlay.forcePurge = true; CurveDisPlay.forcePurge = true;
AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend); AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend);
switch (CKVocAnalyzer.GlobalCKV.adjustType)
{
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
hmiopt.Adjust_ling_biao(0, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
hmiopt.Adjust_ling_biao(1, (ushort)65280);
break;
case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
hmiopt.Adjust_ling_biao(0, 0);
break;
default:
break;
}
} }
//switch (CKVocAnalyzer.GlobalCKV.adjustType)
//{
// case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Zero:
// //hmiopt.Sw_RelayAdiust(0);
// //hmiopt.Sw_Samplegas((ushort)65280);
// hmiopt.Adjust_ling_biao(0, (ushort)65280);
// break;
// case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Biao:
// //hmiopt.Sw_RelayAdiust(1);
// //hmiopt.Sw_Samplegas((ushort)65280);
// hmiopt.Adjust_ling_biao(1, (ushort)65280);
// break;
// case CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang:
// hmiopt.Adjust_ling_biao(0, 0);
// break;
// default:
// break;
//}
} }
else else
{ {
...@@ -3080,6 +3135,11 @@ namespace GcDevicePc ...@@ -3080,6 +3135,11 @@ namespace GcDevicePc
{ {
CurveDisPlay.curdisp.ConfingAdjust(); CurveDisPlay.curdisp.ConfingAdjust();
} }
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
Trace.WriteLine("校准结束", "sys"); Trace.WriteLine("校准结束", "sys");
} }
if (SharedSpace.MControl.MethodType == 2) if (SharedSpace.MControl.MethodType == 2)
...@@ -3090,12 +3150,14 @@ namespace GcDevicePc ...@@ -3090,12 +3150,14 @@ namespace GcDevicePc
{ {
CurveDisPlay.curdisp.ConfingAdjust(); CurveDisPlay.curdisp.ConfingAdjust();
} }
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
Trace.WriteLine("校准结束", "sys"); Trace.WriteLine("校准结束", "sys");
} }
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
//hmiopt.Adjust_ling_biao(0, 0);
}
} }
if (SharedSpace.MControl.forceEnd && SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun) if (SharedSpace.MControl.forceEnd && SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun)
...@@ -3108,6 +3170,11 @@ namespace GcDevicePc ...@@ -3108,6 +3170,11 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = false; SharedSpace.MControl.SetRun = false;
SharedSpace.Data.typesint = 0; SharedSpace.Data.typesint = 0;
Trace.WriteLine("强制校准结束", "sys"); Trace.WriteLine("强制校准结束", "sys");
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
} }
if (SharedSpace.MControl.MethodType == 2) if (SharedSpace.MControl.MethodType == 2)
{ {
...@@ -3115,11 +3182,13 @@ namespace GcDevicePc ...@@ -3115,11 +3182,13 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = false; SharedSpace.MControl.SetRun = false;
SharedSpace.Data.typesint = 0; SharedSpace.Data.typesint = 0;
Trace.WriteLine("强制校准结束", "sys"); Trace.WriteLine("强制校准结束", "sys");
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
hmiopt.Adjust_ling_biao(0, 0);
}
} }
if (CKVocAnalyzer.GlobalCKV.adjustType == CKVocAnalyzer.GlobalCKV.AdjustType.AT_Yang)
{
//hmiopt.Adjust_ling_biao(0, 0);
}
} }
globaldata.m_hmibuffer.gcadjust.runtime = (long)(AutoAdjust - DateTime.Now).TotalSeconds < 0 ? 0: (long)(AutoAdjust - DateTime.Now).TotalSeconds; globaldata.m_hmibuffer.gcadjust.runtime = (long)(AutoAdjust - DateTime.Now).TotalSeconds < 0 ? 0: (long)(AutoAdjust - DateTime.Now).TotalSeconds;
......
...@@ -984,6 +984,8 @@ namespace GcDevicePc.ProThread ...@@ -984,6 +984,8 @@ namespace GcDevicePc.ProThread
{ {
bool ret = false; bool ret = false;
UInt16[] hmistate = new UInt16[9]; UInt16[] hmistate = new UInt16[9];
UInt16[] epcdata = new UInt16[16];
ret = GetHMIState(ref hmistate); ret = GetHMIState(ref hmistate);
if (ret) if (ret)
...@@ -1015,7 +1017,43 @@ namespace GcDevicePc.ProThread ...@@ -1015,7 +1017,43 @@ namespace GcDevicePc.ProThread
} }
} }
ret = GetEPCStatusData(ref epcdata);
if (ret)
{
globaldata.m_hmibuffer.gcinfo.EPCStatus = epcdata;
}
}
private int GetEPCHoldingReg(ushort address, ushort num, ref UInt16[] state)
{
int ret = -1;
int count = 0;
if (setflag)
{
ret = globaldata.global_moudbus.ReadHoldingReg(address, num, this.strIP, this.netPost, ref state);
while (ret != 0)
{
count++;
if (count > 3)
break;
ret = globaldata.global_moudbus.ReadHoldingReg(address, num, this.strIP, this.netPost, ref state);
}
}
return ret;
}
public bool GetEPCStatusData(ref ushort[] data)
{
int ret = -1;
try
{
ret = GetEPCHoldingReg(700, 16, ref data);
}
catch (Exception e)
{
Log.Error(e.Message);
}
return ret == 0;
} }
/// <summary> /// <summary>
......
...@@ -23,7 +23,7 @@ namespace GcDevicePc.ProThread ...@@ -23,7 +23,7 @@ namespace GcDevicePc.ProThread
this.strIP = ip; this.strIP = ip;
this.netPost = post; this.netPost = post;
this.setflag = true; this.setflag = true;
Monitorr1112Start(); //Monitorr1112Start();
} }
else else
{ {
...@@ -232,11 +232,11 @@ namespace GcDevicePc.ProThread ...@@ -232,11 +232,11 @@ namespace GcDevicePc.ProThread
int count = 0; int count = 0;
if (this.setflag) if (this.setflag)
{ {
ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata); ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata);
while (ret != 0) while (ret != 0)
{ {
count++; count++;
ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata); ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata);
Thread.Sleep(200); Thread.Sleep(200);
if (count == 3) if (count == 3)
break; break;
...@@ -286,11 +286,11 @@ namespace GcDevicePc.ProThread ...@@ -286,11 +286,11 @@ namespace GcDevicePc.ProThread
{ {
ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata); ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata);
while (ret != 0) while (ret != 0)
{ {
count++; count++;
ret = m_modbus.ReadCoilStatus(26, 1, this.strIP, this.netPost, ref nowdata); ret = m_modbus.ReadCoilStatus(27, 1, this.strIP, this.netPost, ref nowdata);
Thread.Sleep(200); Thread.Sleep(200);
if (count == 3) if (count == 3)
break; break;
...@@ -307,21 +307,21 @@ namespace GcDevicePc.ProThread ...@@ -307,21 +307,21 @@ namespace GcDevicePc.ProThread
writestatue = 0; writestatue = 0;
} }
ret = m_modbus.WriteSingleCoil(26, writestatue, this.strIP, this.netPost); ret = m_modbus.WriteSingleCoil(27, writestatue, this.strIP, this.netPost);
while (ret != 0) while (ret != 0)
{ {
count++; count++;
ret = m_modbus.WriteSingleCoil(26, writestatue, this.strIP, this.netPost); ret = m_modbus.WriteSingleCoil(27, writestatue, this.strIP, this.netPost);
Thread.Sleep(100); Thread.Sleep(100);
if (count == 3) if (count == 3)
break; break;
} }
ret = m_modbus.WriteSingleCoil(27, 0, this.strIP, this.netPost); ret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
while (ret != 0) while (ret != 0)
{ {
count++; count++;
ret = m_modbus.WriteSingleCoil(27, 0, this.strIP, this.netPost); ret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
Thread.Sleep(100); Thread.Sleep(100);
if (count == 3) if (count == 3)
break; break;
...@@ -357,31 +357,6 @@ namespace GcDevicePc.ProThread ...@@ -357,31 +357,6 @@ namespace GcDevicePc.ProThread
if (count == 3) if (count == 3)
break; break;
} }
if (getrelaystat(26) != oc)
{
bret = m_modbus.WriteSingleCoil(26, oc, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(26, oc, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
if (getrelaystat(27) != oc)
{
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
} }
else if (type == 1) else if (type == 1)
{ {
...@@ -404,31 +379,6 @@ namespace GcDevicePc.ProThread ...@@ -404,31 +379,6 @@ namespace GcDevicePc.ProThread
if (count == 3) if (count == 3)
break; break;
} }
if (getrelaystat(27) != oc)
{
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(27, oc, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
if (getrelaystat(26) != 0)
{
bret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
while (bret != 0)
{
count++;
bret = m_modbus.WriteSingleCoil(26, 0, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
} }
} }
...@@ -581,37 +531,6 @@ namespace GcDevicePc.ProThread ...@@ -581,37 +531,6 @@ namespace GcDevicePc.ProThread
} }
} }
public void Sw_Samplegas(ushort statue)
{
int ret;
ushort switchaddr = 19;
//ushort writestatue = 0;
byte[] nowdata = new byte[1];
int count = 0;
////ret = m_modbus.ReadCoilStatus(switchaddr, 1, this.strIP, this.netPost, ref nowdata);
////while (ret != 0)
////{
//// count++;
//// ret = m_modbus.ReadCoilStatus(switchaddr, 1, this.strIP, this.netPost, ref nowdata);
//// Thread.Sleep(200);
//// if (count == 3)
//// break;
////}
////if (ret == 0)
{
//ret = m_modbus.WriteSingleCoil(switchaddr, statue, this.strIP, this.netPost);
//while (ret != 0)
//{
// count++;
// ret = m_modbus.WriteSingleCoil(switchaddr, statue, this.strIP, this.netPost);
// Thread.Sleep(100);
// if (count == 3)
// break;
//}
}
}
public void Sw_RelayAdiust(int type) public void Sw_RelayAdiust(int type)
{ {
int ret; int ret;
......
...@@ -12,7 +12,7 @@ namespace GcDevicePc ...@@ -12,7 +12,7 @@ namespace GcDevicePc
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
bool createNew; bool createNew;
//Application.Run(new TestForm()); //Application.Run(new ConfigMethod.FID());
{ {
using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew)) using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew))
{ {
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(250, 364); this.button2.Location = new System.Drawing.Point(128, 314);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1; this.button2.TabIndex = 1;
...@@ -108,11 +109,22 @@ ...@@ -108,11 +109,22 @@
this.button6.Text = "button3"; this.button6.Text = "button3";
this.button6.UseVisualStyleBackColor = true; this.button6.UseVisualStyleBackColor = true;
// //
// button7
//
this.button7.Location = new System.Drawing.Point(244, 314);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(75, 23);
this.button7.TabIndex = 4;
this.button7.Text = "button7";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.Button7_Click);
//
// TestForm // TestForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 583); this.ClientSize = new System.Drawing.Size(800, 583);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6); this.Controls.Add(this.button6);
this.Controls.Add(this.button5); this.Controls.Add(this.button5);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
...@@ -136,5 +148,6 @@ ...@@ -136,5 +148,6 @@
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
} }
} }
\ No newline at end of file
...@@ -120,16 +120,7 @@ namespace GcDevicePc ...@@ -120,16 +120,7 @@ namespace GcDevicePc
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
//MessageBox.Show("asd");
//this.pictureMenu1.PMOptbtnstatus = 4;
//(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3;
//tinfliang
//LMessageBox box = new LMessageBox();
//box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK);
NModbusSlave N = new NModbusSlave();
} }
int i = 0; int i = 0;
private void Timer1_Tick(object sender, EventArgs e) private void Timer1_Tick(object sender, EventArgs e)
...@@ -137,5 +128,10 @@ namespace GcDevicePc ...@@ -137,5 +128,10 @@ namespace GcDevicePc
i++; i++;
} }
private void Button7_Click(object sender, EventArgs e)
{
}
} }
} }
...@@ -124,6 +124,8 @@ ...@@ -124,6 +124,8 @@
this.firstfiredelay.Name = "firstfiredelay"; this.firstfiredelay.Name = "firstfiredelay";
this.firstfiredelay.Size = new System.Drawing.Size(100, 21); this.firstfiredelay.Size = new System.Drawing.Size(100, 21);
this.firstfiredelay.TabIndex = 10; this.firstfiredelay.TabIndex = 10;
this.firstfiredelay.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Text_KeyDown);
this.firstfiredelay.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Text_KeyUp);
// //
// label14 // label14
// //
......
...@@ -758,6 +758,37 @@ namespace GcDevicePc ...@@ -758,6 +758,37 @@ namespace GcDevicePc
adsw(0); adsw(0);
} }
private double lastnum;
private void Text_KeyDown(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
lastnum = Convert.ToDouble((sender as TextBox).Text);
}
else
{
lastnum = 0;
}
}
private void Text_KeyUp(object sender, KeyEventArgs e)
{
if (!string.IsNullOrEmpty((sender as TextBox).Text))
{
double nextnum = Convert.ToDouble((sender as TextBox).Text);
if (nextnum < 0)
{
MessageBox.Show("延时时间设置不能小于0");
(sender as TextBox).Text = lastnum.ToString();
}
if (nextnum > 20)
{
MessageBox.Show("延时时间设置不能大于20");
(sender as TextBox).Text = lastnum.ToString();
}
}
}
//private void fireupbtnb_Click(object sender, EventArgs e) //private void fireupbtnb_Click(object sender, EventArgs e)
//{ //{
// if (String.IsNullOrEmpty(fireuptime.Text) || String.IsNullOrEmpty(hvalvetime.Text)) // if (String.IsNullOrEmpty(fireuptime.Text) || String.IsNullOrEmpty(hvalvetime.Text))
......
...@@ -125,7 +125,8 @@ namespace GcDevicePc ...@@ -125,7 +125,8 @@ namespace GcDevicePc
public static bool newfile = false; public static bool newfile = false;
public static bool createfile = false; public static bool createfile = false;
public static bool usable = false;
// public static Modbus m_modbus = new Modbus(); // public static Modbus m_modbus = new Modbus();
//public static UInt32 starttimer = 0x7FFFFFFF; //开始时间 //public static UInt32 starttimer = 0x7FFFFFFF; //开始时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment