20230314Change

This commit is contained in:
17860779768 2023-03-14 08:41:59 +08:00
parent 332ec0688c
commit 1e5327bc48
5 changed files with 569 additions and 254 deletions

View File

@ -789,7 +789,6 @@ namespace BRS.Process.A020
} }
public class DistanceRobot public class DistanceRobot
{ {
public double testDs { get; set; } public double testDs { get; set; }
@ -884,7 +883,6 @@ namespace BRS.Process.A020
return strRobotPoint; return strRobotPoint;
} }
//private void Pause() //private void Pause()
//{ //{
// while (MachineState == MachineState.Pause) // while (MachineState == MachineState.Pause)
@ -893,8 +891,6 @@ namespace BRS.Process.A020
// continue; // continue;
// } // }
//} //}
private bool isMachineRobotRunning() private bool isMachineRobotRunning()
{ {
//if(MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff) //if(MachineState == MachineState.Running && RobotsStatus != RobotsStatus.Pweroff)
@ -1667,6 +1663,11 @@ namespace BRS.Process.A020
PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null); PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.IsProcessOpened.ToString(), true, null);
return new ProcessResponse(true); return new ProcessResponse(true);
} }
#region
/// <summary>
/// 手动拧紧鼠标按下
/// </summary>
/// <param name="machineState"></param>
public void ShaftRightMouseDown(MachineState machineState) public void ShaftRightMouseDown(MachineState machineState)
{ {
if (machineState != MachineState.Ready) if (machineState != MachineState.Ready)
@ -1726,19 +1727,18 @@ namespace BRS.Process.A020
LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!"); LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!");
return; return;
} }
} }
}); });
Task.Run(() => Task.Run(() =>
{ {
ShaftOperateOnce(MelsecPLC, addD1, 500);//D1置1延时500后置0 ShaftOperateOnce(MelsecPLC, addD1, 500);//D1置1延时500后置0
}); });
IsSingleStepOperating = false; IsSingleStepOperating = false;
} }
/// <summary>
/// 手动拧松鼠标按下
/// </summary>
/// <param name="machineState"></param>
public void ShaftLeftMouseDown(MachineState machineState) public void ShaftLeftMouseDown(MachineState machineState)
{ {
if (machineState != MachineState.Ready) if (machineState != MachineState.Ready)
@ -1749,7 +1749,6 @@ namespace BRS.Process.A020
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候..."); LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string addD201 = "D201";//通讯故障检查地址 string addD201 = "D201";//通讯故障检查地址
string addD19 = "D19";//急停状态检查地址 string addD19 = "D19";//急停状态检查地址
string addD1 = "D1";//上位机启动标志位 string addD1 = "D1";//上位机启动标志位
@ -1812,16 +1811,18 @@ namespace BRS.Process.A020
IsSingleStepOperating = false; IsSingleStepOperating = false;
} }
/// <summary>
/// 手动拧紧鼠标抬起
/// </summary>
/// <param name="machineState"></param>
public void ShaftRightMouseUp(MachineState machineState) public void ShaftRightMouseUp(MachineState machineState)
{ {
//if (machineState != MachineState.Ready)
if (machineState != MachineState.Ready) //{
{ // LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动");
LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动"); // return;
return; //}
} //LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
@ -1858,12 +1859,9 @@ namespace BRS.Process.A020
{ {
ProcessWriteInt(MelsecPLC, addD3, "int", "1");//D3置0 ProcessWriteInt(MelsecPLC, addD3, "int", "1");//D3置0
ProcessWriteInt(MelsecPLC, addD51, "int", "0");//手动拧紧螺丝D51置1 ProcessWriteInt(MelsecPLC, addD51, "int", "0");//手动拧紧螺丝D51置1
machineState = MachineState.Pause;//设备暂停 machineState = MachineState.Pause;//设备暂停
LogAsync(DateTime.Now, LogLevel.Detail, "设备已关闭"); LogAsync(DateTime.Now, LogLevel.Detail, "设备已关闭");
} }
ShaftCommunication = ProcessReadInt(MelsecPLC, addD201, "int"); ShaftCommunication = ProcessReadInt(MelsecPLC, addD201, "int");
continue; continue;
@ -1873,24 +1871,24 @@ namespace BRS.Process.A020
LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!"); LogAsync(DateTime.Now, LogLevel.Warning, "通讯故障!");
return; return;
} }
} }
}); });
IsSingleStepOperating = false; IsSingleStepOperating = false;
} }
/// <summary>
/// 手动拧松鼠标抬起
/// </summary>
/// <param name="machineState"></param>
public void ShaftLeftMouseUp(MachineState machineState) public void ShaftLeftMouseUp(MachineState machineState)
{ {
//if (machineState != MachineState.Ready)
if (machineState != MachineState.Ready) //{
{ // LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动");
LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动"); // return;
return; //}
} //LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase; var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string addD201 = "D201";//通讯故障检查地址 string addD201 = "D201";//通讯故障检查地址
@ -1926,13 +1924,9 @@ namespace BRS.Process.A020
else else
{ {
ProcessWriteInt(MelsecPLC, addD3, "int", "1");//D3置0 ProcessWriteInt(MelsecPLC, addD3, "int", "1");//D3置0
ProcessWriteInt(MelsecPLC, addD53, "int", "0");//手动拧紧螺丝D53置0
ProcessWriteInt(MelsecPLC, addD53, "int", "0");//手动拧紧螺丝D51置1
machineState = MachineState.Pause;//设备暂停 machineState = MachineState.Pause;//设备暂停
LogAsync(DateTime.Now, LogLevel.Detail, "设备已关闭"); LogAsync(DateTime.Now, LogLevel.Detail, "设备已关闭");
} }
ShaftCommunication = ProcessReadInt(MelsecPLC, addD201, "int"); ShaftCommunication = ProcessReadInt(MelsecPLC, addD201, "int");
continue; continue;
@ -1950,6 +1944,123 @@ namespace BRS.Process.A020
IsSingleStepOperating = false; IsSingleStepOperating = false;
} }
#endregion
#region
/// <summary>
/// 自动拧紧
/// </summary>
public void ShaftAutoTough(MachineState machineState)
{
if (machineState != MachineState.Ready)
{
LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动");
return;
}
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
//设置PLC
var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string addressD07 = ProcessReadInt(MelsecPLC, "D07", "int");
//string ShaftCommunication = ProcessReadInt(MelsecPLC, "D201", "int");//通讯
machineState = MachineState.Running;
ProcessStatus = ProcessStatus.Init;
MachineStateStep = MachineStateStep.Ready;
Task.Run(()=>
{
while (machineState == MachineState.Running && MachineStateStep != MachineStateStep.Pause)
{
string ShaftCommunication = ProcessReadInt(MelsecPLC, "D201", "int");//通讯
if (ShaftCommunication == "111")//如果等于111流程启动
{
string ShaftEmergencyStop = ProcessReadInt(MelsecPLC, "D19", "int");//急停
if (ShaftEmergencyStop != "0")//判断是否急停0不急停1急停
{
LogAsync(DateTime.Now, LogLevel.Warning, "设备急停!");
//Thread.Sleep(2000);
return;
}
else
{
ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0
ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000
ProcessWriteInt(MelsecPLC, "D51", "int", "1");//手动拧紧螺丝D51置1
machineState = MachineState.Waiting;//设备启动完成后保持状态
LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!");
}
}
}
});
Task.Run(() =>
{
ShaftOperateOnce(MelsecPLC, "D1", 500);//D1置1延时500后置0
});
IsSingleStepOperating = false;
}
/// <summary>
/// 自动拧松流程
/// </summary>
/// <param name="machineState"></param>
public void ShaftAutoLoosen(MachineState machineState)
{
if (machineState != MachineState.Ready)
{
LogAsync(DateTime.Now, LogLevel.Error, "机台不在就绪状态,无法启动");
return;
}
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
//设置PLC
var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string addressD07 = ProcessReadInt(MelsecPLC, "D07", "int");
//string ShaftCommunication = ProcessReadInt(MelsecPLC, "D201", "int");//通讯
machineState = MachineState.Running;
ProcessStatus = ProcessStatus.Init;
MachineStateStep = MachineStateStep.Ready;
Task.Run(() =>
{
while (machineState == MachineState.Running && MachineStateStep != MachineStateStep.Pause)
{
string ShaftCommunication = ProcessReadInt(MelsecPLC, "D201", "int");//通讯
if (ShaftCommunication == "111")//如果等于111流程启动
{
string ShaftEmergencyStop = ProcessReadInt(MelsecPLC, "D19", "int");//急停
if (ShaftEmergencyStop != "0")//判断是否急停0不急停1急停
{
LogAsync(DateTime.Now, LogLevel.Warning, "设备急停!");
//Thread.Sleep(2000);
return;
}
else
{
ProcessWriteInt(MelsecPLC, "D3", "int", "0");//D3置0
ProcessWriteInt(MelsecPLC, "D171", "int", "3000");//最大扭矩3000
ProcessWriteInt(MelsecPLC, "D53", "int", "1");//手动拧紧螺丝D51置1
machineState = MachineState.Waiting;//设备启动完成后保持状态
LogAsync(DateTime.Now, LogLevel.Detail, "设备已启动,请勿其他操作!!");
}
}
}
});
Task.Run(() =>
{
ShaftOperateOnce(MelsecPLC, "D1", 500);//D1置1延时500后置0
});
IsSingleStepOperating = false;
}
/// <summary>
/// 到位或急停后停止
/// </summary>
public void StopProcess()
{
var MelsecPLC = DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
ProcessWriteInt(MelsecPLC, "D3", "int", "1");//D3置0
ProcessWriteInt(MelsecPLC, "D53", "int", "0");//手动拧紧螺丝D53置0
}
#endregion
/// <summary> /// <summary>
/// 进入自动化控制进程,完成系列动作 /// 进入自动化控制进程,完成系列动作
/// </summary> /// </summary>
@ -2341,13 +2452,10 @@ namespace BRS.Process.A020
default: default:
break; break;
} }
sw.Stop(); sw.Stop();
// lblElapsed.Text = sw.ElapsedMilliseconds.ToString(); // lblElapsed.Text = sw.ElapsedMilliseconds.ToString();
} }
private void ProcessStartTimer(object state) private void ProcessStartTimer(object state)
{ {
//isMidFeedingProductFlag = true; //isMidFeedingProductFlag = true;
@ -2578,6 +2686,5 @@ namespace BRS.Process.A020
// MachineState = MachineState.Ready; // MachineState = MachineState.Ready;
return new ProcessResponse(true); return new ProcessResponse(true);
} }
} }
} }

