SVN-Revision: r848
This commit is contained in:
wyf
2025-07-09 08:50:38 +00:00
parent 16c8b9e19f
commit 664fd1c749
2 changed files with 568 additions and 220 deletions
+333 -126
View File
@@ -30,205 +30,412 @@ namespace LadfDataApp
private void InitializeComponent()
{
this.loginInfoPanel = new System.Windows.Forms.Panel();
this.timeUnitLab = new System.Windows.Forms.Label();
this.timeIntervalLab = new System.Windows.Forms.Label();
this.timeIntervalBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.projectComboBox = new System.Windows.Forms.ComboBox();
this.panel2 = new System.Windows.Forms.Panel();
this.tipsTextBox = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dataBaseLab = new System.Windows.Forms.Label();
this.dataBaseBox = new System.Windows.Forms.TextBox();
this.serverLab = new System.Windows.Forms.Label();
this.serverBox = new System.Windows.Forms.TextBox();
this.startBtn = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.loginPasswordBox = new System.Windows.Forms.TextBox();
this.loginNameLab = new System.Windows.Forms.Label();
this.loginNameBox = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.tipsTextBox = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.radioNext = new System.Windows.Forms.RadioButton();
this.panel3 = new System.Windows.Forms.Panel();
this.radioFix = new System.Windows.Forms.RadioButton();
this.panelFix = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.fixEndDate = new System.Windows.Forms.DateTimePicker();
this.fixStartDate = new System.Windows.Forms.DateTimePicker();
this.panel5 = new System.Windows.Forms.Panel();
this.panelNext = new System.Windows.Forms.Panel();
this.nextStartDate = new System.Windows.Forms.DateTimePicker();
this.timeUnitLab = new System.Windows.Forms.Label();
this.timeIntervalLab = new System.Windows.Forms.Label();
this.timeIntervalBox = new System.Windows.Forms.TextBox();
this.linkBtn = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.projectComboBox = new System.Windows.Forms.ComboBox();
this.startBtn = new System.Windows.Forms.Button();
this.loginInfoPanel.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.panel3.SuspendLayout();
this.panelFix.SuspendLayout();
this.panel5.SuspendLayout();
this.panelNext.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// loginInfoPanel
//
this.loginInfoPanel.BackColor = System.Drawing.SystemColors.Control;
this.loginInfoPanel.Controls.Add(this.timeUnitLab);
this.loginInfoPanel.Controls.Add(this.timeIntervalLab);
this.loginInfoPanel.Controls.Add(this.timeIntervalBox);
this.loginInfoPanel.Controls.Add(this.label2);
this.loginInfoPanel.Controls.Add(this.projectComboBox);
this.loginInfoPanel.Controls.Add(this.dataBaseLab);
this.loginInfoPanel.Controls.Add(this.dataBaseBox);
this.loginInfoPanel.Controls.Add(this.serverLab);
this.loginInfoPanel.Controls.Add(this.serverBox);
this.loginInfoPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.loginInfoPanel.Controls.Add(this.startBtn);
this.loginInfoPanel.Controls.Add(this.label1);
this.loginInfoPanel.Controls.Add(this.loginPasswordBox);
this.loginInfoPanel.Controls.Add(this.loginNameLab);
this.loginInfoPanel.Controls.Add(this.loginNameBox);
this.loginInfoPanel.Controls.Add(this.groupBox3);
this.loginInfoPanel.Controls.Add(this.groupBox2);
this.loginInfoPanel.Controls.Add(this.groupBox4);
this.loginInfoPanel.Controls.Add(this.groupBox1);
this.loginInfoPanel.Dock = System.Windows.Forms.DockStyle.Top;
this.loginInfoPanel.Location = new System.Drawing.Point(0, 0);
this.loginInfoPanel.Name = "loginInfoPanel";
this.loginInfoPanel.Size = new System.Drawing.Size(603, 164);
this.loginInfoPanel.Size = new System.Drawing.Size(614, 303);
this.loginInfoPanel.TabIndex = 0;
//
// panel2
//
this.panel2.Controls.Add(this.tipsTextBox);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 303);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(614, 332);
this.panel2.TabIndex = 1;
//
// tipsTextBox
//
this.tipsTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tipsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tipsTextBox.Location = new System.Drawing.Point(0, 0);
this.tipsTextBox.Multiline = true;
this.tipsTextBox.Name = "tipsTextBox";
this.tipsTextBox.ReadOnly = true;
this.tipsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tipsTextBox.Size = new System.Drawing.Size(614, 332);
this.tipsTextBox.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.linkBtn);
this.groupBox1.Controls.Add(this.dataBaseLab);
this.groupBox1.Controls.Add(this.dataBaseBox);
this.groupBox1.Controls.Add(this.serverLab);
this.groupBox1.Controls.Add(this.serverBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.loginPasswordBox);
this.groupBox1.Controls.Add(this.loginNameLab);
this.groupBox1.Controls.Add(this.loginNameBox);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(612, 109);
this.groupBox1.TabIndex = 14;
this.groupBox1.TabStop = false;
//
// dataBaseLab
//
this.dataBaseLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.dataBaseLab.Location = new System.Drawing.Point(309, 44);
this.dataBaseLab.Name = "dataBaseLab";
this.dataBaseLab.Size = new System.Drawing.Size(70, 25);
this.dataBaseLab.TabIndex = 18;
this.dataBaseLab.Text = "数据库:";
this.dataBaseLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// dataBaseBox
//
this.dataBaseBox.Location = new System.Drawing.Point(385, 44);
this.dataBaseBox.Name = "dataBaseBox";
this.dataBaseBox.Size = new System.Drawing.Size(200, 21);
this.dataBaseBox.TabIndex = 17;
//
// serverLab
//
this.serverLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.serverLab.Location = new System.Drawing.Point(13, 44);
this.serverLab.Name = "serverLab";
this.serverLab.Size = new System.Drawing.Size(70, 25);
this.serverLab.TabIndex = 16;
this.serverLab.Text = "服务器:";
this.serverLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// serverBox
//
this.serverBox.Location = new System.Drawing.Point(89, 44);
this.serverBox.Name = "serverBox";
this.serverBox.Size = new System.Drawing.Size(200, 21);
this.serverBox.TabIndex = 15;
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(309, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 25);
this.label1.TabIndex = 14;
this.label1.Text = "密 码:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// loginPasswordBox
//
this.loginPasswordBox.Location = new System.Drawing.Point(385, 17);
this.loginPasswordBox.Name = "loginPasswordBox";
this.loginPasswordBox.PasswordChar = '●';
this.loginPasswordBox.Size = new System.Drawing.Size(200, 21);
this.loginPasswordBox.TabIndex = 13;
//
// loginNameLab
//
this.loginNameLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.loginNameLab.Location = new System.Drawing.Point(13, 17);
this.loginNameLab.Name = "loginNameLab";
this.loginNameLab.Size = new System.Drawing.Size(70, 25);
this.loginNameLab.TabIndex = 12;
this.loginNameLab.Text = "用户名:";
this.loginNameLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// loginNameBox
//
this.loginNameBox.Location = new System.Drawing.Point(89, 17);
this.loginNameBox.Name = "loginNameBox";
this.loginNameBox.Size = new System.Drawing.Size(200, 21);
this.loginNameBox.TabIndex = 11;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.panelFix);
this.groupBox2.Controls.Add(this.panel3);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(0, 151);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(612, 54);
this.groupBox2.TabIndex = 15;
this.groupBox2.TabStop = false;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.panelNext);
this.groupBox3.Controls.Add(this.panel5);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox3.Location = new System.Drawing.Point(0, 205);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(612, 54);
this.groupBox3.TabIndex = 16;
this.groupBox3.TabStop = false;
//
// radioNext
//
this.radioNext.AutoSize = true;
this.radioNext.Location = new System.Drawing.Point(3, 12);
this.radioNext.Name = "radioNext";
this.radioNext.Size = new System.Drawing.Size(71, 16);
this.radioNext.TabIndex = 17;
this.radioNext.TabStop = true;
this.radioNext.Text = "间隔查询";
this.radioNext.UseVisualStyleBackColor = true;
//
// panel3
//
this.panel3.Controls.Add(this.radioFix);
this.panel3.Dock = System.Windows.Forms.DockStyle.Left;
this.panel3.Location = new System.Drawing.Point(3, 17);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(80, 34);
this.panel3.TabIndex = 21;
//
// radioFix
//
this.radioFix.AutoSize = true;
this.radioFix.Location = new System.Drawing.Point(3, 11);
this.radioFix.Name = "radioFix";
this.radioFix.Size = new System.Drawing.Size(71, 16);
this.radioFix.TabIndex = 21;
this.radioFix.Text = "固定查询";
this.radioFix.UseVisualStyleBackColor = true;
//
// panelFix
//
this.panelFix.Controls.Add(this.label3);
this.panelFix.Controls.Add(this.fixEndDate);
this.panelFix.Controls.Add(this.fixStartDate);
this.panelFix.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelFix.Location = new System.Drawing.Point(83, 17);
this.panelFix.Name = "panelFix";
this.panelFix.Size = new System.Drawing.Size(526, 34);
this.panelFix.TabIndex = 22;
//
// label3
//
this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label3.Location = new System.Drawing.Point(226, 6);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(70, 25);
this.label3.TabIndex = 23;
this.label3.Text = "到";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// fixEndDate
//
this.fixEndDate.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.fixEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.fixEndDate.Location = new System.Drawing.Point(302, 7);
this.fixEndDate.Name = "fixEndDate";
this.fixEndDate.ShowUpDown = true;
this.fixEndDate.Size = new System.Drawing.Size(200, 21);
this.fixEndDate.TabIndex = 22;
//
// fixStartDate
//
this.fixStartDate.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.fixStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.fixStartDate.Location = new System.Drawing.Point(6, 7);
this.fixStartDate.Name = "fixStartDate";
this.fixStartDate.ShowUpDown = true;
this.fixStartDate.Size = new System.Drawing.Size(200, 21);
this.fixStartDate.TabIndex = 21;
//
// panel5
//
this.panel5.Controls.Add(this.radioNext);
this.panel5.Dock = System.Windows.Forms.DockStyle.Left;
this.panel5.Location = new System.Drawing.Point(3, 17);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(80, 34);
this.panel5.TabIndex = 22;
//
// panelNext
//
this.panelNext.Controls.Add(this.nextStartDate);
this.panelNext.Controls.Add(this.timeUnitLab);
this.panelNext.Controls.Add(this.timeIntervalLab);
this.panelNext.Controls.Add(this.timeIntervalBox);
this.panelNext.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelNext.Location = new System.Drawing.Point(83, 17);
this.panelNext.Name = "panelNext";
this.panelNext.Size = new System.Drawing.Size(526, 34);
this.panelNext.TabIndex = 23;
//
// nextStartDate
//
this.nextStartDate.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.nextStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.nextStartDate.Location = new System.Drawing.Point(6, 8);
this.nextStartDate.Name = "nextStartDate";
this.nextStartDate.ShowUpDown = true;
this.nextStartDate.Size = new System.Drawing.Size(200, 21);
this.nextStartDate.TabIndex = 25;
//
// timeUnitLab
//
this.timeUnitLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.timeUnitLab.Location = new System.Drawing.Point(243, 127);
this.timeUnitLab.Location = new System.Drawing.Point(457, 7);
this.timeUnitLab.Name = "timeUnitLab";
this.timeUnitLab.Size = new System.Drawing.Size(45, 25);
this.timeUnitLab.TabIndex = 13;
this.timeUnitLab.TabIndex = 24;
this.timeUnitLab.Text = "分钟";
this.timeUnitLab.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// timeIntervalLab
//
this.timeIntervalLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.timeIntervalLab.Location = new System.Drawing.Point(12, 127);
this.timeIntervalLab.Location = new System.Drawing.Point(226, 7);
this.timeIntervalLab.Name = "timeIntervalLab";
this.timeIntervalLab.Size = new System.Drawing.Size(70, 25);
this.timeIntervalLab.TabIndex = 12;
this.timeIntervalLab.TabIndex = 23;
this.timeIntervalLab.Text = "间 隔:";
this.timeIntervalLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// timeIntervalBox
//
this.timeIntervalBox.Location = new System.Drawing.Point(88, 127);
this.timeIntervalBox.Location = new System.Drawing.Point(302, 7);
this.timeIntervalBox.Name = "timeIntervalBox";
this.timeIntervalBox.Size = new System.Drawing.Size(149, 21);
this.timeIntervalBox.TabIndex = 11;
this.timeIntervalBox.TabIndex = 22;
//
// linkBtn
//
this.linkBtn.Location = new System.Drawing.Point(483, 70);
this.linkBtn.Name = "linkBtn";
this.linkBtn.Size = new System.Drawing.Size(102, 31);
this.linkBtn.TabIndex = 21;
this.linkBtn.Text = "连接";
this.linkBtn.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label2);
this.groupBox4.Controls.Add(this.projectComboBox);
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox4.Location = new System.Drawing.Point(0, 109);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(612, 42);
this.groupBox4.TabIndex = 17;
this.groupBox4.TabStop = false;
//
// label2
//
this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(12, 89);
this.label2.Location = new System.Drawing.Point(13, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(70, 25);
this.label2.TabIndex = 10;
this.label2.TabIndex = 23;
this.label2.Text = "项 目:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// projectComboBox
//
this.projectComboBox.FormattingEnabled = true;
this.projectComboBox.Location = new System.Drawing.Point(88, 91);
this.projectComboBox.Location = new System.Drawing.Point(89, 15);
this.projectComboBox.Name = "projectComboBox";
this.projectComboBox.Size = new System.Drawing.Size(200, 20);
this.projectComboBox.TabIndex = 9;
//
// dataBaseLab
//
this.dataBaseLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.dataBaseLab.Location = new System.Drawing.Point(308, 54);
this.dataBaseLab.Name = "dataBaseLab";
this.dataBaseLab.Size = new System.Drawing.Size(70, 25);
this.dataBaseLab.TabIndex = 8;
this.dataBaseLab.Text = "数据库:";
this.dataBaseLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// dataBaseBox
//
this.dataBaseBox.Location = new System.Drawing.Point(384, 54);
this.dataBaseBox.Name = "dataBaseBox";
this.dataBaseBox.Size = new System.Drawing.Size(200, 21);
this.dataBaseBox.TabIndex = 7;
//
// serverLab
//
this.serverLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.serverLab.Location = new System.Drawing.Point(12, 54);
this.serverLab.Name = "serverLab";
this.serverLab.Size = new System.Drawing.Size(70, 25);
this.serverLab.TabIndex = 6;
this.serverLab.Text = "服务器:";
this.serverLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// serverBox
//
this.serverBox.Location = new System.Drawing.Point(88, 54);
this.serverBox.Name = "serverBox";
this.serverBox.Size = new System.Drawing.Size(200, 21);
this.serverBox.TabIndex = 5;
this.projectComboBox.TabIndex = 22;
//
// startBtn
//
this.startBtn.Location = new System.Drawing.Point(482, 127);
this.startBtn.Location = new System.Drawing.Point(483, 263);
this.startBtn.Name = "startBtn";
this.startBtn.Size = new System.Drawing.Size(102, 31);
this.startBtn.TabIndex = 4;
this.startBtn.TabIndex = 18;
this.startBtn.Text = "开始同步";
this.startBtn.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(308, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 25);
this.label1.TabIndex = 3;
this.label1.Text = "密 码:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// loginPasswordBox
//
this.loginPasswordBox.Location = new System.Drawing.Point(384, 18);
this.loginPasswordBox.Name = "loginPasswordBox";
this.loginPasswordBox.PasswordChar = '●';
this.loginPasswordBox.Size = new System.Drawing.Size(200, 21);
this.loginPasswordBox.TabIndex = 2;
//
// loginNameLab
//
this.loginNameLab.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.loginNameLab.Location = new System.Drawing.Point(12, 18);
this.loginNameLab.Name = "loginNameLab";
this.loginNameLab.Size = new System.Drawing.Size(70, 25);
this.loginNameLab.TabIndex = 1;
this.loginNameLab.Text = "用户名:";
this.loginNameLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// loginNameBox
//
this.loginNameBox.Location = new System.Drawing.Point(88, 18);
this.loginNameBox.Name = "loginNameBox";
this.loginNameBox.Size = new System.Drawing.Size(200, 21);
this.loginNameBox.TabIndex = 0;
//
// panel2
//
this.panel2.Controls.Add(this.tipsTextBox);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 164);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(603, 364);
this.panel2.TabIndex = 1;
//
// tipsTextBox
//
this.tipsTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tipsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tipsTextBox.Location = new System.Drawing.Point(0, 0);
this.tipsTextBox.Multiline = true;
this.tipsTextBox.Name = "tipsTextBox";
this.tipsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.tipsTextBox.Size = new System.Drawing.Size(603, 364);
this.tipsTextBox.TabIndex = 0;
//
// FrmMain
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(603, 528);
this.ClientSize = new System.Drawing.Size(614, 635);
this.Controls.Add(this.panel2);
this.Controls.Add(this.loginInfoPanel);
this.Name = "FrmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "朗速科技物联网同步平台";
this.loginInfoPanel.ResumeLayout(false);
this.loginInfoPanel.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panelFix.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
this.panelNext.ResumeLayout(false);
this.panelNext.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel loginInfoPanel;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox tipsTextBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label dataBaseLab;
private System.Windows.Forms.TextBox dataBaseBox;
private System.Windows.Forms.Label serverLab;
private System.Windows.Forms.TextBox serverBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox loginPasswordBox;
private System.Windows.Forms.Label loginNameLab;
private System.Windows.Forms.TextBox loginNameBox;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.R
+235 -94
View File
@@ -22,16 +22,25 @@ namespace LadfDataApp
private string sid = string.Empty;//认证码
private System.Timers.Timer timer = new System.Timers.Timer();//指定间隔循环
private int timeInterval = 0;
private DateTime startTime;
public FrmMain()
{
InitializeComponent();
this.Load += OnFrmMainLoad;
this.linkBtn.Click += OnLinkBtnClick;
this.startBtn.Click += OnStartBtnClick;
this.loginNameBox.TextChanged += OnTextChanged;
this.loginPasswordBox.TextChanged += OnTextChanged;
this.radioFix.CheckedChanged += OnCheckedChanged;
this.radioNext.CheckedChanged += OnCheckedChanged;
}
private void OnFrmMainLoad(object sender, EventArgs e)
{
startBtn.Enabled = false;
radioFix.Checked = true;
DateTime nowDateTime = DateTime.Now;
fixStartDate.Value = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 0, 0, 0, 0);
fixEndDate.Value = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 23, 59, 59, 999);
nextStartDate.Value = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 0, 0, 0, 0);
this.loginNameBox.Text = ConfigurationManager.AppSettings["loginName"];
this.serverBox.Text = ConfigurationManager.AppSettings["server"];
this.dataBaseBox.Text = ConfigurationManager.AppSettings["database"];
@@ -41,19 +50,20 @@ namespace LadfDataApp
this.loginPasswordBox.Text = "lserpAdmin";
}
}
private void OnTextChanged(object sender, EventArgs e)
private void OnCheckedChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.loginNameBox.Text) && !string.IsNullOrEmpty(this.loginPasswordBox.Text))
if (sender == radioFix && radioFix.Checked)
{
if (Login())
{
InitComboBox();
UpdateMsg($"用户登录成功\r\n");
}
else
{
//UpdateMsg($"用户登录失败\r\n");
}
radioNext.Checked = false;
panelFix.Enabled = true;
panelNext.Enabled = false;
}
if (sender == radioNext && radioNext.Checked)
{
radioFix.Checked = false;
panelFix.Enabled = false;
panelNext.Enabled = true;
}
}
/// <summary>
@@ -99,6 +109,41 @@ namespace LadfDataApp
{
}
}
private void OnLinkBtnClick(object sender, EventArgs e)
{
ClearMsg();
bool isConnection = CreateConnection();
if (!isConnection)
{
startBtn.Enabled = false;
MessageBox.Show("网络连接失败", "提示");
return;
}
if (!Login())
{
startBtn.Enabled = false;
MessageBox.Show("物联网平台登录失败", "提示");
return;
}
string alterSql = $@"if not exists (select 1 from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'p_systemtab' and COLUMN_NAME = 'ProjectEndTime')
BEGIN ALTER TABLE p_systemtab ADD ProjectEndTime datetime END";
SqlHelper.ExecuteNonQuery(alterSql);
string selectSql = $"select ProjectEndTime from p_systemtab";
string endDateTime = SqlHelper.ExecuteScalar(selectSql) + "";
if (!string.IsNullOrEmpty(endDateTime))
{
this.nextStartDate.Value = Convert.ToDateTime(endDateTime);
}
else
{
SqlHelper.ExecuteNonQuery($"update p_systemtab set ProjectEndTime = '{this.nextStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff")}'");
}
InitComboBox();
UpdateMsg("连接成功\r\n");
startBtn.Enabled = true;
}
private void OnStartBtnClick(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.loginNameBox.Text) || string.IsNullOrEmpty(this.loginPasswordBox.Text))
@@ -116,14 +161,75 @@ namespace LadfDataApp
MessageBox.Show("未选择项目", "提示");
return;
}
if (!int.TryParse(this.timeIntervalBox.Text, out timeInterval) && timeInterval <= 0)
bool isConnection = CreateConnection();
if (isConnection)
{
MessageBox.Show("间隔时间必须大于0", "提示");
return;
if (radioFix.Checked)
{
GetDataOnlyOne();
}
else if (radioNext.Checked)
{
if (!int.TryParse(this.timeIntervalBox.Text, out timeInterval) && timeInterval <= 0)
{
MessageBox.Show("间隔时间必须大于0", "提示");
return;
}
timer.Elapsed += OnTimerElapsed;
timer.Interval = 100;
timer.Start();
}
}
else
{
MessageBox.Show("网络连接失败", "提示");
}
}
/// <summary>
/// 获取数据事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GetDataOnlyOne()
{
try
{
this.Invoke(new Action(() =>
{
this.groupBox3.Enabled = false;
this.panelFix.Enabled = false;
this.linkBtn.Enabled = false;
this.startBtn.Enabled = false;
this.loginNameBox.Enabled = false;
this.loginPasswordBox.Enabled = false;
this.serverBox.Enabled = false;
this.dataBaseBox.Enabled = false;
this.timeIntervalBox.Enabled = false;
this.projectComboBox.Enabled = false;
}));
ClearMsg();
QueryProjectList();
UpdateMsg("同步完成,所有数据已成功写入\r\n");
}
catch (Exception)
{
}
finally
{
this.Invoke(new Action(() =>
{
this.groupBox3.Enabled = true;
this.panelFix.Enabled = true;
this.loginNameBox.Enabled = true;
this.loginPasswordBox.Enabled = true;
this.linkBtn.Enabled = true;
this.startBtn.Enabled = true;
this.serverBox.Enabled = true;
this.dataBaseBox.Enabled = true;
this.timeIntervalBox.Enabled = true;
this.projectComboBox.Enabled = true;
}));
}
timer.Elapsed += OnTimerElapsed;
timer.Interval = 100;
timer.Start();
}
/// <summary>
/// 获取数据事件
@@ -132,10 +238,14 @@ namespace LadfDataApp
/// <param name="e"></param>
private void OnTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
timer.Enabled = false;
try
{
this.Invoke(new Action(() =>
{
this.groupBox2.Enabled = false;
this.panelNext.Enabled = false;
this.linkBtn.Enabled = false;
this.startBtn.Enabled = false;
this.loginNameBox.Enabled = false;
this.loginPasswordBox.Enabled = false;
@@ -145,31 +255,46 @@ namespace LadfDataApp
this.projectComboBox.Enabled = false;
}));
if (timer.Interval == 100)
{
startTime = this.nextStartDate.Value;
SqlHelper.ExecuteNonQuery($"update p_systemtab set ProjectEndTime = '{this.nextStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff")}'");
}
else
{
string selectSql = $"select ProjectEndTime from p_systemtab";
string endDateTime = SqlHelper.ExecuteScalar(selectSql) + "";
startTime = this.nextStartDate.Value;
if (!string.IsNullOrEmpty(endDateTime))
{
startTime = Convert.ToDateTime(endDateTime);
}
}
if (timer.Interval == 100)
{
timer.Interval = timeInterval * 60 * 1000;
}
ClearMsg();
QueryProjectList();
UpdateMsg("同步完成,所有数据已成功写入\r\n");
string nextTime = DateTime.Now.AddMinutes(timeInterval).ToString("yyyy-MM-dd HH:mm:ss");
UpdateMsg($"下次同步时间:{nextTime}\r\n");
string nextTime = startTime.AddMinutes(timeInterval).ToString("yyyy-MM-dd HH:mm:ss.fff");
if (startTime.AddMinutes(timeInterval) <= DateTime.Now)
{
QueryProjectList();
UpdateMsg("同步完成,所有数据已成功写入\r\n");
SqlHelper.ExecuteNonQuery($"update p_systemtab set ProjectEndTime = '{startTime.AddMinutes(timeInterval).ToString("yyyy-MM-dd HH:mm:ss.fff")}'");
UpdateMsg($"下次同步时间:{DateTime.Now.AddMinutes(timeInterval).ToString("yyyy-MM-dd HH:mm:ss.fff")}\r\n");
}
else
{
UpdateMsg($"结束时间{nextTime}大于当前时间{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}\r\n");
UpdateMsg($"下次同步时间:{DateTime.Now.AddMinutes(timeInterval).ToString("yyyy-MM-dd HH:mm:ss.fff")}\r\n");
}
}
catch (Exception)
{
}
finally
{
this.Invoke(new Action(() =>
{
this.loginNameBox.Enabled = true;
this.loginPasswordBox.Enabled = true;
this.startBtn.Enabled = true;
this.serverBox.Enabled = true;
this.dataBaseBox.Enabled = true;
this.timeIntervalBox.Enabled = true;
this.projectComboBox.Enabled = true;
}));
}
timer.Enabled = true;
}
/// <summary>
/// 登录
@@ -232,71 +357,63 @@ namespace LadfDataApp
selectProjectName = projectComboBox.SelectedItem + "";
}));
JArray projectArray = (JArray)resultJObject["data"];
bool isConnection = CreateConnection();
if (isConnection)
foreach (JObject projectJObject in projectArray)
{
foreach (JObject projectJObject in projectArray)
try
{
try
if (projectJObject.ContainsKey("name") && (projectJObject["name"] + "").Equals(selectProjectName))
{
if (projectJObject.ContainsKey("name") && (projectJObject["name"] + "").Equals(selectProjectName))
try
{
try
UpdateMsg($"正在读取项目:{projectJObject["name"]}\r\n");
ProjectModel projectModel = new ProjectModel();
projectModel.projectId = projectJObject["id"] + "";
projectModel.name = projectJObject["name"] + "";
projectModel.delFlag = projectJObject["delFlag"] + "";
projectModel.province = projectJObject["province"] + "";
projectModel.city = projectJObject["city"] + "";
projectModel.county = projectJObject["county"] + "";
projectModel.address = projectJObject["address"] + "";
projectModel.propertyOwner = projectJObject["propertyOwner"] + "";
projectModel.constructionTime = projectJObject["constructionTime"] + "";
projectModel.acreage = projectJObject["acreage"] + "";
projectModel.typeId = projectJObject["typeId"] + "";
projectModel.state = projectJObject["state"] + "";
projectModel.enableTime = projectJObject["enableTime"] + "";
projectModel.energyConsumption = projectJObject["energyConsumption"] + "";
projectModel.imgUrl = projectJObject["imgUrl"] + "";
projectModel.remarks = projectJObject["remarks"] + "";
projectModel.contractor = projectJObject["contractor"] + "";
projectModel.propertyMgmt = projectJObject["propertyMgmt"] + "";
projectModel.projectTypeId = projectJObject["projectType"]["id"] + "";
projectModel.projectTypeName = projectJObject["projectType"]["name"] + "";
StringBuilder projectSqlStrBuilder = new StringBuilder();
StringBuilder projectInsertKeys = new StringBuilder();
StringBuilder projectInsertValues = new StringBuilder();
PropertyInfo[] devicePmsPropertyInfos = projectModel.GetType().GetProperties();
foreach (System.Reflection.PropertyInfo projectPropertyInfo in devicePmsPropertyInfos)
{
UpdateMsg($"正在读取项目:{projectJObject["name"]}\r\n");
ProjectModel projectModel = new ProjectModel();
projectModel.projectId = projectJObject["id"] + "";
projectModel.name = projectJObject["name"] + "";
projectModel.delFlag = projectJObject["delFlag"] + "";
projectModel.province = projectJObject["province"] + "";
projectModel.city = projectJObject["city"] + "";
projectModel.county = projectJObject["county"] + "";
projectModel.address = projectJObject["address"] + "";
projectModel.propertyOwner = projectJObject["propertyOwner"] + "";
projectModel.constructionTime = projectJObject["constructionTime"] + "";
projectModel.acreage = projectJObject["acreage"] + "";
projectModel.typeId = projectJObject["typeId"] + "";
projectModel.state = projectJObject["state"] + "";
projectModel.enableTime = projectJObject["enableTime"] + "";
projectModel.energyConsumption = projectJObject["energyConsumption"] + "";
projectModel.imgUrl = projectJObject["imgUrl"] + "";
projectModel.remarks = projectJObject["remarks"] + "";
projectModel.contractor = projectJObject["contractor"] + "";
projectModel.propertyMgmt = projectJObject["propertyMgmt"] + "";
projectModel.projectTypeId = projectJObject["projectType"]["id"] + "";
projectModel.projectTypeName = projectJObject["projectType"]["name"] + "";
StringBuilder projectSqlStrBuilder = new StringBuilder();
StringBuilder projectInsertKeys = new StringBuilder();
StringBuilder projectInsertValues = new StringBuilder();
PropertyInfo[] devicePmsPropertyInfos = projectModel.GetType().GetProperties();
foreach (System.Reflection.PropertyInfo projectPropertyInfo in devicePmsPropertyInfos)
{
projectInsertKeys.Append($"{projectPropertyInfo.Name},");
projectInsertValues.Append($"'{(projectPropertyInfo.GetValue(projectModel, null) + "").Replace("'", "''")}',");
}
projectSqlStrBuilder.Append($"delete from LadfProjectTab where projectid = '{projectModel.projectId}';\r\n" +
$"insert into LadfProjectTab ({projectInsertKeys.ToString().TrimEnd(',')}) values ({projectInsertValues.ToString().TrimEnd(',')});\r\n");
if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
{
SqlHelper.ExecuteNonQuery(projectSqlStrBuilder.ToString());
}
QueryDeviceByProject(projectModel);
UpdateMsg($"项目:{projectJObject["name"]}数据写入完成\r\n");
projectInsertKeys.Append($"{projectPropertyInfo.Name},");
projectInsertValues.Append($"'{(projectPropertyInfo.GetValue(projectModel, null) + "").Replace("'", "''")}',");
}
catch (Exception ex)
projectSqlStrBuilder.Append($"delete from LadfProjectTab where projectid = '{projectModel.projectId}';\r\n" +
$"insert into LadfProjectTab ({projectInsertKeys.ToString().TrimEnd(',')}) values ({projectInsertValues.ToString().TrimEnd(',')});\r\n");
if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
{
UpdateMsg($"项目:{projectJObject["name"]}数据写入失败,原因:{ex.Message}\r\n");
SqlHelper.ExecuteNonQuery(projectSqlStrBuilder.ToString());
}
QueryDeviceByProject(projectModel);
UpdateMsg($"项目:{projectJObject["name"]}数据写入完成\r\n");
}
catch (Exception ex)
{
UpdateMsg($"项目:{projectJObject["name"]}数据写入失败,原因:{ex.Message}\r\n");
}
}
catch (Exception)
{
}
}
}
else
{
UpdateMsg($"读取项目失败,服务器连接失败\r\n");
catch (Exception)
{
}
}
}
else if (code.Equals("4012"))
@@ -316,7 +433,6 @@ namespace LadfDataApp
/// </summary>
private void QueryDeviceByProject(ProjectModel projectModel)
{
StringBuilder projectSqlStrBuilder = new StringBuilder();
UpdateMsg($"正在读取项目:{projectModel.name}的设备\r\n");
try
{
@@ -339,6 +455,7 @@ namespace LadfDataApp
{
try
{
StringBuilder projectSqlStrBuilder = new StringBuilder();
UpdateMsg($"正在读取设备:{deviceJObject["name"]}\r\n");
DeviceModel deviceModel = new DeviceModel();
deviceModel.deviceId = deviceJObject["id"] + "";
@@ -360,10 +477,7 @@ namespace LadfDataApp
deviceInsertKeys.Append($"{devicePropertyInfo.Name},");
deviceInsertValues.Append($"'{(devicePropertyInfo.GetValue(deviceModel, null) + "").Replace("'", "''")}',");
}
projectSqlStrBuilder.Append($"delete from LadfDeviceTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n" +
$"delete from LadfDeviceParamTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n" +
$"delete from LadfDeviceParamStatusTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n" +
$"delete from LadfDeviceParamStatusHistoryTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}' and datetime >= {GetNowTime0Stamp()} and datetime <= {GetNowTime24Stamp()};\r\n");
projectSqlStrBuilder.Append($"delete from LadfDeviceTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n");
projectSqlStrBuilder.Append($"insert into LadfDeviceTab ({deviceInsertKeys.ToString().TrimEnd(',')}) values ({deviceInsertValues.ToString().TrimEnd(',')});\r\n");
if (!string.IsNullOrEmpty(projectSqlStrBuilder.ToString()))
{
@@ -446,7 +560,9 @@ namespace LadfDataApp
deviceParamInsertKeys.Append($"{deviceParamPropertyInfo.Name},");
deviceParamInsertValues.Append($"'{(deviceParamPropertyInfo.GetValue(deviceParamModel, null) + "").Replace("'", "''")}',");
}
projectSqlStrBuilder.Append($"delete from LadfDeviceParamTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n");
projectSqlStrBuilder.Append($"insert into LadfDeviceParamTab ({deviceParamInsertKeys.ToString().TrimEnd(',')}) values ({deviceParamInsertValues.ToString().TrimEnd(',')});\r\n");
projectSqlStrBuilder.Append($"delete from LadfDeviceParamStatusTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}';\r\n");
JArray devicePmsArray = (JArray)deviceParamJObject["jsonParams"];
foreach (JObject devicePmsJObject in devicePmsArray)
{
@@ -516,8 +632,16 @@ namespace LadfDataApp
HttpUtil.setting("application/x-www-form-urlencoded", null, null);
Dictionary<string, string> pmsDic = new Dictionary<string, string>();
pmsDic.Add("deviceId", deviceModel.deviceId);
pmsDic.Add("start", GetNowTime0Stamp());
pmsDic.Add("end", GetNowTime24Stamp());
if (radioFix.Checked)
{
pmsDic.Add("start", GetStamp(fixStartDate.Value));
pmsDic.Add("end", GetStamp(fixEndDate.Value));
}
else
{
pmsDic.Add("start", GetStamp(startTime));
pmsDic.Add("end", GetStamp(startTime.AddMinutes(timeInterval)));
}
pmsDic.Add("type", "1");
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("__sid", sid);
@@ -529,6 +653,14 @@ namespace LadfDataApp
string code = resultJObject["code"] + "";
if (code.Equals("200"))
{
if (radioFix.Checked)
{
projectSqlStrBuilder.Append($"delete from LadfDeviceParamStatusHistoryTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}' and datetime >= {GetStamp(fixStartDate.Value)} and datetime <= {GetStamp(fixEndDate.Value)};\r\n");
}
else if (radioNext.Checked)
{
projectSqlStrBuilder.Append($"delete from LadfDeviceParamStatusHistoryTab where projectid = '{deviceModel.projectId}' and deviceId = '{deviceModel.deviceId}' and datetime >= {GetStamp(startTime)} and datetime <= {GetStamp(startTime.AddMinutes(timeInterval))};\r\n");
}
JArray deviceParamHistoryJArray = (JArray)resultJObject["data"];
foreach (JObject deviceParamHistoryJObject in deviceParamHistoryJArray)
{
@@ -648,5 +780,14 @@ namespace LadfDataApp
int month = DateTime.Now.Month;
int day = DateTime.Now.Day;
DateTime dateTime = new DateTime(year, month, day, 23, 59, 59, 999);
TimeSpan tspan = dateTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(tspan.TotalSeconds).ToString();
}
/// <summary>
/// 获取指定时间的时间戳
/// </summary>
/// <returns></returns>
public string GetStamp(DateTime dateTime)
{
TimeSpan tspan = dateTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Con