20230315Change

This commit is contained in:
17860779768 2023-03-15 08:44:52 +08:00
parent 1e5327bc48
commit 8580393da4
3 changed files with 223 additions and 182 deletions

View File

@ -1983,12 +1983,17 @@ namespace BRS.Process.A020
else else
{ {
ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0 ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0
ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000 //ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000
ProcessWriteInt(MelsecPLC, "D51", "int", "1");//手动拧紧螺丝D51置1 ProcessWriteInt(MelsecPLC, "D51", "int", "1");//手动拧紧螺丝D51置1
machineState = MachineState.Waiting;//设备启动完成后保持状态 machineState = MachineState.Waiting;//设备启动完成后保持状态
LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!"); LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!");
} }
} }
else
{
LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!");
return;
}
} }
}); });
Task.Run(() => Task.Run(() =>
@ -2034,12 +2039,17 @@ namespace BRS.Process.A020
else else
{ {
ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0 ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0
ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000 //ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000
ProcessWriteInt(MelsecPLC, "D53", "int", "1");//手动拧紧螺丝D51置1 ProcessWriteInt(MelsecPLC, "D53", "int", "1");//手动拧紧螺丝D51置1
machineState = MachineState.Waiting;//设备启动完成后保持状态 machineState = MachineState.Waiting;//设备启动完成后保持状态
LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!"); LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!");
} }
} }
else
{
LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!");
return;
}
} }
}); });
Task.Run(() => Task.Run(() =>
@ -2107,9 +2117,6 @@ namespace BRS.Process.A020
} }
else else
{ {
ShaftOperateKeep(MelsecPLC, addD3, "0"); ShaftOperateKeep(MelsecPLC, addD3, "0");
Thread.Sleep(500); Thread.Sleep(500);
ShaftOperateOnce(MelsecPLC, addD1, 500); ShaftOperateOnce(MelsecPLC, addD1, 500);
@ -2124,21 +2131,15 @@ namespace BRS.Process.A020
LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!"); LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!");
return; return;
} }
} }
}); });
LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!"); LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!");
PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null); PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null);
return new ProcessResponse(true); return new ProcessResponse(true);
} }
/// <summary> /// <summary>
/// 根据PLC地址操作一次硫化机 /// 根据PLC地址操作一次扭矩轴
/// </summary> /// </summary>
/// <param name="PLC">PLC驱动</param> /// <param name="PLC">PLC驱动</param>
/// <param name="Address">PLC地址</param> /// <param name="Address">PLC地址</param>
@ -2589,7 +2590,6 @@ namespace BRS.Process.A020
} }
[ProcessMethod("", "CloseProcess", "主流程停止", InvokeType.TestInvoke)] [ProcessMethod("", "CloseProcess", "主流程停止", InvokeType.TestInvoke)]
public BRS.Common.Model.ProcessResponse CloseProcess(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) public BRS.Common.Model.ProcessResponse CloseProcess(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
{ {

View File

@ -46,21 +46,17 @@ namespace BRS.Process.A020.UI
this.StopStateLabel = new Sunny.UI.UILabel(); this.StopStateLabel = new Sunny.UI.UILabel();
this.chart2 = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chart2 = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiPanel1 = new Sunny.UI.UIPanel();
this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton(); this.label4 = new System.Windows.Forms.Label();
this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton(); this.label3 = new System.Windows.Forms.Label();
this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton(); this.label2 = new System.Windows.Forms.Label();
this.ToughLight1 = new BRS.Process.A020.UI.CircleButton(); this.label1 = new System.Windows.Forms.Label();
this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.TestBtn = new Sunny.UI.UIButton(); this.TestBtn = new Sunny.UI.UIButton();
this.Setting = new Sunny.UI.UIButton();
this.AutoLoosenBtn1 = new Sunny.UI.UIButton(); this.AutoLoosenBtn1 = new Sunny.UI.UIButton();
this.AutoToughBtn1 = new Sunny.UI.UIButton(); this.AutoToughBtn1 = new Sunny.UI.UIButton();
this.ManualLoosenBtn = new Sunny.UI.UIButton(); this.ManualLoosenBtn = new Sunny.UI.UIButton();
this.ManualToughBtn = new Sunny.UI.UIButton(); this.ManualToughBtn = new Sunny.UI.UIButton();
this.StopBtn2 = new Sunny.UI.UIButton(); this.StopBtn2 = new Sunny.UI.UIButton();
this.StartBtn1 = new Sunny.UI.UIButton(); this.StartBtn1 = new Sunny.UI.UIButton();
this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.ESBtn = new BRS.Process.A020.UI.CircleButton();
this.AutoLoosenBtn = new Sunny.UI.UIButton(); this.AutoLoosenBtn = new Sunny.UI.UIButton();
this.AutoToughBtn = new Sunny.UI.UIButton(); this.AutoToughBtn = new Sunny.UI.UIButton();
this.uiLabel2 = new Sunny.UI.UILabel(); this.uiLabel2 = new Sunny.UI.UILabel();
@ -69,10 +65,16 @@ namespace BRS.Process.A020.UI
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.uiButton1 = new Sunny.UI.UIButton(); this.uiButton1 = new Sunny.UI.UIButton();
this.timer2 = new System.Windows.Forms.Timer(this.components); this.timer2 = new System.Windows.Forms.Timer(this.components);
this.label1 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.OKBtn = new Sunny.UI.UIButton();
this.label4 = new System.Windows.Forms.Label(); this.ManualBtn1 = new BRS.Process.A020.UI.CircleButton();
this.AutoBtn1 = new BRS.Process.A020.UI.CircleButton();
this.LoosenLight1 = new BRS.Process.A020.UI.CircleButton();
this.ToughLight1 = new BRS.Process.A020.UI.CircleButton();
this.StopStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.MoveStateLight1 = new BRS.Process.A020.UI.CircleButton();
this.ESBtn = new BRS.Process.A020.UI.CircleButton();
((System.ComponentModel.ISupportInitialize)(this.chart2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.chart2)).BeginInit();
this.uiPanel1.SuspendLayout(); this.uiPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
@ -204,6 +206,9 @@ namespace BRS.Process.A020.UI
// //
// uiPanel1 // uiPanel1
// //
this.uiPanel1.Controls.Add(this.OKBtn);
this.uiPanel1.Controls.Add(this.label5);
this.uiPanel1.Controls.Add(this.textBox1);
this.uiPanel1.Controls.Add(this.label4); this.uiPanel1.Controls.Add(this.label4);
this.uiPanel1.Controls.Add(this.label3); this.uiPanel1.Controls.Add(this.label3);
this.uiPanel1.Controls.Add(this.label2); this.uiPanel1.Controls.Add(this.label2);
@ -214,7 +219,6 @@ namespace BRS.Process.A020.UI
this.uiPanel1.Controls.Add(this.ToughLight1); this.uiPanel1.Controls.Add(this.ToughLight1);
this.uiPanel1.Controls.Add(this.StopStateLight1); this.uiPanel1.Controls.Add(this.StopStateLight1);
this.uiPanel1.Controls.Add(this.TestBtn); this.uiPanel1.Controls.Add(this.TestBtn);
this.uiPanel1.Controls.Add(this.Setting);
this.uiPanel1.Controls.Add(this.AutoLoosenBtn1); this.uiPanel1.Controls.Add(this.AutoLoosenBtn1);
this.uiPanel1.Controls.Add(this.AutoToughBtn1); this.uiPanel1.Controls.Add(this.AutoToughBtn1);
this.uiPanel1.Controls.Add(this.ManualLoosenBtn); this.uiPanel1.Controls.Add(this.ManualLoosenBtn);
@ -235,56 +239,49 @@ namespace BRS.Process.A020.UI
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiPanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.uiPanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// ManualBtn1 // label4
// //
this.ManualBtn1.BackColor = System.Drawing.Color.Gray; this.label4.AutoSize = true;
this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand; this.label4.BackColor = System.Drawing.Color.Silver;
this.ManualBtn1.Location = new System.Drawing.Point(484, 323); this.label4.Location = new System.Drawing.Point(480, 106);
this.ManualBtn1.Name = "ManualBtn1"; this.label4.Name = "label4";
this.ManualBtn1.Size = new System.Drawing.Size(58, 50); this.label4.Size = new System.Drawing.Size(106, 42);
this.ManualBtn1.TabIndex = 19; this.label4.TabIndex = 23;
this.ManualBtn1.Text = "手动按钮"; this.label4.Text = "手动拧松状态\r\n指示灯";
this.ManualBtn1.UseVisualStyleBackColor = false; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click);
// //
// AutoBtn1 // label3
// //
this.AutoBtn1.BackColor = System.Drawing.Color.Gray; this.label3.AutoSize = true;
this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand; this.label3.BackColor = System.Drawing.Color.Silver;
this.AutoBtn1.Location = new System.Drawing.Point(420, 323); this.label3.Location = new System.Drawing.Point(326, 106);
this.AutoBtn1.Name = "AutoBtn1"; this.label3.Name = "label3";
this.AutoBtn1.Size = new System.Drawing.Size(58, 50); this.label3.Size = new System.Drawing.Size(106, 42);
this.AutoBtn1.TabIndex = 18; this.label3.TabIndex = 22;
this.AutoBtn1.Text = "自动按钮"; this.label3.Text = "手动拧紧状态\r\n指示灯";
this.AutoBtn1.UseVisualStyleBackColor = false; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click);
// //
// LoosenLight1 // label2
// //
this.LoosenLight1.BackColor = System.Drawing.Color.Gray; this.label2.AutoSize = true;
this.LoosenLight1.Location = new System.Drawing.Point(491, 39); this.label2.BackColor = System.Drawing.Color.Silver;
this.LoosenLight1.Name = "LoosenLight1"; this.label2.Location = new System.Drawing.Point(207, 106);
this.LoosenLight1.Size = new System.Drawing.Size(75, 64); this.label2.Name = "label2";
this.LoosenLight1.TabIndex = 17; this.label2.Size = new System.Drawing.Size(74, 42);
this.LoosenLight1.UseVisualStyleBackColor = false; this.label2.TabIndex = 21;
this.label2.Text = "停止状态\r\n指示灯";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// ToughLight1 // label1
// //
this.ToughLight1.BackColor = System.Drawing.Color.Gray; this.label1.AutoSize = true;
this.ToughLight1.Location = new System.Drawing.Point(341, 39); this.label1.BackColor = System.Drawing.Color.Silver;
this.ToughLight1.Name = "ToughLight1"; this.label1.Location = new System.Drawing.Point(63, 106);
this.ToughLight1.Size = new System.Drawing.Size(75, 64); this.label1.Name = "label1";
this.ToughLight1.TabIndex = 16; this.label1.Size = new System.Drawing.Size(74, 42);
this.ToughLight1.UseVisualStyleBackColor = false; this.label1.TabIndex = 20;
// this.label1.Text = "启动状态\r\n指示灯";
// StopStateLight1 this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
this.StopStateLight1.BackColor = System.Drawing.Color.Gray;
this.StopStateLight1.Location = new System.Drawing.Point(211, 39);
this.StopStateLight1.Name = "StopStateLight1";
this.StopStateLight1.Size = new System.Drawing.Size(75, 64);
this.StopStateLight1.TabIndex = 15;
this.StopStateLight1.UseVisualStyleBackColor = false;
// //
// TestBtn // TestBtn
// //
@ -299,19 +296,6 @@ namespace BRS.Process.A020.UI
this.TestBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.TestBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.TestBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.TestBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// Setting
//
this.Setting.Cursor = System.Windows.Forms.Cursors.Hand;
this.Setting.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Setting.Location = new System.Drawing.Point(17, 380);
this.Setting.MinimumSize = new System.Drawing.Size(1, 1);
this.Setting.Name = "Setting";
this.Setting.Size = new System.Drawing.Size(120, 45);
this.Setting.TabIndex = 13;
this.Setting.Text = "扭矩设置";
this.Setting.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Setting.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// AutoLoosenBtn1 // AutoLoosenBtn1
// //
this.AutoLoosenBtn1.Cursor = System.Windows.Forms.Cursors.Hand; this.AutoLoosenBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
@ -398,25 +382,6 @@ namespace BRS.Process.A020.UI
this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StartBtn1.Click += new System.EventHandler(this.StartBtn1_Click); this.StartBtn1.Click += new System.EventHandler(this.StartBtn1_Click);
// //
// MoveStateLight1
//
this.MoveStateLight1.BackColor = System.Drawing.Color.Gray;
this.MoveStateLight1.Location = new System.Drawing.Point(67, 39);
this.MoveStateLight1.Name = "MoveStateLight1";
this.MoveStateLight1.Size = new System.Drawing.Size(75, 64);
this.MoveStateLight1.TabIndex = 3;
this.MoveStateLight1.UseVisualStyleBackColor = false;
//
// ESBtn
//
this.ESBtn.BackColor = System.Drawing.Color.Red;
this.ESBtn.Location = new System.Drawing.Point(45, 185);
this.ESBtn.Name = "ESBtn";
this.ESBtn.Size = new System.Drawing.Size(111, 102);
this.ESBtn.TabIndex = 0;
this.ESBtn.Text = "急停";
this.ESBtn.UseVisualStyleBackColor = false;
//
// AutoLoosenBtn // AutoLoosenBtn
// //
this.AutoLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand; this.AutoLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand;
@ -508,49 +473,110 @@ namespace BRS.Process.A020.UI
this.timer2.Interval = 1000; this.timer2.Interval = 1000;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick); this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
// //
// label1 // textBox1
// //
this.label1.AutoSize = true; this.textBox1.Location = new System.Drawing.Point(132, 383);
this.label1.BackColor = System.Drawing.Color.Silver; this.textBox1.Multiline = true;
this.label1.Location = new System.Drawing.Point(63, 106); this.textBox1.Name = "textBox1";
this.label1.Name = "label1"; this.textBox1.Size = new System.Drawing.Size(141, 45);
this.label1.Size = new System.Drawing.Size(74, 42); this.textBox1.TabIndex = 24;
this.label1.TabIndex = 20; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.label1.Text = "启动状态\r\n指示灯";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// label2 // label5
// //
this.label2.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.BackColor = System.Drawing.Color.Silver; this.label5.Location = new System.Drawing.Point(12, 383);
this.label2.Location = new System.Drawing.Point(207, 106); this.label5.Name = "label5";
this.label2.Name = "label2"; this.label5.Size = new System.Drawing.Size(114, 45);
this.label2.Size = new System.Drawing.Size(74, 42); this.label5.TabIndex = 25;
this.label2.TabIndex = 21; this.label5.Text = "扭矩设置:";
this.label2.Text = "停止状态\r\n指示灯"; this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// label3 // OKBtn
// //
this.label3.AutoSize = true; this.OKBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.label3.BackColor = System.Drawing.Color.Silver; this.OKBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(326, 106); this.OKBtn.Location = new System.Drawing.Point(279, 383);
this.label3.Name = "label3"; this.OKBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.label3.Size = new System.Drawing.Size(106, 42); this.OKBtn.Name = "OKBtn";
this.label3.TabIndex = 22; this.OKBtn.Size = new System.Drawing.Size(100, 45);
this.label3.Text = "手动拧紧状态\r\n指示灯"; this.OKBtn.TabIndex = 26;
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.OKBtn.Text = "确定";
this.OKBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.OKBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.OKBtn.Click += new System.EventHandler(this.OKBtn_Click);
// //
// label4 // ManualBtn1
// //
this.label4.AutoSize = true; this.ManualBtn1.BackColor = System.Drawing.Color.Gray;
this.label4.BackColor = System.Drawing.Color.Silver; this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.label4.Location = new System.Drawing.Point(480, 106); this.ManualBtn1.Location = new System.Drawing.Point(484, 323);
this.label4.Name = "label4"; this.ManualBtn1.Name = "ManualBtn1";
this.label4.Size = new System.Drawing.Size(106, 42); this.ManualBtn1.Size = new System.Drawing.Size(58, 50);
this.label4.TabIndex = 23; this.ManualBtn1.TabIndex = 19;
this.label4.Text = "手动拧松状态\r\n指示灯"; this.ManualBtn1.Text = "手动按钮";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.ManualBtn1.UseVisualStyleBackColor = false;
this.ManualBtn1.Click += new System.EventHandler(this.ManualBtn1_Click);
//
// AutoBtn1
//
this.AutoBtn1.BackColor = System.Drawing.Color.Gray;
this.AutoBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.AutoBtn1.Location = new System.Drawing.Point(420, 323);
this.AutoBtn1.Name = "AutoBtn1";
this.AutoBtn1.Size = new System.Drawing.Size(58, 50);
this.AutoBtn1.TabIndex = 18;
this.AutoBtn1.Text = "自动按钮";
this.AutoBtn1.UseVisualStyleBackColor = false;
this.AutoBtn1.Click += new System.EventHandler(this.AutoBtn1_Click);
//
// LoosenLight1
//
this.LoosenLight1.BackColor = System.Drawing.Color.Gray;
this.LoosenLight1.Location = new System.Drawing.Point(491, 39);
this.LoosenLight1.Name = "LoosenLight1";
this.LoosenLight1.Size = new System.Drawing.Size(75, 64);
this.LoosenLight1.TabIndex = 17;
this.LoosenLight1.UseVisualStyleBackColor = false;
//
// ToughLight1
//
this.ToughLight1.BackColor = System.Drawing.Color.Gray;
this.ToughLight1.Location = new System.Drawing.Point(341, 39);
this.ToughLight1.Name = "ToughLight1";
this.ToughLight1.Size = new System.Drawing.Size(75, 64);
this.ToughLight1.TabIndex = 16;
this.ToughLight1.UseVisualStyleBackColor = false;
//
// StopStateLight1
//
this.StopStateLight1.BackColor = System.Drawing.Color.Gray;
this.StopStateLight1.Location = new System.Drawing.Point(211, 39);
this.StopStateLight1.Name = "StopStateLight1";
this.StopStateLight1.Size = new System.Drawing.Size(75, 64);
this.StopStateLight1.TabIndex = 15;
this.StopStateLight1.UseVisualStyleBackColor = false;
//
// MoveStateLight1
//
this.MoveStateLight1.BackColor = System.Drawing.Color.Gray;
this.MoveStateLight1.Location = new System.Drawing.Point(67, 39);
this.MoveStateLight1.Name = "MoveStateLight1";
this.MoveStateLight1.Size = new System.Drawing.Size(75, 64);
this.MoveStateLight1.TabIndex = 3;
this.MoveStateLight1.UseVisualStyleBackColor = false;
//
// ESBtn
//
this.ESBtn.BackColor = System.Drawing.Color.Red;
this.ESBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.ESBtn.Location = new System.Drawing.Point(45, 185);
this.ESBtn.Name = "ESBtn";
this.ESBtn.Size = new System.Drawing.Size(111, 102);
this.ESBtn.TabIndex = 0;
this.ESBtn.Text = "急停";
this.ESBtn.UseVisualStyleBackColor = false;
this.ESBtn.Click += new System.EventHandler(this.ESBtn_Click);
// //
// 扭矩轴控制 // 扭矩轴控制
// //
@ -602,7 +628,6 @@ namespace BRS.Process.A020.UI
private CircleButton ToughLight1; private CircleButton ToughLight1;
private CircleButton StopStateLight1; private CircleButton StopStateLight1;
private Sunny.UI.UIButton TestBtn; private Sunny.UI.UIButton TestBtn;
private Sunny.UI.UIButton Setting;
private Sunny.UI.UIButton AutoLoosenBtn1; private Sunny.UI.UIButton AutoLoosenBtn1;
private Sunny.UI.UIButton AutoToughBtn1; private Sunny.UI.UIButton AutoToughBtn1;
private Sunny.UI.UIButton ManualLoosenBtn; private Sunny.UI.UIButton ManualLoosenBtn;
@ -616,5 +641,8 @@ namespace BRS.Process.A020.UI
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label5;
private Sunny.UI.UIButton OKBtn;
} }
} }

