This commit is contained in:
17860779768 2023-03-03 12:10:50 +08:00
parent 157613603c
commit 7949ec25c9
24 changed files with 1616 additions and 1459 deletions

63
.gitattributes vendored
View File

@ -1,63 +0,0 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

View File

@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BRS.Device.OmronPLC", "src\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XKRS.Device.NbtRobot", "src\BRS.Device.NbtRobot\XKRS.Device.NbtRobot.csproj", "{8FA74161-0D03-408F-811A-A244C9027BFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XKRS.Device.MelsecPLC", "src\XKRS.Device.MelsecPLC\XKRS.Device.MelsecPLC.csproj", "{887F9454-B1F3-47B8-B9F7-48BEBA47193D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -209,6 +211,24 @@ Global
{8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x64.Build.0 = Release|Any CPU
{8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x86.ActiveCfg = Release|Any CPU
{8FA74161-0D03-408F-811A-A244C9027BFB}.Release|x86.Build.0 = Release|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|x64.ActiveCfg = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|x64.Build.0 = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|x86.ActiveCfg = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug|x86.Build.0 = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug1|Any CPU.ActiveCfg = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug1|Any CPU.Build.0 = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug1|x64.ActiveCfg = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug1|x64.Build.0 = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug1|x86.ActiveCfg = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Debug1|x86.Build.0 = Debug|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|Any CPU.Build.0 = Release|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x64.ActiveCfg = Release|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x64.Build.0 = Release|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x86.ActiveCfg = Release|Any CPU
{887F9454-B1F3-47B8-B9F7-48BEBA47193D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -223,6 +243,7 @@ Global
{9EB9DFC1-C78A-46C0-826A-5ED1A08232C0} = {DD1CE747-341A-4419-8398-0D482E02DE54}
{560CC80B-389B-46FC-9B8C-DA1D62A555D9} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B}
{8FA74161-0D03-408F-811A-A244C9027BFB} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B}
{887F9454-B1F3-47B8-B9F7-48BEBA47193D} = {5DB27B2D-14A5-441F-A861-BAFDB7BAA05B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4BF9CC66-BB0E-4400-BCF8-5BF7F5DA800A}

1
Config.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,22 @@ namespace BRS.Common.Model.Helper
{
public static class EnumHelper
{
static int ShijiaoPostion1 = 0;
static int ShijiaoPostion2 = 0;
static int ShijiaoPostion3 = 0;
public struct MyPoint
{
public double dX;
public double dY;
}
public struct Corner
{
public MyPoint LU;
public MyPoint RU;
public MyPoint LD;
public MyPoint RD;
}
/// <summary>
/// 根据枚举的代码名称获取枚举列表信息
/// </summary>
@ -672,6 +688,8 @@ namespace BRS.Common.Model.Helper
Resetting = 5,
Closing = 6,
ClearProduct = 7,
//等待
Waiting=8,
}
public enum WhoolSize

File diff suppressed because it is too large Load Diff

View File

@ -120,6 +120,15 @@
<Compile Include="ContolPlc.Designer.cs">
<DependentUpon>ContolPlc.cs</DependentUpon>
</Compile>
<Compile Include="UI\CircleButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\ContorlShaft.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\ContorlShaft.Designer.cs">
<DependentUpon>ContorlShaft.cs</DependentUpon>
</Compile>
<Compile Include="UI\ExternalTools.cs" />
<Compile Include="UI\ControlSet.cs">
<SubType>Form</SubType>
@ -184,6 +193,9 @@
<EmbeddedResource Include="ContolPlc.resx">
<DependentUpon>ContolPlc.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\ContorlShaft.resx">
<DependentUpon>ContorlShaft.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\ControlSet.resx">
<DependentUpon>ControlSet.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BRS.Process.A020.UI
{
public class CircleButton:Button
{
protected override void OnPaint(PaintEventArgs e)//重新设置控件的形状 protected 保护 override重新
{
base.OnPaint(e);//递归 每次重新都发生此方法,保证其形状为自定义形状
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(2, 2, this.Width - 6, this.Height - 6);
Graphics g = e.Graphics;
g.DrawEllipse(new Pen(Color.Black, 2), 2, 2, Width - 6, Height - 6);
Region = new Region(path);
}
}
}

View File

@ -0,0 +1,247 @@

namespace BRS.Process.A020.UI
{
partial class
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.TorqueSettingBtn = new Sunny.UI.UIButton();
this.StartBtn = new Sunny.UI.UIButton();
this.ToughBtn = new Sunny.UI.UIButton();
this.LoosenBtn = new Sunny.UI.UIButton();
this.StopBtn = new Sunny.UI.UIButton();
this.ManualOrAuto = new Sunny.UI.UIButton();
this.uiBarChart1 = new Sunny.UI.UIBarChart();
this.uiBarChart2 = new Sunny.UI.UIBarChart();
this.MoveStateLabel = new Sunny.UI.UILabel();
this.StopStateLabel = new Sunny.UI.UILabel();
this.EmengencyStopBtn = new BRS.Process.A020.UI.CircleButton();
this.StopStateLight = new BRS.Process.A020.UI.CircleButton();
this.MoveStateLight = new BRS.Process.A020.UI.CircleButton();
this.SuspendLayout();
//
// TorqueSettingBtn
//
this.TorqueSettingBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.TorqueSettingBtn.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.TorqueSettingBtn.Location = new System.Drawing.Point(169, 392);
this.TorqueSettingBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.TorqueSettingBtn.Name = "TorqueSettingBtn";
this.TorqueSettingBtn.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TorqueSettingBtn.Size = new System.Drawing.Size(124, 46);
this.TorqueSettingBtn.TabIndex = 2;
this.TorqueSettingBtn.Text = "最大扭矩设置";
this.TorqueSettingBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.TorqueSettingBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// StartBtn
//
this.StartBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.StartBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StartBtn.Location = new System.Drawing.Point(180, 215);
this.StartBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.StartBtn.Name = "StartBtn";
this.StartBtn.Size = new System.Drawing.Size(100, 35);
this.StartBtn.TabIndex = 3;
this.StartBtn.Text = "开始";
this.StartBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StartBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StartBtn.Click += new System.EventHandler(this.StartBtn_Click);
this.StartBtn.MouseDown += new System.Windows.Forms.MouseEventHandler(this.StartBtn_MouseDown);
this.StartBtn.MouseUp += new System.Windows.Forms.MouseEventHandler(this.StartBtn_MouseUp);
//
// ToughBtn
//
this.ToughBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.ToughBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ToughBtn.Location = new System.Drawing.Point(367, 215);
this.ToughBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.ToughBtn.Name = "ToughBtn";
this.ToughBtn.Size = new System.Drawing.Size(100, 35);
this.ToughBtn.TabIndex = 4;
this.ToughBtn.Text = "手动拧紧";
this.ToughBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ToughBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// LoosenBtn
//
this.LoosenBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.LoosenBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.LoosenBtn.Location = new System.Drawing.Point(367, 293);
this.LoosenBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.LoosenBtn.Name = "LoosenBtn";
this.LoosenBtn.Size = new System.Drawing.Size(100, 35);
this.LoosenBtn.TabIndex = 5;
this.LoosenBtn.Text = "手动拧松";
this.LoosenBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.LoosenBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// StopBtn
//
this.StopBtn.Cursor = System.Windows.Forms.Cursors.Hand;
this.StopBtn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StopBtn.Location = new System.Drawing.Point(180, 293);
this.StopBtn.MinimumSize = new System.Drawing.Size(1, 1);
this.StopBtn.Name = "StopBtn";
this.StopBtn.Size = new System.Drawing.Size(100, 35);
this.StopBtn.TabIndex = 6;
this.StopBtn.Text = "停止";
this.StopBtn.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StopBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.StopBtn.Click += new System.EventHandler(this.StopBtn_Click);
//
// ManualOrAuto
//
this.ManualOrAuto.Cursor = System.Windows.Forms.Cursors.Hand;
this.ManualOrAuto.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualOrAuto.Location = new System.Drawing.Point(367, 400);
this.ManualOrAuto.MinimumSize = new System.Drawing.Size(1, 1);
this.ManualOrAuto.Name = "ManualOrAuto";
this.ManualOrAuto.Size = new System.Drawing.Size(100, 35);
this.ManualOrAuto.TabIndex = 7;
this.ManualOrAuto.Text = "手动/自动";
this.ManualOrAuto.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ManualOrAuto.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// uiBarChart1
//
this.uiBarChart1.Dock = System.Windows.Forms.DockStyle.Right;
this.uiBarChart1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiBarChart1.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiBarChart1.Location = new System.Drawing.Point(870, 0);
this.uiBarChart1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiBarChart1.Name = "uiBarChart1";
this.uiBarChart1.Size = new System.Drawing.Size(346, 568);
this.uiBarChart1.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiBarChart1.TabIndex = 8;
this.uiBarChart1.Text = "uiBarChart1";
this.uiBarChart1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// uiBarChart2
//
this.uiBarChart2.Dock = System.Windows.Forms.DockStyle.Right;
this.uiBarChart2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiBarChart2.LegendFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiBarChart2.Location = new System.Drawing.Point(524, 0);
this.uiBarChart2.MinimumSize = new System.Drawing.Size(1, 1);
this.uiBarChart2.Name = "uiBarChart2";
this.uiBarChart2.Size = new System.Drawing.Size(346, 568);
this.uiBarChart2.SubFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiBarChart2.TabIndex = 9;
this.uiBarChart2.Text = "uiBarChart2";
this.uiBarChart2.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// MoveStateLabel
//
this.MoveStateLabel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.MoveStateLabel.Location = new System.Drawing.Point(165, 111);
this.MoveStateLabel.Name = "MoveStateLabel";
this.MoveStateLabel.Size = new System.Drawing.Size(125, 23);
this.MoveStateLabel.TabIndex = 10;
this.MoveStateLabel.Text = "运动状态指示灯";
this.MoveStateLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.MoveStateLabel.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// StopStateLabel
//
this.StopStateLabel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.StopStateLabel.Location = new System.Drawing.Point(354, 111);
this.StopStateLabel.Name = "StopStateLabel";
this.StopStateLabel.Size = new System.Drawing.Size(125, 23);
this.StopStateLabel.TabIndex = 11;
this.StopStateLabel.Text = "停止状态指示灯";
this.StopStateLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.StopStateLabel.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// EmengencyStopBtn
//
this.EmengencyStopBtn.BackColor = System.Drawing.Color.Red;
this.EmengencyStopBtn.Font = new System.Drawing.Font("宋体", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.EmengencyStopBtn.Location = new System.Drawing.Point(12, 203);
this.EmengencyStopBtn.Name = "EmengencyStopBtn";
this.EmengencyStopBtn.Size = new System.Drawing.Size(124, 125);
this.EmengencyStopBtn.TabIndex = 12;
this.EmengencyStopBtn.Text = "急停";
this.EmengencyStopBtn.UseVisualStyleBackColor = false;
//
// StopStateLight
//
this.StopStateLight.Location = new System.Drawing.Point(379, 33);
this.StopStateLight.Name = "StopStateLight";
this.StopStateLight.Size = new System.Drawing.Size(76, 75);
this.StopStateLight.TabIndex = 1;
this.StopStateLight.UseVisualStyleBackColor = true;
//
// MoveStateLight
//
this.MoveStateLight.Location = new System.Drawing.Point(193, 33);
this.MoveStateLight.Name = "MoveStateLight";
this.MoveStateLight.Size = new System.Drawing.Size(76, 75);
this.MoveStateLight.TabIndex = 0;
this.MoveStateLight.UseVisualStyleBackColor = true;
//
// 扭矩轴控制
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1216, 568);
this.Controls.Add(this.EmengencyStopBtn);
this.Controls.Add(this.StopStateLabel);
this.Controls.Add(this.MoveStateLabel);
this.Controls.Add(this.uiBarChart2);
this.Controls.Add(this.uiBarChart1);
this.Controls.Add(this.ManualOrAuto);
this.Controls.Add(this.StopBtn);
this.Controls.Add(this.LoosenBtn);
this.Controls.Add(this.ToughBtn);
this.Controls.Add(this.StartBtn);
this.Controls.Add(this.TorqueSettingBtn);
this.Controls.Add(this.StopStateLight);
this.Controls.Add(this.MoveStateLight);
this.Name = "扭矩轴控制";
this.Text = "ContorlShaft";
this.ResumeLayout(false);
}
#endregion
private CircleButton MoveStateLight;
private CircleButton StopStateLight;
private Sunny.UI.UIButton TorqueSettingBtn;
private Sunny.UI.UIButton StartBtn;
private Sunny.UI.UIButton ToughBtn;
private Sunny.UI.UIButton LoosenBtn;
private Sunny.UI.UIButton StopBtn;
private Sunny.UI.UIButton ManualOrAuto;
private Sunny.UI.UIBarChart uiBarChart1;
private Sunny.UI.UIBarChart uiBarChart2;
private Sunny.UI.UILabel MoveStateLabel;
private Sunny.UI.UILabel StopStateLabel;
private CircleButton EmengencyStopBtn;
}
}

View File

@ -0,0 +1,62 @@
using BRS.UI.Model.Winform;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static BRS.Common.Model.Helper.EnumHelper;
namespace BRS.Process.A020.UI
{
[MenuNode("ControlShaft", "扭矩轴控制", 5, "View2", true)]
public partial class : MenuFormBase
{
private bool is_btn_manual { get; set; } = false;
A020Process ProcessA020 => Process as A020Process;
A020Config Config => Process?.IConfig as A020Config;
private bool isSingleStepOperating = false;
public ()
{
InitializeComponent();
}
private void StartBtn_Click(object sender, EventArgs e)
{
}
private void StartBtn_MouseDown(object sender, MouseEventArgs e)
{
this.MoveStateLight.BackColor = Color.GreenYellow;
if (!ProcessA020.IsSingleStepOperating)
{
ProcessA020.IsSingleStepOperating = true;
ProcessA020.ShaftRightMouseDown(MachineState.Ready);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
}
private void StartBtn_MouseUp(object sender, MouseEventArgs e)
{
this.MoveStateLight.BackColor = Color.Red;
if (!ProcessA020.IsSingleStepOperating)
{
ProcessA020.IsSingleStepOperating = true;
ProcessA020.ShaftRightMouseUp(MachineState.Ready);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
}
private void StopBtn_Click(object sender, EventArgs e)
{
this.MoveStateLight.BackColor = Color.Gray;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -29,15 +29,6 @@ namespace BRS.Process.A020.UI
/// </summary>
private void InitializeComponent()
{
this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
this.btn_start = new Sunny.UI.UIButton();
this.btn_pause = new Sunny.UI.UIButton();
this.btn_stop = new Sunny.UI.UIButton();
this.btn_manual = new Sunny.UI.UIButton();
this.btn_auto = new Sunny.UI.UIButton();
this.btn_reset = new Sunny.UI.UIButton();
this.btn_plcset = new Sunny.UI.UIButton();
this.btn_robotset = new Sunny.UI.UIButton();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.uiTitlePanel1 = new Sunny.UI.UITitlePanel();
this.uiPanel2 = new Sunny.UI.UIPanel();
@ -61,7 +52,15 @@ namespace BRS.Process.A020.UI
this.btn_load2_1 = new Sunny.UI.UIButton();
this.cmb_sizechoose2_1 = new Sunny.UI.UIComboBox();
this.uiPanel8 = new Sunny.UI.UIPanel();
this.uiTableLayoutPanel1.SuspendLayout();
this.btn_robotset = new Sunny.UI.UIButton();
this.btn_plcset = new Sunny.UI.UIButton();
this.btn_reset = new Sunny.UI.UIButton();
this.btn_auto = new Sunny.UI.UIButton();
this.btn_manual = new Sunny.UI.UIButton();
this.btn_stop = new Sunny.UI.UIButton();
this.btn_pause = new Sunny.UI.UIButton();
this.btn_start = new Sunny.UI.UIButton();
this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -72,162 +71,9 @@ namespace BRS.Process.A020.UI
this.uiTitlePanel2.SuspendLayout();
this.uiPanel5.SuspendLayout();
this.uiPanel7.SuspendLayout();
this.uiTableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// uiTableLayoutPanel1
//
this.uiTableLayoutPanel1.ColumnCount = 1;
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.uiTableLayoutPanel1.Controls.Add(this.btn_start, 0, 0);
this.uiTableLayoutPanel1.Controls.Add(this.btn_pause, 0, 1);
this.uiTableLayoutPanel1.Controls.Add(this.btn_stop, 0, 2);
this.uiTableLayoutPanel1.Controls.Add(this.btn_manual, 0, 3);
this.uiTableLayoutPanel1.Controls.Add(this.btn_auto, 0, 4);
this.uiTableLayoutPanel1.Controls.Add(this.btn_reset, 0, 5);
this.uiTableLayoutPanel1.Controls.Add(this.btn_plcset, 0, 6);
this.uiTableLayoutPanel1.Controls.Add(this.btn_robotset, 0, 7);
this.uiTableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Left;
this.uiTableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.uiTableLayoutPanel1.Name = "uiTableLayoutPanel1";
this.uiTableLayoutPanel1.RowCount = 8;
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.Size = new System.Drawing.Size(112, 545);
this.uiTableLayoutPanel1.TabIndex = 5;
this.uiTableLayoutPanel1.TagString = null;
//
// btn_start
//
this.btn_start.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_start.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_start.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_start.Location = new System.Drawing.Point(3, 13);
this.btn_start.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_start.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_start.Name = "btn_start";
this.btn_start.Size = new System.Drawing.Size(106, 42);
this.btn_start.TabIndex = 0;
this.btn_start.Text = "启动";
this.btn_start.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_start.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_start.Click += new System.EventHandler(this.btn_start_Click);
//
// btn_pause
//
this.btn_pause.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_pause.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_pause.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_pause.Location = new System.Drawing.Point(3, 81);
this.btn_pause.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_pause.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_pause.Name = "btn_pause";
this.btn_pause.Radius = 1;
this.btn_pause.Size = new System.Drawing.Size(106, 42);
this.btn_pause.TabIndex = 1;
this.btn_pause.Text = "暂停";
this.btn_pause.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_pause.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_stop
//
this.btn_stop.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_stop.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_stop.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stop.Location = new System.Drawing.Point(3, 149);
this.btn_stop.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_stop.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_stop.Name = "btn_stop";
this.btn_stop.Size = new System.Drawing.Size(106, 42);
this.btn_stop.TabIndex = 2;
this.btn_stop.Text = "停止";
this.btn_stop.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stop.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click);
//
// btn_manual
//
this.btn_manual.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_manual.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_manual.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_manual.Location = new System.Drawing.Point(3, 217);
this.btn_manual.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_manual.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_manual.Name = "btn_manual";
this.btn_manual.Size = new System.Drawing.Size(106, 42);
this.btn_manual.Style = Sunny.UI.UIStyle.Custom;
this.btn_manual.TabIndex = 3;
this.btn_manual.Text = "手动";
this.btn_manual.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_manual.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_manual.Click += new System.EventHandler(this.btn_manual_Click);
//
// btn_auto
//
this.btn_auto.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_auto.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_auto.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_auto.Location = new System.Drawing.Point(3, 285);
this.btn_auto.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_auto.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_auto.Name = "btn_auto";
this.btn_auto.Size = new System.Drawing.Size(106, 42);
this.btn_auto.TabIndex = 4;
this.btn_auto.Text = "自动";
this.btn_auto.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_auto.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_auto.Click += new System.EventHandler(this.btn_auto_Click);
//
// btn_reset
//
this.btn_reset.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_reset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_reset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_reset.Location = new System.Drawing.Point(3, 353);
this.btn_reset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_reset.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_reset.Name = "btn_reset";
this.btn_reset.Size = new System.Drawing.Size(106, 42);
this.btn_reset.TabIndex = 5;
this.btn_reset.Text = "复位";
this.btn_reset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_reset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_plcset
//
this.btn_plcset.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_plcset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_plcset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_plcset.Location = new System.Drawing.Point(3, 421);
this.btn_plcset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_plcset.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_plcset.Name = "btn_plcset";
this.btn_plcset.Size = new System.Drawing.Size(106, 42);
this.btn_plcset.TabIndex = 6;
this.btn_plcset.Text = "PLC设置";
this.btn_plcset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_plcset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_robotset
//
this.btn_robotset.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_robotset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_robotset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_robotset.Location = new System.Drawing.Point(3, 489);
this.btn_robotset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_robotset.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_robotset.Name = "btn_robotset";
this.btn_robotset.Size = new System.Drawing.Size(106, 43);
this.btn_robotset.TabIndex = 7;
this.btn_robotset.Text = "ROBOT设置";
this.btn_robotset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_robotset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
@ -635,6 +481,162 @@ namespace BRS.Process.A020.UI
this.uiPanel8.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiPanel8.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_robotset
//
this.btn_robotset.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_robotset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_robotset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_robotset.Location = new System.Drawing.Point(3, 489);
this.btn_robotset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_robotset.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_robotset.Name = "btn_robotset";
this.btn_robotset.Size = new System.Drawing.Size(106, 43);
this.btn_robotset.TabIndex = 7;
this.btn_robotset.Text = "ROBOT设置";
this.btn_robotset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_robotset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_plcset
//
this.btn_plcset.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_plcset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_plcset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_plcset.Location = new System.Drawing.Point(3, 421);
this.btn_plcset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_plcset.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_plcset.Name = "btn_plcset";
this.btn_plcset.Size = new System.Drawing.Size(106, 42);
this.btn_plcset.TabIndex = 6;
this.btn_plcset.Text = "PLC设置";
this.btn_plcset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_plcset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_reset
//
this.btn_reset.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_reset.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_reset.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_reset.Location = new System.Drawing.Point(3, 353);
this.btn_reset.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_reset.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_reset.Name = "btn_reset";
this.btn_reset.Size = new System.Drawing.Size(106, 42);
this.btn_reset.TabIndex = 5;
this.btn_reset.Text = "复位";
this.btn_reset.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_reset.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_auto
//
this.btn_auto.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_auto.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_auto.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_auto.Location = new System.Drawing.Point(3, 285);
this.btn_auto.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_auto.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_auto.Name = "btn_auto";
this.btn_auto.Size = new System.Drawing.Size(106, 42);
this.btn_auto.TabIndex = 4;
this.btn_auto.Text = "自动";
this.btn_auto.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_auto.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_auto.Click += new System.EventHandler(this.btn_auto_Click);
//
// btn_manual
//
this.btn_manual.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_manual.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_manual.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_manual.Location = new System.Drawing.Point(3, 217);
this.btn_manual.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_manual.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_manual.Name = "btn_manual";
this.btn_manual.Size = new System.Drawing.Size(106, 42);
this.btn_manual.TabIndex = 3;
this.btn_manual.Text = "手动";
this.btn_manual.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_manual.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_manual.Click += new System.EventHandler(this.btn_manual_Click);
//
// btn_stop
//
this.btn_stop.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_stop.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_stop.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stop.Location = new System.Drawing.Point(3, 149);
this.btn_stop.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_stop.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_stop.Name = "btn_stop";
this.btn_stop.Size = new System.Drawing.Size(106, 42);
this.btn_stop.TabIndex = 2;
this.btn_stop.Text = "停止";
this.btn_stop.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_stop.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click);
//
// btn_pause
//
this.btn_pause.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_pause.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_pause.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_pause.Location = new System.Drawing.Point(3, 81);
this.btn_pause.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_pause.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_pause.Name = "btn_pause";
this.btn_pause.Radius = 1;
this.btn_pause.Size = new System.Drawing.Size(106, 42);
this.btn_pause.TabIndex = 1;
this.btn_pause.Text = "暂停";
this.btn_pause.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_pause.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
//
// btn_start
//
this.btn_start.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_start.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_start.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_start.Location = new System.Drawing.Point(3, 13);
this.btn_start.Margin = new System.Windows.Forms.Padding(3, 13, 3, 13);
this.btn_start.MinimumSize = new System.Drawing.Size(1, 1);
this.btn_start.Name = "btn_start";
this.btn_start.Size = new System.Drawing.Size(106, 42);
this.btn_start.TabIndex = 0;
this.btn_start.Text = "启动";
this.btn_start.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btn_start.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btn_start.Click += new System.EventHandler(this.btn_start_Click);
this.btn_start.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_start_MouseDown);
this.btn_start.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btn_start_MouseUp);
//
// uiTableLayoutPanel1
//
this.uiTableLayoutPanel1.ColumnCount = 1;
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.uiTableLayoutPanel1.Controls.Add(this.btn_start, 0, 0);
this.uiTableLayoutPanel1.Controls.Add(this.btn_pause, 0, 1);
this.uiTableLayoutPanel1.Controls.Add(this.btn_stop, 0, 2);
this.uiTableLayoutPanel1.Controls.Add(this.btn_manual, 0, 3);
this.uiTableLayoutPanel1.Controls.Add(this.btn_auto, 0, 4);
this.uiTableLayoutPanel1.Controls.Add(this.btn_reset, 0, 5);
this.uiTableLayoutPanel1.Controls.Add(this.btn_plcset, 0, 6);
this.uiTableLayoutPanel1.Controls.Add(this.btn_robotset, 0, 7);
this.uiTableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Left;
this.uiTableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.uiTableLayoutPanel1.Name = "uiTableLayoutPanel1";
this.uiTableLayoutPanel1.RowCount = 8;
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.5F));
this.uiTableLayoutPanel1.Size = new System.Drawing.Size(112, 545);
this.uiTableLayoutPanel1.TabIndex = 5;
this.uiTableLayoutPanel1.TagString = null;
this.uiTableLayoutPanel1.Paint += new System.Windows.Forms.PaintEventHandler(this.uiTableLayoutPanel1_Paint);
//
// ControlSet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -645,7 +647,6 @@ namespace BRS.Process.A020.UI
this.Name = "ControlSet";
this.Text = "控制设置";
this.Load += new System.EventHandler(this.ControlSet_Load);
this.uiTableLayoutPanel1.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
@ -656,21 +657,22 @@ namespace BRS.Process.A020.UI
this.uiTitlePanel2.ResumeLayout(false);
this.uiPanel5.ResumeLayout(false);
this.uiPanel7.ResumeLayout(false);
this.uiTableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Sunny.UI.UITableLayoutPanel uiTableLayoutPanel1;
private Sunny.UI.UIButton btn_start;
private Sunny.UI.UIButton btn_pause;
private Sunny.UI.UIButton btn_stop;
private Sunny.UI.UIButton btn_manual;
private Sunny.UI.UIButton btn_auto;
private Sunny.UI.UIButton btn_reset;
private Sunny.UI.UIButton btn_plcset;
private Sunny.UI.UIButton btn_robotset;
private System.Windows.Forms.SplitContainer splitContainer1;
private Sunny.UI.UIButton btn_robotset;
private Sunny.UI.UIButton btn_plcset;
private Sunny.UI.UIButton btn_reset;
private Sunny.UI.UIButton btn_auto;
private Sunny.UI.UIButton btn_manual;
private Sunny.UI.UIButton btn_stop;
private Sunny.UI.UIButton btn_pause;
private Sunny.UI.UIButton btn_start;
private Sunny.UI.UITableLayoutPanel uiTableLayoutPanel1;
private Sunny.UI.UITitlePanel uiTitlePanel1;
private Sunny.UI.UIPanel uiPanel2;
private Sunny.UI.UIButton btn_down1_2;
@ -679,6 +681,7 @@ namespace BRS.Process.A020.UI
private Sunny.UI.UIPanel uiPanel4;
private Sunny.UI.UIPanel uiPanel1;
private Sunny.UI.UIButton btn_down1_1;
private Sunny.UI.UIComboBox cmb_sizechoose1_1;
private Sunny.UI.UIButton btn_load1_1;
private Sunny.UI.UIPanel uiPanel3;
private Sunny.UI.UITitlePanel uiTitlePanel2;
@ -692,6 +695,5 @@ namespace BRS.Process.A020.UI
private Sunny.UI.UIButton btn_load2_1;
private Sunny.UI.UIComboBox cmb_sizechoose2_1;
private Sunny.UI.UIPanel uiPanel8;
private Sunny.UI.UIComboBox cmb_sizechoose1_1;
}
}

View File

@ -41,9 +41,11 @@ namespace BRS.Process.A020.UI
private void btn_start_Click(object sender, EventArgs e)
{
//流程正转启动按钮
}
private void ControlSet_Load(object sender, EventArgs e)
{
//cmb_sizechoose1_1.SelectedIndex = 0;
@ -247,7 +249,7 @@ namespace BRS.Process.A020.UI
if (item.Value.location == 0)
Machine1Entrance1TyreSize = item.Value.tyreSize;
}
ProcessA020.Machine1Entrance1Up(Machine1Entrance1TyreSize);
//ProcessA020.Machine1Entrance1Up(Machine1Entrance1TyreSize);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
@ -266,7 +268,7 @@ namespace BRS.Process.A020.UI
if (item.Value.location == 0)
Machine1Entrance1TyreSize = item.Value.tyreSize;
}
ProcessA020.Machine1Entrance1Down(Machine1Entrance1TyreSize);
//ProcessA020.Machine1Entrance1Down(Machine1Entrance1TyreSize);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
@ -285,7 +287,7 @@ namespace BRS.Process.A020.UI
if (item.Value.location == 1)
Machine1Entrance2TyreSize = item.Value.tyreSize;
}
ProcessA020.Machine1Entrance2Down(Machine1Entrance2TyreSize);
//ProcessA020.Machine1Entrance2Down(Machine1Entrance2TyreSize);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
@ -305,7 +307,7 @@ namespace BRS.Process.A020.UI
if (item.Value.location == 1)
Machine1Entrance2TyreSize = item.Value.tyreSize;
}
ProcessA020.Machine1Entrance2Up(Machine1Entrance2TyreSize);
//ProcessA020.Machine1Entrance2Up(Machine1Entrance2TyreSize);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
@ -331,6 +333,33 @@ namespace BRS.Process.A020.UI
ProcessA020.Machine1SwitchAutoManual(true);
}
private void uiTableLayoutPanel1_Paint(object sender, PaintEventArgs e)
{
}
private void btn_start_MouseDown(object sender, MouseEventArgs e)
{
if (!ProcessA020.IsSingleStepOperating)
{
ProcessA020.IsSingleStepOperating = true;
ProcessA020.ShaftRightMouseDown(MachineState.Ready);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
}
private void btn_start_MouseUp(object sender, MouseEventArgs e)
{
if (!ProcessA020.IsSingleStepOperating)
{
ProcessA020.IsSingleStepOperating = true;
ProcessA020.ShaftRightMouseUp(MachineState.Ready);
}
else
LogAsync(DateTime.Now, LogLevel.Error, $"有未完成的操作。");
}
}
}

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAy
CwAAAk1TRnQBSQFMAgEBBAEAAfABBAHwAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CwAAAk1TRnQBSQFMAgEBBAEAAQgBBQEIAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -11,6 +11,7 @@ using BRS.Common.Interface;
using BRS.Common.Base;
using static BRS.Common.Model.Helper.EnumHelper;
using System.Diagnostics;
using System.Collections.Concurrent;
namespace BRS.UI.Device.Winform
{
@ -195,7 +196,9 @@ namespace BRS.UI.Device.Winform
}
List<int> oldValues = null;
Dictionary<int, System.Threading.Timer> _cellChangedTimerDict = new Dictionary<int, System.Threading.Timer>();
private ConcurrentDictionary<int, System.Threading.Timer> _cellChangedTimerDict = new ConcurrentDictionary<int, System.Threading.Timer>();
//Dictionary<int, System.Threading.Timer> _cellChangedTimerDict = new Dictionary<int, System.Threading.Timer>();
private void OnRefreshMonitorValues(object state)
{
if (PLC.CurrentState != DeviceState.DSOpen || !dgvMonitor.IsHandleCreated)
@ -255,16 +258,26 @@ namespace BRS.UI.Device.Winform
cell.Value = GetSignedIntValue(newValues[i]);
cell.Style.BackColor = Color.PaleGreen;
cell.Style.ForeColor = Color.Red;
try
{
if (!_cellChangedTimerDict.ContainsKey(i))
{
_cellChangedTimerDict[i] = new System.Threading.Timer(OnChangedDisplayTimeout, new object[] { cell, i }, 1000, -1);
var timer = new System.Threading.Timer(OnChangedDisplayTimeout, new object[] { cell, i }, 1000, -1);
//_cellChangedTimerDict[i] = new System.Threading.Timer(OnChangedDisplayTimeout, new object[] { cell, i }, 1000, -1);
_cellChangedTimerDict.TryAdd(i, timer);
}
else
{
_cellChangedTimerDict[i].Change(1000, -1);
}
}
catch(Exception ex)
{
OnChangedDisplayTimeout(new object[] { cell, i });
}
}
}
}
@ -379,7 +392,9 @@ namespace BRS.UI.Device.Winform
cell.Style.BackColor = SystemColors.Control;
cell.Style.ForeColor = SystemColors.ControlText;
_cellChangedTimerDict.Remove(index);
_cellChangedTimerDict.TryRemove(index, out System.Threading.Timer _);
//_cellChangedTimerDict.Remove(index);
}
private void btnReadInt_Click(object sender, EventArgs e)

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm
CgAAAk1TRnQBSQFMAgEBAgEAAZgBAgGYAQIBGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CgAAAk1TRnQBSQFMAgEBAgEAAcgBAgHIAQIBGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@ -182,7 +182,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD4
CAAAAk1TRnQBSQFMAwEBAAGYAQIBmAECARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
CAAAAk1TRnQBSQFMAwEBAAHIAQIByAECARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
AWADAAEYAwABAQEAAQgGAAEJGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BRS.Common.Base;
using BRS.Common.Interface;
using BRS.Common.Model.Helper;
using BRS.UI.Device.Winform;
using System.Collections.Generic;
using System.ComponentModel;
namespace XKRS.Device.MelsecPLC
{
[Device("MelsecPLC", "三菱PLC", EnumHelper.DeviceAttributeType.OperationConfig)]
public class MelsecPLCOperationConfig : PLCOperationConfigBase
{
public int StartAddress { get; set; }
public int OpLength { get; set; }
public List<int> OpValues { get; set; }
}
[Device("MelsecPLC", "三菱PLC", EnumHelper.DeviceAttributeType.InitialConfig)]
public class MelsecPLCInitialConfig : PLCInitialConfigBase
{
[Category("PLC设置")]
[Description("PLCIP地址")]
[DisplayName("PLC IP")]
public string PLCIpAddress { get; set; }
[Category("PLC设置")]
[Description("PLC端口号")]
[DisplayName("PLC端口")]
[DefaultValue(502)]
public int PLCPort { get; set; } = 502;
[Category("PLC设置")]
[Description("PLC单元号")]
[DisplayName("PLC单元号")]
public int PLCUnitNum { get; set; } = 0;
[Category("PLC设置")]
[Description("本机网络号")]
[DisplayName("本机网络号")]
public int PCNetNum { get; set; } = 0;
[Category("PLC设置")]
[Description("PLC心跳地址")]
[DisplayName("PLC心跳地址")]
public string HeartbeatAddress { get; set; }
[Category("PLC设置")]
[Description("PLC心跳间隔")]
[DisplayName("PLC心跳间隔")]
public int HeartbeatCycle { get; set; } = 0;
//[Category("PLC设置")]
//[Description("PLC单元号")]
//[DisplayName("断线后是否更换PLC单元号的值")]
//public bool IsChangeSA1AfterReadFailed { get; set; } = false;
}
[Device("MelsecPLC", "三菱PLC", EnumHelper.DeviceAttributeType.RunCtrl)]
public class OmronPLCRunCtrl : CtrlPLCRunBase
{
public OmronPLCRunCtrl(IDevice device) : base(device) { }
}
}

