change - 更改项目 继承小件

master
wangsr 11 months ago
parent e45531b324
commit ad6bcdc017

63
.gitattributes vendored

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

363
.gitignore vendored

@ -0,0 +1,363 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

Binary file not shown.

@ -1 +1 @@
ac0a11ee7fe82dce7ae2872df4df8f2250e5b258
324ba96749d19733ffc34cda2dc3ceb694edc3e0

@ -34,3 +34,16 @@ C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Common\obj\Debug\HighWa
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Common\obj\Debug\HighWayIot.Common.csproj.CopyComplete
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Common\obj\Debug\HighWayIot.Common.dll
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Common\obj\Debug\HighWayIot.Common.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\HighWayIot.Common.dll
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\HighWayIot.Common.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\HighWayIot.Log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\Newtonsoft.Json.dll
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\Newtonsoft.Json.xml
D:\Code\Work\RFIDAccess\HighWayIot.Common\obj\Debug\HighWayIot.Common.csproj.AssemblyReference.cache
D:\Code\Work\RFIDAccess\HighWayIot.Common\obj\Debug\HighWayIot.Common.csproj.CoreCompileInputs.cache
D:\Code\Work\RFIDAccess\HighWayIot.Common\obj\Debug\HighWayIot.Common.csproj.CopyComplete
D:\Code\Work\RFIDAccess\HighWayIot.Common\obj\Debug\HighWayIot.Common.dll
D:\Code\Work\RFIDAccess\HighWayIot.Common\obj\Debug\HighWayIot.Common.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Common\bin\Debug\config\log4net.config

@ -49,7 +49,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="config\log4net.config" />
<None Include="config\log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -32,7 +32,7 @@ namespace HighWayIot.Log4net
*
*/
//private readonly string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
private readonly string fileName = "Z:\\Desktop\\日常代码\\HighWayIot\\HighWayIot.Log4net\\config\\log4net.config";
private readonly string fileName = "D:\\Code\\Work\\RFIDAccess\\HighWayIot.Log4net\\config\\log4net.config";
private LogHelper()
{

@ -34,3 +34,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]

@ -1 +1 @@
59081c031c66312c4725da63a7bc5bcf0307991e
eacb03d164c2b5c921167e0c310a2f06da514a19

@ -21,3 +21,12 @@ C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Log4net\obj\Debug\HighW
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.csproj.CopyComplete
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.dll
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\bin\Debug\HighWayIot.Log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\bin\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\bin\Debug\log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.csproj.AssemblyReference.cache
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.csproj.CoreCompileInputs.cache
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.csproj.CopyComplete
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\obj\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Log4net\bin\Debug\config\log4net.config

@ -1 +1 @@
e061e4de927ddb3fdef27ae1bced63ffbea99d10
a71698509dfd9b099ad063a7a5322ca0a030e142

@ -25,3 +25,12 @@ C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Mqtt\obj\Debug\HighWayI
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.csproj.CopyComplete
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.dll
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\bin\Debug\HighWayIot.Mqtt.dll
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\bin\Debug\HighWayIot.Mqtt.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\bin\Debug\log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\bin\Debug\MQTTnet.dll
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.csproj.AssemblyReference.cache
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.csproj.CoreCompileInputs.cache
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.csproj.CopyComplete
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.dll
D:\Code\Work\RFIDAccess\HighWayIot.Mqtt\obj\Debug\HighWayIot.Mqtt.pdb

@ -1 +1 @@
d3a2b36425c9fe84169998718143e6c3666a447c
07c2be28b052d8f09a26905b6fecbd5f367329c9

@ -43,3 +43,18 @@ C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Plc\obj\Debug\HighWayIo
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.csproj.CopyComplete
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.dll
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HighWayIot.Plc.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HighWayIot.Plc.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HighWayIot.Common.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HighWayIot.Log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HslCommunication.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\Newtonsoft.Json.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HighWayIot.Common.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Plc\bin\Debug\Newtonsoft.Json.xml
D:\Code\Work\RFIDAccess\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.csproj.AssemblyReference.cache
D:\Code\Work\RFIDAccess\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.csproj.CoreCompileInputs.cache
D:\Code\Work\RFIDAccess\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.csproj.CopyComplete
D:\Code\Work\RFIDAccess\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.dll
D:\Code\Work\RFIDAccess\HighWayIot.Plc\obj\Debug\HighWayIot.Plc.pdb

