Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
83467de3a9
3 files changed
+94
-12
No files matched your search
+7
-4
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using DyeingComputer.UserClass;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -24,12 +25,14 @@ namespace DyeingComputer
|
|||||||
//DyeingComputer.Properties.Resources.Culture = new System.Globalization.CultureInfo("en-US");//设定语言
|
//DyeingComputer.Properties.Resources.Culture = new System.Globalization.CultureInfo("en-US");//设定语言
|
||||||
}
|
}
|
||||||
System.Threading.Mutex mutex;
|
System.Threading.Mutex mutex;
|
||||||
void App_Startup(object sender, StartupEventArgs e) //程序只允许启动一次
|
void App_Startup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
LogGing.LogGingDATA("800_Start");
|
||||||
bool ret;
|
bool ret;
|
||||||
mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);
|
mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);//程序只允许启动一次
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
LogGing.LogGingDATA("800_The program has been launched");
|
||||||
MessageBox.Show("The program has been launched");
|
MessageBox.Show("The program has been launched");
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
@@ -109,7 +112,7 @@ namespace DyeingComputer
|
|||||||
|
|
||||||
private void Application_Startup(object sender, StartupEventArgs e)
|
private void Application_Startup(object sender, StartupEventArgs e)
|
||||||
{
|
{
|
||||||
Application.Current.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);//和MainWindwo同一目录
|
Application.Current.StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);//和MainWindwo同一目录
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-1
@@ -16,9 +16,24 @@
|
|||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
</NuGetPackageImportStamp>
|
</NuGetPackageImportStamp>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
@@ -26,6 +41,7 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -36,6 +52,12 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject>DyeingComputer.App</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignManifests>false</SignManifests>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
@@ -308,6 +330,9 @@
|
|||||||
<PackageReference Include="NModbus">
|
<PackageReference Include="NModbus">
|
||||||
<Version>3.0.81</Version>
|
<Version>3.0.81</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="NModbus.Serial">
|
||||||
|
<Version>3.0.81</Version>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="ScottPlot.WPF">
|
<PackageReference Include="ScottPlot.WPF">
|
||||||
<Version>5.0.37</Version>
|
<Version>5.0.37</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -339,5 +364,17 @@
|
|||||||
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
||||||
<Resource Include="Fonts\font-awesome-4.7.0\HELP-US-OUT.txt" />
|
<Resource Include="Fonts\font-awesome-4.7.0\HELP-US-OUT.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -16,6 +16,13 @@ using DyeingComputer.UserClass;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using NModbus;
|
||||||
|
using NModbus.Serial;
|
||||||
|
using NModbus.Device;
|
||||||
|
using System.IO.Ports;
|
||||||
|
using OpenTK.Graphics.ES11;
|
||||||
|
using DyeingComputer.Properties;
|
||||||
|
|
||||||
|
|
||||||
namespace DyeingComputer.ViewModel
|
namespace DyeingComputer.ViewModel
|
||||||
{
|
{
|
||||||
@@ -47,8 +54,11 @@ namespace DyeingComputer.ViewModel
|
|||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
WorkNumder = "----------";
|
WorkNumder = "----------";
|
||||||
CountDown();
|
CountDown(); //启动循环任务
|
||||||
SQL_data();
|
SQL_data(); //读数据库
|
||||||
|
UPort(); //启动串口
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string work_Temp; //显示温度
|
public string work_Temp; //显示温度
|
||||||
@@ -113,6 +123,39 @@ namespace DyeingComputer.ViewModel
|
|||||||
lk++;
|
lk++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SerialPort port = new SerialPort();//创建串口
|
||||||
|
void UPort()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
port.PortName = "COM5";
|
||||||
|
port.BaudRate = 9600;//配置
|
||||||
|
port.DataBits = 8;
|
||||||
|
port.Parity = Parity.None;
|
||||||
|
port.StopBits = StopBits.One;
|
||||||
|
port.Open();//打开串口
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LogGing.LogGingDATA("800_SerialPort_Not");
|
||||||
|
LogGing.LogGingDATA(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// var factory = new ModbusFactory();
|
||||||
|
// IModbusMaster master = factory.CreateRtuMaster(port);
|
||||||
|
// IModbusSerialMaster master = ModbusSerialMaster.CreateRtu(port);
|
||||||
|
byte slaveId = 1;
|
||||||
|
ushort startAddress = 100;
|
||||||
|
ushort[] registers = new ushort[] { 1, 2, 3 };
|
||||||
|
|
||||||
|
// write three registers
|
||||||
|
|
||||||
|
var master = ModbusRtuMaster.CreateSerial("COM1", 9600, Parity.None, 8, StopBits.One);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataTable dt_d = new DataTable("DIO");
|
DataTable dt_d = new DataTable("DIO");
|
||||||
@@ -127,14 +170,13 @@ namespace DyeingComputer.ViewModel
|
|||||||
dt_a = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='AI' OR type='AO'", null).Tables[0];
|
dt_a = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='AI' OR type='AO'", null).Tables[0];
|
||||||
dt_m = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='M'", null).Tables[0];
|
dt_m = SQLiteHelpers.ExecuteDataSet("select * from IOName where type='M'", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IO_data()//刷新
|
void IO_data()//刷新
|
||||||
{
|
{
|
||||||
updata_dtm("1", lk);
|
updata_dtm("1001", lk);
|
||||||
updata_dtd("1", Convert.ToBoolean(1));
|
updata_dtd("2001", Convert.ToBoolean(1));
|
||||||
updata_dta("1",10000+lk);
|
updata_dta("4001",10000+lk);
|
||||||
|
|
||||||
|
|
||||||
SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
||||||
|
|||||||
Reference in new issue
Block a user