View File

@ -46,6 +46,21 @@ 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.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.TestBtn = new Sunny.UI.UIButton();
this.Setting = new Sunny.UI.UIButton();
this.AutoLoosenBtn1 = new Sunny.UI.UIButton();
this.AutoToughBtn1 = new Sunny.UI.UIButton();
this.ManualLoosenBtn = new Sunny.UI.UIButton();
this.ManualToughBtn = new Sunny.UI.UIButton();
this.StopBtn2 = 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();
@ -53,21 +68,11 @@ namespace BRS.Process.A020.UI
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
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.StartBtn1 = new Sunny.UI.UIButton(); this.timer2 = new System.Windows.Forms.Timer(this.components);
this.StopBtn2 = new Sunny.UI.UIButton(); this.label1 = new System.Windows.Forms.Label();
this.ManualToughBtn = new Sunny.UI.UIButton(); this.label2 = new System.Windows.Forms.Label();
this.ManualLoosenBtn = new Sunny.UI.UIButton(); this.label3 = new System.Windows.Forms.Label();
this.AutoToughBtn1 = new Sunny.UI.UIButton(); this.label4 = new System.Windows.Forms.Label();
this.AutoLoosenBtn1 = new Sunny.UI.UIButton();
this.Setting = new Sunny.UI.UIButton();
this.TestBtn = new Sunny.UI.UIButton();
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();
@ -199,6 +204,10 @@ namespace BRS.Process.A020.UI
// //
// uiPanel1 // uiPanel1
// //
this.uiPanel1.Controls.Add(this.label4);
this.uiPanel1.Controls.Add(this.label3);
this.uiPanel1.Controls.Add(this.label2);
this.uiPanel1.Controls.Add(this.label1);
this.uiPanel1.Controls.Add(this.ManualBtn1); this.uiPanel1.Controls.Add(this.ManualBtn1);
this.uiPanel1.Controls.Add(this.AutoBtn1); this.uiPanel1.Controls.Add(this.AutoBtn1);
this.uiPanel1.Controls.Add(this.LoosenLight1); this.uiPanel1.Controls.Add(this.LoosenLight1);
@ -226,6 +235,188 @@ 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
//
this.ManualBtn1.BackColor = System.Drawing.Color.Gray;
this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualBtn1.Location = new System.Drawing.Point(484, 323);
this.ManualBtn1.Name = "ManualBtn1";
this.ManualBtn1.Size = new System.Drawing.Size(58, 50);
this.ManualBtn1.TabIndex = 19;
this.ManualBtn1.Text = "手动按钮";
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;
//
// TestBtn
//
this.TestBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.TestBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.TestBtn.Location = new System.Drawing.Point(12, 508);
this.TestBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.TestBtn.Name = "TestBtn";
this.TestBtn.Size = new System.Drawing.Size(100, 35);
this.TestBtn.TabIndex = 14;
this.TestBtn.Text = "测试按钮";
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);
//
// 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
//
this.AutoLoosenBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.AutoLoosenBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoLoosenBtn1.Location = new System.Drawing.Point(420, 450);
this.AutoLoosenBtn1.MinimumSize = new System.Drawing.Size(1, 1);
this.AutoLoosenBtn1.Name = "AutoLoosenBtn1";
this.AutoLoosenBtn1.Size = new System.Drawing.Size(120, 45);
this.AutoLoosenBtn1.TabIndex = 12;
this.AutoLoosenBtn1.Text = "自动拧松";
this.AutoLoosenBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoLoosenBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.AutoLoosenBtn1.Click += new System.EventHandler(this.AutoLoosenBtn1_Click);
//
// AutoToughBtn1
//
this.AutoToughBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.AutoToughBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoToughBtn1.Location = new System.Drawing.Point(420, 393);
this.AutoToughBtn1.MinimumSize = new System.Drawing.Size(1, 1);
this.AutoToughBtn1.Name = "AutoToughBtn1";
this.AutoToughBtn1.Size = new System.Drawing.Size(120, 45);
this.AutoToughBtn1.TabIndex = 11;
this.AutoToughBtn1.Text = "自动拧紧";
this.AutoToughBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoToughBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.AutoToughBtn1.Click += new System.EventHandler(this.AutoToughBtn1_Click);
//
// ManualLoosenBtn
//
this.ManualLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualLoosenBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualLoosenBtn.Location = new System.Drawing.Point(420, 258);
this.ManualLoosenBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.ManualLoosenBtn.Name = "ManualLoosenBtn";
this.ManualLoosenBtn.Size = new System.Drawing.Size(120, 45);
this.ManualLoosenBtn.TabIndex = 10;
this.ManualLoosenBtn.Text = "手动拧松";
this.ManualLoosenBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualLoosenBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.ManualLoosenBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ManualLoosenBtn_MouseDown);
this.ManualLoosenBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ManualLoosenBtn_MouseUp);
//
// ManualToughBtn
//
this.ManualToughBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualToughBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualToughBtn.Location = new System.Drawing.Point(420, 185);
this.ManualToughBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.ManualToughBtn.Name = "ManualToughBtn";
this.ManualToughBtn.Size = new System.Drawing.Size(120, 45);
this.ManualToughBtn.TabIndex = 9;
this.ManualToughBtn.Text = "手动拧紧";
this.ManualToughBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualToughBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.ManualToughBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ManualToughBtn_MouseDown);
this.ManualToughBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ManualToughBtn_MouseUp);
//
// StopBtn2
//
this.StopBtn2.Cursor = System.Windows.Forms.Cursors.Hand;
this.StopBtn2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StopBtn2.Location = new System.Drawing.Point(215, 258);
this.StopBtn2.MinimumSize = new System.Drawing.Size(1, 1);
this.StopBtn2.Name = "StopBtn2";
this.StopBtn2.Size = new System.Drawing.Size(120, 45);
this.StopBtn2.TabIndex = 8;
this.StopBtn2.Text = "停止";
this.StopBtn2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StopBtn2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StopBtn2.Click += new System.EventHandler(this.StopBtn2_Click);
//
// StartBtn1
//
this.StartBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.StartBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StartBtn1.Location = new System.Drawing.Point(215, 185);
this.StartBtn1.MinimumSize = new System.Drawing.Size(1, 1);
this.StartBtn1.Name = "StartBtn1";
this.StartBtn1.Size = new System.Drawing.Size(120, 45);
this.StartBtn1.TabIndex = 7;
this.StartBtn1.Text = "开始";
this.StartBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
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;
@ -312,185 +503,54 @@ namespace BRS.Process.A020.UI
this.uiButton1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0); this.uiButton1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
// //
// StartBtn1 // timer2
// //
this.StartBtn1.Cursor = System.Windows.Forms.Cursors.Hand; this.timer2.Interval = 1000;
this.StartBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
this.StartBtn1.Location = new System.Drawing.Point(199, 156);
this.StartBtn1.MinimumSize = new System.Drawing.Size(1, 1);
this.StartBtn1.Name = "StartBtn1";
this.StartBtn1.Size = new System.Drawing.Size(100, 35);
this.StartBtn1.TabIndex = 7;
this.StartBtn1.Text = "开始";
this.StartBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StartBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StartBtn1.Click += new System.EventHandler(this.StartBtn1_Click);
// //
// StopBtn2 // label1
// //
this.StopBtn2.Cursor = System.Windows.Forms.Cursors.Hand; this.label1.AutoSize = true;
this.StopBtn2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.BackColor = System.Drawing.Color.Silver;
this.StopBtn2.Location = new System.Drawing.Point(199, 229); this.label1.Location = new System.Drawing.Point(63, 106);
this.StopBtn2.MinimumSize = new System.Drawing.Size(1, 1); this.label1.Name = "label1";
this.StopBtn2.Name = "StopBtn2"; this.label1.Size = new System.Drawing.Size(74, 42);
this.StopBtn2.Size = new System.Drawing.Size(100, 35); this.label1.TabIndex = 20;
this.StopBtn2.TabIndex = 8; this.label1.Text = "启动状态\r\n指示灯";
this.StopBtn2.Text = "停止"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.StopBtn2.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StopBtn2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StopBtn2.Click += new System.EventHandler(this.StopBtn2_Click);
// //
// ManualToughBtn // label2
// //
this.ManualToughBtn.Cursor = System.Windows.Forms.Cursors.Hand; this.label2.AutoSize = true;
this.ManualToughBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label2.BackColor = System.Drawing.Color.Silver;
this.ManualToughBtn.Location = new System.Drawing.Point(420, 156); this.label2.Location = new System.Drawing.Point(207, 106);
this.ManualToughBtn.MinimumSize = new System.Drawing.Size(1, 1); this.label2.Name = "label2";
this.ManualToughBtn.Name = "ManualToughBtn"; this.label2.Size = new System.Drawing.Size(74, 42);
this.ManualToughBtn.Size = new System.Drawing.Size(100, 35); this.label2.TabIndex = 21;
this.ManualToughBtn.TabIndex = 9; this.label2.Text = "停止状态\r\n指示灯";
this.ManualToughBtn.Text = "手动拧紧"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.ManualToughBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualToughBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.ManualToughBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ManualToughBtn_MouseDown);
this.ManualToughBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ManualToughBtn_MouseUp);
// //
// ManualLoosenBtn // label3
// //
this.ManualLoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand; this.label3.AutoSize = true;
this.ManualLoosenBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label3.BackColor = System.Drawing.Color.Silver;
this.ManualLoosenBtn.Location = new System.Drawing.Point(420, 229); this.label3.Location = new System.Drawing.Point(326, 106);
this.ManualLoosenBtn.MinimumSize = new System.Drawing.Size(1, 1); this.label3.Name = "label3";
this.ManualLoosenBtn.Name = "ManualLoosenBtn"; this.label3.Size = new System.Drawing.Size(106, 42);
this.ManualLoosenBtn.Size = new System.Drawing.Size(100, 35); this.label3.TabIndex = 22;
this.ManualLoosenBtn.TabIndex = 10; this.label3.Text = "手动拧紧状态\r\n指示灯";
this.ManualLoosenBtn.Text = "手动拧松"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.ManualLoosenBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualLoosenBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.ManualLoosenBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ManualLoosenBtn_MouseDown);
this.ManualLoosenBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ManualLoosenBtn_MouseUp);
// //
// AutoToughBtn1 // label4
// //
this.AutoToughBtn1.Cursor = System.Windows.Forms.Cursors.Hand; this.label4.AutoSize = true;
this.AutoToughBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label4.BackColor = System.Drawing.Color.Silver;
this.AutoToughBtn1.Location = new System.Drawing.Point(420, 364); this.label4.Location = new System.Drawing.Point(480, 106);
this.AutoToughBtn1.MinimumSize = new System.Drawing.Size(1, 1); this.label4.Name = "label4";
this.AutoToughBtn1.Name = "AutoToughBtn1"; this.label4.Size = new System.Drawing.Size(106, 42);
this.AutoToughBtn1.Size = new System.Drawing.Size(100, 35); this.label4.TabIndex = 23;
this.AutoToughBtn1.TabIndex = 11; this.label4.Text = "手动拧松状态\r\n指示灯";
this.AutoToughBtn1.Text = "自动拧紧"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.AutoToughBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoToughBtn1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// AutoLoosenBtn1
//
this.AutoLoosenBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.AutoLoosenBtn1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoLoosenBtn1.Location = new System.Drawing.Point(420, 421);
this.AutoLoosenBtn1.MinimumSize = new System.Drawing.Size(1, 1);
this.AutoLoosenBtn1.Name = "AutoLoosenBtn1";
this.AutoLoosenBtn1.Size = new System.Drawing.Size(100, 35);
this.AutoLoosenBtn1.TabIndex = 12;
this.AutoLoosenBtn1.Text = "自动拧松";
this.AutoLoosenBtn1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.AutoLoosenBtn1.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(199, 299);
this.Setting.MinimumSize = new System.Drawing.Size(1, 1);
this.Setting.Name = "Setting";
this.Setting.Size = new System.Drawing.Size(100, 35);
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);
//
// TestBtn
//
this.TestBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.TestBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.TestBtn.Location = new System.Drawing.Point(27, 457);
this.TestBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.TestBtn.Name = "TestBtn";
this.TestBtn.Size = new System.Drawing.Size(100, 35);
this.TestBtn.TabIndex = 14;
this.TestBtn.Text = "测试按钮";
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);
//
// ManualBtn1
//
this.ManualBtn1.BackColor = System.Drawing.Color.Gray;
this.ManualBtn1.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualBtn1.Location = new System.Drawing.Point(491, 284);
this.ManualBtn1.Name = "ManualBtn1";
this.ManualBtn1.Size = new System.Drawing.Size(58, 50);
this.ManualBtn1.TabIndex = 19;
this.ManualBtn1.Text = "手动按钮";
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(398, 284);
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.Location = new System.Drawing.Point(46, 147);
this.ESBtn.Name = "ESBtn";
this.ESBtn.Size = new System.Drawing.Size(111, 102);
this.ESBtn.TabIndex = 0;
this.ESBtn.Text = "急停";
this.ESBtn.UseVisualStyleBackColor = false;
// //
// 扭矩轴控制 // 扭矩轴控制
// //
@ -505,6 +565,7 @@ namespace BRS.Process.A020.UI
this.Load += new System.EventHandler(this._Load); this.Load += new System.EventHandler(this._Load);
((System.ComponentModel.ISupportInitialize)(this.chart2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.chart2)).EndInit();
this.uiPanel1.ResumeLayout(false); this.uiPanel1.ResumeLayout(false);
this.uiPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -550,5 +611,10 @@ namespace BRS.Process.A020.UI
private Sunny.UI.UIButton StartBtn1; private Sunny.UI.UIButton StartBtn1;
private CircleButton MoveStateLight1; private CircleButton MoveStateLight1;
private CircleButton ESBtn; private CircleButton ESBtn;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
} }
} }

