1增加WorkAreaId设置,

2 修改时间格式;
master
mzhifa 10 months ago
parent 25827e5273
commit 1e1ba85733

@ -121,34 +121,17 @@ namespace Txgy.FilesWatcher.ViewModels
get { return account; } get { return account; }
set { SetProperty(ref account, value); } set { SetProperty(ref account, value); }
} }
private string password="123"; private int workAreaId = 1;
public string Password public int WorkAreaId
{ {
get { return password; } get { return workAreaId; }
set { SetProperty(ref password, value); } set { SetProperty(ref workAreaId, value); }
} }
private string _loginContent="登 录";
public string LoginContent
{
get { return _loginContent; }
set { SetProperty(ref _loginContent, value); }
}
bool isLogin = false; bool isLogin = false;
public DelegateCommand LoginCommand => new(() => { public DelegateCommand SureCommand => new(() => {
if (!isLogin)
{
this.ShowLoading();
// _websocketClient.SiginServer(Account, Password);
}
else
{
isLogin = false;
LoginContent = "登 录";
// _websocketClient.Closed();
}
}); });
public DelegateCommand StartCommand => new(Start); public DelegateCommand StartCommand => new(Start);
@ -220,7 +203,7 @@ namespace Txgy.FilesWatcher.ViewModels
// path = "I:\\DATA/NET2023/06/22/22/56"; // path = "I:\\DATA/NET2023/06/22/22/56";
if (Directory.Exists(path)) if (Directory.Exists(path))
{ {
UploadMseedFile.UploadMSeedOnce(path); UploadMseedFile.UploadMSeedOnce(path, WorkAreaId);
} }
} }
@ -316,12 +299,12 @@ namespace Txgy.FilesWatcher.ViewModels
if (watch != null && watch.Path == watcherArray[0].Path) if (watch != null && watch.Path == watcherArray[0].Path)
{ {
watcherArray[0].EnableRaisingEvents = false; watcherArray[0].EnableRaisingEvents = false;
UploadRealtimeFile.UploadRealtimeFileOnce(e.FullPath, lastLine); UploadRealtimeFile.UploadRealtimeFileOnce(e.FullPath, lastLine, WorkAreaId);
} }
else if (watch != null && watch.Path == watcherArray[1].Path) else if (watch != null && watch.Path == watcherArray[1].Path)
{ {
watcherArray[1].EnableRaisingEvents = false; watcherArray[1].EnableRaisingEvents = false;
UploadPostproFile.UploadPostproFileOnce(watcherArray[1].Path, lastLine); UploadPostproFile.UploadPostproFileOnce(watcherArray[1].Path, lastLine, WorkAreaId);
} }
var str= dataList.Where(f => f.Data == lastLine).FirstOrDefault(); var str= dataList.Where(f => f.Data == lastLine).FirstOrDefault();
if (!string.IsNullOrWhiteSpace(lastLine) if (!string.IsNullOrWhiteSpace(lastLine)

@ -17,7 +17,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Row="0"> <StackPanel Grid.Row="0">
</StackPanel> </StackPanel>
<GroupBox Header="文件监控管理" IsEnabled="{Binding ElementName=rtnConnect, Path=IsChecked}" Style="{StaticResource GroupBoxOriginal}" BorderThickness="3" Margin="1"> <GroupBox Header="文件上传管理" IsEnabled="{Binding ElementName=rtnConnect, Path=IsChecked}" Style="{StaticResource GroupBoxOriginal}" BorderThickness="3" Margin="1">
<Grid Margin="10"> <Grid Margin="10">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
@ -33,21 +33,17 @@
<RowDefinition Height="30*"/> <RowDefinition Height="30*"/>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.ColumnSpan="2" Visibility="Hidden"> <Grid Grid.Row="0" Grid.ColumnSpan="2" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="30"/> <RowDefinition Height="30"/>
<RowDefinition Height="10*"/> <RowDefinition Height="10*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DockPanel Grid.Row="0" > <DockPanel Grid.Row="0" >
<TextBlock Text="用户名" VerticalAlignment="Center"/> <TextBlock Text="WorkAreaId" VerticalAlignment="Center"/>
<TextBox Text="{Binding Account}" DockPanel.Dock="Right"/> <hc:NumericUpDown Value="{Binding WorkAreaId}" DockPanel.Dock="Right"/>
</DockPanel> </DockPanel>
<DockPanel Grid.Row="1" > <Button Grid.Row="2" Content="确定" Command="{Binding SureCommand}"/>
<TextBlock Text="密 码:" VerticalAlignment="Center"/>
<hc:PasswordBox UnsafePassword="{Binding Password,UpdateSourceTrigger=PropertyChanged}" IsSafeEnabled="False" ShowClearButton="True" ShowEyeButton="True" DockPanel.Dock="Right"/>
</DockPanel>
<Button Grid.Row="2" Content="{Binding LoginContent}" Command="{Binding LoginCommand}" Visibility="Hidden"/>
</Grid> </Grid>
<RadioButton GroupName="start" Content="启动" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"> <RadioButton GroupName="start" Content="启动" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">
<i:Interaction.Triggers> <i:Interaction.Triggers>

@ -11,7 +11,6 @@ namespace Txgy.FilesWatcher.model
public class DBConfig public class DBConfig
{ {
private static readonly string _connStr; private static readonly string _connStr;
private static IDbConnection Cnn => new MySqlConnection(_connStr);
static DBConfig() static DBConfig()
{ {
_connStr = "Server=bj-cdb-q64mbxr6.sql.tencentcdb.com;Port=60027;Database=yuwu2021;Uid=yuwudba;Pwd=Yw123456;charset='utf8'"; _connStr = "Server=bj-cdb-q64mbxr6.sql.tencentcdb.com;Port=60027;Database=yuwu2021;Uid=yuwudba;Pwd=Yw123456;charset='utf8'";
@ -19,54 +18,47 @@ namespace Txgy.FilesWatcher.model
public static MySqlConnection OpenConnection() public static MySqlConnection OpenConnection()
{ {
MySqlConnection connection = new MySqlConnection(_connStr); MySqlConnection connection = new MySqlConnection(_connStr);
// SimpleCRUD.SetDialect(SimpleCRUD.Dialect.MySQL);
connection.Open(); connection.Open();
return connection; return connection;
} }
public string getConfig(string configkey)
{
return "";
}
///////////////////////////////// /////////////////////////////////
//createtables 配置 //createtables 配置
//起始台站号 //起始台站号
public int stationNoStart = 02; public int stationNoStart = 02;
//结束台站号 //结束台站号
public int stationNoend => 27; public int stationNoend = 27;
//起始年月 //起始年月
public string YearMonthStart => "2022-03"; public string YearMonthStart = "2022-03";
//结束年月 //结束年月
public string YearMonthend => "2027-03"; public string YearMonthend = "2027-03";
//uploadminiseed 配置(以分钟为单位) //uploadminiseed 配置(以分钟为单位)
//Miniseed文件路径BASE public string MiniseedPathBase = "Y:/YuwuN3102mseed/NET2023";
public string MiniseedPathBase => "Y:/YuwuN3102mseed/NET2023";
//从当前年、月、日、时、分往以前X分钟 //从当前年、月、日、时、分往以前X分钟
//'BeforeNMin' => 60*24*1, //'BeforeNMin' => 60*24*1,
public int BeforeNMin => 60 * 1 * 1; public int BeforeNMin = 60 * 1 * 1;
//从当前年、月、日、时、分往以后X分钟 //从当前年、月、日、时、分往以后X分钟
//'AfterNMin' => 60*24*1, //'AfterNMin' => 60*24*1,
public int AfterNMin => 10 * 1 * 1; public int AfterNMin = 10 * 1 * 1;
/////////////////////////////////
///////////////////////////////// /////////////////////////////////
//uploadrealtime 配置(以天为单位) //uploadrealtime 配置(以天为单位)
//realtimeEvent文件路径BASE //realtimeEvent文件路径BASE
public string EventPathBase => "Y:/YuwuN3102mseed/"; public string EventPathBase = "Y:/YuwuN3102mseed/";
//从当前年、月、日往以前X天 //从当前年、月、日往以前X天
public int EventBeforeNDay => 3; public int EventBeforeNDay = 3;
//从当前年、月、日往以后X天 //从当前年、月、日往以后X天
public int EventAfterNDay => 1; public int EventAfterNDay = 1;
/////////////////////////////////
/////////////////////////////////
//uploadpostpro 配置(以天为单位)
//PostProEvent文件路径BASE //PostProEvent文件路径BASE
public string PostProEventPathBase => "Y:/YuwuN3102mseed/post/"; public string PostProEventPathBase = "Y:/YuwuN3102mseed/post/";
//从当前年、月、日往以前X天 //从当前年、月、日往以前X天
public int PostProEventBeforeNDa => 3; public int PostProEventBeforeNDa = 3;
//从当前年、月、日往以后X天 //从当前年、月、日往以后X天
public int PostProEventAfterNDay => 1; public int PostProEventAfterNDay = 1;
} }
} }

@ -12,7 +12,6 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq; using System.Xml.Linq;
using Txgy.FilesWatcher.DBModels; using Txgy.FilesWatcher.DBModels;
using static System.Net.WebRequestMethods;
namespace Txgy.FilesWatcher.model namespace Txgy.FilesWatcher.model
{ {
@ -60,7 +59,7 @@ namespace Txgy.FilesWatcher.model
} }
catch (Exception ex) catch (Exception ex)
{ {
throw ex; System.Windows.MessageBox.Show(ex.ToString());
} }
} }

