You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
314 lines
11 KiB
314 lines
11 KiB
3 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Drawing;
|
||
|
using System.Linq;
|
||
|
using System.Reflection;
|
||
|
using System.Security.Permissions;
|
||
|
using System.Text;
|
||
|
using System.Threading;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.Windows.Forms;
|
||
|
using MESClassLibrary;
|
||
|
using MESClassLibrary.BLL.Painting;
|
||
|
using MESClassLibrary.BLL.Log;
|
||
|
|
||
|
namespace PaintingView
|
||
|
{
|
||
|
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
|
||
|
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
|
||
|
|
||
|
public partial class Form1 : Form
|
||
|
{
|
||
|
public Form1()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
private void Form1_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
//webBrowser1.ScriptErrorsSuppressed = true;
|
||
|
StockInBLL bll=new StockInBLL();
|
||
|
|
||
|
try
|
||
|
{
|
||
|
Control.CheckForIllegalCrossThreadCalls = false;
|
||
|
Thread t = new Thread(new ThreadStart(TimeGo));
|
||
|
t.Start();
|
||
|
|
||
|
Thread t2 = new Thread(new ThreadStart(TimeLoad));
|
||
|
t2.Start();
|
||
|
|
||
|
label3.BackColor = System.Drawing.Color.FromArgb(40,153,244);
|
||
|
label9.BackColor = System.Drawing.Color.FromArgb(40, 153, 244);
|
||
|
|
||
|
label20.BackColor = System.Drawing.Color.FromArgb(40, 153, 244);
|
||
|
label14.BackColor = System.Drawing.Color.FromArgb(40, 153, 244);
|
||
|
|
||
|
label4.BackColor = System.Drawing.Color.FromArgb(00, 255, 00);
|
||
|
label10.BackColor = System.Drawing.Color.FromArgb(00, 255, 00);
|
||
|
|
||
|
label19.BackColor = System.Drawing.Color.FromArgb(00, 255, 00);
|
||
|
label13.BackColor = System.Drawing.Color.FromArgb(00, 255, 00);
|
||
|
#region 07:30-19:30
|
||
|
|
||
|
if (DateTime.Now > DateTime.Parse(DateTime.Now.ToShortDateString() + " 07:30:00") && DateTime.Now < DateTime.Parse(DateTime.Now.ToShortDateString() + " 19:30:00"))
|
||
|
{
|
||
|
DataTable dtA = bll.SearchInfoA();
|
||
|
if (dtA != null && dtA.Rows.Count > 0)
|
||
|
{
|
||
|
label6.Text = dtA.Rows[0]["c1"].ToString();
|
||
|
label7.Text = dtA.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label6.Text = "0";
|
||
|
label7.Text = "0";
|
||
|
}
|
||
|
|
||
|
DataTable dtBA = bll.SearchInfoBByA();
|
||
|
if (dtBA != null && dtBA.Rows.Count > 0)
|
||
|
{
|
||
|
label16.Text = dtBA.Rows[0]["c1"].ToString();
|
||
|
label17.Text = dtBA.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label16.Text = "0";
|
||
|
label17.Text = "0";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 19:30-00:00
|
||
|
|
||
|
if (DateTime.Now > DateTime.Parse(DateTime.Now.ToShortDateString() + " 19:30:00") && DateTime.Now < DateTime.Parse(DateTime.Now.ToShortDateString() + " 23:59:59"))
|
||
|
{
|
||
|
DataTable dtA2 = bll.SearchInfoA();
|
||
|
if (dtA2 != null && dtA2.Rows.Count > 0)
|
||
|
{
|
||
|
label6.Text = dtA2.Rows[0]["c1"].ToString();
|
||
|
label7.Text = dtA2.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label6.Text = "0";
|
||
|
label7.Text = "0";
|
||
|
}
|
||
|
|
||
|
DataTable dtB1 = bll.SearchInfoB();
|
||
|
if (dtB1 != null && dtB1.Rows.Count > 0)
|
||
|
{
|
||
|
label16.Text = dtB1.Rows[0]["c1"].ToString();
|
||
|
label17.Text = dtB1.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label16.Text = "0";
|
||
|
label17.Text = "0";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 0:00-7:30
|
||
|
|
||
|
if (DateTime.Now > DateTime.Parse(DateTime.Now.ToShortDateString() + " 00:00:00") && DateTime.Now < DateTime.Parse(DateTime.Now.ToShortDateString() + " 07:30:00"))
|
||
|
{
|
||
|
DataTable dtA3 = bll.SearchInfoAByB();
|
||
|
if (dtA3 != null && dtA3.Rows.Count > 0)
|
||
|
{
|
||
|
label6.Text = dtA3.Rows[0]["c1"].ToString();
|
||
|
label7.Text = dtA3.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label6.Text = "0";
|
||
|
label7.Text = "0";
|
||
|
}
|
||
|
|
||
|
DataTable dtB1 = bll.SearchInfoB();
|
||
|
if (dtB1 != null && dtB1.Rows.Count > 0)
|
||
|
{
|
||
|
label16.Text = dtB1.Rows[0]["c1"].ToString();
|
||
|
label17.Text = dtB1.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label16.Text = "0";
|
||
|
label17.Text = "0";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void TimeGo()
|
||
|
{
|
||
|
System.Timers.Timer timer = new System.Timers.Timer();
|
||
|
timer.Interval = 10;
|
||
|
timer.Enabled = true;
|
||
|
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Tick);
|
||
|
}
|
||
|
|
||
|
private void timer_Tick(object sender, EventArgs e)
|
||
|
{
|
||
|
label2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
|
Thread.Sleep(500);
|
||
|
}
|
||
|
|
||
|
private void TimeLoad()
|
||
|
{
|
||
|
System.Timers.Timer timer = new System.Timers.Timer();
|
||
|
timer.Interval = 5000;
|
||
|
timer.Enabled = true;
|
||
|
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer2_Tick);
|
||
|
}
|
||
|
|
||
|
private void timer2_Tick(object sender, EventArgs e)
|
||
|
{
|
||
|
|
||
|
try
|
||
|
{
|
||
|
StockInBLL bll = new StockInBLL();
|
||
|
#region 7:30-19:30
|
||
|
|
||
|
if (DateTime.Now > DateTime.Parse(DateTime.Now.ToShortDateString() + " 07:30:00") && DateTime.Now < DateTime.Parse(DateTime.Now.ToShortDateString() + " 19:30:00"))
|
||
|
{
|
||
|
DataTable dtA = bll.SearchInfoA();
|
||
|
if (dtA != null && dtA.Rows.Count > 0)
|
||
|
{
|
||
|
label6.Text = dtA.Rows[0]["c1"].ToString();
|
||
|
label7.Text = dtA.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label6.Text = "0";
|
||
|
label7.Text = "0";
|
||
|
}
|
||
|
|
||
|
DataTable dtBA = bll.SearchInfoBByA();
|
||
|
if (dtBA != null && dtBA.Rows.Count > 0)
|
||
|
{
|
||
|
label16.Text = dtBA.Rows[0]["c1"].ToString();
|
||
|
label17.Text = dtBA.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label16.Text = "0";
|
||
|
label17.Text = "0";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 19:30-00:00
|
||
|
|
||
|
if (DateTime.Now > DateTime.Parse(DateTime.Now.ToShortDateString() + " 19:30:00") && DateTime.Now < DateTime.Parse(DateTime.Now.ToShortDateString() + " 23:59:59"))
|
||
|
{
|
||
|
DataTable dtA2 = bll.SearchInfoA();
|
||
|
if (dtA2 != null && dtA2.Rows.Count > 0)
|
||
|
{
|
||
|
label6.Text = dtA2.Rows[0]["c1"].ToString();
|
||
|
label7.Text = dtA2.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label6.Text = "0";
|
||
|
label7.Text = "0";
|
||
|
}
|
||
|
|
||
|
DataTable dtB1 = bll.SearchInfoB();
|
||
|
if (dtB1 != null && dtB1.Rows.Count > 0)
|
||
|
{
|
||
|
label16.Text = dtB1.Rows[0]["c1"].ToString();
|
||
|
label17.Text = dtB1.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label16.Text = "0";
|
||
|
label17.Text = "0";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 0:00-7:30
|
||
|
|
||
|
if (DateTime.Now > DateTime.Parse(DateTime.Now.ToShortDateString() + " 00:00:00") && DateTime.Now < DateTime.Parse(DateTime.Now.ToShortDateString() + " 07:30:00"))
|
||
|
{
|
||
|
DataTable dtA3 = bll.SearchInfoAByB();
|
||
|
if (dtA3 != null && dtA3.Rows.Count > 0)
|
||
|
{
|
||
|
label6.Text = dtA3.Rows[0]["c1"].ToString();
|
||
|
label7.Text = dtA3.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label6.Text = "0";
|
||
|
label7.Text = "0";
|
||
|
}
|
||
|
|
||
|
DataTable dtB1 = bll.SearchInfoB();
|
||
|
if (dtB1 != null && dtB1.Rows.Count > 0)
|
||
|
{
|
||
|
label16.Text = dtB1.Rows[0]["c1"].ToString();
|
||
|
label17.Text = dtB1.Rows[0]["c2"].ToString();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
label16.Text = "0";
|
||
|
label17.Text = "0";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
||
|
}
|
||
|
|
||
|
Thread.Sleep(500);
|
||
|
}
|
||
|
|
||
|
private void button1_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
Program.a = 1;
|
||
|
FrmDetail fr=new FrmDetail();
|
||
|
fr.Show();
|
||
|
}
|
||
|
|
||
|
private void button2_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
Program.a = 2;
|
||
|
FrmDetail fr = new FrmDetail();
|
||
|
fr.Show();
|
||
|
}
|
||
|
|
||
|
private void label2_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
Environment.Exit(0);
|
||
|
}
|
||
|
|
||
|
protected override void OnVisibleChanged(EventArgs e)
|
||
|
{
|
||
|
base.OnVisibleChanged(e);
|
||
|
if (!IsHandleCreated)
|
||
|
{
|
||
|
this.Close();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|