liuwf 1 year ago
commit dea0a90a12

@ -920,10 +920,6 @@
"target": "Package",
"version": "[7.0.0, )"
},
"TouchSocket": {
"target": "Package",
"version": "[1.3.0, )"
},
"log4net": {
"target": "Package",
"version": "[2.0.12, )"

@ -15,7 +15,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Api")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Api")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Api")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
a22ffb70c3624b5184910c59b4042df90f3f75c5bfafb020bbaec9208ed377f5
0148f6b8fdfc80bd2a2859df935bb6604d1b43ca78d100f4c11ea77e74071abe

@ -3990,19 +3990,6 @@
"lib/netstandard1.3/System.Xml.XmlDocument.dll": {}
}
},
"TouchSocket/1.3.0": {
"type": "package",
"compile": {
"lib/netcoreapp3.1/TouchSocket.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netcoreapp3.1/TouchSocket.dll": {
"related": ".xml"
}
}
},
"UAParser/3.1.47": {
"type": "package",
"compile": {
@ -4196,7 +4183,6 @@
"Admin.Core.Common": "1.0.0",
"Admin.Core.IService": "1.0.0",
"System.Speech": "7.0.0",
"TouchSocket": "1.3.0",
"log4net": "2.0.12"
},
"compile": {
@ -11266,27 +11252,6 @@
"system.xml.xmldocument.nuspec"
]
},
"TouchSocket/1.3.0": {
"sha512": "z6sJfYv/l5pT3pwCpEZ7KsmQbd7dqiJemQ1DSr8t0lqVZEssTYWnxHjAd5GhxelLy/EdsyF2i17lICASbswGSw==",
"type": "package",
"path": "touchsocket/1.3.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.txt",
"lib/net45/TouchSocket.dll",
"lib/net45/TouchSocket.xml",
"lib/net7.0/TouchSocket.dll",
"lib/net7.0/TouchSocket.xml",
"lib/netcoreapp3.1/TouchSocket.dll",
"lib/netcoreapp3.1/TouchSocket.xml",
"lib/netstandard2.0/TouchSocket.dll",
"lib/netstandard2.0/TouchSocket.xml",
"logo.png",
"touchsocket.1.3.0.nupkg.sha512",
"touchsocket.nuspec"
]
},
"UAParser/3.1.47": {
"sha512": "I68Jl/Vs5RQZdz9BbmYtnXgujg0jVd61LhKbyNZOCm9lBxZFGxLbiQo6yFj21VYi7DzPvEvrVOmeC6v41AoLfw==",
"type": "package",

@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "8OEVqYq9LP4/Zquk0QAXy85fFYCYMQevZ2NPgY3pXW4kBIKAFgqDq35KYBm/tY06lfK7FWxaLf3xs7SH99Ti7w==",
"dgSpecHash": "J5jaKkkBa1hP+fG2B4Llawxq5LtxoWmKqZxt4rRTQDhaSrtHiudJwHWpHoQG3GlWnoQ4wbGr8/SmLP0AFmG69A==",
"success": true,
"projectFilePath": "D:\\Project\\gitea\\AUCMA\\SCADA\\Admin.Core.Api\\Admin.Core.Api.csproj",
"expectedPackageFiles": [
@ -228,7 +228,6 @@
"C:\\Users\\admin\\.nuget\\packages\\system.xml.readerwriter\\4.3.0\\system.xml.readerwriter.4.3.0.nupkg.sha512",
"C:\\Users\\admin\\.nuget\\packages\\system.xml.xdocument\\4.3.0\\system.xml.xdocument.4.3.0.nupkg.sha512",
"C:\\Users\\admin\\.nuget\\packages\\system.xml.xmldocument\\4.3.0\\system.xml.xmldocument.4.3.0.nupkg.sha512",
"C:\\Users\\admin\\.nuget\\packages\\touchsocket\\1.3.0\\touchsocket.1.3.0.nupkg.sha512",
"C:\\Users\\admin\\.nuget\\packages\\uaparser\\3.1.47\\uaparser.3.1.47.nupkg.sha512"
],
"logs": []

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
43cce3e1729b66c69101c338ad89d905087f628183d713ef8cde43dac540c86d
29c0e73aaffbb136ed3bf0ea920c38ccd5f8942089c0eab6977f44b9574bc515

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
4c7908c0d1c0366b59ab3ecbec8b794be215bb09f0dc894fc770fc82a17503f0
b55513969e6f435c068d915433287572bfe5569312ab419e27d9c676b39709d2

@ -35,4 +35,10 @@
<ProjectReference Include="..\Aucma.Core.TemperatureTask\Aucma.Core.TemperatureTask.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="TouchSocket">
<HintPath>..\dll\TouchSocket.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1c24e3b71af58170904fd584601e6d11096091b8")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
147a4f923b8161c7419e523c19ebd4b4c4acf34f3fee21885153282fe995d97e
465860234743f1c79866f2fe7d03a08a7318746635d0c5a8914b9177c3f0ff51

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
e2c4e1b804505a01f875b56e29bb4fdec4a6b2c04a546efb5486dc64d4863a14
a268c6f24aaea521ae31d6d7413bcf74440bebc6025c2b781eca66a9895d71fe

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
56f00e4b22241486ee5c7ed34498025dc7c115882b73472d41e2bb5ff4a51a6d
f90ceed39fd9abe0d7cf3fd7393aa7e31152407a532bac550d4ec89e8acff61e

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
0c9df6ce96f987f9ac1850b6dbf48d6fff639b1781b36f0e83c50bd5c619490e
85bf9620515ac511164074c8ed8a8979582a08cf1c74a7e59bdaff6ba1caa0f7

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
ca2b1ef2c2f23ccc2401f80970a5253e0ed301b5e159b0b614e1a8dc233b10c3
6595a36c314086862e215ec6166f939adb15b90616206d6071f800086045c13d

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bbafaee8fe732961eae6546590b0f4d57ea4a80a")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
b01301148dd261d777cc6215850c3de411dbc5ed92b5077685a3e1bd7cacdd0f
71bf26c4357ccd5b202b5a78fe33b771d0252b66b6393a0e14263cff18f40422

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
032175962c1bde51f970a9b05ea9102ef76437bf6d27a210259112212dea5e5c
dfc6b2054970be703e28559753b0da8c285e0587b587be69de4ec441dae6188f

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
90d5c4b7ecc3b4b31fb9f49079ec52849371bc289f6b26664a0dd9019427843f
49f70ffba3e253317a7346e1d49bc62608b31a922c2a0dacb3a2cea91b307e57

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
3f96c9fb0f53245146a9bee243b67bc1eb793cbf7f1239c2acabe4ef80647074
f60ade9ee5404973cfa376afed32a1e7cdbc17d5041cfd6953b2d01f1abc2dea

@ -9,7 +9,6 @@
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.12" />
<PackageReference Include="System.Speech" Version="7.0.0" />
<PackageReference Include="TouchSocket" Version="1.3.0" />
</ItemGroup>
<ItemGroup>
@ -21,4 +20,10 @@
<Folder Include="Model\" />
</ItemGroup>
<ItemGroup>
<Reference Include="TouchSocket">
<HintPath>..\dll\TouchSocket.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
cae5590e8f50feea4c189aad7a6e5b353938db2e0a26e918121248683711d81d
a613c06ccb5239f51be1db003ca82041e4b9ee9a2881c308d8a67fa2c66d1f4e

@ -83,9 +83,6 @@
<Reference Include="LiveCharts.Wpf">
<HintPath>..\dll\LiveCharts.Wpf.dll</HintPath>
</Reference>
<Reference Include="MvCodeReaderSDK.Net">
<HintPath>..\dll\MvCodeReaderSDK.Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

@ -18,6 +18,7 @@ using System.Windows.Forms;
using Admin.Core.Model.Model_New;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
using Microsoft.IdentityModel.Logging;
using Admin.Core.Socket;
namespace Aucma.Core.BoxFoam.Business
{
@ -117,7 +118,7 @@ namespace Aucma.Core.BoxFoam.Business
public InStoreBusiness()
{
MvCodeHelper.PQKReceiveCodeEvent += NewTask;
TouchSocketService.ReceiveCodeDelegateEvent += NewTask;
storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode");//泡前库code
#region 更新库数据
@ -136,7 +137,7 @@ namespace Aucma.Core.BoxFoam.Business
/// </summary>
/// <param name="materialBarCode"></param>
/// <returns></returns>
public async Task NewTask(string materialBarCode)
public async Task NewTask(string IP,string materialBarCode)
{
if (string.IsNullOrEmpty(materialBarCode))
{

@ -1,285 +0,0 @@
using Admin.Core.Common;
using Aucma.Core.Scanner;
using MvCodeReaderSDKNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.BoxFoam.Business
{
public class MvCodeHelper
{
//private static AppConfig appConfig = AppConfig.Instance;
public static bool m_bGrabbing = true;
private static string lastCode;
private static List<ScannerModel> allScanners = Appsettings.app<ScannerModel>("ScannerServer").ToList();
// 内胆扫码器ip
private static string LinerScannerIp = allScanners.First(x => x.Name == "扫码器1").Ip;
#region 委托事件
/// <summary>
/// 泡前库扫码
/// </summary>
/// <param name="Code1"></param>
public delegate Task PQKReceiveCode(string code1);
public static event PQKReceiveCode? PQKReceiveCodeEvent;
/// <summary>
/// 日志信息刷新
/// </summary>
/// <param name="message"></param>
public delegate void RefreshLogMessage(string message);
public static event RefreshLogMessage RefreshLogMessageEvent;
#endregion
public static void LinerImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser)
{
var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2));
MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2));
// Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]");
if (stBcrResult.nCodeNum == 0)
{
Console.WriteLine("liner--->No Read 处理");
}
for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
{
bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
if (bIsValidUTF8)
{
string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode);
Console.WriteLine("Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
}
else
{
string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
Console.WriteLine("Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
// RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp);
// 业务处理
Console.WriteLine(strCode.Trim().TrimEnd('\0'));
PQKReceiveCodeEvent?.Invoke(strCode.Trim().TrimEnd('\0'));
}
}
MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST));
Console.WriteLine("ocrAllNum[" + Convert.ToString(stOcrInfo.nOCRAllNum) + "]");
for (int i = 0; i < stOcrInfo.nOCRAllNum; i++)
{
string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr);
Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]");
}
}
public static void Liner()
{
MvCodeReader.cbOutputEx2delegate ImageCallback;
MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfo = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2();
MvCodeReader device = new MvCodeReader();
int nRet = MvCodeReader.MV_CODEREADER_OK;
do
{
// ch:枚举设备 | en:Enum device
MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST stDevList = new MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST();
nRet = MvCodeReader.MV_CODEREADER_EnumDevices_NET(ref stDevList, MvCodeReader.MV_CODEREADER_GIGE_DEVICE);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Enum device failed:{0:x8}", nRet);
break;
}
Console.WriteLine("Enum device count : " + Convert.ToString(stDevList.nDeviceNum));
if (0 == stDevList.nDeviceNum)
{
break;
}
MvCodeReader.MV_CODEREADER_DEVICE_INFO stDevInfo; // 通用设备信息
Int32 nDevIndex = -1;
// ch:打印设备信息 | en:Print device info
for (Int32 i = 0; i < stDevList.nDeviceNum; i++)
{
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType)
{
MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO stGigEDeviceInfo = (MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)MvCodeReader.ByteToStruct(stDevInfo.SpecialInfo.stGigEInfo, typeof(MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO));
uint nIp1 = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24);
uint nIp2 = ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16);
uint nIp3 = ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8);
uint nIp4 = (stGigEDeviceInfo.nCurrentIp & 0x000000ff);
// Console.WriteLine("\n" + i.ToString() + ": [GigE] User Define Name : " + stGigEDeviceInfo.chUserDefinedName);
string ip = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8) + "." + (stGigEDeviceInfo.nCurrentIp & 0x000000ff);
string ipStr = nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4;
if (ipStr == LinerScannerIp)
{
Console.WriteLine("device IP :" + ipStr);
nDevIndex = i;
}
}
}
if (nDevIndex < 0) return;
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[nDevIndex], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
// ch:创建设备 | en:Create device
nRet = device.MV_CODEREADER_CreateHandle_NET(ref stDevInfo);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Create device failed:{0:x8}", nRet);
break;
}
// ch:打开设备 | en:Open device
nRet = device.MV_CODEREADER_OpenDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Open device failed:{0:x8}", nRet);
break;
}
// ch:注册回调函数 | en:Register image callback
ImageCallback = new MvCodeReader.cbOutputEx2delegate(LinerImageCallbackFunc);
nRet = device.MV_CODEREADER_RegisterImageCallBackEx2_NET(ImageCallback, IntPtr.Zero);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Register image callback failed!");
break;
}
// ch:开启抓图 || en: start grab image
nRet = device.MV_CODEREADER_StartGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Start grabbing failed:{0:x8}", nRet);
break;
}
Console.WriteLine("Press enter to exit");
Console.ReadLine();
// ch:停止抓图 | en:Stop grabbing
nRet = device.MV_CODEREADER_StopGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Stop grabbing failed{0:x8}", nRet);
break;
}
// ch:关闭设备 | en:Close device
nRet = device.MV_CODEREADER_CloseDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Close device failed{0:x8}", nRet);
break;
}
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
break;
}
} while (false);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
}
}
}
#region 判断字符编码
/// <summary>
/// 判断字符编码
/// </summary>
/// <param name="inputStream"></param>
/// <returns></returns>
public static bool IsTextUTF8(byte[] inputStream)
{
int encodingBytesCount = 0;
bool allTextsAreASCIIChars = true;
for (int i = 0; i < inputStream.Length; i++)
{
byte current = inputStream[i];
if ((current & 0x80) == 0x80)
{
allTextsAreASCIIChars = false;
}
// First byte
if (encodingBytesCount == 0)
{
if ((current & 0x80) == 0)
{
// ASCII chars, from 0x00-0x7F
continue;
}
if ((current & 0xC0) == 0xC0)
{
encodingBytesCount = 1;
current <<= 2;
// More than two bytes used to encoding a unicode char.
// Calculate the real length.
while ((current & 0x80) == 0x80)
{
current <<= 1;
encodingBytesCount++;
}
}
else
{
// Invalid bits structure for UTF8 encoding rule.
return false;
}
}
else
{
// Following bytes, must start with 10.
if ((current & 0xC0) == 0x80)
{
encodingBytesCount--;
}
else
{
// Invalid bits structure for UTF8 encoding rule.
return false;
}
}
}
if (encodingBytesCount != 0)
{
// Invalid bits structure for UTF8 encoding rule.
// Wrong following bytes count.
return false;
}
// Although UTF8 supports encoding for ASCII chars, we regard as a input stream, whose contents are all ASCII as default encoding.
return !allTextsAreASCIIChars;
}
#endregion
}
}