View File

@ -28,7 +28,7 @@ namespace BRS.Process.A020.UI
private bool is_btn_manual { get; set; } = false;//是否手动 private bool is_btn_manual { get; set; } = false;//是否手动
private bool isOpenAuto { get; set; } = false;//是否正在自动操作 private bool isOpenAuto { get; set; } = false;//是否正在自动操作
int resValue1; int resValue1;
int resValue2; int resValue2;
A020Process ProcessA020 => Process as A020Process; A020Process ProcessA020 => Process as A020Process;
A020Config Config => Process?.IConfig as A020Config; A020Config Config => Process?.IConfig as A020Config;
@ -38,7 +38,6 @@ namespace BRS.Process.A020.UI
public () public ()
{ {
InitializeComponent(); InitializeComponent();
} }
public IDevice Device { get; set; } public IDevice Device { get; set; }
protected PLCBase PLC protected PLCBase PLC
@ -192,7 +191,7 @@ namespace BRS.Process.A020.UI
this.chart2.Series[0].Points.AddXY(DateTime.Now.ToOADate(), ProcessReadInt(MelsecPlc, "D251", "int")); this.chart2.Series[0].Points.AddXY(DateTime.Now.ToOADate(), ProcessReadInt(MelsecPlc, "D251", "int"));
this.chart2.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(1).ToOADate();//X坐标后移1秒 this.chart2.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(1).ToOADate();//X坐标后移1秒
this.chart2.ChartAreas[0].AxisX.Minimum = DateTime.Now.AddSeconds(-5).ToOADate();//此刻后十秒钟作为最初X轴 this.chart2.ChartAreas[0].AxisX.Minimum = DateTime.Now.AddSeconds(-5).ToOADate();//此刻后十秒钟作为最初X轴
this.chart1.Series[0].Points.AddXY(DateTime.Now.ToOADate(), ProcessReadInt(MelsecPlc, "D351", "int")); this.chart1.Series[0].Points.AddXY(DateTime.Now.ToOADate(), ProcessReadInt(MelsecPlc, "D351", "int"));
this.chart1.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(1).ToOADate();//X坐标后移1秒 this.chart1.ChartAreas[0].AxisX.Maximum = DateTime.Now.AddSeconds(1).ToOADate();//X坐标后移1秒
this.chart1.ChartAreas[0].AxisX.Minimum = DateTime.Now.AddSeconds(-5).ToOADate();//此刻后十秒钟作为最初X轴 this.chart1.ChartAreas[0].AxisX.Minimum = DateTime.Now.AddSeconds(-5).ToOADate();//此刻后十秒钟作为最初X轴
@ -533,41 +532,12 @@ namespace BRS.Process.A020.UI
{ {
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
ProcessWriteInt(MelsecPLC, "D3", "int", "1"); ProcessWriteInt(MelsecPLC, "D3", "int", "1");
ProcessWriteInt(MelsecPLC, "D7", "int", "0"); //ProcessWriteInt(MelsecPLC, "D7", "int", "0");
if (Process == null) this.StopStateLight1.BackColor = Color.Red;
{ this.MoveStateLight1.BackColor = Color.Gray;
MessageBox.Show("无法操作空流程"); timer1.Stop();
return; timer2.Stop();
} isOpenAuto = false;
StopBtn2.Enabled = false;
try
{
ProcessOperation(false);
//if (isStart)
//{
// await ProcessOperation(false);
//}
}
catch (Exception ex)
{
//MessageBox.Show(ex.GetExceptionMessage());
}
finally
{
this.StopStateLight1.BackColor = Color.Red;
this.MoveStateLight1.BackColor = Color.Gray;
this.ToughLight1.BackColor = Color.Gray;
this.LoosenLight1.BackColor = Color.Gray;
//将自动手动按钮颜色恢复为灰色
this.AutoBtn1.BackColor = Color.Gray;
this.ManualBtn1.BackColor = Color.Gray;
//点击停止后初始化图表
InitChart();
timer1.Stop();
timer2.Stop();
StopBtn2.Enabled = true;
isOpenAuto = false;
}
} }
/// <summary> /// <summary>
/// 手动拧紧鼠标按下 /// 手动拧紧鼠标按下
@ -727,7 +697,6 @@ namespace BRS.Process.A020.UI
{ {
LogAsync(DateTime.Now, LogLevel.Error, "当前流程未启动,无法选择操作模式"); LogAsync(DateTime.Now, LogLevel.Error, "当前流程未启动,无法选择操作模式");
} }
} }
private void ManualBtn1_Click(object sender, EventArgs e) private void ManualBtn1_Click(object sender, EventArgs e)
{ {
@ -745,16 +714,13 @@ namespace BRS.Process.A020.UI
AutoBtn1.BackColor = Color.Gray; AutoBtn1.BackColor = Color.Gray;
ManualBtn1.BackColor = Color.GreenYellow; ManualBtn1.BackColor = Color.GreenYellow;
} }
} }
else if (StopStateLight1.BackColor == Color.Red) else if (StopStateLight1.BackColor == Color.Red)
{ {
LogAsync(DateTime.Now, LogLevel.Error, "当前流程未启动,无法选择操作模式"); LogAsync(DateTime.Now, LogLevel.Error, "当前流程未启动,无法选择操作模式");
} }
is_btn_manual = true; is_btn_manual = true;
} }
/// <summary> /// <summary>
/// 自动拧紧 /// 自动拧紧
/// </summary> /// </summary>
@ -786,7 +752,6 @@ namespace BRS.Process.A020.UI
} }
else else
{ {
LogAsync(DateTime.Now, LogLevel.Error, $"未打到自动状态"); LogAsync(DateTime.Now, LogLevel.Error, $"未打到自动状态");
} }
} }
@ -794,7 +759,6 @@ namespace BRS.Process.A020.UI
{ {
LogAsync(DateTime.Now, LogLevel.Error, $"当前流程未启动"); LogAsync(DateTime.Now, LogLevel.Error, $"当前流程未启动");
} }
} }
/// <summary> /// <summary>
/// 自动拧松 /// 自动拧松
@ -851,5 +815,54 @@ namespace BRS.Process.A020.UI
return; return;
} }
} }
/// <summary>
/// 急停按钮结束PLC连接停止流程
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ESBtn_Click(object sender, EventArgs e)
{
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
ProcessWriteInt(MelsecPLC, "D3", "int", "1");//D3写入1使上位机停止
ProcessWriteInt(MelsecPLC, "D7", "int", "0");
if (Process == null)
{
MessageBox.Show("无法操作空流程");
return;
}
try
{
ProcessOperation(false);
//if (isStart)
//{
// await ProcessOperation(false);
//}
}
catch (Exception ex)
{
//MessageBox.Show(ex.GetExceptionMessage());
}
finally
{
this.StopStateLight1.BackColor = Color.Gray;
this.MoveStateLight1.BackColor = Color.Gray;
this.ToughLight1.BackColor = Color.Gray;
this.LoosenLight1.BackColor = Color.Gray;
//将自动手动按钮颜色恢复为灰色
this.AutoBtn1.BackColor = Color.Gray;
this.ManualBtn1.BackColor = Color.Gray;
//点击停止后初始化图表
InitChart();
timer1.Stop();
timer2.Stop();
isOpenAuto = false;
}
}
private void OKBtn_Click(object sender, EventArgs e)
{
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
ProcessWriteInt(MelsecPLC, "D171", "int", textBox1.Text);
}
} }
} }