1.停止时,关闭文件监控;

2.上传逻辑;
3.去掉报错弹窗;
4 增加工区配置;
master
mzhifa 3 months ago
parent a635c7b2af
commit f7e8b01149

@ -48,6 +48,8 @@ namespace Txgy.FilesWatcher.ViewModels
MseedPath = systemConfig.mseedpath; MseedPath = systemConfig.mseedpath;
MainPath= systemConfig.mainpath; MainPath= systemConfig.mainpath;
ToolPath = systemConfig.toolpath; ToolPath = systemConfig.toolpath;
WorkAreaId = systemConfig.workAreaId;
CycleTime = systemConfig.cycleTime;
DataBaseConnect.GetInstance.DataBaseConfig = systemConfig.dBConfig; DataBaseConnect.GetInstance.DataBaseConfig = systemConfig.dBConfig;
@ -124,7 +126,7 @@ namespace Txgy.FilesWatcher.ViewModels
set { SetProperty(ref isUploadPostPath, value); } set { SetProperty(ref isUploadPostPath, value); }
} }
private bool isUploadDB = false; private bool isUploadDB = true;
public bool IsUploadDB public bool IsUploadDB
{ {
@ -294,6 +296,9 @@ namespace Txgy.FilesWatcher.ViewModels
timerTool.Start(); timerTool.Start();
StartConnectMQ(); StartConnectMQ();
mseedFileTime = DateTime.Now; mseedFileTime = DateTime.Now;
_systemConfig.cycleTime = CycleTime;
_systemConfig.workAreaId = WorkAreaId;
UpdateJsonConfig(_systemConfig);
} }
} }
@ -504,7 +509,7 @@ namespace Txgy.FilesWatcher.ViewModels
DateTime currentT= DateTime.Now; DateTime currentT= DateTime.Now;
RunTime = DateDiff(currentT, StartTime); RunTime = DateDiff(currentT, StartTime);
// path = "I:\\yuwuN3102mseed\\NET2023\\06\\22\\21\\51"; // path = "I:\\yuwuN3102mseed\\NET2023\\06\\22\\21\\51";
if ((currentT - mseedFileTime).TotalSeconds >= 15) if ((currentT - mseedFileTime).TotalSeconds >= CycleTime)
{ {
mseedFileTime = DateTime.Now; mseedFileTime = DateTime.Now;
//DateTime end= DateTime.Now.AddDays(-3); //DateTime end= DateTime.Now.AddDays(-3);
@ -519,8 +524,6 @@ namespace Txgy.FilesWatcher.ViewModels
private void MseedFileChanged(DateTime currentT) private void MseedFileChanged(DateTime currentT)
{ {
_log.Log.Debug("MainViewModel.MseedFileChanged() > enter....");
_log.Log.DebugFormat("MainViewModel.MseedFileChanged() currentT:{0}", currentT);
string path = $"{Path.Combine(MainPath, MseedPath)}/{currentT.Month.ToString("D2")}/{currentT.Day.ToString("D2")}/{currentT.Hour.ToString("D2")}/{currentT.AddMinutes(-2).Minute.ToString("D2")}"; string path = $"{Path.Combine(MainPath, MseedPath)}/{currentT.Month.ToString("D2")}/{currentT.Day.ToString("D2")}/{currentT.Hour.ToString("D2")}/{currentT.AddMinutes(-2).Minute.ToString("D2")}";
Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}"); Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}");
if (Directory.Exists(path) && IsUploadDB && IsUploadMseedPath) if (Directory.Exists(path) && IsUploadDB && IsUploadMseedPath)
@ -538,8 +541,6 @@ namespace Txgy.FilesWatcher.ViewModels
}); });
}), path, WorkAreaId); }), path, WorkAreaId);
} }
_log.Log.Debug("MainViewModel.MseedFileChanged() < exit....");
} }
@ -567,8 +568,8 @@ namespace Txgy.FilesWatcher.ViewModels
} }
} }
} }
watcherArray[0].EnableRaisingEvents =IsUploadRealtimePath; watcherArray[0].EnableRaisingEvents = IsUploadRealtimePath && IsEnableRaising;
watcherArray[1].EnableRaisingEvents = IsUploadPostPath; watcherArray[1].EnableRaisingEvents = IsUploadPostPath && IsEnableRaising;
IsIndeterminate = IsEnableRaising; IsIndeterminate = IsEnableRaising;
} }
catch (Exception ex) catch (Exception ex)

