1修改钉钉发送问题(client重连没有登录),设备震级阈值

2 增加mseedC.dll同时使用问题;
3修改波形时间位置
master
mzhifa 7 months ago
parent a85d2d45c8
commit 92776e6a97

@ -31,6 +31,7 @@ namespace StartServerWPF.Models
private string chartsavepath1;
private string apmsavepath1;
private string toolsavepath1;
private double apmpush2ddmag1;
private int delayTime1;
private ApmsModel apmModel1;
@ -55,6 +56,10 @@ namespace StartServerWPF.Models
[JsonProperty("toolpush2wx")]
public bool toolpush2wx { get => toolpush2wx1; set => SetProperty(ref toolpush2wx1, value); }
[JsonProperty("apmpush2ddmag")]
public double apmpush2ddmag { get => apmpush2ddmag1; set => SetProperty(ref apmpush2ddmag1, value); }
[JsonProperty("delayTime")]
public int delayTime { get => delayTime1; set => SetProperty(ref delayTime1, value); }

@ -29,11 +29,12 @@ namespace StartServerWPF.Modules.Main.ViewModels
{
public class MainViewModel : BindableBase
{
public MainViewModel(SystemConfigModel systemConfig, IDialogService dialogService, WebsocketClient websocket, LoginViewDialogViewModel loginViewDialogViewModel)
public MainViewModel(SystemConfigModel systemConfig, WorkareaModel workareaModel, IDialogService dialogService, WebsocketClient websocket, LoginViewDialogViewModel loginViewDialogViewModel)
{
Message = "View A" ;
Console.WriteLine(System.Environment.CurrentDirectory + "\\" + JsonParser.systemConfigPath);
_systemConfig = systemConfig;
this._workareaModel = workareaModel;
ApmsIsEnable = _systemConfig.proApms.IsEnable;
ToolsIsEnable= _systemConfig.proTools.IsEnable;
DingdingIsEnable = _systemConfig.remoteDb.DingdingIsEnable;
@ -523,7 +524,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
public bool vpnStatus = false;
private SystemConfigModel _systemConfig;
private readonly WorkareaModel _workareaModel;
private DispatcherTimer timer1= new DispatcherTimer();
private readonly IDialogService _dialogService;
private readonly WebsocketClient _websocket;
@ -627,7 +628,8 @@ namespace StartServerWPF.Modules.Main.ViewModels
message = outLine.Data,
};
string jsonStr = JsonSerializer.Serialize(cSDevicePublish);
if (_systemConfig.remoteDb.DingdingIsEnable)
//判断震级大小设置值
if (_systemConfig.remoteDb.DingdingIsEnable && (ms.ML >= _workareaModel.apmpush2ddmag))
{
_websocket.SendMes(jsonStr);
}

@ -82,13 +82,15 @@
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="后处理路径:" Width="65" VerticalAlignment="Center"/>
<TextBox DockPanel.Dock="Left" Width="100" Text="{Binding WareaModel.toolsavepath}"/>
<TextBlock Text="后理微信通知:" Width="90" VerticalAlignment="Center"/>
<TextBlock Text="后理微信通知:" Width="90" VerticalAlignment="Center"/>
<CheckBox IsChecked="{Binding WareaModel.toolpush2wx}"/>
</StackPanel>
<DockPanel VerticalAlignment="Center">
<TextBlock Text="延时时间(min):" VerticalAlignment="Center"/>
<hc:NumericUpDown Value="{Binding WareaModel.delayTime}" Width="70" HorizontalAlignment="Left"/>
<TextBlock Text="震级钉钉通知:" Width="90" VerticalAlignment="Center"/>
<hc:NumericUpDown Value="{Binding WareaModel.apmpush2ddmag}" Width="70" HorizontalAlignment="Left"/>
</DockPanel>
<DockPanel VerticalAlignment="Center">
<TextBlock Text="network:" VerticalAlignment="Center"/>

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Text.Json;
using System.Threading;
@ -25,17 +26,22 @@ namespace StartServerWPF.Modules.Main
webSocket4Net.Opened += WebSocket4Net_Opened;
webSocket4Net.Error += new EventHandler<ErrorEventArgs>(WebSocket_Error);
webSocket4Net.MessageReceived += WebSocket4Net_MessageReceived;
webSocket4Net.Open();
Debug.WriteLine("客户端连接成功!");
// thread.Start();
}
private string name = string.Empty;
private string pwd = string.Empty;
public void SiginServer(string account,string password)
{
isHeartbeat = false;
string jsonstr= JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account=account,password=password});
SendMes(jsonstr);
isHeartbeat = false;
name = account;
pwd = password;
webSocket4Net.Open();
// string jsonstr= JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account=account,password=password});
// SendMes(jsonstr);
Task.Run(async () =>{
await Task.Delay(2000);
isHeartbeat = true;
@ -58,22 +64,21 @@ namespace StartServerWPF.Modules.Main
{
while (isHeartbeat)
{
//Console.WriteLine($"客户端发送数据{i++}");
try
{
if (webSocket4Net.State == WebSocketState.Open)
{
webSocket4Net.Send("{\"type\":\"heartbeat\",\"utype\":\"device\"}");
}
else if (webSocket4Net.State == WebSocketState.Closed)
{
try
{
webSocket4Net.Open();
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
Thread.Sleep(TimeSpan.FromSeconds(20));
Debug.WriteLine("连接报错:"+ ex.ToString());
Thread.Sleep(TimeSpan.FromSeconds(10));
}
Thread.Sleep(TimeSpan.FromSeconds(5));
}
@ -86,7 +91,9 @@ namespace StartServerWPF.Modules.Main
private void WebSocket4Net_Opened(object sender, EventArgs e)
{
Debug.WriteLine("连接websocket成功****************");
string jsonstr = JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account = name, password = pwd });
SendMes(jsonstr);
}
void WebSocket_Error(object sender, ErrorEventArgs e)
{

@ -15,6 +15,8 @@ namespace StartServerWPF.Modules.MseedChart.Models
{
public class WavesModel
{
public const int lineTextX = 60;
public const int lineTextY = -5;
public List<AxisY> CreateYAxisChart(List<StationModel> stationModels, LightningChart curChart)
{
List<AxisY> axisYList = new List<AxisY>();
@ -90,14 +92,14 @@ namespace StartServerWPF.Modules.MseedChart.Models
lineCollection.LineStyle.Color = System.Windows.Media.Colors.Red;
lineCollection.Title.Text = chartV.YAxes[assignYAxisIndex].Title.Text + ph.atime.ToString();
lineCollection.Title.Visible = true;
lineCollection.Title.Font.Size = 10;
lineCollection.Title.Font.Size = 12;
lineCollection.Title.Shadow.DropColor = System.Windows.Media.Colors.Transparent;
//lineCollection.Title.Shadow.ContrastColor = System.Windows.Media.Colors.Transparent;
lineCollection.Title.AutoPlacement = false;
lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left;
var b = chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(ph.atime))-80;
lineCollection.Title.Offset.SetValues((int)b, 3);
lineCollection.Title.Color = System.Windows.Media.Colors.Red;
var b = chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(ph.atime))- WavesModel.lineTextX;
lineCollection.Title.Offset.SetValues((int)b, WavesModel.lineTextY);
lineCollection.Title.Color = System.Windows.Media.Colors.Blue;
chartV.LineCollections.Add(lineCollection);
}
@ -121,14 +123,14 @@ namespace StartServerWPF.Modules.MseedChart.Models
lineCollection.LineStyle.Color = System.Windows.Media.Colors.Red;
lineCollection.Title.Text = chartV.YAxes[assignYAxisIndex].Title.Text+ " "+ am.atime.ToString("HH:mm:ss.fff");
lineCollection.Title.Visible = true;
lineCollection.Title.Font.Size = 10;
lineCollection.Title.Font.Size = 12;
lineCollection.Title.Shadow.DropColor = System.Windows.Media.Colors.Transparent;
// lineCollection.Title.Shadow.ContrastColor = System.Windows.Media.Colors.Transparent;
lineCollection.Title.AutoPlacement = false;
lineCollection.Title.HorizontalAlign = AlignmentHorizontal.Left;
var b= chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(am.atime))-80;
lineCollection.Title.Offset.SetValues((int)b,3);
lineCollection.Title.Color = System.Windows.Media.Colors.Red;
var b= chartV.XAxes[0].ValueToCoordD(chartV.XAxes[0].DateTimeToAxisValue(am.atime))- WavesModel.lineTextX;
lineCollection.Title.Offset.SetValues((int)b, WavesModel.lineTextY);
lineCollection.Title.Color = System.Windows.Media.Colors.Blue;
chartV.LineCollections.Add(lineCollection);
}
return new List<AxisY>();

@ -24,7 +24,20 @@ namespace StartServerWPF.Modules.MseedChart
[DllImport("mseedC.dll")]
public static extern void MseedDatasCallFun(LoopCallbackHandler callback);
}
//实时波形调用,确定切换页面时数据继续接收
public class MseedReal2asciiApi
{
public delegate void LoopCallbackHandler(AsciiDataStruct asciiData);
[DllImport("mseedCReal.dll", EntryPoint = "MseedDatas")]
public extern static int MseedDatas(int a, string[] name);
//public extern static int MseedDatas(Byte[] bytes, int lenght);
[DllImport("mseedCReal.dll", EntryPoint = "bufferMseedData")]
public extern static int bufferMseedData(int length, Byte[] data);
[DllImport("mseedCReal.dll", EntryPoint = "testc")]
public extern static int testc(int a, int b);
[DllImport("mseedCReal.dll")]
public static extern void MseedDatasCallFun(LoopCallbackHandler callback);
}
[StructLayout(LayoutKind.Sequential)]
public struct AsciiDataStruct
{

@ -33,15 +33,15 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
public class ChartPlotRealDataViewModel : BindableBase, INavigationAware
{
Mseed2asciiApi.LoopCallbackHandler loopCallback;
MseedReal2asciiApi.LoopCallbackHandler loopCallback;
WorkareaModel workarea;
public ChartPlotRealDataViewModel(SystemConfigModel configModel, WorkareaModel workareaModel, IDialogService dialogService)
{
(Application.Current.MainWindow as System.Windows.Window).Closing += ApplicationClosingDispose;
_dispatcher = Application.Current.Dispatcher;
IntervalTime = 1000;
loopCallback = new Mseed2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
loopCallback = new MseedReal2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
MseedReal2asciiApi.MseedDatasCallFun(loopCallback);
GC.KeepAlive(loopCallback);
workarea = workareaModel;
_wavesModel = new WavesModel();
@ -281,12 +281,12 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
private void Loaded()
{
Mseed2asciiApi.MseedDatasCallFun(loopCallback);
}
private void UnLoaded()
{
Mseed2asciiApi.MseedDatasCallFun(null);
}
private void Sure()
@ -574,7 +574,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{
iRedisSubscription.UnSubscribeFromChannels(subNameList.Keys.ToArray());
}
Mseed2asciiApi.bufferMseedData(message.Length, message);
MseedReal2asciiApi.bufferMseedData(message.Length, message);
}, subNameList.Keys.ToArray());
}
});

