领胜LDS 键盘AOI检测项目
xcd
2020-07-02 a332decd68d6d8bb5678d8ec95e6c65e0ccf9f33
Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071
3 文件已重命名
8个文件已修改
191 ■■■■ 已修改文件
src/Bro.Common.Model/Helper/SettingHelper.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.GTSCard/GTSCardDriver.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Process/ProcessControl.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/Bro.UI.Config.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/MenuForms/FrmConfig.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/MenuForms/FrmConfig.resx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.Designer.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.resx 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Helper/SettingHelper.cs
@@ -21,8 +21,6 @@
        {
            get
            {
                if (data == null)
                {
                    string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SETTINGFILE);
                    if (File.Exists(configPath))
                    {
@@ -30,7 +28,6 @@
                        {
                            string dataStr = reader.ReadToEnd();
                            data = JsonConvert.DeserializeObject<JObject>(dataStr);
                        }
                    }
                }
@@ -66,6 +63,28 @@
            return codes;
        }
        public static List<string> AddNewProductionCode(string code)
        {
            List<string> codes = GetProcessCodes();
            if (!codes.Contains(code))
            {
                codes.Add(code);
            }
            if (Data != null && Data.ContainsKey(PROPERTY_PRODUCTIONCODES))
            {
                Data[PROPERTY_PRODUCTIONCODES] = new JArray(codes);
                string newDataStr = JsonConvert.SerializeObject(Data, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto });
                using (StreamWriter writer = new StreamWriter(GetSettingFilePath(), false, System.Text.Encoding.UTF8))
                {
                    writer.Write(newDataStr);
                    writer.Flush();
                    writer.Close();
                }
            }
            return GetProcessCodes();
        }
        public static string GetConfigFilePath()
        {
            string path = "";
@@ -78,6 +97,18 @@
            return path;
        }
        public static string GetSettingFilePath()
        {
            string path = "";
            if (Data != null && Data.ContainsKey(SETTINGFILE))
            {
                path = Data.Value<string>(SETTINGFILE);
            }
            return path;
        }
        public static string GetProgramDescription()
        {
            string desc = "伯肯森自动化技术有限公司";
src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -736,8 +736,8 @@
                        sw.Start();
                        if (MonitorValues.Count == newValues.Count)
                        {
                            var tempNew = new List<IOItem>(newValues);//clone
                            var tempOld = new List<IOItem>(MonitorValues);
                            var tempNew = newValues.DeepSerializeClone();//clone
                            var tempOld = MonitorValues.DeepSerializeClone();
                            MonitorCheckAndInvoke(tempNew, tempOld);
                        }
                        MonitorValues = new List<IOItem>(newValues);
src/Bro.Process/ProcessControl.cs
@@ -342,6 +342,31 @@
            }
        }
        public void CreateNewConfig(IProcessConfig config, string newProductionCode)
        {
            try
            {
                if (config == null)
                    throw new ProcessException("保存的配置信息不能为空");
                ProductionCode = newProductionCode;
                //生成config.json
                string newConfig = JsonConvert.SerializeObject(config, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All });
                using (StreamWriter writer = new StreamWriter(_configPath, false, System.Text.Encoding.UTF8))
                {
                    writer.Write(newConfig);
                    writer.Flush();
                    writer.Close();
                }
                //添加到Setting.json
                SettingHelper.AddNewProductionCode(ProductionCode);
            }
            catch (Exception ex)
            {
                throw new ProcessException(ex.Message, null);
            }
        }
        private void SaveBackupConfig()
        {
            string backPath = Path.GetDirectoryName(_configPath);
src/Bro.UI.Config/Bro.UI.Config.csproj
@@ -104,6 +104,7 @@
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\libs\halcon12\halcondotnet.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualBasic" />
    <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
src/Bro.UI.Config/MenuForms/FrmConfig.Designer.cs
@@ -34,7 +34,7 @@
            this.btnSave = new System.Windows.Forms.Button();
            this.imgList = new System.Windows.Forms.ImageList(this.components);
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.button1 = new System.Windows.Forms.Button();
            this.buttonCreateConfig = new System.Windows.Forms.Button();
            this.tableLayoutPanel1.SuspendLayout();
            this.SuspendLayout();
            // 
@@ -81,7 +81,7 @@
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tableLayoutPanel1.Controls.Add(this.propGrid, 0, 1);
            this.tableLayoutPanel1.Controls.Add(this.btnSave, 2, 0);
            this.tableLayoutPanel1.Controls.Add(this.button1, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.buttonCreateConfig, 0, 0);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -91,15 +91,16 @@
            this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 487);
            this.tableLayoutPanel1.TabIndex = 2;
            // 
            // button1
            // buttonCreateConfig
            // 
            this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.button1.Location = new System.Drawing.Point(3, 3);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(175, 35);
            this.button1.TabIndex = 2;
            this.button1.Text = "从当前配置派生新产品";
            this.button1.UseVisualStyleBackColor = true;
            this.buttonCreateConfig.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.buttonCreateConfig.Location = new System.Drawing.Point(3, 3);
            this.buttonCreateConfig.Name = "buttonCreateConfig";
            this.buttonCreateConfig.Size = new System.Drawing.Size(175, 35);
            this.buttonCreateConfig.TabIndex = 2;
            this.buttonCreateConfig.Text = "从当前配置派生新产品";
            this.buttonCreateConfig.UseVisualStyleBackColor = true;
            this.buttonCreateConfig.Click += new System.EventHandler(this.buttonCreateConfig_Click);
            // 
            // FrmConfig
            // 
