Commit fb343727 authored by 姜春辉's avatar 姜春辉

完成数据同步部分改造

parent 6e8ca719
......@@ -30,7 +30,7 @@
<Property Name="Tag" Caption="标识"></Property>
</Declare>
<Datas>
<Data DisplayName="BeiYang" Type="Card" Descript="北洋通道" VID="" PID="" MI="5" isVirtual="false" ImplDLLName="Device.Implement.IPCBeiYangCardReader.dll" isWatch="true" isPolling="true" AllowFind="true" Interval="300" Tag="" />
<!--<Data DisplayName="BeiYang" Type="Card" Descript="北洋通道" VID="" PID="" MI="5" isVirtual="false" ImplDLLName="Device.Implement.IPCBeiYangCardReader.dll" isWatch="true" isPolling="true" AllowFind="true" Interval="300" Tag="" />-->
</Datas>
</Structure>
</Structures>
......
......@@ -2,8 +2,8 @@
<Settings xmlns="urn:Chinags-Configuration" AddonName="GS.Terminal.FaceRecognization">
<Dictionaries>
<Dict Name="baseConfig" Caption="基本配置">
<Key Caption="面部识别SDK版本" Choice="" Name="SDKVersion" Value="2" />
<Key Caption="摄像头输出图像尺寸" Choice="" Name="VideoOutPutSize" Value="352,288" />
<Key Caption="面部识别SDK版本" Choice="" Name="SDKVersion" Value="4" />
<Key Caption="摄像头输出图像尺寸" Choice="" Name="VideoOutPutSize" Value="640,480" />
<Key Caption="摄像头通道编号" Choice="" Name="VideoPort" Value="0" />
<Key Caption="摄像头启动模式" Choice="" Name="VideoMode" Value="" />
<Key Caption="识别间隔" Choice="" Name="RecognizationInterval" Value="1000" />
......@@ -11,7 +11,7 @@
<Key Caption="摄像头图像输出间隔(毫秒)" Choice="" Name="VideoOutputSpan" Value="20" />
<Key Caption="摄像头画面旋转" Choice="" Name="VideoOutputRotate" Value="0" />
<Key Caption="面部特征值阀值" Choice="" Name="FaceRecognizationValue" Value="0.8" />
<Key Caption="是否为增值版" Choice="" Name="IsArcFacePro" Value="" >
<Key Caption="是否为增值版" Choice="" Name="IsArcFacePro" Value="true" >
<![CDATA[
增值版需将离线激活文件放置到程序根目录下,重命名为ArcFacePro.dat
]]>
......
......@@ -2,7 +2,7 @@
<Extensibility xmlns="urn:Chinags-Extensibility-1.0"
Name="提供面部识别服务的插件"
SymbolicName="GS.Terminal.FaceRecognization"
Version="1.0.0.0" StartLevel="10">
Version="3.1.0.0" StartLevel="10">
<License>Rr+1HM0Sq4Bpkvdel43Ls95HlVj7GKdkBGSBnHLi0a2yCUJBWU/GxD/w4mqHu8AT85wxxV7I0WtxRe8S45zlBYRtd4wEZb0PpAtdcCPzpfwP7ozPI6pHfUMqiF7Evvc08Ech7xSDIu1WW8xUMJiThe1xq61Y2xoaNZWMQWyrGhc=</License>
<Activator Type="GS.Terminal.FaceRecognization.Program" />
<Runtime>
......
......@@ -174,7 +174,7 @@ namespace GS.Terminal.Identification.Enterprise.Logic
IsCard = isCard,
IsVisitor = isVisitor,
Time = DateTime.Now.ToString("HH:mm:ss"),
HumanPhoto = string.IsNullOrWhiteSpace(employee.PhotoPath) ? null : Path.Combine(Program.webPath, employee.PhotoPath),
HumanPhoto = string.IsNullOrWhiteSpace(employee.PhotoPath) ? null : Path.Combine(Program.config.GlobalConfig.ResourcePath, employee.PhotoPath),
};
}
......
<?xml version="1.0" encoding="utf-8" ?>
<Settings xmlns="urn:Chinags-Configuration" AddonName="GS.Terminal.Identification.Enterprise.Logic">
<Dictionaries>
<Dict Caption="业务逻辑基本配置" Name="LogicConfig">
<Key Caption="同一个人面部识别间隔" Choice="" Name="IdentifyTimeSpan" Value="15"/>
<Key Caption="面部识别阈值" Choice="" Name="FaceCompareValue" Value="0.8"/>
<Key Caption="是否拍照" Choice="" Name="IsTakePhoto" Value="true"/>
<Key Caption="自动待机延时(秒)" Choice="" Name="CleanViewDelay" Value="15"/>
</Dict>
</Dictionaries>
<Dictionaries>
<Dict Caption="业务逻辑基本配置" Name="LogicConfig">
<Key Caption="同一个人面部识别间隔" Choice="" Name="IdentifyTimeSpan" Value="15"/>
<Key Caption="面部识别阈值" Choice="" Name="FaceCompareValue" Value="0.8"/>
<Key Caption="是否拍照" Choice="" Name="IsTakePhoto" Value="true"/>
<Key Caption="自动待机延时(秒)" Choice="" Name="CleanViewDelay" Value="15"/>
</Dict>
</Dictionaries>
<Structures>
<Structure Name="DataSyncConfig" Caption="同步管理">
<Declare>
<Property Name="DisPlayName" Caption="同步标题"></Property>
<Property Name="Key" Caption="同步标识"></Property>
<Property Name="IntervalSec" Caption="同步间隔(秒)"></Property>
<Property Name="ServiceUrl" Caption="同步服务地址"></Property>
<Property Name="Enable" Caption="是否开启"></Property>
</Declare>
<Datas>
<Data DisPlayName="员工信息同步" Key="Employee" IntervalSec="100" ServiceUrl="/Services/EnterpriseIdentification/GetAllEmployee/json" Enable="true"/>
<Data DisPlayName="员工面部特征同步" Key="EmployeeFaceData" IntervalSec="30" ServiceUrl="/Services/EnterpriseIdentification/GetAllEmployeeFaceData/json" Enable="true"/>
<Data DisPlayName="来访记录同步" Key="VisitInfo" IntervalSec="30" ServiceUrl="/Services/EnterpriseIdentification/GetVisitor/json" Enable="true"/>
</Datas>
</Structure>
<Structures>
<Structure Name="DataSyncConfig" Caption="同步管理">
<Declare>
<Property Name="DisPlayName" Caption="同步标题"></Property>
<Property Name="Key" Caption="同步标识"></Property>
<Property Name="IntervalSec" Caption="同步间隔(秒)"></Property>
<Property Name="ServiceUrl" Caption="同步服务地址"></Property>
<Property Name="Enable" Caption="是否开启"></Property>
</Declare>
<Datas>
<Data DisPlayName="员工信息同步" Key="Employee" IntervalSec="100" ServiceUrl="/api/GS.WebApi.Terminal.Identification.Enterprise/DataSync/GetEmployee" Enable="true"/>
<Data DisPlayName="员工面部特征同步" Key="EmployeeFaceData" IntervalSec="30" ServiceUrl="/Services/EnterpriseIdentification/GetAllEmployeeFaceData/json" Enable="true"/>
<Data DisPlayName="来访记录同步" Key="VisitInfo" IntervalSec="30" ServiceUrl="/api/GS.WebApi.Terminal.Identification.Enterprise/DataSync/GetVisitors" Enable="true"/>
<Data DisPlayName="员工卡片同步" Key="EmployeeCards" IntervalSec="30" ServiceUrl="/api/GS.WebApi.Terminal.Identification.Enterprise/DataSync/GetEmployeeCards" Enable="true"/>
</Datas>
</Structure>
<Structure Name="ServiceConfig" Caption="服务配置">
<Declare>
<Property Name="ServiceKey" Caption="服务标识"/>
<Property Name="ServiceName" Caption="批量保存识别记录"/>
<Property Name="ServiceUrl" Caption="服务地址"/>
</Declare>
<Structure Name="ServiceConfig" Caption="服务配置">
<Declare>
<Property Name="ServiceKey" Caption="服务标识"/>
<Property Name="ServiceName" Caption="批量保存识别记录"/>
<Property Name="ServiceUrl" Caption="服务地址"/>
</Declare>
<Datas>
<Data ServiceKey="SaveIdentityBatch" ServiceName="批量上传员工识别记录" ServiceUrl="/Services/EnterpriseIdentification/SaveIdentityInfoBatch/json"/>
<Data ServiceKey="SaveVisitorIdentifyBatch" ServiceName="批量上传访客识别记录" ServiceUrl="/Services/EnterpriseIdentification/SaveVisitorIdentifyBatch/json"/>
</Datas>
</Structure>
</Structures>
<Datas>
<Data ServiceKey="SaveIdentityBatch" ServiceName="批量上传员工识别记录" ServiceUrl="/Services/EnterpriseIdentification/SaveIdentityInfoBatch/json"/>
<Data ServiceKey="SaveVisitorIdentifyBatch" ServiceName="批量上传访客识别记录" ServiceUrl="/Services/EnterpriseIdentification/SaveVisitorIdentifyBatch/json"/>
</Datas>
</Structure>
</Structures>
</Settings>
\ No newline at end of file
......@@ -69,6 +69,10 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Config
/// Web服务地址
/// </summary>
public string WebPath { get; set; }
/// <summary>
/// 资源文件地址
/// </summary>
public string ResourcePath { get; set; }
}
public class LogicConfig : IDictSetting
......
using GS.Terminal.Frame.Network.WebApiModel;
using GS.Terminal.Identification.DbHandler;
using GS.Terminal.Identification.LocalDbModel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace GS.Terminal.Identification.Enterprise.Logic.Core
{
public delegate void FaceFeatureLoaderDelegate(List<FaceFeature> datas);
public class FaceFeatureLoader
{
public event FaceFeatureLoaderDelegate OnInit;
public event FaceFeatureLoaderDelegate OnChanged;
private Task _MainTask;
//private EventWaitHandle eventWaitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
private FaceFeatureLibrary cache = new FaceFeatureLibrary();
/// <summary>
/// 加载本地数据
/// </summary>
public void LoadLocal()
{
cache.Read();
try
{
OnInit.Invoke(cache.Datas);
}
catch (Exception ex)
{
Program.Logger.Error("FaceFeatureLoader OnInit事件异常", ex);
}
}
/// <summary>
/// 开始同步数据
/// </summary>
public void StartSync()
{
_MainTask = Task.Run(async () =>
{
while (true)
{
var downloadResult = downLoad(cache.Version);
var version = downloadResult.version;
var datas = downloadResult.datas;
if (datas.Count > 0)
{
if (string.IsNullOrEmpty(cache.Version))
{
cache.Datas = datas.Select(s => new FaceFeature
{
Id = s.FFId,
FeatureData = Convert.FromBase64String(s.Data),
EmployeeId = Guid.Parse(s.PersonKey)
}).ToList();
}
else
{
foreach (var item in datas)
{
var old = cache.Datas.FirstOrDefault(s => s.Id == item.FFId);
if (old != null)
{
if (item.IsDeleted)
{
cache.Datas.Remove(old);
continue;
}
old.EmployeeId = Guid.Parse(item.PersonKey);
old.FeatureData = Convert.FromBase64String(item.Data);
}
else
{
if (!item.IsDeleted)
{
cache.Datas.Add(new FaceFeature
{
EmployeeId = Guid.Parse(item.PersonKey),
Id = item.FFId,
FeatureData = Convert.FromBase64String(item.Data)
});
}
}
}
}
cache.Version = version;
try
{
OnChanged?.Invoke(cache.Datas);
}
catch (Exception ex)
{
Program.Logger.Error("人脸库变更事件触发异常", ex);
}
cache.Save();
}
await Task.Delay(10 * 1000);
}
});
}
private (string version, List<FaceFeatureWithCustomScore> datas) downLoad(string version, int pageIndex = 1)
{
var result = new List<FaceFeatureWithCustomScore>();
var downLoadSize = 1000;
var newVersion = version;
try
{
var responseData =
Program.WebApiClient.Get<Dto_FeatureList_Response>($"/api/GS.WebApi.Facerecognization/FeatureLibrary?pageSize={downLoadSize}&version={version}&currentIndex={pageIndex}&type=人员信息&platform=ArcFace4");
if (responseData != null)
{
newVersion = responseData.version;
result.AddRange(responseData.records);
if (responseData.paging.totalPage > pageIndex)
{
result.AddRange(downLoad(version, pageIndex++).datas);
}
}
}
catch (HttpRequestException http)
{
Program.Logger.Error("请求人脸库服务异常", http);
}
catch (Exception ex)
{
Program.Logger.Error(@"请求人脸库发生未知异常", ex);
}
return (newVersion, result);
}
}
public class Dto_Req_FeatureList
{
/// <summary>
/// 页面大小
/// </summary>
public int pageSize { get; set; } = 10;
/// <summary>
/// 当前页码
/// </summary>
public int currentIndex { get; set; } = 1;
public string target { get; set; }
public string type { get; set; }
/// <summary>
/// 平台: ArcFace2,ArcFace3,ArcFace4,MCV1
/// </summary>
public string platform { get; set; }
public string version { get; set; }
}
public class Dto_FeatureList_Response : SuccessQuery<FaceFeatureWithCustomScore>
{
public string version { get; set; }
}
public class FaceFeatureWithCustomScore
{
/// <summary>
/// 特征值id
/// </summary>
public Guid FFId { get; set; }
public string PersonName { get; set; }
public string PersonKey { get; set; }
/// <summary>
/// 特征值数据的base64字符串
/// </summary>
public string Data { get; set; }
/// <summary>
/// 特征值来源
/// </summary>
public string From { get; set; }
/// <summary>
/// sdk版本.
/// </summary>
public int SdkVersion { get; set; }
/// <summary>
/// 查询时Target的自定义阀值
/// </summary>
public float CustomScore { get; set; }
/// <summary>
/// 平台版本
/// </summary>
public string SdkPlatform { get; set; }
public bool IsDeleted { get; set; }
}
public class FaceFeatureLibrary
{
[JsonIgnore]
private string _FileName = "";
public string Version { get; set; }
[JsonIgnore]
private object _locker = new object();
public List<FaceFeature> Datas { get; set; } = new List<FaceFeature>();
/// <summary>
/// 将数据写入本地文件
/// </summary>
public void Save()
{
try
{
File.WriteAllText(_FileName, JsonConvert.SerializeObject(this), Encoding.UTF8);
}
catch (Exception ex)
{
Program.Logger.Error($"人脸数据写入本地异常", ex);
}
}
/// <summary>
/// 从本地加载数据
/// </summary>
public void Read()
{
_FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "facefeaturelibrary.json");
if (!File.Exists(_FileName))
{
Save();
}
var content = File.ReadAllText(_FileName);
FaceFeatureLibrary data = null;
try
{
data = JsonConvert.DeserializeObject<FaceFeatureLibrary>(content);
}
catch (Exception ex)
{
Program.Logger.Error($"解析本地人脸数据异常", ex);
Version = "";
Datas = new List<FaceFeature>();
Save();
}
if (data != null)
{
Version = data.Version;
Datas = data.Datas;
}
}
}
public class FaceFeature
{
public Guid Id { get; set; }
public byte[] FeatureData { get; set; }
public Guid EmployeeId { get; set; }
}
}
......@@ -15,6 +15,7 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
private static List<Employee> Employee = new List<Employee>();
private static List<VisitInfo> VisitInfo = new List<VisitInfo>();
private static List<FaceEntity> AllFace = new List<FaceEntity>();
private static List<EmployeeCard> AllCards = new List<EmployeeCard>();
internal static void InitDataSync()
{
......@@ -26,8 +27,8 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
{
var employeeSync =
Program.syncService.Regist<Employee>(Key,
$"{Program.config.GlobalConfig.WebPath}/{config.ServiceUrl}",
config.IntervalSec);
$"{Program.config.GlobalConfig.WebPath}{config.ServiceUrl}",
config.IntervalSec, Program.WebApiClient.Token);
employeeSync.OnDataInit += EmployeeSync_OnDataInit;
employeeSync.OnDataChanged += EmployeeSync_OnDataChanged;
}
......@@ -36,17 +37,10 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
#region 员工面部特征
{
var Key = "EmployeeFaceData";
var config = Program.config.DataSyncConfig.Datas.FirstOrDefault(ss => ss.Key.Equals(Key, StringComparison.CurrentCultureIgnoreCase));
if (config != null && config.Enable)
{
var employeeFaceDataSync =
Program.syncService.Regist<EmployeeFaceData>(Key,
$"{Program.config.GlobalConfig.WebPath}/{config.ServiceUrl}",
config.IntervalSec);
employeeFaceDataSync.OnDataInit += EmployeeFaceDataSync_OnDataInit;
employeeFaceDataSync.OnDataChanged += EmployeeFaceDataSync_OnDataChanged;
}
Program.FaceFeatureLoader.OnInit += EmployeeFaceDataSync_OnDataInit;
Program.FaceFeatureLoader.OnChanged += EmployeeFaceDataSync_OnDataChanged;
}
#endregion
......@@ -58,13 +52,39 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
{
var visitInfoSync =
Program.syncService.Regist<VisitInfo>(Key,
$"{Program.config.GlobalConfig.WebPath}/{config.ServiceUrl}",
config.IntervalSec);
$"{Program.config.GlobalConfig.WebPath}{config.ServiceUrl}",
config.IntervalSec, Program.WebApiClient.Token);
visitInfoSync.OnDataInit += VisitInfoSync_OnDataInit;
visitInfoSync.OnDataChanged += VisitInfoSync_OnDataChanged;
}
}
#endregion
#region 卡片同步
{
var Key = "EmployeeCards";
var config = Program.config.DataSyncConfig.Datas.FirstOrDefault(ss => ss.Key.Equals(Key, StringComparison.CurrentCultureIgnoreCase));
if (config != null && config.Enable)
{
var employeeCardSync =
Program.syncService.Regist<EmployeeCard>(Key,
$"{Program.config.GlobalConfig.WebPath}{config.ServiceUrl}",
config.IntervalSec, Program.WebApiClient.Token);
employeeCardSync.OnDataInit += EmployeeCardSync_OnDataInit;
employeeCardSync.OnDataChanged += EmployeeCardSync_OnDataChanged;
}
}
#endregion
}
private static void EmployeeCardSync_OnDataChanged(object sender, List<EmployeeCard> newData)
{
AllCards = newData ?? new List<EmployeeCard>();
}
private static void EmployeeCardSync_OnDataInit(object sender, List<EmployeeCard> data)
{
AllCards = data ?? new List<EmployeeCard>();
}
......@@ -83,12 +103,12 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
#endregion
#region 员工面部特征
private static void EmployeeFaceDataSync_OnDataChanged(object sender, List<EmployeeFaceData> newData)
private static void EmployeeFaceDataSync_OnDataChanged(List<FaceFeature> newData)
{
SetEmplyFaceList(newData);
}
private static void EmployeeFaceDataSync_OnDataInit(object sender, List<EmployeeFaceData> data)
private static void EmployeeFaceDataSync_OnDataInit(List<FaceFeature> data)
{
SetEmplyFaceList(data);
}
......@@ -123,11 +143,11 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
mergeFace(t);
}
internal static void SetEmplyFaceList(List<EmployeeFaceData> facedata)
internal static void SetEmplyFaceList(List<FaceFeature> facedata)
{
var t = new List<FaceEntity>();
foreach (var item in facedata)
t.Add(new FaceEntity { Id = item.UserId, PersonType = 'e', FaceData = item.FaceData });
t.Add(new FaceEntity { Id = item.EmployeeId, PersonType = 'e', FaceData = item.FeatureData });
mergeFace(t);
}
......@@ -154,7 +174,9 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
/// <returns></returns>
internal static Employee GetEmplyByCardNum(string cardNum)
{
return Employee.FirstOrDefault(ss => ss.CardNum.Equals(cardNum, StringComparison.CurrentCultureIgnoreCase));
var card = AllCards.FirstOrDefault(s => s.card.Equals(cardNum, StringComparison.CurrentCultureIgnoreCase));
if (card == null) return null;
return Employee.FirstOrDefault(ss => ss.Id == card.employeeid);
}
/// <summary>
......@@ -213,4 +235,10 @@ namespace GS.Terminal.Identification.Enterprise.Logic.Core
}
}
}
public class EmployeeCard
{
public Guid employeeid { get; set; }
public string card { get; set; }
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -56,6 +57,9 @@
<HintPath>..\packages\CommonServiceLocator.2.0.2\lib\net45\CommonServiceLocator.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Develop.Extension.Commucation, Version=1.5.0.4, Culture=neutral, PublicKeyToken=0567760a09670059, processorArchitecture=MSIL">
<HintPath>..\packages\Develop.Extension.Commucation.1.5.0.4\lib\net40\Develop.Extension.Commucation.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
<Private>True</Private>
......@@ -74,8 +78,14 @@
<Reference Include="GS.Terminal.Common">
<HintPath>..\..\release\Tools\GS.Terminal.Common.dll</HintPath>
</Reference>
<Reference Include="GS.Terminal.LogicShell.Interface">
<HintPath>..\..\release\Addons\GS.Terminal.LogicShell\GS.Terminal.LogicShell.Interface.dll</HintPath>
<Reference Include="GS.Terminal.Frame, Version=1.0.0.21, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Terminal.Frame.1.0.0.21\lib\net452\GS.Terminal.Frame.dll</HintPath>
</Reference>
<Reference Include="GS.Terminal.LogicShell.Attributes, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Terminal.LogicShell.Attributes.2.1.3\lib\net452\GS.Terminal.LogicShell.Attributes.dll</HintPath>
</Reference>
<Reference Include="GS.Terminal.LogicShell.Interface, Version=2.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Terminal.LogicShell.Interface.2.1.3.3\lib\net452\GS.Terminal.LogicShell.Interface.dll</HintPath>
</Reference>
<Reference Include="GS.Unitive.Framework, Version=1.4.0.2, Culture=neutral, PublicKeyToken=769358b197600ab3, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Unitive.Framework.1.4.0.2\lib\net40\GS.Unitive.Framework.dll</HintPath>
......@@ -92,8 +102,23 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Blob.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Extensions.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="SafeObjectPool, Version=2.3.1.0, Culture=neutral, PublicKeyToken=2979badd66b9f481, processorArchitecture=MSIL">
<HintPath>..\packages\SafeObjectPool.2.3.1\lib\net45\SafeObjectPool.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.1.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlSugar.5.0.1.4\lib\SqlSugar.dll</HintPath>
</Reference>
......@@ -122,12 +147,12 @@
<Compile Include="CallbackHandler\LogicHandler.cs" />
<Compile Include="Config\ServiceListing.cs" />
<Compile Include="Config\TerminalSetting.cs" />
<Compile Include="Core\FaceFeatureLoader.cs" />
<Compile Include="Core\LocalDataCenter.cs" />
<Compile Include="Core\Uploader.cs" />
<Compile Include="Face\FaceRecognizationService.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Service.cs" />
<Compile Include="Tools.cs" />
<Compile Include="ViewModelHandler\HeadHandler.cs" />
<Compile Include="ViewModelHandler\MainHandler.cs" />
......@@ -169,5 +194,6 @@
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props'))" />
</Target>
</Project>
\ No newline at end of file
......@@ -2,11 +2,16 @@
using GS.EnterpriseIdentification.ServiceModel;
using GS.Remote.Synchronize.EasyTask;
using GS.Terminal.Common;
using GS.Terminal.Frame.AddonServices;
using GS.Terminal.Frame.Logic;
using GS.Terminal.Frame.Network;
using GS.Terminal.Frame.Network.WebApiModel;
using GS.Terminal.Identification.DbHandler;
using GS.Terminal.Identification.Enterprise.Logic.Core;
using GS.Terminal.Identification.LocalDbModel;
using GS.Terminal.LogicShell.Interface;
using GS.Unitive.Framework.Core;
using GS.Unitive.Framework.Logging;
using IdentificationViewModels;
using Microsoft.VisualBasic.ApplicationServices;
using System;
......@@ -22,6 +27,12 @@ using System.Windows;
namespace GS.Terminal.Identification.Enterprise.Logic
{
public class TerminalStatusDefined
{
public const string STANDBY = "Standby";
public const string PLAYVIDEO = "播放视频";
public const string PLAYIMAGE = "播放图片";
}
public class Program : IAddonActivator
{
internal static IAddonContext addonContext; // 插件上下文
......@@ -38,13 +49,18 @@ namespace GS.Terminal.Identification.Enterprise.Logic
internal static Config.ServiceListing serviceListing; // 服务清单配置
internal static Uploader uploader; // 数据上传
internal static IEasyTaskService syncService; // 数据同步插件服务
internal static string _logicVersion = "210904"; // 业务版本
internal static WebApiClient WebApiClient;
internal static ILogWriter Logger;
internal static FaceFeatureLoader FaceFeatureLoader;
public void Start(IAddonContext Context)
{
AddonRuntime.Instance.onRuntimeCompleted += Instance_onRuntimeCompleted;
AddonRuntime.Instance.onRuntimeCompleted += Instance_onRuntimeCompleted;
FaceFeatureLoader = new FaceFeatureLoader();
addonContext = Context;
Logger = Context.Logger;
LoadConfig();
InitSqliteDb();
......@@ -73,21 +89,98 @@ namespace GS.Terminal.Identification.Enterprise.Logic
webPath = config.GlobalConfig.WebPath;
identifyTimeSpan = config.LogicConfig.IdentifyTimeSpan;
faceCompareValue = config.LogicConfig.FaceCompareValue;
serviceListing = new Config.ServiceListing(config.GlobalConfig.WebPath);
}
internal static void RefreshToken()
{
var signatureResult = WebApiClient.Signature();
if (!signatureResult.success)
{
addonContext.Logger.Error($"终端注册失败.{signatureResult.message}", null);
Task.Run(async () =>
{
while (true)
{
Logger.Debug("终端远程注册失败,5秒后重试");
await Task.Delay(5 * 1000);
var retrysignatureResult = WebApiClient.Signature();
if (retrysignatureResult.success)
{
Logger.Debug("终端注册加载成功");
break;
}
else
{
addonContext.Logger.Error($"重试终端注册失败。{retrysignatureResult.message}", null);
}
}
});
}
}
internal static void AutoRefreshTokenTask()
{
var startTime = DateTime.Today.AddDays(1).AddHours(1);
Timeline.CreateTimingTask(startTime, taskid =>
{
Logger.Debug("开始刷新本地token");
RefreshToken();
AutoRefreshTokenTask();
}, null, "每日凌晨刷新本机token");
Program.Logger.Debug($"每日凌晨刷新本机token任务创建完成,执行时间({startTime})");
}
internal static void UpdateLocalTime()
{
Task.Run(() =>
{
Logger.Debug("开始远程校时");
var remoteTime =
WebApiClient.Get<SuccessObject<DateTime>>("/api/GS.WebApi.Terminal/NTP");
if (remoteTime != null && remoteTime.Status)
{
var time = new Frame.Utility.EnvironmentInfo.SystemTime
{
wYear = (short)remoteTime.record.Year,
wMonth = (short)remoteTime.record.Month,
wDay = (short)remoteTime.record.Day,
wHour = (short)remoteTime.record.Hour,
wMinute = (short)remoteTime.record.Minute,
wSecond = (short)remoteTime.record.Second
};
var ret = Frame.Utility.EnvironmentInfo.SetLocalTime(ref time);
Logger.Debug($"远程校时完成。结果:{ret}");
}
else
{
Logger.Debug($"远程校时失败。{remoteTime?.Message}");
}
});
}
private void Instance_onRuntimeCompleted(object sender)
{
GetAndRegistServices();
TerminalStatusCenter.Instance.SetStatus(TerminalStatusDefined.STANDBY, "system");
addonContext.CreateIntercativeData<string>("TERMINAL_STATUS");
var terminal_status = $"{Frame.Utility.EnvironmentInfo.GetApplicationVersion()}({_logicVersion}) Standby {Frame.Network.HardwareInfo.GetMACAddress()}";
addonContext.IntercativeData("TERMINAL_STATUS", terminal_status);
TerminalConsole.StartHeart(config.GlobalConfig.ServerIP, 0, 10 * 1000);
WebApiClient = new Frame.Network.WebApiClient(config.GlobalConfig.WebPath, config.GlobalConfig.tCode);
RefreshToken();
AutoRefreshTokenTask();
UpdateLocalTime();
RegistViewModel();
MainHandler.ViewModel.tCode = config.GlobalConfig.tCode;
MainHandler.ViewModel.VersionString = new ApplicationBase().Info.Version.ToString();
logicShellService.ShowView(SimpleIoc.Default.GetInstance<Locator>().MainPage, args =>
{
//注册数据同步监听
LocalDataCenter.InitDataSync();
FaceFeatureLoader.LoadLocal();
FaceFeatureLoader.StartSync();
});
}
......
using GS.Unitive.Framework.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GS.Terminal.Identification.Enterprise.Logic
{
public class Service
{
public Service()
{
Console.WriteLine("ctor in");
}
public void UpdateMedia(string msg)
{
MainHandler.ViewModel.Footer = msg;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net452" />
<package id="Develop.Extension.Commucation" version="1.5.0.4" targetFramework="net452" />
<package id="GS.Terminal.Frame" version="1.0.0.21" targetFramework="net452" />
<package id="GS.Terminal.LogicShell.Attributes" version="2.1.3" targetFramework="net452" />
<package id="GS.Terminal.LogicShell.Interface" version="2.1.3.3" targetFramework="net452" />
<package id="GS.Unitive.Framework" version="1.4.0.2" targetFramework="net452" />
<package id="log4net" version="2.0.8" targetFramework="net452" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
<package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net452" />
<package id="SafeObjectPool" version="2.3.1" targetFramework="net452" />
<package id="sqlSugar" version="5.0.1.4" targetFramework="net452" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net452" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<appSettings>
<clear />
<add key="UpdateUrl" value="http://192.168.1.210/Soft/update" />
<add key="ServerIP" value="192.168.1.210" />
<add key="tCode" value="D1" />
<add key="WebPath" value="http://192.168.1.150:666/" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.113.0" newVersion="1.0.113.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<appSettings>
<clear />
<add key="UpdateUrl" value="http://192.168.1.210/Soft/update" />
<add key="ServerIP" value="192.168.1.7" />
<add key="tCode" value="SYL106" />
<add key="WebPath" value="http://192.168.1.7:5888" />
<add key="ResourcePath" value="http://192.168.1.7:8888" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.113.0" newVersion="1.0.113.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -94,7 +94,7 @@ namespace GS.Terminal.Identification.EnterpriseHost
mainWindow.ContentRendered += MainWindow_ContentRendered;
mainWindow.Show();
}
catch (Exception ex)
catch (Exception)
{
throw;
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props" Condition="Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -79,6 +80,10 @@
<Reference Include="CommonServiceLocator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.2.0.2\lib\net45\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="Develop.Extension.Commucation, Version=1.5.0.4, Culture=neutral, PublicKeyToken=0567760a09670059, processorArchitecture=MSIL">
<HintPath>..\packages\Develop.Extension.Commucation.1.5.0.4\lib\net40\Develop.Extension.Commucation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Develop.Extension.Wpf">
<HintPath>..\..\release\Tools\Develop.Extension.Wpf.dll</HintPath>
</Reference>
......@@ -91,6 +96,16 @@
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
<Reference Include="GS.Terminal.Frame, Version=1.0.0.21, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Terminal.Frame.1.0.0.21\lib\net452\GS.Terminal.Frame.dll</HintPath>
</Reference>
<Reference Include="GS.Terminal.LogicShell.Attributes, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Terminal.LogicShell.Attributes.2.1.3\lib\net452\GS.Terminal.LogicShell.Attributes.dll</HintPath>
</Reference>
<Reference Include="GS.Terminal.LogicShell.Interface, Version=2.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Terminal.LogicShell.Interface.2.1.3.3\lib\net452\GS.Terminal.LogicShell.Interface.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="GS.Unitive.Framework, Version=1.4.0.2, Culture=neutral, PublicKeyToken=769358b197600ab3, processorArchitecture=MSIL">
<HintPath>..\packages\GS.Unitive.Framework.1.4.0.2\lib\net40\GS.Unitive.Framework.dll</HintPath>
</Reference>
......@@ -105,6 +120,25 @@
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenCvSharp.Blob, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Blob.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenCvSharp.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OpenCvSharp.UserInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net40\OpenCvSharp.UserInterface.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SafeObjectPool, Version=2.3.1.0, Culture=neutral, PublicKeyToken=2979badd66b9f481, processorArchitecture=MSIL">
<HintPath>..\packages\SafeObjectPool.2.3.1\lib\net45\SafeObjectPool.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.1.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlSugar.5.0.1.4\lib\SqlSugar.dll</HintPath>
</Reference>
......@@ -181,14 +215,26 @@
<Link>Addons\GS.Terminal.Console\GS.Terminal.Console.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.Console\GS.Terminal.Console.pdb">
<Link>Addons\GS.Terminal.Console\GS.Terminal.Console.pdb</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.Console\Mapper.xml">
<Link>Addons\GS.Terminal.Console\Mapper.xml</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.Console\SuperSocket.ClientEngine.dll">
<Link>Addons\GS.Terminal.Console\SuperSocket.ClientEngine.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.Console\Terminal.Common.Structs.dll">
<Link>Addons\GS.Terminal.Console\Terminal.Common.Structs.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.Console\WebSocket4Net.dll">
<Link>Addons\GS.Terminal.Console\WebSocket4Net.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.DeviceManager\Config.xml">
<Link>Addons\GS.Terminal.DeviceManager\Config.xml</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
......@@ -245,12 +291,12 @@
<Link>Addons\GS.Terminal.FaceRecognization\AForge.Video.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.FaceRecognization\ArcFaceSharp.dll">
<Link>Addons\GS.Terminal.FaceRecognization\ArcFaceSharp.dll</Link>
<Content Include="..\..\release\Addons\GS.Terminal.FaceRecognization\Arcface4net.dll">
<Link>Addons\GS.Terminal.FaceRecognization\Arcface4net.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.FaceRecognization\ArcFaceSharp.xml">
<Link>Addons\GS.Terminal.FaceRecognization\ArcFaceSharp.xml</Link>
<Content Include="..\..\release\Addons\GS.Terminal.FaceRecognization\ArcFaceProSDK4net.dll">
<Link>Addons\GS.Terminal.FaceRecognization\ArcFaceProSDK4net.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\..\release\Addons\GS.Terminal.FaceRecognization\Config.xml">
......@@ -389,10 +435,6 @@
<Link>Addons\GS.Terminal.Identification.Enterprise.Logic\Mapper.xml</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\IdentificationCommand\bin\Debug\IdentificationCommand.dll">
<Link>Addons\GS.Terminal.Console\IdentificationCommand.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="favicon.ico" />
<Content Include="..\IdentificationViewModels\bin\Debug\IdentificationViewModels.dll">
<Link>Addons\GS.Terminal.LogicShell\ViewModels\IdentificationViewModels.dll</Link>
......@@ -504,5 +546,6 @@
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
<Error Condition="!Exists('..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\build\OpenCvSharp3-AnyCPU.props'))" />
</Target>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net452" />
<package id="Develop.Extension.Commucation" version="1.5.0.4" targetFramework="net452" />
<package id="GS.Terminal.Frame" version="1.0.0.21" targetFramework="net452" />
<package id="GS.Terminal.LogicShell.Attributes" version="2.1.3" targetFramework="net452" />
<package id="GS.Terminal.LogicShell.Interface" version="2.1.3.3" targetFramework="net452" />
<package id="GS.Unitive.Framework" version="1.4.0.2" targetFramework="net452" />
<package id="GS.Unitive.Framework.Security" version="1.4.0.2" targetFramework="net452" />
<package id="log4net" version="2.0.8" targetFramework="net452" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
<package id="OpenCvSharp3-AnyCPU" version="4.0.0.20181129" targetFramework="net452" />
<package id="SafeObjectPool" version="2.3.1" targetFramework="net452" />
<package id="sqlSugar" version="5.0.1.4" targetFramework="net452" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.113.3" targetFramework="net452" />
<package id="System.Data.SQLite.Core" version="1.0.113.6" targetFramework="net452" />
......
......@@ -58,7 +58,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="UpdateMedia.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
......
using Develop.Extension.Commucation.Instruct;
using GS.Unitive.Framework.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IdentificationCommand
{
[Export(typeof(IInstructCommand))]
[InstructCommandAttribute("DoMediaTask")]
public class UpdateMedia : IInstructCommand
{
public string Excute(IAddonContext context, System.Net.EndPoint remotePoint, string CommandArg)
{
try
{
Debug.WriteLine($"收到多媒体指令==>远程IP==>{remotePoint.ToString()}==>CommandArg==>{CommandArg}");
dynamic service =
context.GetFirstOrDefaultService("GS.Terminal.Identification.Enterprise.Logic", "GS.Terminal.Identification.Enterprise.Logic.Service");
if (service != null)
{
Task.Run(new Action(() =>
{
service.UpdateMedia(CommandArg);
}));
return "success";
}
}
catch (Exception ee) { context.Logger.Error("下载多媒体信息出错", ee); }
return "fail";
}
}
}
......@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace IdentificationViewModels
{
[Export(typeof(ILocator))]
public class Locator : ILocator
public class Locator : LocatorBase
{
public Locator()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment