305e2990bb2161177e87ab7711f9dfb205762bcd..007782bf44e49b4e3d5166ef361ac9fd03cad9c2
2025-06-17 kingno
合并
007782 对比 | 目录
2025-06-17 kingno
双击圆点出图
11219b 对比 | 目录
2025-06-17 kingno
Revert "双击圆点出图"
7f699a 对比 | 目录
2025-06-17 kingno
双击圆点出图
f4bea2 对比 | 目录
2025-06-17 Gokiburi
增加离线测试功能
2ad4cf 对比 | 目录
3个文件已添加
3个文件已删除
17个文件已修改
591 ■■■■■ 已修改文件
libs/PFW.7z 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.Common.Device.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.Common.Model.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.DataBase.Model.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.Process.DataBase.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.Process.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.UI.Device.Winform.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.UI.Main.deps.json 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.UI.Main.dll 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.UI.Main.exe 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW/Bro.UI.Model.Winform.dll 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M135.Common/Bro.M135.Common.csproj 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M135.Common/FrmProductList.Designer.cs 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M135.Common/FrmProductList.cs 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M135.Common/FrmProductList.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M135.Common/ProductModel.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M135.Common/Properties/launchSettings.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Config.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Models.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Process.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Process_ImageCheck.cs 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/Properties/launchSettings.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141_AOI1.Process/AOI1Process.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libs/PFW.7z
Binary files differ
libs/PFW/Bro.Common.Device.dll
Binary files differ
libs/PFW/Bro.Common.Model.dll
Binary files differ
libs/PFW/Bro.DataBase.Model.dll
Binary files differ
libs/PFW/Bro.Process.DataBase.dll
Binary files differ
libs/PFW/Bro.Process.dll
Binary files differ
libs/PFW/Bro.UI.Device.Winform.dll
Binary files differ
libs/PFW/Bro.UI.Main.deps.json
@@ -16,21 +16,21 @@
          "Krypton.Docking": "6.2111.312",
          "ScottPlot.WinForms": "4.1.58",
          "SunnyUI": "3.0.9",
          "runtimepack.Microsoft.Windows.SDK.NET.Ref": "10.0.19041.28"
          "runtimepack.Microsoft.Windows.SDK.NET.Ref": "10.0.19041.52"
        },
        "runtime": {
          "Bro.UI.Main.dll": {}
        }
      },
      "runtimepack.Microsoft.Windows.SDK.NET.Ref/10.0.19041.28": {
      "runtimepack.Microsoft.Windows.SDK.NET.Ref/10.0.19041.52": {
        "runtime": {
          "Microsoft.Windows.SDK.NET.dll": {
            "assemblyVersion": "10.0.19041.24",
            "fileVersion": "10.0.19041.28"
            "assemblyVersion": "10.0.19041.38",
            "fileVersion": "10.0.19041.52"
          },
          "WinRT.Runtime.dll": {
            "assemblyVersion": "2.0.0.0",
            "fileVersion": "2.0.1.40881"
            "assemblyVersion": "2.1.0.0",
            "fileVersion": "2.1.6.47881"
          }
        }
      },
@@ -1009,7 +1009,10 @@
          "Bro.UI.Model.Winform": "1.0.0"
        },
        "runtime": {
          "Bro.Common.Device.dll": {}
          "Bro.Common.Device.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.40124.0"
          }
        }
      },
      "Bro.Common.Model/1.0.0": {
@@ -1021,7 +1024,10 @@
          "System.Resources.ResourceManager": "4.3.0"
        },
        "runtime": {
          "Bro.Common.Model.dll": {}
          "Bro.Common.Model.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.40127.0"
          }
        },
        "resources": {
          "en-US/Bro.Common.Model.resources.dll": {
@@ -1035,7 +1041,10 @@
          "Microsoft.EntityFrameworkCore": "7.0.0"
        },
        "runtime": {
          "Bro.DataBase.Model.dll": {}
          "Bro.DataBase.Model.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.0.0"
          }
        }
      },
      "Bro.Process/1.0.0": {
@@ -1047,7 +1056,10 @@
          "Bro.UI.Model.Winform": "1.0.0"
        },
        "runtime": {
          "Bro.Process.dll": {}
          "Bro.Process.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.40125.0"
          }
        }
      },
      "Bro.Process.DataBase/1.0.0": {
@@ -1061,7 +1073,10 @@
          "System.Configuration.ConfigurationManager": "6.0.0"
        },
        "runtime": {
          "Bro.Process.DataBase.dll": {}
          "Bro.Process.DataBase.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.21116.0"
          }
        }
      },
      "Bro.UI.Device.Winform/1.0.0": {
@@ -1071,7 +1086,10 @@
          "Bro.UI.Model.Winform": "1.0.0"
        },
        "runtime": {
          "Bro.UI.Device.Winform.dll": {}
          "Bro.UI.Device.Winform.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.30415.0"
          }
        }
      },
      "Bro.UI.Model.Winform/1.0.0": {
@@ -1081,7 +1099,10 @@
          "SunnyUI": "3.0.9"
        },
        "runtime": {
          "Bro.UI.Model.Winform.dll": {}
          "Bro.UI.Model.Winform.dll": {
            "assemblyVersion": "1.0.0",
            "fileVersion": "1.0.21118.0"
          }
        }
      },
      "halcondotnet/12.0.0.0": {
@@ -1116,7 +1137,7 @@
      "serviceable": false,
      "sha512": ""
    },
    "runtimepack.Microsoft.Windows.SDK.NET.Ref/10.0.19041.28": {
    "runtimepack.Microsoft.Windows.SDK.NET.Ref/10.0.19041.52": {
      "type": "runtimepack",
      "serviceable": false,
      "sha512": ""
libs/PFW/Bro.UI.Main.dll
Binary files differ
libs/PFW/Bro.UI.Main.exe
Binary files differ
libs/PFW/Bro.UI.Model.Winform.dll
Binary files differ
src/Bro.M135.Common/Bro.M135.Common.csproj
@@ -22,6 +22,7 @@
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Windows.CppWinRT" Version="2.0.250303.1" />
    <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
    <PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.3" />
    <PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" />
@@ -55,12 +56,6 @@
    <Reference Include="SunnyUI.Common">
      <HintPath>..\..\libs\Nuget\SunnyUI.Common.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Update="FrmProductList.cs">
      <SubType>UserControl</SubType>
    </Compile>
  </ItemGroup>
</Project>
src/Bro.M135.Common/FrmProductList.Designer.cs
File was deleted
src/Bro.M135.Common/FrmProductList.cs
File was deleted
src/Bro.M135.Common/FrmProductList.resx
File was deleted
src/Bro.M135.Common/ProductModel.cs
@@ -76,6 +76,8 @@
        public bool IsPreStationOK { get; set; } = false;
        public List<string> ImagePaths { get; set; } = new List<string>();
        public DateTime? EndTime { get; set; } = null;
        object _checkResultLock = new object();
src/Bro.M135.Common/Properties/launchSettings.json
New file
@@ -0,0 +1,7 @@
{
  "profiles": {
    "Bro.M135.Common": {
      "commandName": "Project"
    }
  }
}
src/Bro.M141.Process/M141Config.cs
@@ -13,6 +13,7 @@
using System.Drawing.Printing;
using System.Reflection;
using System.Windows.Forms.Design;
using static Bro.Common.Helper.EnumHelper;
namespace Bro.M141.Process
{
@@ -24,6 +25,12 @@
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(ComplexCollectionEditor<Printer>), typeof(UITypeEditor))]
        public List<Printer> Printers { get; set; } = new List<Printer>();
        [Category("产品显示界面配置")]
@@ -364,6 +371,11 @@
        [Description("应对单次检测项需要多次拍照时,记录图片的索引号,从0开始")]
        public int ImageIndex { get; set; } = 0;
        [Category("启用配置")]
        [DisplayName("固定检测项")]
        [Description("true:该检测项是固定检测项目,必须执行 false:该检测是可变检测项目,流程中决定是否检测,默认不检测")]
        public bool IsFixed { get; set; } = true;
        [Category("取像设置")]
        [DisplayName("相机选择")]
        [Description("选择该检测项对应的相机")]
@@ -422,7 +434,10 @@
        [DisplayName("OK图片保存开关")]
        public bool OKImageSwitch { get; set; } = false;
        [Category("图片保存设置")]
        [Description("该站检测图片保存时,保存的图片顺序后缀")]
        [DisplayName("图片保存顺序后缀")]
        public string ImageSaveSeq { get; set; } = "1";
        public string GetDisplayText()
        {
@@ -907,6 +922,21 @@
    }
    [Device("OfflineDemo", "离线测试", DeviceAttributeType.OperationConfig)]
    public class OfflineDemoOperationConfig : OperationConfigBase
    {
        [Category("图片目录")]
        [Description("图片目录")]
        [DisplayName("图片目录")]
        [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
        public string ImageFolder { get; set; }
        [Category("启动配置")]
        [Description("true:启动离线测试 false:停止离线测试")]
        [DisplayName("测试开关")]
        public bool IsStart { get; set; } = true;
    }
    public class RealTimeAdjustDataDetail : IComplexDisplay
    {
        [Category("点位设置")]
src/Bro.M141.Process/M141Models.cs
@@ -203,6 +203,9 @@
        [Description("该检测项所涉及的所有检测点位集合")]
        [TypeConverter(typeof(ComplexObjectConvert))]
        [Editor(typeof(ComplexCollectionEditor<MeasurePointSelector>), typeof(UITypeEditor))]
        public List<MeasurePointSelector> MeasurePointNameCollection { get; set; } = new List<MeasurePointSelector>();
src/Bro.M141.Process/M141Process.cs
@@ -38,8 +38,11 @@
        public M141Process(string productCode) : base(productCode) { }
        #endregion
        TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
        public event Action<string, P_PRODUCT_DETAIL, string> OnSinglePostionDetectResultUpdate;
        protected M141Config M141Config => Config as M141Config;
        public static object _productListLock = new object();
@@ -55,7 +58,6 @@
        public override void InitialProcessMethods()
        {
            base.InitialProcessMethods();
            if (ThHeartPlc == null)
            {
@@ -82,7 +84,6 @@
        bool devicestate = false;
        PLCBase Plc2;
        public Thread ThHeartPlc;
        public override void Open()
@@ -120,6 +121,7 @@
            base.Close();
        }
        public void Heartplc()
        {
@@ -417,8 +419,6 @@
        Dictionary<string, List<string>> _positionSpecHeads = new Dictionary<string, List<string>>();
        volatile int uploadId = 0;
@@ -512,8 +512,8 @@
                        //    dicpid[tem] = pidList[i];
                        //}
                        List<DetectResult> detectResults = ML?.RunMLDetectionSync(imgSet, pidList, measureBind.DetectionId);
                        //var c=products[0].ImagePaths;
                        List<DetectResult> detectResults = ML?.RunMLDetectionSync(imgSet, pidList, measureBind.DetectionId,false,null,null,"", products[0].ImagePaths);
                        List<DetectResult> ngResults = new List<DetectResult>();
src/Bro.M141.Process/M141Process_ImageCheck.cs
@@ -8,7 +8,9 @@
using Microsoft.VisualBasic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.UserModel;
using NPOI.Util;
using NPOI.XSSF.UserModel;
using Sunny.UI;
using System.Data;
using System.Data.SqlTypes;
@@ -439,6 +441,8 @@
            return msg;
        }
        [ProcessMethod("", "ProductDataUpload", "产品数据汇总", InvokeType.TestInvoke)]
@@ -503,6 +507,109 @@
        }
        private bool _isDemoStarted = false;
        [ProcessMethod("OfflineDemo", "OfflineDemo", "离线测试", InvokeType.CalibInvoke)]
        public ResponseMessage OfflineDemo(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
        {
            if (config is OfflineDemoOperationConfig opConfig)
            {
                if (_isDemoStarted)
                {
                    _isDemoStarted = false;
                }
                else
                {
                    _isDemoStarted = true;
                    OfflineDemoAsync(opConfig.ImageFolder);
                }
            }
            return new ResponseMessage();
        }
        private async void OfflineDemoAsync(string imageFolder)
        {
            await Task.Run(() =>
            {
                var imageFileNames = new DirectoryInfo(imageFolder).GetFiles().Select(u => u.FullName).ToList();
                for (int i = 0; i < imageFileNames.Count; i++)
                {
                    if (!_isDemoStarted)
                    {
                        return;
                    }
                    var imageFile = Path.GetFileNameWithoutExtension(imageFileNames[i]);
                    if (imageFile.EndsWith("Fit"))
                    {
                        continue;
                    }
                    var nameDatas = imageFile.Split(new char[] { '_'}, StringSplitOptions.RemoveEmptyEntries).ToList();
                    if (nameDatas.Count != 5)
                    {
                        LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"文件{imageFile}命名不符合规范,不执行离线测试");
                        continue;
                    }
                    var sn = nameDatas[0];
                    var imageSeq = nameDatas[1];
                    var measureBind = M141Config.MeasureBindCollection.FirstOrDefault(u => u.ImageSaveSeq == imageSeq);
                    if (measureBind == null || !measureBind.IsFixed)
                    {
                        LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"离线测试,工位{(measureBind == null ? "未匹配" : $"{measureBind.WorkPosition}未开启")}");
                        continue;
                    }
                    LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"离线测试,产品{sn}开始工位{measureBind.WorkPosition}离线检测");
                    MLImageSet imgSet = new MLImageSet();
                    imgSet.HImage = new HalconDotNet.HImage(imageFileNames[i]);
                    imgSet.PID = sn;
                    var detectResults = ML.RunMLDetectionSync(imgSet, null, measureBind.DetectionId);
                    imgSet.HImage?.Dispose();
                    imgSet.HImage = null;
                    //var defectFields = M141Config.DefectLocationSettings.FirstOrDefault(u => u.PositionCode == measureBind.WorkPosition);
                    //var list = detectResults.SelectMany(u => u.NetResults.SelectMany(m => m.DetectDetails)).ToList();
                    ////if (list.Count > 0)
                    ////{
                    ////    //list.ForEach(d =>
                    ////    //{
                    ////    //    //if (defectFields == null)
                    ////    //    //{
                    ////    //    //    d.Tag = "";
                    ////    //    //}
                    ////    //    //else
                    ////    //    //{
                    ////    //    //    RectangleF rect = new RectangleF(d.Rect.Point_LU.X, d.Rect.Point_LU.Y, d.Rect.Width, d.Rect.Height);
                    ////    //    //    //var rectList = defectFields.Display.RectDict.Where(u => rect.IntersectsWith(u.Value)).ToList();
                    ////    //    //    //if (rectList.Count > 0)
                    ////    //    //    //{
                    ////    //    //    //    d.Tag = string.Join(" ", rectList.Select(u => u.Key).OrderBy(u => u));
                    ////    //    //    //}
                    ////    //    //    //else
                    ////    //    //    //{
                    ////    //    //    //    d.Tag = "";
                    ////    //    //    //}
                    ////    //    //}
                    ////    //});
                    ////}
                    //Bitmap originImage = new Bitmap(imageFileNames[i]);
                    //DetectResultSaveExcelAsync(detectResults, sn, originImage, DateTime.Now);
                }
            });
        }
        [ProcessMethod("printer", "printer", "打印机打印", InvokeType.TestInvoke)]
        public ResponseMessage Printer(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
@@ -559,6 +666,9 @@
            });
            return specList;
        }
        protected void FillSpecResults(string pid, List<ISpec> detectSpec, List<double> results, string SEQUENCE)
        {
@@ -637,7 +747,7 @@
            UpdateDefectAsync(defects);
            var defectClass = GetDefectClassFromDefectList(defects);
            UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, "");
            UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, "",p.ImagePaths);
            //产品序号+1
            //Interlocked.Increment(ref _productIndex);
src/Bro.M141.Process/Properties/launchSettings.json
New file
@@ -0,0 +1,7 @@
{
  "profiles": {
    "Bro.M141.Process": {
      "commandName": "Project"
    }
  }
}
src/Bro.M141_AOI1.Process/AOI1Process.cs
@@ -48,6 +48,7 @@
            base.Open();
        }
        [ProcessMethod("", "PositionCheck_P1", "工位1检测", InvokeType.TestInvoke)]
        public ResponseMessage PositionCheck_P1(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
        {
@@ -64,6 +65,7 @@
            return msg;
        }
        [ProcessMethod("", "PositionCheck_P2", "工位2检测", InvokeType.TestInvoke)]
        public ResponseMessage PositionCheck_P2(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
@@ -82,6 +84,7 @@
            return msg;
        }
        [ProcessMethod("", "PositionCheck_P3", "工位3检测", InvokeType.TestInvoke)]
        public ResponseMessage PositionCheck_P3(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
        {
@@ -98,7 +101,6 @@
            return msg;
        }
        [ProcessMethod("ImageCheck", "ReadBarcode", "读码", InvokeType.TestInvoke)]
@@ -233,6 +235,7 @@
            return "NOREAD";
        }
        private bool CheckBarcodeValid(string barcode)
        {
@@ -389,5 +392,7 @@
    }
}