@@ -120,6 +121,6 @@
        private System.Windows.Forms.Button btnSave;
        private System.Windows.Forms.ImageList imgList;
        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button buttonCreateConfig;
    }
}
src/Bro.UI.Config/MenuForms/FrmConfig.cs
@@ -1,6 +1,8 @@
using Bro.Common.Interface;
using Bro.UI.Model.Winform;
using System;
using Microsoft.VisualBasic;
using System.Windows.Forms;
namespace Bro.UI.Config.MenuForms
{
@@ -46,5 +48,16 @@
            Process.SaveProcessConfig(propGrid.SelectedObject as IProcessConfig);
            LogAsync(DateTime.Now, "配置保存完成");
        }
        private void buttonCreateConfig_Click(object sender, EventArgs e)
        {
            string pCode = Interaction.InputBox("请输入产品编码", "产品编码", "", 100, 100);
            if (string.IsNullOrWhiteSpace(pCode))
            {
                MessageBox.Show("请输入产品编码!");
                return;
            }
        }
    }
}
src/Bro.UI.Config/MenuForms/FrmConfig.resx
@@ -125,7 +125,7 @@
        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACY
        CAAAAk1TRnQBSQFMAwEBAAEwAQABMAEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
        CAAAAk1TRnQBSQFMAwEBAAE4AQABOAEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
        AWADAAEYAwABAQEAAQgGAAEJGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
        AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
        AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
src/Bro.UI.Device.Winform/Bro.UI.Device.Winform.csproj
@@ -89,11 +89,11 @@
    <Compile Include="CtrlCameraRunBase.Designer.cs">
      <DependentUpon>CtrlCameraRunBase.cs</DependentUpon>
    </Compile>
    <Compile Include="MotionCard\CtrlMotionCardOperation.cs">
    <Compile Include="MotionCard\CtrlMotionCardOperationBase.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="MotionCard\CtrlMotionCardOperation.Designer.cs">
      <DependentUpon>CtrlMotionCardOperation.cs</DependentUpon>
    <Compile Include="MotionCard\CtrlMotionCardOperationBase.Designer.cs">
      <DependentUpon>CtrlMotionCardOperationBase.cs</DependentUpon>
    </Compile>
    <Compile Include="CtrlPLCRunBase.cs">
      <SubType>UserControl</SubType>
@@ -118,8 +118,8 @@
    <EmbeddedResource Include="CtrlCameraRunBase.resx">
      <DependentUpon>CtrlCameraRunBase.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="MotionCard\CtrlMotionCardOperation.resx">
      <DependentUpon>CtrlMotionCardOperation.cs</DependentUpon>
    <EmbeddedResource Include="MotionCard\CtrlMotionCardOperationBase.resx">
      <DependentUpon>CtrlMotionCardOperationBase.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="CtrlPLCRunBase.resx">
      <DependentUpon>CtrlPLCRunBase.cs</DependentUpon>
@@ -141,6 +141,10 @@
      <Project>{1A3CBFE7-3F78-42C3-95C5-10360450DBEA}</Project>
      <Name>Bro.Common.Model</Name>
    </ProjectReference>
    <ProjectReference Include="..\Bro.Device.GTSCard\Bro.Device.GTSCard.csproj">
      <Project>{B536003E-70BA-4701-B8FD-BAFA303AB4E2}</Project>
      <Name>Bro.Device.GTSCard</Name>
    </ProjectReference>
    <ProjectReference Include="..\Bro.UI.Model.Winform\Bro.UI.Model.Winform.csproj">
      <Project>{741f6491-57c7-479a-b391-09bba9fba9dc}</Project>
      <Name>Bro.UI.Model.Winform</Name>
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.Designer.cs
File was renamed from src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.Designer.cs
@@ -1,6 +1,6 @@
namespace Bro.UI.Device.Winform
{
    partial class CtrlMotionCardOperation
    partial class CtrlMotionCardOperationBase
    {
        /// <summary> 
        /// 必需的设计器变量。
@@ -28,14 +28,14 @@
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlMotionCardOperation));
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CtrlMotionCardOperationBase));
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.listBoxMsg = new System.Windows.Forms.ListBox();
            this.groupBoxPara = new System.Windows.Forms.GroupBox();
            this.propGrid = new System.Windows.Forms.PropertyGrid();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.groupBoxMoveModel = new System.Windows.Forms.GroupBox();
            this.radioGoHome = new System.Windows.Forms.RadioButton();
            this.radioJog = new System.Windows.Forms.RadioButton();
            this.radioP2P = new System.Windows.Forms.RadioButton();
@@ -86,7 +86,7 @@
            this.tableLayoutPanel2.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBoxPara.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.groupBoxMoveModel.SuspendLayout();
            this.groupBoxCommBtn.SuspendLayout();
            this.tableLayoutPanel3.SuspendLayout();
            this.groupBox5.SuspendLayout();
@@ -114,7 +114,7 @@
            this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanel2.Controls.Add(this.groupBox2, 0, 3);
            this.tableLayoutPanel2.Controls.Add(this.groupBoxPara, 0, 2);
            this.tableLayoutPanel2.Controls.Add(this.groupBox1, 0, 1);
            this.tableLayoutPanel2.Controls.Add(this.groupBoxMoveModel, 0, 1);
            this.tableLayoutPanel2.Controls.Add(this.groupBoxCommBtn, 0, 0);
            this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
@@ -169,18 +169,18 @@
            this.propGrid.Size = new System.Drawing.Size(374, 438);
            this.propGrid.TabIndex = 1;
            // 
            // groupBox1
            // groupBoxMoveModel
            // 
            this.groupBox1.Controls.Add(this.radioGoHome);
            this.groupBox1.Controls.Add(this.radioJog);
            this.groupBox1.Controls.Add(this.radioP2P);
            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.groupBox1.Location = new System.Drawing.Point(3, 93);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(380, 44);
            this.groupBox1.TabIndex = 5;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "运动类型";
            this.groupBoxMoveModel.Controls.Add(this.radioGoHome);
            this.groupBoxMoveModel.Controls.Add(this.radioJog);
            this.groupBoxMoveModel.Controls.Add(this.radioP2P);
            this.groupBoxMoveModel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.groupBoxMoveModel.Location = new System.Drawing.Point(3, 93);
            this.groupBoxMoveModel.Name = "groupBoxMoveModel";
            this.groupBoxMoveModel.Size = new System.Drawing.Size(380, 44);
            this.groupBoxMoveModel.TabIndex = 5;
            this.groupBoxMoveModel.TabStop = false;
            this.groupBoxMoveModel.Text = "运动类型";
            // 
            // radioGoHome
            // 
@@ -666,19 +666,19 @@
            this.flowLayoutPanelRunStatus.Size = new System.Drawing.Size(578, 422);
            this.flowLayoutPanelRunStatus.TabIndex = 8;
            // 
            // CtrlMotionCardRunBase
            // CtrlMotionCardOperation
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.tableLayoutPanel1);
            this.Name = "CtrlMotionCardRunBase";
            this.Name = "CtrlMotionCardOperation";
            this.Size = new System.Drawing.Size(982, 720);
            this.tableLayoutPanel1.ResumeLayout(false);
            this.tableLayoutPanel2.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBoxPara.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBoxMoveModel.ResumeLayout(false);
            this.groupBoxMoveModel.PerformLayout();
            this.groupBoxCommBtn.ResumeLayout(false);
            this.groupBoxCommBtn.PerformLayout();
            this.tableLayoutPanel3.ResumeLayout(false);
@@ -694,7 +694,7 @@
        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
        private System.Windows.Forms.GroupBox groupBoxCommBtn;
        private System.Windows.Forms.GroupBox groupBoxPara;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.GroupBox groupBoxMoveModel;
        private System.Windows.Forms.Button buttonClearStatus;
        private System.Windows.Forms.Button buttonEmergencyStop;
        private System.Windows.Forms.Button buttonServoEnable;
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
File was renamed from src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperation.cs
@@ -1,5 +1,6 @@
using Bro.Common.Helper;
using Bro.Common.Interface;
using Bro.Device.GTSCard;
using System;
using System.Collections.Generic;
using System.Data;
@@ -8,14 +9,23 @@
namespace Bro.UI.Device.Winform
{
    public partial class CtrlMotionCardOperation : UserControl, IProcessObserver, ILogOutput
    public partial class CtrlMotionCardOperationBase : UserControl, IRunCtrl
    {
        public CtrlMotionCardOperation()
        public CtrlMotionCardOperationBase()
        {
            InitializeComponent();
            GTSCardOperationConfig = new GTSCardOperationConfig();
        }
        List<string> _avaiableMethods { get; set; } = new List<string>();
        public IDevice Device { get; set; }
        //protected CameraBase Camera
        //{
        //    get => Device as CameraBase;
        //}
        GTSCardOperationConfig GTSCardOperationConfig = null;
        MovingOption movingConfig = null;
        private IProcess process = null;
        public IProcess Process
@@ -63,7 +73,21 @@
        private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            //加载对应运动的 movingConfig
            if (radioP2P.Checked)
            {
                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal);
            }
            else if (radioJog.Checked)
            {
                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog);
            }
            else if (radioGoHome.Checked)
            {
                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri);
            }
            propGrid.SelectedObject = movingConfig;
        }
        private void buttonClearStatus_Click(object sender, EventArgs e)
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.resx