@ -105,7 +105,6 @@ namespace Txgy.FilesWatcher.ViewModels
CancellationTokenSource cts = new CancellationTokenSource(); CancellationTokenSource cts = new CancellationTokenSource();
public async Task StartHandle(DateTime start, DateTime end) public async Task StartHandle(DateTime start, DateTime end)
{ {
_log.Log.Debug("ManualModeDialogViewModel.StartHandle() > enter...");
_log.Log.DebugFormat("ManualModeDialogViewModel.StartHandle() start:{0},end:{1}",start, end); _log.Log.DebugFormat("ManualModeDialogViewModel.StartHandle() start:{0},end:{1}",start, end);
CancellationToken cancellationToken = cts.Token; CancellationToken cancellationToken = cts.Token;
string realtimePath = Path.Combine(mainModel.MainPath, mainModel.RealtimePath); string realtimePath = Path.Combine(mainModel.MainPath, mainModel.RealtimePath);
@ -158,7 +157,6 @@ namespace Txgy.FilesWatcher.ViewModels
} }
}, cancellationToken); }, cancellationToken);
await Task.WhenAll(task1, task2, task3); await Task.WhenAll(task1, task2, task3);
_log.Log.Debug("ManualModeDialogViewModel.StartHandle() < exit...");
} }
@ -169,7 +167,6 @@ namespace Txgy.FilesWatcher.ViewModels
private void MseedUpload(DateTime currentT) private void MseedUpload(DateTime currentT)
{ {
_log.Log.Debug("ManualModeDialogViewModel.MseedUpload() > enter...");
string path = $"{Path.Combine(mainModel.MainPath, mainModel.MseedPath)}/{currentT.Month.ToString("D2")}/{currentT.Day.ToString("D2")}/{currentT.Hour.ToString("D2")}/{currentT.Minute.ToString("D2")}"; string path = $"{Path.Combine(mainModel.MainPath, mainModel.MseedPath)}/{currentT.Month.ToString("D2")}/{currentT.Day.ToString("D2")}/{currentT.Hour.ToString("D2")}/{currentT.Minute.ToString("D2")}";
// path = "I:\\yuwuN3102mseed\\NET2023\\06\\22\\21\\51"; // path = "I:\\yuwuN3102mseed\\NET2023\\06\\22\\21\\51";
Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}"); Debug.WriteLine($"**********当前时间:{currentT},监控路径:{path}");
@ -189,13 +186,10 @@ namespace Txgy.FilesWatcher.ViewModels
}); });
}), path, mainModel.WorkAreaId); }), path, mainModel.WorkAreaId);
} }
_log.Log.Debug("ManualModeDialogViewModel.MseedUpload() < exit...");
} }
private void RealtimeChanged(string filePath, string lastLine) private void RealtimeChanged(string filePath, string lastLine)
{ {
_log.Log.Debug("ManualModeDialogViewModel.RealtimeChanged() > enter...");
// string tmp = dt.Hour.ToString() + "时" + dt.Minute.ToString() + "分" + dt.Second.ToString() + "秒" + dt.Millisecond.ToString() + "毫秒,目录发生变化\r\n"; // string tmp = dt.Hour.ToString() + "时" + dt.Minute.ToString() + "分" + dt.Second.ToString() + "秒" + dt.Millisecond.ToString() + "毫秒,目录发生变化\r\n";
DateTime lastWriteTime = DateTime.Now; //File.GetLastWriteTime(e.FullPath); DateTime lastWriteTime = DateTime.Now; //File.GetLastWriteTime(e.FullPath);
Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{filePath}"); Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{filePath}");
@ -224,13 +218,11 @@ namespace Txgy.FilesWatcher.ViewModels
}, filePath, lastLine); }, filePath, lastLine);
} }
_log.Log.Debug("ManualModeDialogViewModel.RealtimeChanged() < exit...");
} }
private void PostChanged(string filePath, string lastLine) private void PostChanged(string filePath, string lastLine)
{ {
_log.Log.Debug("ManualModeDialogViewModel.PostChanged() > enter...");
// string tmp = dt.Hour.ToString() + "时" + dt.Minute.ToString() + "分" + dt.Second.ToString() + "秒" + dt.Millisecond.ToString() + "毫秒,目录发生变化\r\n"; // string tmp = dt.Hour.ToString() + "时" + dt.Minute.ToString() + "分" + dt.Second.ToString() + "秒" + dt.Millisecond.ToString() + "毫秒,目录发生变化\r\n";
DateTime lastWriteTime = DateTime.Now; //File.GetLastWriteTime(e.FullPath); DateTime lastWriteTime = DateTime.Now; //File.GetLastWriteTime(e.FullPath);
Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{filePath}"); Debug.WriteLine($"最后修改时间:{lastWriteTime},文件路径:{filePath}");
@ -264,7 +256,6 @@ namespace Txgy.FilesWatcher.ViewModels
}); });
}, filePath, lastLine); }, filePath, lastLine);
} }
_log.Log.Debug("ManualModeDialogViewModel.PostChanged() < exit...");
} }
private DispatcherTimer timer1 = new DispatcherTimer(); private DispatcherTimer timer1 = new DispatcherTimer();

@ -128,7 +128,7 @@
</GroupBox> </GroupBox>
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Text="自动处理时间间隔(小时)" VerticalAlignment="Center"/> <TextBlock Text="自动处理时间间隔()" VerticalAlignment="Center"/>
<hc:NumericUpDown Value="{Binding CycleTime}"/> <hc:NumericUpDown Value="{Binding CycleTime}"/>
</StackPanel> </StackPanel>
<Button Content="手动处理" Command="{Binding ManualCommand}" Margin="0,20,0,0"/> <Button Content="手动处理" Command="{Binding ManualCommand}" Margin="0,20,0,0"/>

@ -26,7 +26,7 @@
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/> <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
<!--日期的格式,每天换一个文件记录,如不设置则永远只记录一天的日志,需设置--> <!--日期的格式,每天换一个文件记录,如不设置则永远只记录一天的日志,需设置-->
<!--<datePattern value="yyyyMMdd&quot;\\trace_&quot;yyyyMMHH.log&quot;&quot;"/>--> <!--<datePattern value="yyyyMMdd&quot;\\trace_&quot;yyyyMMHH.log&quot;&quot;"/>-->
<datePattern value="yyyyMMdd&quot;\\trace_&quot;yyyyMMHH.log"/> <datePattern value="yyyyMMdd&quot;\\trace_&quot;yyyyMMHH"/>
<!--是否追加到文件,默认为true通常无需设置--> <!--是否追加到文件,默认为true通常无需设置-->
<appendToFile value="true"/> <appendToFile value="true"/>
<StaticLogFileName value="false"/> <StaticLogFileName value="false"/>

@ -16,6 +16,8 @@ namespace Txgy.FilesWatcher.model
public string toolpath { get; set; } public string toolpath { get; set; }
public int cycleTime { get; set; } public int cycleTime { get; set; }
public int workAreaId { get; set; }
public MQTTConfig mQTTConfig { get; set; } public MQTTConfig mQTTConfig { get; set; }
public DBConfig dBConfig { get; set; } public DBConfig dBConfig { get; set; }