@ -39,8 +39,8 @@
<Reference Include="Oracle.ManagedDataAccess">
<HintPath>..\HighWayIot.Library\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="SqlSugar">
<HintPath>Z:\Desktop\日常代码\HighWayIot\HighWayIot.Library\SqlSugar.dll</HintPath>
<Reference Include="SqlSugar, Version=5.1.4.130, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SqlSugar.5.1.4.130\lib\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@ -59,17 +59,17 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="domain\BaseBomInfo.cs" />
<Compile Include="domain\SysUserInfo.cs" />
<Compile Include="domain\BaseDeviceinfo.cs" />
<Compile Include="domain\RFIDHeartbeat.cs" />
<Compile Include="domain\RFIDState.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repository.cs" />
<Compile Include="service\IBaseBomInfoService.cs" />
<Compile Include="service\Impl\BaseBomInfoServiceImpl.cs" />
<Compile Include="service\ISysUserInfoService.cs" />
<Compile Include="service\IBaseDeviceinfoService.cs" />
<Compile Include="service\Impl\BaseSysUserInfoServiceImpl.cs" />
<Compile Include="service\Impl\BaseDeviceinfoServiceImpl.cs" />
<Compile Include="domain\RFIDContent.cs" />
<Compile Include="service\IContentService.cs" />
<Compile Include="service\Impl\BaseContentServiceImpl.cs" />
<Compile Include="service\IHeartbeatService.cs" />
<Compile Include="service\Impl\BaseHeartbeatServiceImpl.cs" />
<Compile Include="service\IStateService.cs" />
<Compile Include="service\Impl\BaseStateServiceImpl.cs" />
<Compile Include="SqlSugarHelper.cs" />
</ItemGroup>
<ItemGroup>
@ -84,6 +84,7 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -21,30 +21,31 @@ namespace HighWayIot.Repository
* Sqlite:debug
* private static string sqliteConnStr = $"Data Source={Path.GetFullPath("data\\data.db")};Version=3";
*/
private static string sqliteConnStr = "Data Source=Z:\\Desktop\\日常代码\\HighWayIot\\HighWayIot\\bin\\Debug\\data\\data.db;Version=3";
//private static string sqliteConnStr = "Data Source=Z:\\Desktop\\日常代码\\HighWayIot\\HighWayIot\\bin\\Debug\\data\\data.db;Version=3";
/**
* Mysql
*/
private static string mysqlConnStr = "Data Source=124.70.63.37;Port=6000;Initial Catalog=ry-cloud;uid=root;pwd=haiwei@123;Charset=utf8mb4;SslMode=none";
private static string mysqlConnStr = "Data Source=127.0.0.1;Port=3306;Initial Catalog=rfid;uid=root;pwd=123456;Charset=utf8mb4;SslMode=none";
private static string oracleConnStr = "Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma";
//private static string oracleConnStr = "Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma";
#endregion
//如果是固定多库可以传 new SqlSugarScope(List<ConnectionConfig>,db=>{}) 文档:多租户
//如果是不固定多库 可以看文档Saas分库
//用单例模式
public static SqlSugarScope Db = new SqlSugarScope(new List<ConnectionConfig>()
{
new ConnectionConfig()
{
ConfigId = "sqlite",
ConnectionString = sqliteConnStr,
DbType = DbType.Sqlite,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
},
public static SqlSugarScope Db = new SqlSugarScope(
// new List<ConnectionConfig>()
//{
//new ConnectionConfig()
//{
// ConfigId = "sqlite",
// ConnectionString = sqliteConnStr,
// DbType = DbType.Sqlite,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true
//},
new ConnectionConfig()
{
ConfigId = "mysql",
@ -53,15 +54,16 @@ namespace HighWayIot.Repository
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
},
new ConnectionConfig()
{
ConfigId = "aucma_mes",
ConnectionString = oracleConnStr,
DbType = DbType.Oracle,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
}
},
//},
//new ConnectionConfig()
//{
// ConfigId = "aucma_mes",
// ConnectionString = oracleConnStr,
// DbType = DbType.Oracle,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true
//}
//},
db =>
{
//(A)全局生效配置点

@ -22,6 +22,10 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.122.21.1" newVersion="4.122.21.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -22,6 +22,10 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.122.21.1" newVersion="4.122.21.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -1,22 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.domain
{
[SugarTable("BASE_BOMINFO")]
public class BaseBomInfo
{
/// <summary>
/// 主键标识
///</summary>
[SugarColumn(ColumnName = "OBJID", IsPrimaryKey = true, IsIdentity = true)]
public int ObjId { get; set; }
[SugarColumn(ColumnName = "BOM_CODE")]
public string bomCode { get; set; }
}
}

@ -1,59 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
namespace HighWayIot.Repository.domain
{
/// <summary>
/// 设备信息
///</summary>
[SugarTable("base_deviceInfo")]
public class BaseDeviceinfo
{
/// <summary>
/// 主键标识
///</summary>
[SugarColumn(ColumnName="objId" ,IsPrimaryKey = true ,IsIdentity = true )]
public int ObjId { get; set; }
/// <summary>
/// 机台编号
///</summary>
[SugarColumn(ColumnName="process_Id" )]
public int? ProcessId { get; set; }
/// <summary>
/// 位置编号
///</summary>
[SugarColumn(ColumnName="position_Id" )]
public int? PositionId { get; set; }
/// <summary>
/// 设备编号
///</summary>
[SugarColumn(ColumnName="device_Id" )]
public int? DeviceId { get; set; }
/// <summary>
/// 设备名称
///</summary>
[SugarColumn(ColumnName="device_Name" )]
public string DeviceName { get; set; }
/// <summary>
/// 设备 IP
///</summary>
[SugarColumn(ColumnName="device_Ip" )]
public string DeviceIp { get; set; }
/// <summary>
/// 设备端口
///</summary>
[SugarColumn(ColumnName="device_Port" )]
public int? DevicePort { get; set; }
/// <summary>
/// 设备天线
///</summary>
[SugarColumn(ColumnName="device_Ant" )]
public int? DeviceAnt { get; set; }
/// <summary>
/// 设备类型
///</summary>
[SugarColumn(ColumnName="device_Type" )]
public string DeviceType { get; set; }
}
}

@ -0,0 +1,28 @@
using SqlSugar;
using System;
namespace HighWayIot.Repository.domain
{
[SugarTable("rfid_content")]
public class RFIDContent
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
[SugarColumn(ColumnName = "content")]
public string Content { get; set; }
[SugarColumn(ColumnName = "deviceno")]
public int DeviceNo { get; set; }
[SugarColumn(ColumnName = "readkind")]
public string ReadKind { get; set; }
[SugarColumn(ColumnName = "logtime")]
public DateTime LogTime { get; set; }
}
}

@ -0,0 +1,25 @@
using SqlSugar;
using System;
namespace HighWayIot.Repository.domain
{
[SugarTable("rfid_heartbeat")]
public class RFIDHeartbeat
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
[SugarColumn(ColumnName = "deviceno")]
public int DeviceNo { get; set; }
[SugarColumn(ColumnName = "beattime")]
public DateTime BeatTime { get; set; }
[SugarColumn(ColumnName = "timespan")]
public string TimeSpan { get; set; }
}
}

@ -0,0 +1,24 @@
using SqlSugar;
using System;
namespace HighWayIot.Repository.domain
{
[SugarTable("rfid_state")]
public class RFIDState
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
[SugarColumn(ColumnName = "deviceno")]
public int DeviceNo { get; set; }
[SugarColumn(ColumnName = "devicestate")]
public bool DeviceState { get; set; }
[SugarColumn(ColumnName = "logtime")]
public DateTime LogTime { get; set; }
}
}

