init: 北航大学BH-DAS项目首次入库

This commit is contained in:
XingCheng3
2026-06-08 17:06:10 +08:00
commit 10f06d99cd
207 changed files with 40597 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FCFBEF3B-BD04-432F-9B74-579FF8568EAA}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>GlobalVar</RootNamespace>
<AssemblyName>GlobalVar</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="MQTTnet, Version=4.2.0.706, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.4.2.0.706\lib\net461\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=4.2.0.706, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.Extensions.ManagedClient.4.2.0.706\lib\net461\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppConfig.cs" />
<Compile Include="GlobalVar.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyLog4Net\01_MyLog4Net.csproj">
<Project>{1dc48c83-1842-4de8-acaf-26e1e7f7c58f}</Project>
<Name>01_MyLog4Net</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

18
GlobalVar/App.config Normal file
View File

@@ -0,0 +1,18 @@
<?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>
<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>
</runtime>
</configuration>

85
GlobalVar/AppConfig.cs Normal file
View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DNC_CSharp_Demo
{
public class ToolInfo
{
public string Name { get; set; }
public string TimeRated { get; set; }
public string TimeUsed { get; set; }
}
public class AxisInfo
{
public string AxisName { get; set; }
public string AxisValue { get; set; }
}
public class ParameterInfo
{
public string ParameterName { get; set; }
public string ParameterValue { get; set; }
}
public class AlarmInfo
{
public string Alarm { get; set; }
public string AlarmTime { get; set; }
}
public class DeviceInfo
{
public string order { get; set; } = "";
public string Name { get; set; }
public string Id { get; set; }
public string Status { get; set; }
public string Program { get; set; }
public string Feed { get; set; }
public string Speed { get; set; }
public string Rapid { get; set; }
public string ProgramStatus { get; set; }
public ToolInfo Tool { get; set; }
public List<AxisInfo> Axis { get; set; }
public List<ParameterInfo> OtherParameter { get; set; }
public List<AlarmInfo> Alarm { get; set; }
}
public class JointConfig
{
public string JointName { get; set; }
public string ModelCode { get; set; }
public string JointType { get; set; }
public string Axis { get; set; }
public string Flip { get; set; }
public string Value { get; set; }
public string ValueFactor { get; set; }
public string Delta { get; set; }
public string Order { get; set; }
}
public class MachineToolConfig
{
public string Enable { get; set; }
public string Type { get; set; }
public string ConnectStr { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string DataTimeInterval { get; set; }
public string AxesTimeInterval { get; set; }
public List<JointConfig> Joints { get; set; }
}
public class AppConfig
{
public List<MachineToolConfig> MachineTool { get; set; }
}
}

83
GlobalVar/GlobalVar.cs Normal file
View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Text;
//using MQTTnet;
//using MQTTnet.Extensions.ManagedClient;
//using DatabaseClient;
using System.Security.Cryptography;
namespace DNC_CSharp_Demo
{
public class GlobalVar
{
// public static SafeMqttClient mqttClient = null;
public static AppConfig appConfig = new AppConfig();
//public static IManagedMqttClient mqttClient = null;
//public static DBClient dbClient = null;
public static bool enableLog = false;
public static string DatabaseConnectStr = "";
public static bool saveHistory = true;
public static int isFirstConnect = 0;
public static string OpName = "F56AE937-A27E-40A3-A4E1-1217CD71C9BC";
public static void Init(bool isEnableLog)
{
enableLog = isEnableLog;
//mqttClient = new MqttFactory().CreateManagedMqttClient();
}
public static void InitDatabase(string connStr)
{
DatabaseConnectStr = connStr;
//dbClient = new DBClientFactory("Mysql").Create();
//dbClient.Connect(connStr);
}
public static void SendMessage(string topic, string msg)
{
//if (mqttClient != null)
//{
// mqttClient.EnqueueAsync(topic, msg);
//}
//if (saveHistory)
//{
// ThreadPool.QueueUserWorkItem((object obj) =>
// {
// var opName = topic;
// var now = DateTime.Now;
// var currentDay = now.ToString("yyyyMMdd");
// string sql = " INSERT INTO z_save_position_" + currentDay + "(ID, OpName, Value, OperationTime, ProjectCode) VALUES('" +
// Guid.NewGuid() + "', '" + opName + "', '" + msg + "', '" + now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "', '" + "PLC" + "');\n";
// MysqlClient.ExecQuerySQL(sql, DatabaseConnectStr, out string error);
// });
//}
if (enableLog)
{
MyLog4Net.MyLogHelper.Info("MQTT", "【TOPIC】" + topic + "【MESSAGE】" + msg);
}
}
}
public class Tools
{
public static string GetMd5(string str)
{
MD5 md5 = new MD5CryptoServiceProvider();
var bytes = Encoding.UTF8.GetBytes(str);
return Encoding.UTF8.GetString(md5.ComputeHash(bytes));
}
}
}

16
GlobalVar/Program.cs Normal file
View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GlobalVar
{
internal class Program
{
static void Main(string[] args)
{
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GlobalVar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GlobalVar")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fcfbef3b-bd04-432f-9b74-579ff8568eaa")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

35
GlobalVar/config.json Normal file
View File

@@ -0,0 +1,35 @@
{
"MachineTool": [
{
"Enable": "1",
"Type": "Fanuc_CNC",
"ConnectStr": "10.10.59.103",
"Id": "307BF923-DEA4-446F-8B52-0C0A119C146D",
"Name": "Fanuc_CNC_1",
"DataTimeInterval": "10000",
"AxesTimeInterval": "50",
"Joints": [
{
"Order": "0",
"JointName": "X1",
"ModelCode": "da2e82eb-0452-4a95-b437-1f846d85f6a6",
"JointType": "position",
"Axis": "y",
"Flip": "1",
"ValueFactor": "0.001",
"Delta": "0"
},
{
"Order": "1",
"JointName": "Y1",
"ModelCode": "5cdbe8f5-70b1-4119-af20-a794e14d1b7d",
"JointType": "position",
"Axis": "z",
"Flip": "1",
"ValueFactor": "0.001",
"Delta": "0"
}
]
}
]
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MQTTnet" version="4.2.0.706" targetFramework="net461" />
<package id="MQTTnet.Extensions.ManagedClient" version="4.2.0.706" targetFramework="net461" />
</packages>