@ -50,6 +50,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
IntervalTime=100;
CreateChart();
loopCallback = new Mseed2asciiApi.LoopCallbackHandler(Mseed2AsciiEvent);
Mseed2asciiApi.MseedDatasCallFun(loopCallback);
GC.KeepAlive(loopCallback);
}
@ -324,12 +325,12 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
private void Loaded()
{
Mseed2asciiApi.MseedDatasCallFun(loopCallback);
}
private void UnLoaded()
{
Mseed2asciiApi.MseedDatasCallFun(null);
}
private void AxesYVisible(object isCheck)
{
@ -698,8 +699,8 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{
foreach (var item in LChartALL.ViewXY.LineCollections)
{
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX) - 80;
item.Title.Offset.SetValues((int)b, 3);
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX) - WavesModel.lineTextX;
item.Title.Offset.SetValues((int)b, WavesModel.lineTextY);
}
}
@ -707,8 +708,8 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{
foreach (var item in LChartALL.ViewXY.LineCollections)
{
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX) - 80;
item.Title.Offset.SetValues((int)b, 3);
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX) - WavesModel.lineTextX;
item.Title.Offset.SetValues((int)b, WavesModel.lineTextY);
}
}
@ -721,8 +722,8 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
}
foreach (var item in LChartALL.ViewXY.LineCollections)
{
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX)-80;
item.Title.Offset.SetValues((int)b, 3);
double b = LChartALL.ViewXY.XAxes[0].ValueToCoordD(item.Lines[0].AX)- WavesModel.lineTextX;
item.Title.Offset.SetValues((int)b, WavesModel.lineTextY);
}
}

@ -30,6 +30,10 @@ namespace StartServerWPF
System.AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
// AddSecurity(@"C:\ProgramData\Microsoft\Network\Connections");
if(File.Exists("mseedC.dll"))
{
File.Copy("mseedC.dll", "mseedCReal.dll",true);
}
}
/// <summary>

@ -6,6 +6,7 @@
"toolsavepath": "Post",
"apmpush2wx": false,
"toolpush2wx": false,
"apmpush2ddmag": -1.2,
"delayTime": 10,
"apmModel": {
"station": "N2107_1116.csv",

Loading…
Cancel
Save