@ -1,37 +0,0 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.domain
{
/// <summary>
/// 用户信息
///</summary>
[SugarTable("sys_user")]
public class SysUserInfo
{
/// <summary>
/// 用户Id自增主键
///</summary>
[SugarColumn(ColumnName = "user_id", IsPrimaryKey = true, IsIdentity = true)]
public int userId { get; set; }
/// <summary>
/// 用户名称
///</summary>
[SugarColumn(ColumnName = "user_name")]
public string userName { get; set; }
/// <summary>
/// 用户密码
///</summary>
[SugarColumn(ColumnName = "password")]
public string password { get; set; }
}
}

@ -1 +1 @@
895f3c69f89b5588bcc6d1c266768b015c1ec5d0
7777ddc0dc77b42c0c95cd534f3fd3ac82b4377a

@ -42,3 +42,26 @@ C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Repository\obj\Debug\Hi
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.csproj.CopyComplete
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.dll
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Repository.dll.config
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Repository.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Repository.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Common.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\Oracle.ManagedDataAccess.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\Newtonsoft.Json.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\System.Memory.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\System.Threading.Tasks.Extensions.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\System.Numerics.Vectors.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\System.Buffers.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Common.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\Newtonsoft.Json.xml
D:\Code\Work\RFIDAccess\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.csproj.AssemblyReference.cache
D:\Code\Work\RFIDAccess\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.csproj.CoreCompileInputs.cache
D:\Code\Work\RFIDAccess\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.csproj.CopyComplete
D:\Code\Work\RFIDAccess\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\obj\Debug\HighWayIot.Repository.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\SqlSugar.dll
D:\Code\Work\RFIDAccess\HighWayIot.Repository\bin\Debug\config\log4net.config

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SqlSugar" version="5.1.4.130" targetFramework="net48" />
</packages>

@ -1,14 +0,0 @@
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{
public interface IBaseBomInfoService
{
List<BaseBomInfo> GetBomInfos();
}
}

@ -7,14 +7,19 @@ using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{
public interface IBaseDeviceinfoService
public interface IContentService
{
/// <summary>
/// 根据工序编号获取设备集合
/// 获取RFID信息列表
/// </summary>
/// <param name="ProcessId"></param>
/// <returns></returns>
List<BaseDeviceinfo> GetDeviceInfoListByProcessId(int ProcessId);
List<RFIDContent> GetContentInfos( );
/// <summary>
/// 新增一条信息
/// </summary>
/// <param name="content"></param>
void AddContentInfo(RFIDContent content);
}
}

@ -0,0 +1,33 @@
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{
public interface IHeartbeatService
{
/// <summary>
/// 获取RFID心跳状态列表
/// </summary>
/// <returns></returns>
List<RFIDHeartbeat> GetHeartbeatInfos();
/// <summary>
/// 新增一条心跳
/// </summary>
/// <param name="content"></param>
void AddHeartbeatInfo(RFIDHeartbeat heartbeat);
/// <summary>
/// 更新对应ID的心跳
/// </summary>
/// <param name="deviceno"></param>
/// <returns>影响的行数</returns>
int UpdateHeartbeatInfo(int deviceno);
}
}

@ -7,13 +7,19 @@ using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{
public interface ISysUserInfoService
public interface IStateService
{
/// <summary>
/// 获取用户列表
/// 获取RFID状态列表
/// </summary>
/// <returns></returns>
List<SysUserInfo> GetUserInfos( );
List<RFIDState>GetStateInfos();
/// <summary>
/// 新增一条状态
/// </summary>
/// <param name="content"></param>
void AddStateInfo(RFIDState state);
}
}

@ -1,30 +0,0 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseBomInfoServiceImpl:IBaseBomInfoService
{
Repository<BaseBomInfo> _bomInfoRepository => new Repository<BaseBomInfo>("aucma_mes");
private LogHelper logHelper = LogHelper.Instance;
public List<BaseBomInfo> GetBomInfos()
{
try
{
var info = _bomInfoRepository.GetList();
return info;
}catch(Exception ex)
{
logHelper.Error("获取BOM集合异常", ex);
return null;
}
}
}
}

@ -0,0 +1,42 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseContentServiceImpl : IContentService
{
private LogHelper log = LogHelper.Instance;
Repository<RFIDContent> _repository => new Repository<RFIDContent>("mysql");
public List<RFIDContent> GetContentInfos()
{
try
{
List<RFIDContent> deviceInfo = _repository.GetList();
return deviceInfo;
}catch (Exception ex)
{
log.Error("RFID内容信息获取异常", ex);
return null;
}
}
public void AddContentInfo(RFIDContent content)
{
try
{
_repository.Insert(content);
}
catch (Exception ex)
{
log.Error("RFID内容信息插入异常", ex);
}
}
}
}

