prepare reset

This commit is contained in:
2025-10-28 13:34:47 +08:00
parent 2ad81a1304
commit 3868825a60
44 changed files with 5661 additions and 5182 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace LibCamera
{
public delegate void OnImageCollectorMessage(string msg);
public delegate void OnImageCollectorInfo(string info);
public delegate void OnImageCollectorConnected(string serial);
public delegate void OnImageCollectorDisConnected(string serial);
public delegate void OnImageCollectorData(byte[] imageData);
public interface IImageCollector
{
event OnImageCollectorMessage OnImageCollectorMessage;
event OnImageCollectorInfo OnImageCollectorInfo;
event OnImageCollectorConnected OnImageCollectorConnected;
event OnImageCollectorDisConnected OnImageCollectorDisConnected;
event OnImageCollectorData OnImageCollectorData;
void Start();
void Stop();
void SetPixelFormat(string pixelFormat);
void SetExposureTime(double exposureTime);
void SetGainRawGain(double gain);
void SetAcquisitionMode(string acquisitionMode);
void SetTriggerMode(string triggerMode);
void StartSoftwareGrabbing();
}
}

152
LibCamera/ImageCollector.cs Normal file
View File

@@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ThridLibray;
namespace LibCamera
{
public class ImageCollector : IImageCollector
{
public event OnImageCollectorMessage OnImageCollectorMessage;
public event OnImageCollectorInfo OnImageCollectorInfo;
public event OnImageCollectorConnected OnImageCollectorConnected;
public event OnImageCollectorDisConnected OnImageCollectorDisConnected;
public event OnImageCollectorData OnImageCollectorData;
private IDevice m_dev_cam;
private bool m_abort = false;
private DateTime m_start = DateTime.Now;
private string m_serial;
public ImageCollector(string serial)
{
m_serial = serial;
}
public void Start()
{
m_abort = false;
Task.Run(() => { ConnectDevice(); });
}
private void ConnectDevice()
{
m_start = DateTime.Now.AddSeconds(-6);
while (true)
{
if (m_abort)
return;
Thread.Sleep(100);
try
{
if (m_dev_cam == null || (m_dev_cam.IsOpen == false && ((DateTime.Now - m_start).TotalSeconds >= 5)))
{
OnImageCollectorDisConnected?.Invoke(m_serial);
if (m_dev_cam != null && !m_dev_cam.IsOpen)
m_dev_cam.StreamGrabber.ImageGrabbed -= StreamGrabber_ImageGrabbed;
m_dev_cam = null;
Enumerator.EnumerateDevices();
m_dev_cam = Enumerator.GetDeviceByKey(m_serial);
if (m_dev_cam == null)
continue;
m_dev_cam.Open();
if (m_dev_cam.IsOpen)
{
m_dev_cam.StreamGrabber.ImageGrabbed += StreamGrabber_ImageGrabbed;
OnImageCollectorInfo?.Invoke($"Device {m_serial} connected.");
OnImageCollectorConnected?.Invoke(m_serial);
}
}
}
catch (Exception ex)
{
m_dev_cam = null;
OnImageCollectorMessage?.Invoke($"ConnectDevice {m_serial} Exception: {ex.Message}");
}
}
}
private void StreamGrabber_ImageGrabbed(object sender, GrabbedEventArgs e)
{
OnImageCollectorData?.Invoke(e.GrabResult.Image);
}
public void Stop()
{
try
{
m_abort = true;
if (m_dev_cam != null)
{
m_dev_cam.StreamGrabber.ImageGrabbed -= StreamGrabber_ImageGrabbed;
if (m_dev_cam.IsOpen)
{
m_dev_cam.Close();
}
m_dev_cam = null;
}
}
catch (Exception ex)
{
OnImageCollectorMessage?.Invoke($"Stop {m_serial} Exception: {ex.Message}");
}
}
private bool IsDeviceConnected()
{
return m_dev_cam != null && m_dev_cam.IsOpen;
}
public void SetPixelFormat(string pixelFormat)
{
if (!IsDeviceConnected())
return;
using (IEnumParameter p = m_dev_cam.ParameterCollection[ParametrizeNameSet.ImagePixelFormat])
{
p.SetValue(pixelFormat);
}
}
public void SetExposureTime(double exposureTime)
{
if (!IsDeviceConnected())
return;
using (IFloatParameter p = m_dev_cam.ParameterCollection[ParametrizeNameSet.ExposureTime])
{
p.SetValue(exposureTime);
}
}
public void SetGainRawGain(double gain)
{
if (!IsDeviceConnected())
return;
using (IFloatParameter p = m_dev_cam.ParameterCollection[ParametrizeNameSet.GainRaw])
{
p.SetValue(gain);
}
}
public void SetAcquisitionMode(string acquisitionMode)
{
if (!IsDeviceConnected())
return;
using (IEnumParameter p = m_dev_cam.ParameterCollection[ParametrizeNameSet.AcquisitionMode])
{
p.SetValue(acquisitionMode);
}
}
public void SetTriggerMode(string triggerMode)
{
if (!IsDeviceConnected())
return;
using (IEnumParameter p = m_dev_cam.ParameterCollection[ParametrizeNameSet.TriggerMode])
{
p.SetValue(triggerMode);
}
}
public void StartSoftwareGrabbing()
{
if (!IsDeviceConnected())
return;
m_dev_cam.TriggerSet.Open(TriggerSourceEnum.Software);
if (!m_dev_cam.GrabUsingGrabLoopThread())
OnImageCollectorMessage("开启采集失败");
else
OnImageCollectorInfo($"相机{m_serial}加载完毕");
}
}
}