@ -6,6 +6,7 @@ using Admin.Core.IService.ISys;
using Admin.Core.Model;
using Admin.Core.Repository;
using Admin.Core.Service;
using Admin.Core.Socket;
using Admin.Core.Tasks;
using Aucma.Core.RunPlc;
using Aucma.Core.Scanner;
@ -14,6 +15,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Net.Sockets;
using System.Text;
namespace Aucma.Core.BoxFoam
@ -63,13 +65,14 @@ namespace Aucma.Core.BoxFoam
AddServices(services);
//扫码器
services.AddScannerSetup();
//services.AddScannerSetup();
//任务调度
// services.AddJobSetup();
//PLC
services.AddPlcSetup();
//socket连接扫码器
services.AddTouchSocketSetup();
//支持编码大全 例如:支持 System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030")
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
@ -90,7 +93,7 @@ namespace Aucma.Core.BoxFoam
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app, IRunPlcService runPlcService)
public void Configure(IApplicationBuilder app, IRunPlcService runPlcService, ITouchSocketService socket)
{
// 使用静态文件
app.UseStaticFiles();
@ -102,8 +105,7 @@ namespace Aucma.Core.BoxFoam
//PLC
app.UsePlcMildd(runPlcService);
//开启扫码服务
//app.UseScannerMildd(scannerService);
app.UseTouchSocketMildd(socket);
}
#region 注册服务