@ -1,23 +0,0 @@
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseDeviceinfoServiceImpl : IBaseDeviceinfoService
{
Repository<BaseDeviceinfo> _deviceInfoRepository => new Repository<BaseDeviceinfo>("sqlite");
public List<BaseDeviceinfo> GetDeviceInfoListByProcessId(int ProcessId)
{
Expression<Func<BaseDeviceinfo, bool>> exp = s1 => s1.ProcessId == ProcessId;
List<BaseDeviceinfo> deviceinfos = _deviceInfoRepository.GetList(exp);
return deviceinfos;
}
}
}

@ -0,0 +1,55 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseHeartbeatServiceImpl : IHeartbeatService
{
private LogHelper log = LogHelper.Instance;
Repository<RFIDHeartbeat> _repository => new Repository<RFIDHeartbeat>("mysql");
public List<RFIDHeartbeat> GetHeartbeatInfos()
{
try
{
List<RFIDHeartbeat> deviceInfo = _repository.GetList();
return deviceInfo;
}catch (Exception ex)
{
log.Error("RFID心跳信息获取异常", ex);
return null;
}
}
public void AddHeartbeatInfo(RFIDHeartbeat heartbeat)
{
try
{
_repository.Insert(heartbeat);
}
catch (Exception ex)
{
log.Error("RFID心跳信息插入异常", ex);
}
}
public int UpdateHeartbeatInfo(int deviceno)
{
try
{
return _repository.AsUpdateable().SetColumns(x => x.BeatTime == DateTime.Now).Where(x => x.DeviceNo == deviceno).ExecuteCommand();
}
catch(Exception ex)
{
log.Error("RFID心跳信息更新异常", ex);
return -1;
}
}
}
}

@ -0,0 +1,42 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseStateServiceImpl : IStateService
{
private LogHelper log = LogHelper.Instance;
Repository<RFIDState> _repository => new Repository<RFIDState>("mysql");
public List<RFIDState> GetStateInfos()
{
try
{
List<RFIDState> deviceInfo = _repository.GetList();
return deviceInfo;
}catch (Exception ex)
{
log.Error("RFID状态信息获取异常", ex);
return null;
}
}
public void AddStateInfo(RFIDState state)
{
try
{
_repository.Insert(state);
}
catch (Exception ex)
{
log.Error("RFID状态信息插入异常", ex);
}
}
}
}

@ -1,30 +0,0 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseSysUserInfoServiceImpl : ISysUserInfoService
{
private LogHelper log = LogHelper.Instance;
Repository<SysUserInfo> _repository => new Repository<SysUserInfo>("mysql");
public List<SysUserInfo> GetUserInfos()
{
try
{
List<SysUserInfo> deviceInfo = _repository.GetList();
return deviceInfo;
}catch (Exception ex)
{
log.Error("用户信息获取异常", ex);
return null;
}
}
}
}

@ -1 +1 @@
4513ba02cf63dbc13668b2fa4a8e815c58d65ebd
0f8d688630de9b926f42827bc262d48170ef65d9

@ -43,3 +43,18 @@ C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Rfid\obj\Debug\HighWayI
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.csproj.CopyComplete
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.dll
C:\项目代码\澳柯玛MES项目\HighWayIot\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\HighWayIot.Rfid.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\HighWayIot.Rfid.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\GRreader.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\HighWayIot.Common.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\HighWayIot.Log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\Newtonsoft.Json.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\log4net.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\HighWayIot.Common.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\HighWayIot.Log4net.pdb
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\bin\Debug\Newtonsoft.Json.xml
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.csproj.AssemblyReference.cache
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.csproj.CoreCompileInputs.cache
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.csproj.CopyComplete
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.dll
D:\Code\Work\RFIDAccess\HighWayIot.Rfid\obj\Debug\HighWayIot.Rfid.pdb