View File

@ -20,17 +20,20 @@ using static BRS.Common.Model.Helper.EnumHelper;
namespace BRS.Process.A020.UI namespace BRS.Process.A020.UI
{ {
[MenuNode("ControlShaft", "扭矩轴控制", 5, "View2", true)] [MenuNode("ControlShaft", "扭矩轴控制", 5, "View2", true)]
public partial class : MenuFormBase, IRunCtrl public partial class : MenuFormBase, IRunCtrl
{ {
private DateTime X_minValue;//横坐标最初值 private DateTime X_minValue;//横坐标最初值
private bool is_btn_manual { get; set; } = false; private bool is_btn_manual { get; set; } = false;//是否手动
private bool isOpenAuto { get; set; } = false;//是否正在自动操作
int resValue1;
int resValue2;
A020Process ProcessA020 => Process as A020Process; A020Process ProcessA020 => Process as A020Process;
A020Config Config => Process?.IConfig as A020Config; A020Config Config => Process?.IConfig as A020Config;
private bool isSingleStepOperating = false; //private bool isSingleStepOperating = false;
public () public ()
{ {
@ -503,11 +506,11 @@ namespace BRS.Process.A020.UI
try try
{ {
ProcessOperation(true);//点击开始按钮后执行 ProcessOperation(true);//点击开始按钮后执行
//if (isStart) //if (isStart)
//{ //{
// await ProcessOperation(true); // await ProcessOperation(true);
// //ProcessOperation(true); // //ProcessOperation(true);
//} //}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -528,12 +531,14 @@ namespace BRS.Process.A020.UI
} }
private void StopBtn2_Click(object sender, EventArgs e) private void StopBtn2_Click(object sender, EventArgs e)
{ {
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
ProcessWriteInt(MelsecPLC, "D3", "int", "1");
ProcessWriteInt(MelsecPLC, "D7", "int", "0");
if (Process == null) if (Process == null)
{ {
MessageBox.Show("无法操作空流程"); MessageBox.Show("无法操作空流程");
return; return;
} }
StopBtn2.Enabled = false; StopBtn2.Enabled = false;
try try
{ {
@ -558,7 +563,10 @@ namespace BRS.Process.A020.UI
this.ManualBtn1.BackColor = Color.Gray; this.ManualBtn1.BackColor = Color.Gray;
//点击停止后初始化图表 //点击停止后初始化图表
InitChart(); InitChart();
timer1.Stop();
timer2.Stop();
StopBtn2.Enabled = true; StopBtn2.Enabled = true;
isOpenAuto = false;
} }
} }
/// <summary> /// <summary>
@ -612,7 +620,7 @@ namespace BRS.Process.A020.UI
{ {
return; return;
} }
else if(MoveStateLight1.BackColor == Color.GreenYellow&&ManualBtn1.BackColor==Color.Gray) else if (MoveStateLight1.BackColor == Color.GreenYellow && ManualBtn1.BackColor == Color.Gray)
{ {
return; return;
} }
@ -692,25 +700,155 @@ namespace BRS.Process.A020.UI
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。"); LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
} }
} }
/// <summary>
/// 点击自动按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AutoBtn1_Click(object sender, EventArgs e) private void AutoBtn1_Click(object sender, EventArgs e)
{ {
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
if (MoveStateLight1.BackColor == Color.GreenYellow) if (MoveStateLight1.BackColor == Color.GreenYellow)
{ {
AutoBtn1.BackColor = Color.GreenYellow; if (isOpenAuto == true)
ManualBtn1.BackColor = Color.Gray; {
LogAsync(DateTime.Now, LogLevel.Error, "流程已启动,请勿重新启动!");
}
else
{
ProcessWriteInt(MelsecPLC, "D7", "int", "1");
AutoBtn1.BackColor = Color.GreenYellow;
ManualBtn1.BackColor = Color.Gray;
is_btn_manual = false;
}
} }
else if (StopStateLight1.BackColor == Color.Red) else if (StopStateLight1.BackColor == Color.Red)
{ {
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)
{ {
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
if (MoveStateLight1.BackColor == Color.GreenYellow) if (MoveStateLight1.BackColor == Color.GreenYellow)
{ {
AutoBtn1.BackColor = Color.Gray; if (isOpenAuto == true)
ManualBtn1.BackColor = Color.GreenYellow; {
LogAsync(DateTime.Now, LogLevel.Error, "当前正在进行自动操作,请勿切换!");
}
else
{
ProcessWriteInt(MelsecPLC, "D7", "int", "0");
AutoBtn1.BackColor = Color.Gray;
ManualBtn1.BackColor = Color.GreenYellow;
}
}
else if (StopStateLight1.BackColor == Color.Red)
{
LogAsync(DateTime.Now, LogLevel.Error, "当前流程未启动,无法选择操作模式");
}
is_btn_manual = true;
}
/// <summary>
/// 自动拧紧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AutoToughBtn1_Click(object sender, EventArgs e)
{
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string addressD07 = ProcessReadInt(MelsecPLC, "D07", "int");
if (MoveStateLight1.BackColor == Color.GreenYellow)
{
if (addressD07 == "1")
{
if (!ProcessA020.IsSingleStepOperating)
{
if (isOpenAuto == true)
{
LogAsync(DateTime.Now, LogLevel.Error, "流程已启动,请勿重新启动!");
return;
}
isOpenAuto = true;
ProcessA020.IsSingleStepOperating = true;
ProcessA020.ShaftAutoTough(MachineState.Ready);
timer1.Start();
timer2.Start();
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"未打到自动状态");
}
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"当前流程未启动");
}
}
/// <summary>
/// 自动拧松
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AutoLoosenBtn1_Click(object sender, EventArgs e)
{
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string addressD07 = ProcessReadInt(MelsecPLC, "D07", "int");
if (MoveStateLight1.BackColor == Color.GreenYellow)
{
if (addressD07 == "1")
{
if (!ProcessA020.IsSingleStepOperating)
{
if (isOpenAuto == true)
{
LogAsync(DateTime.Now, LogLevel.Error, "流程已启动,请勿重新启动!");
return;
}
isOpenAuto = true;
ProcessA020.IsSingleStepOperating = true;
ProcessA020.ShaftAutoLoosen(MachineState.Ready);
timer1.Start();
timer2.Start();
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"未打到自动状态");
}
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"当前流程未启动");
}
}
private void timer2_Tick(object sender, EventArgs e)
{
var MelsecPLC = ProcessA020.DeviceCollection.FirstOrDefault(u => u is PLCBase) as PLCBase;
string torsionValue = ProcessReadInt(MelsecPLC, "D251", "int");
string angleValue = ProcessReadInt(MelsecPLC, "D351", "int");
resValue1 = Convert.ToInt32(torsionValue);//将接收到的返回值转为int类型
resValue2 = Convert.ToInt32(angleValue);
while (resValue1 >= 200 && resValue2 <= 6)
{
ProcessA020.StopProcess();
LogAsync(DateTime.Now, LogLevel.Information, "已完成");
timer2.Stop();
timer1.Stop();
return;
} }
} }
} }

View File

@ -120,6 +120,9 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>45</value> <value>45</value>
</metadata> </metadata>

View File

@ -4,7 +4,8 @@ using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下 // 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改 // 控制。更改这些特性值可修改
// 与程序集关联的信息。 // 与程序集关联的信息。
[assembly: AssemblyTitle("磁环分选系统")] //[assembly: AssemblyTitle("磁环分选系统")]
[assembly: AssemblyTitle("大扭矩拧紧轴操作系统")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]