@ -1,4 +1,5 @@
using Admin.Core.Common;
using Admin.Core.Socket;
using Aucma.Core.BoxFoam.Business;
using Aucma.Core.BoxFoam.Views;
using Aucma.Core.HwPLc;
@ -6,6 +7,7 @@ using Aucma.Core.Scanner;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using log4net;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
@ -30,18 +32,12 @@ namespace Aucma.Core.BoxFoam.ViewModels
MonitorPageView monitorPage = new MonitorPageView();//任务监控
FoamMachinesPageView foamMachinesPageView = new FoamMachinesPageView();
public MainWindowViewModel()
{
UserContent = firstPage;
// 创建一个DispatcherTimer对象
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
InitHikRobot();
TouchSocketService.RefreshStateEvent += RefreshScanner;
string address = Appsettings.app("Middleware", "TouchSocket", "Address").ObjToString();
RefreshScanner(address, false);
Task.Run(() =>
{
init();
@ -60,33 +56,14 @@ namespace Aucma.Core.BoxFoam.ViewModels
timer.Enabled = true;
timer.Start();
// 创建一个DispatcherTimer对象
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Tick += Timer_Tick;
dispatcherTimer.Start();
return Task.CompletedTask;
}
#region 开启海康扫码器
public void InitHikRobot()
{
try
{
Task.Run(() =>
{
Thread.Sleep(2000);
//MvCodeHelper1.DeviceListAcq();//获取创建设备
// MvCodeHelper1.StartGrab(); // 开启触发扫码接收数据
Business.MvCodeHelper.Liner();
});
}
catch (Exception ex)
{
//MvCodeHelper.CloseAllDevice();
InitHikRobot();
}
}
#endregion
#region 设备状态刷新
/// <summary>
/// 设备状态刷新
@ -97,8 +74,6 @@ namespace Aucma.Core.BoxFoam.ViewModels
{
RefreshMesDb();
RefreshPlc();
RefreshScanner();
}
/// <summary>
/// 数据库状态刷新
@ -156,11 +131,9 @@ namespace Aucma.Core.BoxFoam.ViewModels
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void RefreshScanner()
public void RefreshScanner(string address,bool type)
{
string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip");
// bool flag1 = MvCodeHelper.ConnectionStatus(ip1);
Scanner1State(true);
Scanner1State(type);
}
#endregion

@ -193,7 +193,7 @@
},
"TouchSocket": {
"Enabled": true,
"Address": "10.10.92.232:5000"
"Address": "10.10.93.50:5000"
}
},
"ScannerServer": [

@ -77,12 +77,6 @@
<ProjectReference Include="..\Admin.Core.Extensions\Admin.Core.Extensions.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="MvCodeReaderSDK.Net">
<HintPath>..\dll\MvCodeReaderSDK.Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Update="Views\FoamMachinesPageView.xaml.cs">
<SubType>Code</SubType>

@ -17,6 +17,7 @@ using System.Collections.ObjectModel;
using System.Collections;
using Admin.Core.Socket;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
using Admin.Core.Common;
namespace Aucma.Core.DoorFoam.ViewModels
{
@ -35,12 +36,9 @@ namespace Aucma.Core.DoorFoam.ViewModels
{
UserContent = firstPage;
TouchSocketService.RefreshStateEvent += RefreshScanner;
RefreshScanner("10.10.92.130", false);
string address = Appsettings.app("Middleware", "TouchSocket", "Address").ObjToString();
RefreshScanner(address, false);
init();
//doorCollection.startCollect();
//collectionFoam.startCollect();
}
#region 初始化

@ -47,7 +47,7 @@ namespace Aucma.Core.DoorFoam.ViewModels
_printBarCodeServices = App.ServiceProvider.GetService<IPrintBarCodeServices>();
_materialCompletionServices = App.ServiceProvider.GetService<IMaterialCompletionServices>();
TouchSocketService.DoorReceiveCodeDelegateEvent += OnLoadPlanData;
TouchSocketService.ReceiveCodeDelegateEvent += OnLoadPlanData;
Task.Run(async () =>
{

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("HwControlLib")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5cf54f161bb434f34e3453817192aca063d32ff4")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+68d81235bf7a78dee392ba1937d2c5747fb64d9f")]
[assembly: System.Reflection.AssemblyProductAttribute("HwControlLib")]
[assembly: System.Reflection.AssemblyTitleAttribute("HwControlLib")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
7f553edd50145e81b8a678e0b235b1e213196676d76eee80e8d8c486b569c540
c2517d70935d0a6741ad8803672a2b7ac6786f5fae94d443d59da6faaea0c443

Binary file not shown.
Loading…
Cancel
Save