@ -0,0 +1,114 @@
using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using HighWayIot.Repository.service.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.TouchSocket
{
public class BufferAnalysis
{
private static LogHelper logHelper = LogHelper.Instance;
/// <summary>
/// 心跳报文分析
/// </summary>
/// <param name="bytes"></param>
public static void HeartbeatSocket(byte[] bytes)
{
if (int.TryParse(Encoding.ASCII.GetString(bytes, 4, 4), out int deviceno))
{
BaseHeartbeatServiceImpl sql = new BaseHeartbeatServiceImpl();
if (sql.UpdateHeartbeatInfo(deviceno) == 0)
{
RFIDHeartbeat heartbeat = new RFIDHeartbeat()
{
DeviceNo = deviceno,
BeatTime = DateTime.Now,
};
sql.AddHeartbeatInfo(heartbeat);
}
}
else
{
logHelper.Error("心跳报文编号数值转换出现错误!");
}
}
/// <summary>
/// RFID发送设备状态
/// </summary>
/// <param name="bytes"></param>
public static void RFIDStatusSocket(byte[] bytes)
{
if (int.TryParse(Encoding.ASCII.GetString(bytes, 4, 4), out int deviceno) &&
int.TryParse(Encoding.ASCII.GetString(bytes, 9, 1), out int state))
{
BaseStateServiceImpl sql = new BaseStateServiceImpl();
RFIDState rFIDState = new RFIDState()
{
DeviceNo = deviceno,
DeviceState = state == 1 ? true : false,
LogTime = DateTime.Now,
};
sql.AddStateInfo(rFIDState);
}
else
{
logHelper.Error("设备状态报文编号数值转换出现错误!");
}
}
/// <summary>
/// RFID发送条码
/// </summary>
/// <param name="bytes"></param>
public static void RFIDCodeSocket(byte[] bytes)
{
string readKind = Encoding.ASCII.GetString(bytes, 4, 2);
if (int.TryParse(Encoding.ASCII.GetString(bytes, 7, 4), out int deviceno))
{
RFIDContent rFIDContent = new RFIDContent()
{
DeviceNo = deviceno,
ReadKind = readKind,
LogTime = DateTime.Now,
};
string content = "";
if (readKind == "NB" || readKind == "GR")
{
content = Encoding.ASCII.GetString(bytes, 12, 16);
}
else if (readKind == "MR")
{
content = Encoding.ASCII.GetString(bytes, 12, bytes.Length - 12 - 2); // 减去条码内容之前和之后内容的长度
}
rFIDContent.Content = content;
BaseContentServiceImpl sql = new BaseContentServiceImpl();
sql.AddContentInfo(rFIDContent);
}
else
{
logHelper.Error("条码发送报文编号数值转换出现错误!");
}
}
/// <summary>
/// 将一个数组拆成另外一个数组
/// </summary>
/// <param name="originbyte">原始数组,被拆分的数组</param>
/// <param name="oringinstartindex">从原始数组第几个元素开始</param>
/// <param name="destbytelength">目标数组的长度</param>
/// <param name="destbytestartindex">目标数组开始的元素序号默认为0</param>
/// <returns></returns>
public static byte[] SplitByteArray(byte[] originbyte, int oringinstartindex, int destbytelength, int destbytestartindex = 0)
{
byte[] result = new byte[destbytelength];
System.Array.Copy(originbyte, oringinstartindex, result, destbytestartindex, destbytelength);
return result;
}
}
}

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.TouchSocket
{
public class Class1
{
}
}