@ -23,7 +23,6 @@ namespace Txgy.FilesWatcher.model
public static void UploadMSeedOnce(Action<string> mseedAction, string path, int workAreaId) public static void UploadMSeedOnce(Action<string> mseedAction, string path, int workAreaId)
{ {
GetLogger _log = new GetLogger("UploadMseedFile"); GetLogger _log = new GetLogger("UploadMseedFile");
_log.Log.Debug("UploadMseedFile.UploadMSeedOnce() > enter....");
_log.Log.DebugFormat("UploadMseedFile.UploadMSeedOnce() path:{0},workAreaId:{1}", path, workAreaId); _log.Log.DebugFormat("UploadMseedFile.UploadMSeedOnce() path:{0},workAreaId:{1}", path, workAreaId);
try try
{ {
@ -75,8 +74,6 @@ namespace Txgy.FilesWatcher.model
{ {
_log.Log.ErrorFormat("UploadMseedFile.UploadMSeedOnce()() error:{0}", ex); _log.Log.ErrorFormat("UploadMseedFile.UploadMSeedOnce()() error:{0}", ex);
} }
_log.Log.Debug("UploadMseedFile.UploadMSeedOnce()() < exit....");
} }
} }

@ -20,7 +20,6 @@ namespace Txgy.FilesWatcher.model
public static void UploadPostproFileOnce(string path, string eventMessage, int workAreaId , out bool isUpload) public static void UploadPostproFileOnce(string path, string eventMessage, int workAreaId , out bool isUpload)
{ {
GetLogger _log = new GetLogger("UploadPostproFile"); GetLogger _log = new GetLogger("UploadPostproFile");
_log.Log.Debug("UploadPostproFile.UploadPostproFileOnce() > enter....");
_log.Log.DebugFormat("UploadPostproFile.UploadPostproFileOnce() path:{0},eventMessage:{1},workAreaId:{2}", path, eventMessage, workAreaId); _log.Log.DebugFormat("UploadPostproFile.UploadPostproFileOnce() path:{0},eventMessage:{1},workAreaId:{2}", path, eventMessage, workAreaId);
isUpload = false; isUpload = false;
try try
@ -50,12 +49,28 @@ namespace Txgy.FilesWatcher.model
} }
string EventTime = index_file_line[0].Substring(0, 23); string EventTime = index_file_line[0].Substring(0, 23);
string OriginTime = EventTime; string OriginTime = EventTime;
//.json文件
//WorkAreaId = 1,更新realtimeeventresult string JPath = dFile.FullName.Replace(".mseed", "A.json");
sqlNumber = $"INSERT INTO {tbrealtimeresult}(WorkAreaId, EventTime, OriginTime, X, Y, Z, ML, LocSta, MLSta, RMS) VALUES('{workAreaId}', '{EventTime}', '{OriginTime}', '{index_file_line[1]}', '{index_file_line[2]}', '{index_file_line[3]}', '{index_file_line[5]}', '{index_file_line[7]}', '{index_file_line[8]}', '{index_file_line[6]}')"; if (File.Exists(JPath))
var res = conn.Execute(sqlNumber); {
string mes = File.ReadAllText(JPath);
if (!mes.Contains(EventTime))
{
//和json文件的otime 时间需要一致
continue;
}
}
// 上传前检查workAreaId和eventTime
sqlNumber = $"SELECT COUNT(*) FROM {tbrealtimeresult} WHERE WorkAreaId = '{workAreaId}' && EventTime='{EventTime}'";
cmd = new MySqlCommand(sqlNumber, conn);
int b = conn.QueryFirst<int>(sqlNumber);
if (b == 0)
{
sqlNumber = $"INSERT INTO {tbrealtimeresult}(WorkAreaId, EventTime, OriginTime, X, Y, Z, ML, LocSta, MLSta, RMS) VALUES('{workAreaId}', '{EventTime}', '{OriginTime}', '{index_file_line[1]}', '{index_file_line[2]}', '{index_file_line[3]}', '{index_file_line[5]}', '{index_file_line[7]}', '{index_file_line[8]}', '{index_file_line[6]}')";
var res = conn.Execute(sqlNumber);
_log.Log.DebugFormat("UploadPostproFileOnce() 上传数据表:{0},eventMessage:{1}", tbrealtimeresult, eventMessage);
}
isUpload = true; isUpload = true;
_log.Log.DebugFormat("UploadPostproFileOnce() 上传数据表:{0},eventMessage:{1}", tbrealtimeresult, eventMessage);
// .mseed文件 // .mseed文件
FileStream fs = new FileStream(dFile.FullName, FileMode.Open, FileAccess.Read); FileStream fs = new FileStream(dFile.FullName, FileMode.Open, FileAccess.Read);
BinaryReader mbr = new BinaryReader(fs); BinaryReader mbr = new BinaryReader(fs);
@ -83,12 +98,12 @@ namespace Txgy.FilesWatcher.model
{ {
sqlNumber = $"INSERT INTO {tbname} (EventTime, WorkAreaID, WaveData, JsonFile) VALUES('{EventTime}', '{workAreaId}', @mDatas, @jDatas);"; sqlNumber = $"INSERT INTO {tbname} (EventTime, WorkAreaID, WaveData, JsonFile) VALUES('{EventTime}', '{workAreaId}', @mDatas, @jDatas);";
MySqlCommand mycomm = new MySqlCommand(sqlNumber, conn); MySqlCommand mycomm = new MySqlCommand(sqlNumber, conn);
res = conn.Execute(sqlNumber, new { mDatas = mseedDatas, jDatas = jsonDatas }); conn.Execute(sqlNumber, new { mDatas = mseedDatas, jDatas = jsonDatas });
_log.Log.DebugFormat("UploadPostproFileOnce() 上传数据表:{0}", tbname); _log.Log.DebugFormat("UploadPostproFileOnce() 上传数据表:{0}", tbname);
} }
sqlNumber = $"INSERT INTO {uploadedtbname}(filename, uploadtime) VALUES('{file}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"; sqlNumber = $"INSERT INTO {uploadedtbname}(filename, uploadtime) VALUES('{file}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')";
res = conn.Execute(sqlNumber); conn.Execute(sqlNumber);
_log.Log.DebugFormat("UploadPostproFileOnce() 上传数据表:{0},文件:{1}", uploadedtbname, file); _log.Log.DebugFormat("UploadPostproFileOnce() 上传数据表:{0},文件:{1}", uploadedtbname, file);
} }
} }
@ -97,14 +112,11 @@ namespace Txgy.FilesWatcher.model
catch (Exception ex) catch (Exception ex)
{ {
_log.Log.ErrorFormat("UploadPostproFile.UploadPostproFileOnce() error:{0}", ex); _log.Log.ErrorFormat("UploadPostproFile.UploadPostproFileOnce() error:{0}", ex);
System.Windows.MessageBox.Show(ex.ToString());
} }
_log.Log.Debug("UploadPostproFile.UploadPostproFileOnce() < exit....");
} }
public static void UploadPostproFileMQ(Action<string, string> mqAction, string path, string eventMessage) public static void UploadPostproFileMQ(Action<string, string> mqAction, string path, string eventMessage)
{ {
GetLogger _log = new GetLogger("UploadPostproFile"); GetLogger _log = new GetLogger("UploadPostproFile");
_log.Log.Debug("UploadPostproFile.UploadPostproFileMQ() > enter....");
_log.Log.DebugFormat("UploadPostproFile.UploadPostproFileMQ() path:{0},eventMessage:{1}", path, eventMessage); _log.Log.DebugFormat("UploadPostproFile.UploadPostproFileMQ() path:{0},eventMessage:{1}", path, eventMessage);
try try
{ {
@ -141,7 +153,6 @@ namespace Txgy.FilesWatcher.model
{ {
_log.Log.ErrorFormat("UploadPostproFile.UploadPostproFileMQ() error:{0}", ex); _log.Log.ErrorFormat("UploadPostproFile.UploadPostproFileMQ() error:{0}", ex);
} }
_log.Log.Debug("UploadPostproFile.UploadPostproFileMQ() < exit....");
} }
} }

