Commit a73a41b0 刘韬

1

1 个父辈 ee2815f3
...@@ -56,10 +56,6 @@ ...@@ -56,10 +56,6 @@
<Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL"> <Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath> <HintPath>..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
</Reference> </Reference>
<Reference Include="IDHIKCamera, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\IDHK\IDHIKCamera\IDHIKCamera\bin\Debug\IDHIKCamera.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
...@@ -147,6 +143,10 @@ ...@@ -147,6 +143,10 @@
<Project>{e28de77a-fc70-4be4-96ec-d0c1a7215a15}</Project> <Project>{e28de77a-fc70-4be4-96ec-d0c1a7215a15}</Project>
<Name>DAL</Name> <Name>DAL</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\IDHIKCamera\IDHIKCamera.csproj">
<Project>{2fa7c3a5-e237-4c79-8f4a-4b71c218be89}</Project>
<Name>IDHIKCamera</Name>
</ProjectReference>
<ProjectReference Include="..\Model\Model.csproj"> <ProjectReference Include="..\Model\Model.csproj">
<Project>{20e61a3d-bf87-4a99-9756-7fe13d2daa6e}</Project> <Project>{20e61a3d-bf87-4a99-9756-7fe13d2daa6e}</Project>
<Name>Model</Name> <Name>Model</Name>
......
...@@ -171,13 +171,19 @@ namespace BLL ...@@ -171,13 +171,19 @@ namespace BLL
} }
public static void Close() public static void Close()
{ {
if (useIDCamera) try
{ {
IDHIK.Instance.CloseAll(); if (useIDCamera)
} {
else IDHIK.Instance.CloseAll();
}
else
{
cameraVision?.Close();
}
}catch (Exception ex)
{ {
cameraVision?.Close(); LogNet.log.Error($"关闭相机失败 {ex}");
} }
} }
public static string[] GetBarCodeText(List<BarcodeInfo> barcodeInfos) public static string[] GetBarCodeText(List<BarcodeInfo> barcodeInfos)
...@@ -224,7 +230,10 @@ namespace BLL ...@@ -224,7 +230,10 @@ namespace BLL
catch (Exception e) catch (Exception e)
{ {
LogNet.log.Error($"{cameraName}取图失败:", e); LogNet.log.Error($"{cameraName}取图失败:", e);
} }
finally {
Close();
}
return barcodeInfos; return barcodeInfos;
} }
} }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace IDHIKCamera
{
/// <summary>
/// 条码信息
/// </summary>
[Serializable]
public class CodeInfo
{
public string CodeStr = "";
public int X = 0;
public int Y = 0;
public string CodeType;
public double Orientation = 0;
public CodeInfo()
{
}
public CodeInfo(string codeStr, int x, int y)
{
this.CodeStr = codeStr;
this.X = x;
this.Y = y;
}
public CodeInfo(string codeStr, int x, int y, string type)
{
this.CodeType = type;
this.CodeStr = codeStr;
this.X = x;
this.Y = y;
}
public string GetCodeStr()
{
return Gb2312Correct(CodeStr);
}
/// <summary>
/// 判断字符串中是否包含中文
/// </summary>
/// <param name="str">需要判断的字符串</param>
/// <returns>判断结果</returns>
public static bool HasChinese(string str)
{
return Regex.IsMatch(str, @"[\u4e00-\u9fa5]");
}
/// <summary>
/// utf8文字用gb2312格式显示时候乱码,需要转换为gb2312
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static string Gb2312Correct(string text)
{
//string ascii= Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(text));
//return ascii;
if (!HasChinese(text))
{
return text;
}
//声明字符集
System.Text.Encoding utf8, gb2312;
//utf8
utf8 = System.Text.Encoding.GetEncoding("utf-8");
//gb2312
gb2312 = System.Text.Encoding.GetEncoding("gb2312");
byte[] gb;
gb = utf8.GetBytes(text);
//utf8.GetString(System.Text.Encoding.Convert(utf8, gb2312, gb));
gb = System.Text.Encoding.Convert(utf8, gb2312, gb);
//返回转换后的字符
string s = utf8.GetString(gb);
int sp = 0;
while (true)
{
sp = s.IndexOf("?", sp + 1);
if (sp < 0)
break;
if (s.Substring(sp, 2) != "?;")
{
s = s.Insert(sp + 1, ";");
}
}
return s;
}
}
}
namespace IDHIKCamera
{
partial class FrmTest
{
/// <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.btnIDHIKInit = new System.Windows.Forms.Button();
this.cbDeviceList = new System.Windows.Forms.ComboBox();
this.btnIDHIKTest = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.lblCodeInfo = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.btnStop = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// btnIDHIKInit
//
this.btnIDHIKInit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnIDHIKInit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnIDHIKInit.Location = new System.Drawing.Point(156, 79);
this.btnIDHIKInit.Name = "btnIDHIKInit";
this.btnIDHIKInit.Size = new System.Drawing.Size(137, 35);
this.btnIDHIKInit.TabIndex = 46;
this.btnIDHIKInit.Text = "IDHIK 加载相机";
this.btnIDHIKInit.UseVisualStyleBackColor = true;
this.btnIDHIKInit.Visible = false;
this.btnIDHIKInit.Click += new System.EventHandler(this.btnIDHIKInit_Click);
//
// cbDeviceList
//
this.cbDeviceList.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cbDeviceList.FormattingEnabled = true;
this.cbDeviceList.Location = new System.Drawing.Point(12, 6);
this.cbDeviceList.Name = "cbDeviceList";
this.cbDeviceList.Size = new System.Drawing.Size(929, 28);
this.cbDeviceList.TabIndex = 45;
//
// btnIDHIKTest
//
this.btnIDHIKTest.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnIDHIKTest.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnIDHIKTest.Location = new System.Drawing.Point(13, 40);
this.btnIDHIKTest.Name = "btnIDHIKTest";
this.btnIDHIKTest.Size = new System.Drawing.Size(137, 35);
this.btnIDHIKTest.TabIndex = 44;
this.btnIDHIKTest.Text = "IDHIK扫码测试";
this.btnIDHIKTest.UseVisualStyleBackColor = true;
this.btnIDHIKTest.Click += new System.EventHandler(this.btnIDHIKTest_Click);
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(965, 9);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(127, 35);
this.btnExit.TabIndex = 47;
this.btnExit.Text = "关闭";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Location = new System.Drawing.Point(13, 120);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(1079, 616);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 48;
this.pictureBox1.TabStop = false;
//
// lblCodeInfo
//
this.lblCodeInfo.AutoSize = true;
this.lblCodeInfo.Location = new System.Drawing.Point(353, 40);
this.lblCodeInfo.Name = "lblCodeInfo";
this.lblCodeInfo.Size = new System.Drawing.Size(77, 12);
this.lblCodeInfo.TabIndex = 50;
this.lblCodeInfo.Text = "扫到条码信息";
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox1.Location = new System.Drawing.Point(156, 49);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(82, 18);
this.checkBox1.TabIndex = 51;
this.checkBox1.Text = "循环测试";
this.checkBox1.UseVisualStyleBackColor = true;
//
// btnStop
//
this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnStop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStop.Location = new System.Drawing.Point(13, 81);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(137, 35);
this.btnStop.TabIndex = 52;
this.btnStop.Text = "停止测试";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// FrmTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1095, 748);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.lblCodeInfo);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnIDHIKInit);
this.Controls.Add(this.cbDeviceList);
this.Controls.Add(this.btnIDHIKTest);
this.Name = "FrmTest";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "IDHIK Scan Test";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FrmTest_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnIDHIKInit;
private System.Windows.Forms.ComboBox cbDeviceList;
private System.Windows.Forms.Button btnIDHIKTest;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label lblCodeInfo;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button btnStop;
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace IDHIKCamera
{
public partial class FrmTest : Form
{
public FrmTest()
{
InitializeComponent();
pictureBox1.Show();
}
/// <summary>
/// 初始化摄像机名称和二维码类型
/// </summary>
public static void LoadConfig()
{
try
{
IDHIK.Instance.Load();
List<string> names = IDHIK.Instance.cameraName;
if (names != null)
{
// hikNameList.AddRange(names);
foreach (string name in names)
{
LibLogUtil.Info("加载到IDHIK相机:" + name);
}
}
//IDHIK.Instance.OpenAll();
}
catch (Exception ex)
{
LibLogUtil.Error("解析IDHIK出错:" + ex.StackTrace);
}
}
private void btnIDHIKInit_Click(object sender, EventArgs e)
{
LoadConfig();
foreach (string name in IDHIK.Instance.cameraName)
{
cbDeviceList.Items.Add(name);
}
if (cbDeviceList.Items.Count > 0)
{
cbDeviceList.SelectedIndex = 0;
btnIDHIKInit.Visible = false;
}
}
private Task scanTask = null;
private int count = 0;
private void btnIDHIKTest_Click(object sender, EventArgs e)
{
StopTest = true;
string cName = cbDeviceList.Text;
if (cName == "")
{
return;
}
ScanTest(cName);
count = 1;
if (checkBox1.Checked)
{
StopTest = false;
scanTask = Task.Factory.StartNew(() =>
{
while (checkBox1.Checked)
{
if (StopTest)
{
break;
}
count++;
ScanTest(cName);
Thread.Sleep(100);
}
});
}
}
private void ScanTest(string cName)
{
try
{
List<CodeInfo> codes = CameraScan(new string[] { cName });
lblCodeInfo.Text = "";
string str = $"扫码{count}:\r\n";
foreach (CodeInfo code in codes)
{
str += $"[{code.CodeType}][{code.X},{code.Y}]{code.CodeStr}\r\n";
}
lblCodeInfo.Text = str;
}
catch (Exception ex)
{
LibLogUtil.Error("出错:" + ex.ToString());
}
}
[HandleProcessCorruptedStateExceptions]
public List<CodeInfo> CameraScan(string[] cameraNameList)
{
HashSet<string> codestr = new HashSet<string>();
List<CodeInfo> codeList = new List<CodeInfo>();
if (cameraNameList == null || cameraNameList.Length <= 0)
{
throw new Exception("CameraScan方法没有传入相机名称.");
}
try
{
foreach (string cameraName in cameraNameList)
{
string r = "";
LibLogUtil.Info($"【" + cameraName + "】开始取图片");
if (cameraName.Trim().Equals(""))
{
continue;
}
DateTime startTime = DateTime.Now;
Image bmp = null;
try
{
bmp = IDHIK.Instance.GrabOne(cameraName, out List<CodeInfo> cc);
//HalconDotNet.HOperatorSet.RotateImage()
if (bmp == null)
{
LibLogUtil.Error(" 【" + cameraName + "】取图片失败[" + IDHIK.Instance._errInfo + "],关闭相机");
IDHIK.Instance.Close(cameraName);
continue;
}
LibLogUtil.Info(" 【" + cameraName + "】取图片扫码完成,数量【" + cc.Count + "】");
cc.ForEach((c) =>
{
if (!codestr.Contains(c.CodeStr))
{
codeList.Add(c);
codestr.Add(c.CodeStr);
r += "##" + c.CodeStr;
}
});
LibLogUtil.Info(" 【" + cameraName + "】" + " 扫码完成【" + (DateTime.Now - startTime).TotalSeconds.ToString() + "】 " + count + ":" + r);
pictureBox1.Image = (Image)bmp;
pictureBox1.Refresh();
}
catch (AccessViolationException e)
{
LibLogUtil.Error(" 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
// GC.Collect();
}
catch (Exception ex)
{
LibLogUtil.Error(" 扫码出错:" + ex.ToString());
}
finally
{
if (bmp != null)
bmp.Dispose();
}
}
}
catch (AccessViolationException e)
{
LibLogUtil.Error(" 扫码出现AccessViolationException异常:" + e.ToString());
}
catch (Exception ex)
{
LibLogUtil.Error(" 扫码出错:" + ex.ToString());
}
return codeList;
}
private bool StopTest = false;
private void btnExit_Click(object sender, EventArgs e)
{
StopTest = true;
checkBox1.Checked = false;
this.Close();
}
private void FrmTest_Load(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
LoadConfig();
foreach (string name in IDHIK.Instance.cameraName)
{
cbDeviceList.Items.Add(name);
}
if (cbDeviceList.Items.Count > 0)
{
cbDeviceList.SelectedIndex = 0;
}
else
{
btnIDHIKInit.Visible = true;
}
}
private void btnStop_Click(object sender, EventArgs e)
{
checkBox1.Checked = false;
}
}
}
<?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>
\ No newline at end of file \ No newline at end of file
using System;
namespace IDHIKCamera
{
public class LibLogUtil
{
public delegate void LogEventHandler(LibLogEventArg libLogEventArg);
public static event LogEventHandler LogEvent;
public static string prefix_log = "IDHIKCamera-";
public static void Info(string msg)
{
LogEvent?.Invoke(new LibLogEventArg()
{
Msg = $"{prefix_log}{msg}",
Level = LibLogLevel.Info
});
}
public static void Warn(string msg)
{
LogEvent?.Invoke(new LibLogEventArg()
{
Msg = $"{prefix_log}{msg}",
Level = LibLogLevel.Warning,
});
}
public static void Error(string msg, Exception ex = null)
{
LogEvent?.Invoke(new LibLogEventArg()
{
Msg = $"{prefix_log}{msg}",
Level = LibLogLevel.Error,
Exception = ex
});
}
}
public class LibLogEventArg : EventArgs
{
public string Msg { get; set; }
public LibLogLevel Level { get; set; }
public Exception Exception { get; set; }
}
public enum LibLogLevel
{
Debug,
Info,
Warning,
Error
}
}
此文件的差异被折叠, 点击展开。
<?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>{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IDHIKCamera</RootNamespace>
<AssemblyName>IDHIKCamera</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>
<ItemGroup>
<Reference Include="MvCodeReaderSDK.Net">
<HintPath>..\SharedDLL\MvCodeReaderSDK.Net.dll</HintPath>
</Reference>
<Reference Include="MVIDCodeReader.Net, Version=1.1.9.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\MVIDCodeReader.Net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<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="CodeInfo.cs" />
<Compile Include="FrmTest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmTest.Designer.cs">
<DependentUpon>FrmTest.cs</DependentUpon>
</Compile>
<Compile Include="HDLogUtil.cs" />
<Compile Include="IDHIK.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FrmTest.resx">
<DependentUpon>FrmTest.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="MvCodeReaderSDK.Net.dll" />
<Content Include="MvCodeReaderSDK.Net.XML" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
此文件的差异太大,无法显示。
此文件类型无法预览
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("IDHIKCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("IDHIKCamera")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2fa7c3a5-e237-4c79-8f4a-4b71c218be89")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
...@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "paddleOCR", "paddleOCR\padd ...@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "paddleOCR", "paddleOCR\padd
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataHandling", "DataHandling\DataHandling.csproj", "{0F23B7DB-9953-46ED-9166-115646467647}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataHandling", "DataHandling\DataHandling.csproj", "{0F23B7DB-9953-46ED-9166-115646467647}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IDHIKCamera", "IDHIKCamera\IDHIKCamera.csproj", "{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -111,6 +113,18 @@ Global ...@@ -111,6 +113,18 @@ Global
{0F23B7DB-9953-46ED-9166-115646467647}.Release|x64.Build.0 = Release|Any CPU {0F23B7DB-9953-46ED-9166-115646467647}.Release|x64.Build.0 = Release|Any CPU
{0F23B7DB-9953-46ED-9166-115646467647}.Release|x86.ActiveCfg = Release|Any CPU {0F23B7DB-9953-46ED-9166-115646467647}.Release|x86.ActiveCfg = Release|Any CPU
{0F23B7DB-9953-46ED-9166-115646467647}.Release|x86.Build.0 = Release|Any CPU {0F23B7DB-9953-46ED-9166-115646467647}.Release|x86.Build.0 = Release|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Debug|x64.ActiveCfg = Debug|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Debug|x64.Build.0 = Debug|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Debug|x86.ActiveCfg = Debug|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Debug|x86.Build.0 = Debug|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Release|Any CPU.Build.0 = Release|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Release|x64.ActiveCfg = Release|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Release|x64.Build.0 = Release|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Release|x86.ActiveCfg = Release|Any CPU
{2FA7C3A5-E237-4C79-8F4A-4B71C218BE89}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -216,7 +216,8 @@ namespace SmartScan ...@@ -216,7 +216,8 @@ namespace SmartScan
BLLCommon.labelEdit.PrintLast(BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName, BLLCommon.config.PrintLandscape, content, out string[] barcode); BLLCommon.labelEdit.PrintLast(BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName, BLLCommon.config.PrintLandscape, content, out string[] barcode);
LogNet.log.Info(string.Format("打印标签 Label[{0}] Printer[{1}]", BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName)); LogNet.log.Info(string.Format("打印标签 Label[{0}] Printer[{1}]", BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName));
var bmp = BLLCommon.labelEdit.PrintImage(BLLCommon.config.DefaultPrintLabel, content, out _); var bmp = BLLCommon.labelEdit.PrintImage(BLLCommon.config.DefaultPrintLabel, content, out _);
_=UnifiedDataHandler.PostSmfImageAsync(bmp, new Dictionary<string, string> { { "cid", BLLCommon.config.CID+"_2" } }, bmp.Width, bmp.Height); if (bmp != null)
_ =UnifiedDataHandler.PostSmfImageAsync(bmp, new Dictionary<string, string> { { "cid", BLLCommon.config.CID+"_2" } }, bmp.Width, bmp.Height);
bmp.Dispose(); bmp.Dispose();
//SaveRetrospect(labelBmp, barcode); //SaveRetrospect(labelBmp, barcode);
UnifiedDataHandler.RecordPrintNg(false, true, out string[] strarrys); UnifiedDataHandler.RecordPrintNg(false, true, out string[] strarrys);
......
...@@ -237,6 +237,7 @@ namespace SmartScan ...@@ -237,6 +237,7 @@ namespace SmartScan
if (image.Count > 0) if (image.Count > 0)
{ {
BLLCommon.mateEdit.CurrntBitmap = image[0]; BLLCommon.mateEdit.CurrntBitmap = image[0];
if (BLLCommon.mateEdit.CurrntBitmap!=null)
_ = UnifiedDataHandler.PostSmfImageAsync(BLLCommon.mateEdit.CurrntBitmap, new Dictionary<string, string> { { "cid", BLLCommon.config.CID + "_1" } }, BLLCommon.mateEdit.CurrntBitmap.Width, BLLCommon.mateEdit.CurrntBitmap.Height); _ = UnifiedDataHandler.PostSmfImageAsync(BLLCommon.mateEdit.CurrntBitmap, new Dictionary<string, string> { { "cid", BLLCommon.config.CID + "_1" } }, BLLCommon.mateEdit.CurrntBitmap.Width, BLLCommon.mateEdit.CurrntBitmap.Height);
} }
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!