@ -32,21 +32,47 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.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" />
<Reference Include="TouchSocket">
<HintPath>Z:\Desktop\日常代码\HighWayIot\HighWayIot.Library\TouchSocket.dll</HintPath>
<Reference Include="TouchSocket, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5f39d7da98dac6a9, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.2.0.0-beta.253\lib\net45\TouchSocket.dll</HintPath>
</Reference>
<Reference Include="TouchSocket.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d6c415a2f58eda72, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.Core.2.0.0-beta.253\lib\net45\TouchSocket.Core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="BufferAnalysis.cs" />
<Compile Include="TcpServer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\TouchSocket.Core.2.0.0-beta.253\analyzers\dotnet\cs\TouchSocket.Core.SourceGenerator.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HighWayIot.Log4net\HighWayIot.Log4net.csproj">
<Project>{DEABC30C-EC6F-472E-BD67-D65702FDAF74}</Project>
<Name>HighWayIot.Log4net</Name>
</ProjectReference>
<ProjectReference Include="..\HighWayIot.Repository\HighWayIot.Repository.csproj">
<Project>{d0dc3cfb-6748-4d5e-b56a-76fdc72ab4b3}</Project>
<Name>HighWayIot.Repository</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,142 @@
using HighWayIot.Log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchSocket.Core;
using TouchSocket.Sockets;
namespace HighWayIot.TouchSocket
{
public class TcpServer
{
private static readonly Lazy<TcpServer> lazy = new Lazy<TcpServer>(() => new TcpServer());
public static TcpServer Instance => lazy.Value;
private static LogHelper logHelper = LogHelper.Instance;
public ServerState State
{
get => service.ServerState;
private set => State = value;
}
TcpService service = new TcpService();
public bool ServerStart(string ip, string port)
{
try
{
service.Connecting = (client, e) =>
{
logHelper.Info($"客户端{client.IP}正在连接");
return EasyTask.CompletedTask;
};//有客户端正在连接
service.Connected = (client, e) =>
{
logHelper.Info($"客户端{client.IP}成功连接");
return EasyTask.CompletedTask;
};//有客户端成功连接
service.Disconnecting = (client, e) =>
{
logHelper.Info($"客户端{client.IP}正在断开连接");
return EasyTask.CompletedTask;
};//有客户端正在断开连接,只有当主动断开时才有效。
service.Disconnected = (client, e) =>
{
logHelper.Info($"客户端{client.IP}断开连接");
return EasyTask.CompletedTask;
};//有客户端断开连接
service.Received = (client, e) =>
{
////从客户端收到信息
//var mes = Encoding.ASCII.GetString(e.ByteBlock.Buffer, 0, e.ByteBlock.Len);//注意数据长度是byteBlock.Len
//logHelper.Info($"已从{client.IP}:{client.Port}接收到信息:{mes}");
BufferMemory(BufferAnalysis.SplitByteArray(e.ByteBlock.Buffer, 0, e.ByteBlock.Len));
return EasyTask.CompletedTask;
};
service.Setup(new TouchSocketConfig()//载入配置
.SetListenOptions(option =>
{
option.Add(new TcpListenOption()
{
IpHost = ip + ":" + port,
Name = "Server",//名称用于区分监听
ServiceSslOption = null,//可以针对当前监听单独启用ssl加密
Adapter = () => new NormalDataHandlingAdapter(),//可以单独对当前地址监听,配置适配器
//还有其他可配置项,都是单独对当前地址有效。
});
})
.ConfigureContainer(a =>//容器的配置顺序应该在最前面
{
a.AddConsoleLogger();//添加一个控制台日志注入注意在maui中控制台日志不可用
})
.ConfigurePlugins(a =>
{
//a.Add();//此处可以添加插件
}));
service.Start();//启动
logHelper.Info("监听服务启动成功");
return true;
}
catch (Exception ex)
{
logHelper.Error("监听服务启动失败! 错误代码" + ex.ToString());
return false;
}
}
public bool ServerStop()
{
try
{
service.Stop();
logHelper.Info("监听服务关闭成功!");
return true;
}
catch (Exception ex)
{
logHelper.Error("监听服务关闭失败! 错误代码" + ex.ToString());
return false;
}
}
public bool ServerDispose()
{
try
{
service.Dispose();
logHelper.Info("监听服务释放成功!");
return true;
}
catch (Exception ex)
{
logHelper.Error("监听服务释放失败! 错误代码" + ex.ToString());
return false;
}
}
private void BufferMemory(byte[] bytes)
{
byte[] identify = new byte[2] { bytes[1], bytes[2] };
if (identify[0] == 0x30 && identify[1] == 0x31)
{
BufferAnalysis.HeartbeatSocket(bytes);
}
else if (identify[0] == 0x30 && identify[1] == 0x34)
{
BufferAnalysis.RFIDStatusSocket(bytes);
}
else if (identify[0] == 0x35 && identify[1] == 0x33)
{
BufferAnalysis.RFIDCodeSocket(bytes);
}
}
}
}

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@ -17,16 +14,6 @@
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.116.0" newVersion="1.0.116.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.122.21.1" newVersion="4.122.21.1" />

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save