新增:

1 完成上下位机通信功能测试,并对出现的bug进行修改;
This commit is contained in:
XuMinMin 2024-07-26 17:51:34 +08:00
parent db357c62fa
commit 9a51dcc1f6
24 changed files with 51 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -592,6 +592,26 @@ namespace JiangsuEarthquake.Common
#endregion
#region
public static byte[] ConvertHexToBinary(byte[] hexArray)
{
byte[] binaryArray = new byte[hexArray.Length * 8];
for (int i = 0; i < hexArray.Length; i++)
{
string binaryString = Convert.ToString(hexArray[i], 2);
// 补充到8位以确保每个byte都是8位
binaryString = binaryString.PadLeft(8, '0');
// 将二进制字符串转换为byte数组
for (int j = 0; j < 8; j++)
{
binaryArray[i * 8 + j] = Convert.ToByte(binaryString[j] - '0');
}
}
return binaryArray;
}
#endregion
#region IntToByte[4]
/// <summary>
/// int转化为byte[4]

View File

@ -7,4 +7,5 @@
<ImageSource x:Key="CycleGray">Assets/Images/CycleGray.png</ImageSource>
<ImageSource x:Key="DeviceOff">Assets/Images/DeviceOff.png</ImageSource>
<ImageSource x:Key="DeviceOn">Assets/Images/DeviceOn.png</ImageSource>
<ImageSource x:Key="NoDevice">Assets/Images/NoDevice.png</ImageSource>
</ResourceDictionary>

View File

@ -38,6 +38,7 @@
<None Remove="Assets\Images\Link.png" />
<None Remove="Assets\Images\Max.png" />
<None Remove="Assets\Images\Min.png" />
<None Remove="Assets\Images\NoDevice.png" />
<None Remove="Assets\Images\Open.png" />
<None Remove="Assets\Images\Refresh.png" />
<None Remove="Assets\Images\Reset.png" />
@ -156,6 +157,9 @@
<Resource Include="Assets\Images\Min.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\NoDevice.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Open.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>

View File