View File

@ -0,0 +1,424 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BRS.Common.Base;
using BRS.Common.Model;
using BRS.Common.Model.Helper;
using System.Threading.Tasks;
using HslCommunication;
using HslCommunication.Profinet.Melsec;
using static BRS.Common.Model.Helper.EnumHelper;
using System.Diagnostics;
namespace XKRS.Device.MelsecPLC
{
[Device("MelsecPLC", "三菱PLC", DeviceAttributeType.Device)]
public class MelsecPLCDriver : PLCBase
{
public MelsecPLCInitialConfig IIConfig
{
get
{
return InitialConfig as MelsecPLCInitialConfig;
}
}
private MelsecMcNet melsecMc = new MelsecMcNet();
#region PLCBase
public override List<int> Read(string startAddress, int length)
{
PLCItem item = new PLCItem();
item.Address = startAddress;
item.ItemLength = length;
ReadItem(item);
//List<int> valueList = new List<int>();
//if (!string.IsNullOrWhiteSpace(item.ItemValue))
//{
// valueList = item.ItemValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(s => int.Parse(s)).ToList();
//}
return item.ItemValues;
}
public override void ReadItem(PLCItem item)
{
item.PLCOpType = PLCOpType.Read;
item.ItemValues.Clear();
try
{
// 读取Int变量
var result = melsecMc.ReadInt32(item.Address, (ushort)item.ItemLength);
if (result.IsSuccess)
{
for (int i = 0; i < result.Content.Length; i++)
{
item.ItemValues.Add(result.Content[i]);
}
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name}未读取到数据:" + "地址:" + item.Address + ";长度:" + item.ItemLength + ";提示:" + result.Message);
}
}
catch (Exception ex)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}读取异常:" + ex.GetExceptionMessage());
}
}
public override int ReadInt(string address)
{
try
{
// 读取Int变量
var result = melsecMc.ReadInt32(address);
if (result.IsSuccess)
{
return result.Content;
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name}未读取到数据:" + "地址:" + address + ";提示:" + result.Message);
return -1;
}
}
catch (Exception ex)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}读取异常:" + ex.GetExceptionMessage());
return -1;
}
}
public override string ReadString(string address, ushort length)
{
try
{
// 读取String变量
var result = melsecMc.ReadString(address, length);
if (result.IsSuccess)
{
return result.Content;
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name}未读取到数据:" + "地址:" + address + ";提示:" + result.Message);
return "-1";
}
}
catch (Exception ex)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}读取异常:" + ex.GetExceptionMessage());
return "-1";
}
}
public override float ReadFloat(string address)
{
try
{
// 读取Float变量
var result = melsecMc.ReadFloat(address);
if (result.IsSuccess)
{
return result.Content;
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name}未读取到数据:" + "地址:" + address + ";提示:" + result.Message);
return -1;
}
}
catch (Exception ex)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}读取异常:" + ex.GetExceptionMessage());
return -1;
}
}
public override void WriteItem(PLCItem item, bool waitForReply = true)
{
item.PLCOpType = PLCOpType.Write;
if (item.ItemValues == null || item.ItemValues.Count < 1)
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name} 数据写入值不能为空");
return;
}
int repeatTime = 3;
Stopwatch sw = new Stopwatch();
do
{
try
{
var result = melsecMc.Write(item.Address, item.ItemValues.First());
if (result.IsSuccess)
{
repeatTime = 0;
}
}
catch (Exception ex)
{
if (repeatTime < 0)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}数据写入异常:{ex.GetExceptionMessage()}");
}
}
} while (repeatTime > 0);
sw.Stop();
LogAsync(DateTime.Now, LogLevel.Assist, $"{Name} WriteItem{item.GetDisplayText()},写入 {item.ItemValues.First()}完成,耗时:{sw.ElapsedMilliseconds} ms");
}
/// <summary>
/// 写单独地址
/// </summary>
/// <param name="address">地址</param>
/// <param name="writeValue"></param>
/// <param name="waitForReply"></param>
public override void WriteInt(string address, int writeValue, bool waitForReply = true)
{
if (string.IsNullOrEmpty(address))
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name} 数据写入参数不能为空!");
return;
}
int repeatTime = 3;
Stopwatch sw = new Stopwatch();
do
{
try
{
var result = melsecMc.Write(address, writeValue);
if (result.IsSuccess)
{
repeatTime = 0;
}
}
catch (Exception ex)
{
if (repeatTime < 0)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}数据写入异常:{ex.GetExceptionMessage()}");
}
}
} while (repeatTime > 0);
sw.Stop();
LogAsync(DateTime.Now, LogLevel.Assist, $"{Name} {address},写入 {writeValue} 完成,耗时:{sw.ElapsedMilliseconds} ms");
}
/// <summary>
/// 写单独地址 string值
/// </summary>
/// <param name="address">地址</param>
/// <param name="writeValue"></param>
/// <param name="waitForReply"></param>
public override void WriteString(string address, string writeValue, bool waitForReply = true)
{
if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(writeValue))
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name} 数据写入参数不能为空!");
return;
}
int repeatTime = 3;
Stopwatch sw = new Stopwatch();
do
{
try
{
var result = melsecMc.Write(address, writeValue);
if (result.IsSuccess)
{
repeatTime = 0;
}
}
catch (Exception ex)
{
if (repeatTime < 0)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}数据写入异常:{ex.GetExceptionMessage()}");
}
}
} while (repeatTime > 0);
sw.Stop();
LogAsync(DateTime.Now, LogLevel.Assist, $"{Name} {address},写入{writeValue}完成,耗时:{sw.ElapsedMilliseconds} ms");
}
/// <summary>
/// 写单独地址 float值
/// </summary>
/// <param name="address">地址</param>
/// <param name="writeValue"></param>
/// <param name="waitForReply"></param>
public override void WriteFloat(string address, float writeValue, bool waitForReply = true)
{
if (string.IsNullOrEmpty(address))
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name} 数据写入参数不能为空!");
return;
}
int repeatTime = 3;
Stopwatch sw = new Stopwatch();
do
{
try
{
var result = melsecMc.Write(address, writeValue);
if (result.IsSuccess)
{
repeatTime = 0;
}
}
catch (Exception ex)
{
if (repeatTime < 0)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}数据写入异常:{ex.GetExceptionMessage()}");
}
}
} while (repeatTime > 0);
sw.Stop();
LogAsync(DateTime.Now, LogLevel.Assist, $"{Name} {address},写入{writeValue}完成,耗时:{sw.ElapsedMilliseconds} ms");
}
#endregion
#region DeviceBase
protected override void Init()
{
}
protected override void Start()
{
// IConfig.ip
melsecMc = new MelsecMcNet(IIConfig.PLCIpAddress, IIConfig.PLCPort);
// 如果网络不太理想,配置了两个端口,一个有问题,立即切换另一个的话,可以配置如下的代码
// melsecMc.GetPipeSocket().SetMultiPorts(new int[] { 6000, 6001 });
// 连接对象
OperateResult connect = melsecMc.ConnectServer();
if (connect.IsSuccess)
{
base.Start();
Task.Run(() =>
{
HeartbeatMonitor();
});
}
else
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}已开启异常:{connect.Message}");
}
}
protected override void Stop()
{
try
{
// 断开连接
// melsecMc.RemoteStop();
// OmronUDPNet.Stop();
}
catch (Exception ex)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{Name}关闭异常:{ex.GetExceptionMessage()}");
}
}
#endregion
//private void InitialScanClient()
//{
// InitialTcpClient(ref scanClient, ref scanStream);
//}
//private void InitialOpClient()
//{
// InitialTcpClient(ref opClient, ref opStream);
//}
//private void InitialTcpClient(ref TcpClient client, ref NetworkStream stream)
//{
// if (client == null || !client.Connected || !client.Client.Connected)
// {
// client = new TcpClient();
// client.NoDelay = true;
// client.Client.NoDelay = true;
// client.Client.Blocking = true;
// client.Connect(plcEP);
// stream = client.GetStream();
// }
//}
#region IMonitor
readonly byte[] scanBuffer = new byte[2048];
public override List<int> GetMonitorValues(int startAddress, int length)
{
List<int> res = new List<int>();
//var result = melsecMc.ReadInt32("D" + startAddress, (ushort)length);
var result = melsecMc.ReadInt32("D" + startAddress, (ushort)length);
if (result.IsSuccess)
{
res = new List<int>(result.Content);
}
else
{
LogAsync(DateTime.Now, LogLevel.Error, $"{Name}未读取到数据:" + "地址W" + startAddress + ";长度:" + length + ";提示:" + result.Message);
}
return res;
}
#endregion
public async void HeartbeatMonitor()
{
if (IIConfig.HeartbeatCycle <= 0)
{
return;
}
await Task.Run(async () =>
{
if (!string.IsNullOrEmpty(IIConfig.HeartbeatAddress)
&& IIConfig.HeartbeatCycle > 0)
{
while (CurrentState != DeviceState.DSClose && CurrentState != DeviceState.DSExcept)
{
if (IIConfig.HeartbeatCycle <= 0)
{
return;
}
try
{
await Task.Delay(IIConfig.HeartbeatCycle * 1000);
var result = melsecMc.Write(IIConfig.HeartbeatAddress, 1);
if (!result.IsSuccess)
{
LogAsync(DateTime.Now, LogLevel.Error, $"{this.Name} 心跳监听失败");
}
}
catch (Exception ex)
{
if (CurrentState == DeviceState.DSOpen)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"{this.Name} 心跳监听异常,{ex.GetExceptionMessage()}");
}
}
}
}
});
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XKRS.Device.MelsecPLC
{
class Program
{
static void Main(string[] args)
{
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("XKRS.Device.MelsecPLC")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("XKRS.Device.MelsecPLC")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("887f9454-b1f3-47b8-b9f7-48beba47193d")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace XKRS.Device.MelsecPLC.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{887F9454-B1F3-47B8-B9F7-48BEBA47193D}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>XKRS.Device.MelsecPLC</RootNamespace>
<AssemblyName>XKRS.Device.MelsecPLC</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="HslCommunication, Version=10.6.1.0, Culture=neutral, PublicKeyToken=3d72ad3b6b5ec0e3, processorArchitecture=MSIL">
<HintPath>..\..\packages\HslCommunication.10.6.1\lib\net451\HslCommunication.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MelsecPLCConfig.cs" />
<Compile Include="MelsecPLCDriver.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BRS.Common.Device\BRS.Common.Device.csproj">
<Project>{987308dd-8baa-463a-94e2-77d62e01a5bf}</Project>
<Name>BRS.Common.Device</Name>
</ProjectReference>
<ProjectReference Include="..\BRS.Common.Model\BRS.Common.Model.csproj">
<Project>{1a3cbfe7-3f78-42c3-95c5-10360450dbea}</Project>
<Name>BRS.Common.Model</Name>
</ProjectReference>
<ProjectReference Include="..\BRS.UI.Device.Winform\BRS.UI.Device.Winform.csproj">
<Project>{e6429c64-92b3-46a2-b35e-579856d47f62}</Project>
<Name>BRS.UI.Device.Winform</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HslCommunication" version="10.6.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
</packages>