@ -35,7 +35,6 @@ namespace Txgy.FilesWatcher.model
var a = conn.QueryFirst<int>(sqlNumber); var a = conn.QueryFirst<int>(sqlNumber);
if (a == 0) if (a == 0)
{ {
// string WaveTime = $"{file.Substring(3, 4)}-{file.Substring(7, 2)}-{file.Substring(9, 2)}T{file.Substring(12, 2)}:{file.Substring(14, 2)}:{file.Substring(16, 2)}";
string[] index_file_line = eventMessage.Split(" "); string[] index_file_line = eventMessage.Split(" ");
string EventTime = index_file_line[0].Substring(0, 23); string EventTime = index_file_line[0].Substring(0, 23);
string OriginTime = EventTime; string OriginTime = EventTime;

@ -42,7 +42,6 @@ namespace Txgy.FilesWatcher.model
var a = conn.QueryFirst<int>(sqlNumber); var a = conn.QueryFirst<int>(sqlNumber);
if (a==0) if (a==0)
{ {
// string WaveTime = $"{file.Substring(3, 4)}-{file.Substring(7, 2)}-{file.Substring(9, 2)}T{file.Substring(12, 2)}:{file.Substring(14, 2)}:{file.Substring(16, 2)}";
string[] index_file_line = eventMessage.Split(" "); string[] index_file_line = eventMessage.Split(" ");
string EventTime = index_file_line[0].Substring(0, 23); string EventTime = index_file_line[0].Substring(0, 23);
string OriginTime = EventTime; string OriginTime = EventTime;

Loading…
Cancel
Save