@ -26,7 +26,6 @@ namespace Txgy.FilesWatcher.model
public static void UploadRealtimeFileOnce(string path, string eventMessage, int workAreaId, out bool isUpload) public static void UploadRealtimeFileOnce(string path, string eventMessage, int workAreaId, out bool isUpload)
{ {
GetLogger _log = new GetLogger("UploadRealtimeFile"); GetLogger _log = new GetLogger("UploadRealtimeFile");
_log.Log.Debug("UploadRealtimeFile.UploadRealtimeFileOnce() > enter....");
_log.Log.DebugFormat("UploadRealtimeFile.UploadRealtimeFileOnce() path:{0},eventMessage:{1},workAreaId:{2}", path, eventMessage, workAreaId); _log.Log.DebugFormat("UploadRealtimeFile.UploadRealtimeFileOnce() path:{0},eventMessage:{1},workAreaId:{2}", path, eventMessage, workAreaId);
isUpload = false; isUpload = false;
try try
@ -57,20 +56,29 @@ namespace Txgy.FilesWatcher.model
string EventTime = index_file_line[0].Substring(0, 23); string EventTime = index_file_line[0].Substring(0, 23);
string OriginTime = EventTime; string OriginTime = EventTime;
//.json文件
//上传前检查workAreaId和eventTime string JPath = dFile.FullName.Replace(".mseed", "A.json");
if(File.Exists(JPath))
{ {
//int workAreaId = 10; string mes= File.ReadAllText(JPath);
//string eventTime = "0"; if (!mes.Contains(EventTime))
//if (workAreaId == 0 && eventTime == "0") {
//{ } //和json文件的otime 时间需要一致
continue;
}
} }
//WorkAreaId = 1,更新realtimeeventresult // 上传前检查workAreaId和eventTime
sqlNumber = $"INSERT INTO {tbrealtimeresult}(WorkAreaId, EventTime, OriginTime, X, Y, Z, ML, LocSta, MLSta, RMS) VALUES('{workAreaId}', '{EventTime}', '{OriginTime}', '{index_file_line[1]}', '{index_file_line[2]}', '{index_file_line[3]}', '{index_file_line[5]}', '{index_file_line[7]}', '{index_file_line[8]}', '{index_file_line[6]}')"; sqlNumber = $"SELECT COUNT(*) FROM {tbrealtimeresult} WHERE WorkAreaId = '{workAreaId}' && EventTime='{EventTime}'";
var res = conn.Execute(sqlNumber); cmd = new MySqlCommand(sqlNumber, conn);
int b = conn.QueryFirst<int>(sqlNumber);
if (b == 0)
{
sqlNumber = $"INSERT INTO {tbrealtimeresult}(WorkAreaId, EventTime, OriginTime, X, Y, Z, ML, LocSta, MLSta, RMS) VALUES('{workAreaId}', '{EventTime}', '{OriginTime}', '{index_file_line[1]}', '{index_file_line[2]}', '{index_file_line[3]}', '{index_file_line[5]}', '{index_file_line[7]}', '{index_file_line[8]}', '{index_file_line[6]}')";
conn.Execute(sqlNumber);
_log.Log.DebugFormat("UploadRealtimeFileOnce() 上传数据表:{0},eventMessage:{1}", tbrealtimeresult, eventMessage);
}
isUpload = true; isUpload = true;
_log.Log.DebugFormat("UploadRealtimeFileOnce() 上传数据表:{0},eventMessage:{1}", tbrealtimeresult, eventMessage);
// .mseed文件 // .mseed文件
FileStream fs = new FileStream(dFile.FullName, FileMode.Open, FileAccess.Read); FileStream fs = new FileStream(dFile.FullName, FileMode.Open, FileAccess.Read);
BinaryReader mbr = new BinaryReader(fs); BinaryReader mbr = new BinaryReader(fs);
@ -97,12 +105,11 @@ namespace Txgy.FilesWatcher.model
{ {
sqlNumber = $"INSERT INTO {tbname} (EventTime, WorkAreaID, WaveData, JsonFile) VALUES('{EventTime}', '{workAreaId}', @mDatas, @jDatas);"; sqlNumber = $"INSERT INTO {tbname} (EventTime, WorkAreaID, WaveData, JsonFile) VALUES('{EventTime}', '{workAreaId}', @mDatas, @jDatas);";
MySqlCommand mycomm = new MySqlCommand(sqlNumber, conn); MySqlCommand mycomm = new MySqlCommand(sqlNumber, conn);
res = conn.Execute(sqlNumber, new { mDatas = mseedDatas, jDatas = jsonDatas }); conn.Execute(sqlNumber, new { mDatas = mseedDatas, jDatas = jsonDatas });
_log.Log.DebugFormat("UploadRealtimeFileOnce() 上传数据表:{0}", tbname); _log.Log.DebugFormat("UploadRealtimeFileOnce() 上传数据表:{0}", tbname);
} }
sqlNumber = $"INSERT INTO {uploadedtbname}(filename, uploadtime) VALUES('{file}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"; sqlNumber = $"INSERT INTO {uploadedtbname}(filename, uploadtime) VALUES('{file}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')";
res = conn.Execute(sqlNumber); int res = conn.Execute(sqlNumber);
_log.Log.DebugFormat("UploadRealtimeFileOnce() 上传数据表:{0},文传:{1}", uploadedtbname, file); _log.Log.DebugFormat("UploadRealtimeFileOnce() 上传数据表:{0},文传:{1}", uploadedtbname, file);
} }
@ -112,15 +119,12 @@ namespace Txgy.FilesWatcher.model
catch (Exception ex) catch (Exception ex)
{ {
_log.Log.ErrorFormat("UploadRealtimeFile.UploadRealtimeFileOnce() error:{0}", ex); _log.Log.ErrorFormat("UploadRealtimeFile.UploadRealtimeFileOnce() error:{0}", ex);
MessageBox.Show(ex.ToString());
} }
_log.Log.Debug("UploadRealtimeFile.UploadRealtimeFileOnce() < exit....");
} }
public static void UploadRealtimeFileMQ(Action<string, string> mqAction, string path, string eventMessage) public static void UploadRealtimeFileMQ(Action<string, string> mqAction, string path, string eventMessage)
{ {
GetLogger _log = new GetLogger("UploadRealtimeFile"); GetLogger _log = new GetLogger("UploadRealtimeFile");
_log.Log.Debug("UploadRealtimeFile.UploadRealtimeFileMQ() > enter....");
_log.Log.DebugFormat("UploadRealtimeFile.UploadRealtimeFileMQ() path:{0},eventMessage:{1}", path, eventMessage); _log.Log.DebugFormat("UploadRealtimeFile.UploadRealtimeFileMQ() path:{0},eventMessage:{1}", path, eventMessage);
try try
{ {
@ -151,10 +155,8 @@ namespace Txgy.FilesWatcher.model
} }
catch (Exception ex) catch (Exception ex)
{ {
//MessageBox.Show(ex.ToString());
_log.Log.ErrorFormat("UploadRealtimeFile.UploadRealtimeFileMQ() error:{0}", ex); _log.Log.ErrorFormat("UploadRealtimeFile.UploadRealtimeFileMQ() error:{0}", ex);
} }
_log.Log.Debug("UploadRealtimeFile.UploadRealtimeFileMQ() < exit....");
} }
} }

@ -9,6 +9,9 @@
"toolpath": "post20231119", "toolpath": "post20231119",
// //
"mseedpath": "NET2023", "mseedpath": "NET2023",
//
"workAreaId": 8,
"cycleTime": 3600,
"mQTTConfig": { "mQTTConfig": {
"serverIP": "49.232.209.49", "serverIP": "49.232.209.49",
"port": 1883, "port": 1883,

Loading…
Cancel
Save