离线测试测试功能增加OKNG分类测试功能,添加图片资源释放延时优化最终结果少存图合并
2个文件已添加
3个文件已删除
5个文件已修改
512 ■■■■ 已修改文件
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/Properties/launchSettings.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Config.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Models.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/M141Process_ImageCheck.cs 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141.Process/Properties/launchSettings.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M141_AOI1.Process/AOI1Process.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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/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,35 @@
    }
    [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;
        [Category("检测功能")]
        [Description("图片在批量测试过程中最终图片结果会存储较慢需要设置延时确保图片不被资源自动释放")]
        [DisplayName("图片存图延时")]
        public int SaveImageTime { get; set; } = 0;
        [Category("检测功能")]
        [Description("true:启动OK测试 false:启动NG测试")]
        [DisplayName("是否测试OK图片")]
        public bool IsOK { 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_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;
@@ -441,6 +443,8 @@
        }
        [ProcessMethod("", "ProductDataUpload", "产品数据汇总", InvokeType.TestInvoke)]
        public ResponseMessage ProductDataUpload(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
        {
@@ -503,6 +507,84 @@
        }
        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, opConfig.IsOK, opConfig.SaveImageTime);
                }
            }
            return new ResponseMessage();
        }
        private async void OfflineDemoAsync(string imageFolder,bool isok,int saveimagetime)
        {
            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;
                    }
                    if (imageFile.EndsWith("OK")& isok == false)
                    {
                        continue;
                    }
                    if (imageFile.EndsWith("NG") & isok == true)
                    {
                        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[2][^1].ToString();
                    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);
                    Thread.Sleep(saveimagetime);
                    imgSet.HImage?.Dispose();
                    imgSet.HImage = null;
                }
            });
        }
        [ProcessMethod("printer", "printer", "打印机打印", InvokeType.TestInvoke)]
        public ResponseMessage Printer(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
@@ -560,6 +642,9 @@
            return specList;
        }
        protected void FillSpecResults(string pid, List<ISpec> detectSpec, List<double> results, string SEQUENCE)
        {
            detectSpec.ForEach(s =>
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
@@ -390,5 +390,9 @@
            return msg;
        }
    }
}