修改测试相关问题

master
mzhifa 10 months ago
parent 5e544144a1
commit 60dda83726

@ -220,6 +220,7 @@ namespace Txgy.FilesWatcher.ViewModels
timer1.Interval = TimeSpan.FromSeconds(ProMonInterval);
timer1.Start();
timer1.Tick += timer1_Tick;
StartConnectMQ();
}
}
@ -227,6 +228,7 @@ namespace Txgy.FilesWatcher.ViewModels
{
WatchStartOrSopt(false);
timer1.Stop();
StopMQ();
}
public DelegateCommand<object> FilePathSaveCommand => new((obj) =>
@ -392,7 +394,7 @@ namespace Txgy.FilesWatcher.ViewModels
DateTime currentT= DateTime.Now;
RunTime = DateDiff(currentT, StartTime);
string path = $"{Path.Combine(MainPath, MseedPath)}/{currentT.Month.ToString("D2")}/{currentT.Day.ToString("D2")}/{currentT.Hour.ToString("D2")}/{currentT.AddMinutes(-2).Minute.ToString("D2")}";
// path = "I:\\yuwuN3102mseed\\NET2023\\06\\22\\21\\50";
// path = "I:\\yuwuN3102mseed\\NET2023\\06\\22\\21\\51";
Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}");
if (Directory.Exists(path) && IsUploadDB&& IsUploadMseedPath)
{
@ -472,7 +474,6 @@ namespace Txgy.FilesWatcher.ViewModels
Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{watch.Path}");
if (watch != null && watch.Path == watcherArray[0].Path)
{
watcherArray[0].EnableRaisingEvents = false;
if (IsUploadDB && isUploadRealtimePath)
{

@ -102,12 +102,12 @@
<ListView ItemsSource="{Binding DataList}" >
<ListView.View>
<GridView>
<GridViewColumn Header="时间" DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn Header="内容" Width="300" >
<GridViewColumn DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn >
<!--模板化单元格内容-->
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Foreground="CornflowerBlue" MinWidth="200" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
<TextBox Foreground="CornflowerBlue" MinWidth="300" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
@ -132,12 +132,12 @@
<ListView ItemsSource="{Binding RealTimeDataList}" >
<ListView.View>
<GridView>
<GridViewColumn Header="时间" DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn Header="内容" Width="300" >
<GridViewColumn DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn >
<!--模板化单元格内容-->
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Foreground="CornflowerBlue" MinWidth="200" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
<TextBox Foreground="CornflowerBlue" MinWidth="300" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
@ -150,12 +150,12 @@
<ListView ItemsSource="{Binding PostDataList}" >
<ListView.View>
<GridView>
<GridViewColumn Header="时间" DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn Header="内容" Width="300" >
<GridViewColumn DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn >
<!--模板化单元格内容-->
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Foreground="CornflowerBlue" MinWidth="200" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
<TextBox Foreground="CornflowerBlue" MinWidth="300" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
@ -168,12 +168,12 @@
<ListView ItemsSource="{Binding MQTTDataList}" >
<ListView.View>
<GridView>
<GridViewColumn Header="时间" DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn Header="内容" Width="300" >
<GridViewColumn DisplayMemberBinding="{Binding CreateTime, StringFormat=yyyy-MM-dd HH:mm:ss}" />
<GridViewColumn >
<!--模板化单元格内容-->
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Foreground="CornflowerBlue" MinWidth="200" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
<TextBox Foreground="CornflowerBlue" MinWidth="300" Cursor="Hand" Text="{Binding Data}" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" TextWrapping="Wrap"></TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

@ -26,6 +26,7 @@ namespace Txgy.FilesWatcher.model
{
var currentTime = DateTime.Now;
var Dfiles = new DirectoryInfo(path).GetFiles("*.mseed");
string mes = string.Empty;
foreach (var DFile in Dfiles)
{
string file = DFile.Name;
@ -42,6 +43,7 @@ namespace Txgy.FilesWatcher.model
if (a == 0)
{
//WorkAreaId = 1,更新
mes += file.Substring(3, 3);
FileStream fs = new FileStream(DFile.FullName, FileMode.Open, FileAccess.Read);
BinaryReader mbr = new BinaryReader(fs);
Byte[] mseedDatas = mbr.ReadBytes((int)fs.Length);
@ -57,9 +59,9 @@ namespace Txgy.FilesWatcher.model
}
}
}
// if (Dfiles.Length != 0)
if (!string.IsNullOrEmpty(mes))
{
string notifyMes = $"共{Dfiles.Length}个数据上传成功,{string.Join(",", Dfiles.Select(f => f.Name.Substring(3, 3)))}";
string notifyMes = $"共{Dfiles.Length}个数据上传成功,{mes}";// {string.Join(",", Dfiles.Select(f => f.Name.Substring(3, 3)))}";
mseedAction(notifyMes);
}
}

@ -69,7 +69,7 @@ namespace Txgy.FilesWatcher.model
sqlNumber = $"INSERT INTO {tbname} (EventTime, WorkAreaID, WaveData, JsonFile) VALUES('{EventTime}', '{workAreaId}', @mDatas, @jDatas);";
MySqlCommand mycomm = new MySqlCommand(sqlNumber, conn);
res = conn.Execute(sqlNumber, new { mDatas = mseedDatas, jDatas = jsonDatas });
mqAction($"/watcherdata/post/", JsonSerializer.Serialize(new { jsonFile = jsonString, eventMessage = eventMessage }, options));
mqAction($"/watcherdata/post", JsonSerializer.Serialize(new { jsonFile = jsonString, eventMessage = eventMessage }, options));
sqlNumber = $"INSERT INTO {uploadedtbname}(filename, uploadtime) VALUES('{file}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')";
res = conn.Execute(sqlNumber);
}

@ -75,7 +75,7 @@ namespace Txgy.FilesWatcher.model
sqlNumber = $"INSERT INTO {tbname} (EventTime, WorkAreaID, WaveData, JsonFile) VALUES('{EventTime}', '{workAreaId}', @mDatas, @jDatas);";
MySqlCommand mycomm = new MySqlCommand(sqlNumber,conn);
res = conn.Execute(sqlNumber, new { mDatas = mseedDatas, jDatas = jsonDatas });
mqAction("$/watcherdata/realtime/", JsonSerializer.Serialize(new { jsonFile = jsonString, eventMessage = eventMessage }, options));
mqAction($"/watcherdata/realtime", JsonSerializer.Serialize(new { jsonFile = jsonString, eventMessage = eventMessage }, options));
sqlNumber = $"INSERT INTO {uploadedtbname}(filename, uploadtime) VALUES('{file}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')";
res = conn.Execute(sqlNumber);
}

Loading…
Cancel
Save