View File

@@ -0,0 +1,73 @@
<?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>{884C8BB2-78D9-4EED-A2FA-492F075E1F64}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LibCamera</RootNamespace>
<AssemblyName>LibCamera</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="CLIDelegate">
<HintPath>..\dll\CLIDelegate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<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" />
<Reference Include="ThridLibray">
<HintPath>..\dll\ThridLibray.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="IImageCollector.cs" />
<Compile Include="ImageCollector.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("LibCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("LibCamera")]
[assembly: AssemblyCopyright("Copyright © HP 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("884c8bb2-78d9-4eed-a2fa-492f075e1f64")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,46 @@
using LibCamera;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibImageService
{
public class ImageService
{
IImageCollector m_imageCollectorOCR;
IImageCollector m_imageCollectorLocation;
//private Dictionary<string, IImageCollector>
public ImageService(string serialLocation, string serialOCR)
{
m_imageCollectorLocation = new ImageCollector(serialLocation);
m_imageCollectorOCR = new ImageCollector(serialOCR);
m_imageCollectorLocation.OnImageCollectorData += M_imageCollectorLocation_OnImageCollectorData;
m_imageCollectorLocation.OnImageCollectorMessage += M_imageCollectorLocation_OnImageCollectorMessage;
m_imageCollectorLocation.OnImageCollectorInfo += M_imageCollectorLocation_OnImageCollectorInfo;
}
private void M_imageCollectorLocation_OnImageCollectorInfo(string info)
{
throw new NotImplementedException();
}
private void M_imageCollectorLocation_OnImageCollectorMessage(string msg)
{
throw new NotImplementedException();
}
private void M_imageCollectorLocation_OnImageCollectorData(byte[] imageData)
{
throw new NotImplementedException();
}
public void Start()
{
m_imageCollectorLocation.Start();
m_imageCollectorOCR.Start();
}
}
}

View File

@@ -0,0 +1,73 @@
<?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>{BC738E23-1B32-497B-A654-569212EF4647}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LibImageService</RootNamespace>
<AssemblyName>LibImageService</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<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="ImageService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibCamera\LibCamera.csproj">
<Project>{884c8bb2-78d9-4eed-a2fa-492f075e1f64}</Project>
<Name>LibCamera</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("LibImageService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("LibImageService")]
[assembly: AssemblyCopyright("Copyright © HP 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("bc738e23-1b32-497b-a654-569212ef4647")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,9 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1972
# Visual Studio Version 17
VisualStudioVersion = 17.14.36518.9 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TetraParkOCR", "利乐包装OCR\TetraParkOCR.csproj", "{533800AA-D6A6-4EF7-825F-AA143B1EE901}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TetraParkOCR", "TetraParkOCR\TetraParkOCR.csproj", "{533800AA-D6A6-4EF7-825F-AA143B1EE901}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibCamera", "LibCamera\LibCamera.csproj", "{884C8BB2-78D9-4EED-A2FA-492F075E1F64}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibImageService", "LibImageService\LibImageService.csproj", "{BC738E23-1B32-497B-A654-569212EF4647}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -27,6 +31,30 @@ Global
{533800AA-D6A6-4EF7-825F-AA143B1EE901}.Release|x64.Build.0 = Release|x64
{533800AA-D6A6-4EF7-825F-AA143B1EE901}.Release|x86.ActiveCfg = Release|x86
{533800AA-D6A6-4EF7-825F-AA143B1EE901}.Release|x86.Build.0 = Release|x86
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Debug|x64.ActiveCfg = Debug|x64
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Debug|x64.Build.0 = Debug|x64
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Debug|x86.ActiveCfg = Debug|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Debug|x86.Build.0 = Debug|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Release|Any CPU.Build.0 = Release|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Release|x64.ActiveCfg = Release|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Release|x64.Build.0 = Release|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Release|x86.ActiveCfg = Release|Any CPU
{884C8BB2-78D9-4EED-A2FA-492F075E1F64}.Release|x86.Build.0 = Release|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Debug|x64.ActiveCfg = Debug|x64
{BC738E23-1B32-497B-A654-569212EF4647}.Debug|x64.Build.0 = Debug|x64
{BC738E23-1B32-497B-A654-569212EF4647}.Debug|x86.ActiveCfg = Debug|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Debug|x86.Build.0 = Debug|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Release|Any CPU.Build.0 = Release|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Release|x64.ActiveCfg = Release|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Release|x64.Build.0 = Release|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Release|x86.ActiveCfg = Release|Any CPU
{BC738E23-1B32-497B-A654-569212EF4647}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -37,6 +37,10 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.4.0" newVersion="4.2.4.0" />

View File

@@ -101,13 +101,13 @@ namespace TetraPackOCR
/// </summary>
string SaveImageFileOCR = AppDomain.CurrentDomain.BaseDirectory + "SaveImage\\OCR";//ocr存图
string SaveImageFileDET = AppDomain.CurrentDomain.BaseDirectory + "SaveImage\\Det";//ocr存图
private CogJobManager myJobManager1, myJobManager2;
private CogJob myJob1, myJob2;
private CogJobManager myJobManager1;//, myJobManager2;
private CogJob myJob1;//, myJob2;
private string[] verocr = new string[20];
bool Coprinted_ordeFlag = false; //是否为共印订单旗帜
bool PlcContinueFlag = false; //PLC状态旗帜
//bool PlcContinueFlag = false; //PLC状态旗帜
int mMatchingStr = 0;//接收当前OCR拍照位置
List<float> ocrAcc = new List<float>();
@@ -146,11 +146,11 @@ namespace TetraPackOCR
log.Info("软件正在加载...");
Action action = (() =>
{
InitializeCamer1();
InitializeCamer2();
//InitializeCamer1();
//InitializeCamer2();
InitializePaddleOCR();
myJobManager1 = CogSerializer.LoadObjectFromFile(vppdetFile) as CogJobManager;
myJobManager2 = CogSerializer.LoadObjectFromFile(vppocrFile) as CogJobManager;
//myJobManager2 = CogSerializer.LoadObjectFromFile(vppocrFile) as CogJobManager;
InitializeCC24();
@@ -191,7 +191,7 @@ namespace TetraPackOCR
myJob1 = myJobManager1.Job(0);
myJob2 = myJobManager2.Job(0);
//myJob2 = myJobManager2.Job(0);
// 注册结果队列事件
myJobManager1.UserResultAvailable += new CogJobManager.CogUserResultAvailableEventHandler(DetResult);
@@ -221,14 +221,14 @@ namespace TetraPackOCR
try
{
if (myJob1.AcqFifo.FrameGrabber != null)
{
myJob1.AcqFifo.FrameGrabber.Disconnect(true);
}
if (myJob2.AcqFifo.FrameGrabber != null)
{
myJob2.AcqFifo.FrameGrabber.Disconnect(true);
}
//if (myJob1.AcqFifo.FrameGrabber != null)
//{
// myJob1.AcqFifo.FrameGrabber.Disconnect(true);
//}
//if (myJob2.AcqFifo.FrameGrabber != null)
//{
// myJob2.AcqFifo.FrameGrabber.Disconnect(true);
//}
ClossCam();
@@ -678,7 +678,7 @@ namespace TetraPackOCR
{
log.Info("当前订单号为:" + order);
//读取表格内容
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
ExcelPackage.License.SetNonCommercialOrganization("My Noncommercial organization");
using (ExcelPackage package = new ExcelPackage(execlFileName))
{
sheet1 = package.Workbook.Worksheets["P2生成数据"];
@@ -821,7 +821,7 @@ namespace TetraPackOCR
{
log.Info("当前订单号为:" + order);
//读取表格内容
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
ExcelPackage.License.SetNonCommercialOrganization("My Noncommercial organization");
using (ExcelPackage package = new ExcelPackage(execlFileName))
{
sheet1 = package.Workbook.Worksheets["P2生成数据"];
@@ -2001,13 +2001,13 @@ namespace TetraPackOCR
}
if (e.ProtocolStatus == CogNdmConnectionStatusConstants.Connected)
{
PlcContinueFlag = true;
//PlcContinueFlag = true;
log.Info("PLC已连接PC,可以进行相关操作");
ttls_PCLStatusShow.Visible = true;
}
else if (e.ProtocolStatus != CogNdmConnectionStatusConstants.Connecting)
{
PlcContinueFlag = false;
//PlcContinueFlag = false;
log.Info("PLC已断开PC请查看相关设备是否连接");
ttls_PCLStatusShow.Visible = false;
}

5145
TetraParkOCR/Form1.resx Normal file

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -97,7 +97,7 @@
<ItemGroup>
<Reference Include="Bjcve.Comm.FFP, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Bjcve.Comm.FFP.dll</HintPath>
<HintPath>..\dll\Bjcve.Comm.FFP.dll</HintPath>
</Reference>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
@@ -106,43 +106,43 @@
<HintPath>..\packages\BouncyCastle.Cryptography.2.7.0-beta.98\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="CLIDelegate">
<HintPath>dll\CLIDelegate.dll</HintPath>
<HintPath>..\dll\CLIDelegate.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.Comm, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.Comm.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.Comm.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.Controls, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.Controls.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.Controls.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.Core, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.Core.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.Core.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.Display.Controls, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.Display.Controls.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.Display.Controls.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.ImageProcessing, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.ImageProcessing.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.ImageProcessing.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.PMAlign, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.PMAlign.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.PMAlign.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.QuickBuild.Core, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.QuickBuild.Core.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.QuickBuild.Core.dll</HintPath>
</Reference>
<Reference Include="Cognex.VisionPro.ToolGroup, Version=59.2.0.0, Culture=neutral, PublicKeyToken=ef0f902af9dee505, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Cognex.VisionPro.ToolGroup.dll</HintPath>
<HintPath>..\dll\Cognex.VisionPro.ToolGroup.dll</HintPath>
</Reference>
<Reference Include="Enums.NET, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7ea1c1650d506225, processorArchitecture=MSIL">
<HintPath>..\packages\Enums.NET.5.0.0\lib\net461\Enums.NET.dll</HintPath>
@@ -164,10 +164,10 @@
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\log4net.dll</HintPath>
<HintPath>..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="LogShowLib">
<HintPath>dll\LogShowLib.dll</HintPath>
<HintPath>..\dll\LogShowLib.dll</HintPath>
</Reference>
<Reference Include="MathNet.Numerics, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cd8b63ad3d691a37, processorArchitecture=MSIL">
<HintPath>..\packages\MathNet.Numerics.Signed.5.0.0\lib\net461\MathNet.Numerics.dll</HintPath>
@@ -272,7 +272,7 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ThridLibray">
<HintPath>dll\ThridLibray.dll</HintPath>
<HintPath>..\dll\ThridLibray.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
@@ -336,15 +336,21 @@
<None Include="Resources\ON.png" />
<None Include="Resources\OFF.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibImageService\LibImageService.csproj">
<Project>{bc738e23-1b32-497b-a654-569212ef4647}</Project>
<Name>LibImageService</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\PaddleOCRSharp.5.1.0\build\PaddleOCRSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PaddleOCRSharp.5.1.0\build\PaddleOCRSharp.targets'))" />
<Error Condition="!Exists('..\packages\SixLabors.ImageSharp.3.1.11\build\SixLabors.ImageSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SixLabors.ImageSharp.3.1.11\build\SixLabors.ImageSharp.props'))" />
<Error Condition="!Exists('..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets'))" />
<Error Condition="!Exists('..\packages\Paddle.Runtime.win_x64.3.1.0.1\build\Paddle.Runtime.win_x64.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Paddle.Runtime.win_x64.3.1.0.1\build\Paddle.Runtime.win_x64.targets'))" />
<Error Condition="!Exists('..\packages\SixLabors.ImageSharp.3.1.11\build\SixLabors.ImageSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SixLabors.ImageSharp.3.1.11\build\SixLabors.ImageSharp.props'))" />
</Target>
<Import Project="..\packages\PaddleOCRSharp.5.1.0\build\PaddleOCRSharp.targets" Condition="Exists('..\packages\PaddleOCRSharp.5.1.0\build\PaddleOCRSharp.targets')" />
<Import Project="..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets" Condition="Exists('..\packages\System.ValueTuple.4.6.1\build\net471\System.ValueTuple.targets')" />

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because it is too large Load Diff