@ -557,7 +557,7 @@ namespace JiangsuEarthquake.Models
App.Current.Dispatcher.Invoke(() =>
{
if (id == 1)
MainViewModel.baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOff");
return;
else
MainViewModel.baseStationStateModel2.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOff");
@ -578,7 +578,7 @@ namespace JiangsuEarthquake.Models
App.Current.Dispatcher.Invoke(() =>
{
if (id == 1)
MainViewModel.baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOn");
return;
else
MainViewModel.baseStationStateModel2.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOn");
@ -598,7 +598,7 @@ namespace JiangsuEarthquake.Models
break;
//存储历史设置
sql = $"insert into switch_info_his(StationID,RecordTime,SwitchName,SwitchState) values('{id}','{DateTime.Now}','BackupSeisPower','{state}');";
sql = $"insert into switch_info_his(StationID,RecordTime,SwitchName,SwitchState) values('{id}','{DateTime.Now}','ElectPower','{state}');";
DBHelper.ExecuteNonQuery(sql, 1);
}
@ -669,6 +669,7 @@ namespace JiangsuEarthquake.Models
try
{
byte[] state1 = new byte[] { byteList[7], byteList[8], byteList[9], byteList[10] };
state1 = Tools.ConvertHexToBinary(state1);
if (Tools.IsBitSet(state1, 32))
JunBox_ProBoard_PowCarrier_State = 1;
if (Tools.IsBitSet(state1, 31))
@ -695,6 +696,7 @@ namespace JiangsuEarthquake.Models
JunBox_Elect = 1;
byte[] state2 = new byte[] { byteList[11], byteList[12], byteList[13], byteList[14] };
state2 = Tools.ConvertHexToBinary(state2);
if (Tools.IsBitSet(state2, 32))
Leakage = 1;
if (Tools.IsBitSet(state2, 31))

View File

@ -1862,6 +1862,12 @@ namespace JiangsuEarthquake.ViewModels
#region On/Off状态初始化
if(station_id==1)
{
ElectPowerOpenBtnIsEnabled = false;
ElectPowerCloseBtnIsEnabled = false;
}
sql = String.Format("select RelayStatus from boosterstation_state where StationID = {0} ORDER by id desc limit 1", 1);
dataReader = DBHelper.ExecuteReader(sql, 1);
if (dataReader.Read())
@ -1898,10 +1904,10 @@ namespace JiangsuEarthquake.ViewModels
else
baseStationStateModel1.JunBox_Seis2 = (ImageSource)Application.Current.FindResource("DeviceOff");
if (dataReader["JunBox_Elect"].ToString() == "1")
baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOn");
else
baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOff");
//if (dataReader["JunBox_Elect"].ToString() == "1")
// baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("DeviceOn");
//else
baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("NoDevice");
if (dataReader["JunBox_ProBoard_PowCarrier_State"].ToString() == "0")
@ -4688,6 +4694,9 @@ namespace JiangsuEarthquake.ViewModels
break;
case "SystemControlView":
MainSeisIsChecked = true;
baseStationStateModel1.JunBox_Elect = (ImageSource)Application.Current.FindResource("NoDevice");
ElectPowerOpenBtnIsEnabled = false;
ElectPowerCloseBtnIsEnabled = false;
#region
//string sql = String.Format("select SwitchState from switch_info where StationID = 1 and SwitchName = 'BaseStationPower'");
@ -4793,6 +4802,8 @@ namespace JiangsuEarthquake.ViewModels
break;
case "SystemControlView":
MainSeisIsChecked = true;
ElectPowerOpenBtnIsEnabled = true;
ElectPowerCloseBtnIsEnabled = true;
#region
//string sql = String.Format("select SwitchState from switch_info where StationID = 2 and SwitchName = 'BaseStationPower'");

View File

@ -11,7 +11,7 @@
<add key="XWJ_Service_IP1" value="10.20.102.229" />
<add key="XWJ_Service_Port1" value="9527" />
<add key="XWJ_Service_IPEndPoint1" value="10.20.102.201:0" />
<add key="XWJ_Service_IP2" value="10.20.102.201" />
<add key="XWJ_Service_IP2" value="10.20.102.229" />
<add key="XWJ_Service_Port2" value="9528" />
<add key="XWJ_Service_IPEndPoint2" value="10.20.102.201:0" />
<add key="FTPIP1" value="10.20.98.219" />

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("JiangsuEarthquake")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+61ab0351f9c108eff79a78da68e2d28ea1803b38")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+db357c62fa64b508f3bdf99ddc12577da611e5d2")]
[assembly: System.Reflection.AssemblyProductAttribute("JiangsuEarthquake")]
[assembly: System.Reflection.AssemblyTitleAttribute("JiangsuEarthquake")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
5a7bf72812aaa09ee422f7a5fec4b31c3e51dd2f4b28e4c2c0fbaa7b83ccbd8d
ffc0e59e2d5d836bc16ecab8b7acca818090807c6120167d90ffdbb10b85a5a6

View File

@ -16,5 +16,5 @@ F:\Code\JSEQ\20240301_JSEQ_upperpc\JiangsuEarthquake\JiangsuEarthquake\App.xaml
227-662592483
Assets\Styles\DefaultStyle.xaml;ImageDictionary.xaml;MainWindow.xaml;Views\AlarmRecordView.xaml;Views\BoosterStationStateDataView.xaml;Views\LogRecordView.xaml;Views\RealTimeDataView.xaml;Views\SeismometerParameterView.xaml;Views\SeismometerStateDataView.xaml;Views\SystemControlView.xaml;Views\SystemEnvironDataView.xaml;Views\SystemMonitorDataView.xaml;Views\UserControls\AlarmSettingView.xaml;Views\UserControls\BaseStationModel.xaml;Views\UserControls\FTPConnectSstView.xaml;Views\UserControls\FTPSettingView.xaml;Views\UserControls\InitialView.xaml;Views\UserControls\InitialView1.xaml;Views\UserControls\OtherSettingView.xaml;Views\UserControls\TextDialog.xaml;
True
False

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\LogRecordView.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "BBF4C673CF40E4386BA52CCA94BB06B2F1CBF400"
#pragma checksum "..\..\..\..\Views\LogRecordView.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3B781C81F640001620B4CE20722354B1FE658E52"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\LogRecordView.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "BBF4C673CF40E4386BA52CCA94BB06B2F1CBF400"
#pragma checksum "..\..\..\..\Views\LogRecordView.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3B781C81F640001620B4CE20722354B1FE658E52"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB