|
@ -72,31 +72,35 @@ namespace InjectionPC |
|
|
initProduct(); |
|
|
initProduct(); |
|
|
|
|
|
|
|
|
initBarCode(); |
|
|
initBarCode(); |
|
|
DateTime aa = GetDateTime(); |
|
|
SetBatchText(); |
|
|
|
|
|
|
|
|
if (aa.Hour >= 8 && aa.Hour < 20) |
|
|
////DateTime aa = GetDateTime();
|
|
|
{ |
|
|
//DateTime aa = BasicDAL.GetServerTime();
|
|
|
Program.Shift = "A班"; |
|
|
|
|
|
Program.ProductDate = aa.ToString("yyyy-MM-dd"); |
|
|
//if (aa.Hour >= 8 && aa.Hour < 20)
|
|
|
} |
|
|
//{
|
|
|
else |
|
|
// Program.Shift = "A班";
|
|
|
{ |
|
|
// Program.ProductDate = aa.ToString("yyyy-MM-dd");
|
|
|
Program.Shift = "B班"; |
|
|
//}
|
|
|
if (aa.Hour >= 0 && aa.Hour < 8) |
|
|
//else
|
|
|
{ |
|
|
//{
|
|
|
Program.ProductDate =aa.AddDays(-1).ToString("yyyy-MM-dd"); |
|
|
// Program.Shift = "B班";
|
|
|
//Program.ProductDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
|
|
|
// if (aa.Hour >= 0 && aa.Hour < 8)
|
|
|
} |
|
|
// {
|
|
|
else |
|
|
// Program.ProductDate =aa.AddDays(-1).ToString("yyyy-MM-dd");
|
|
|
{ |
|
|
// //Program.ProductDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
|
|
|
Program.ProductDate = aa.ToString("yyyy-MM-dd"); |
|
|
// }
|
|
|
//Program.ProductDate = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
// else
|
|
|
} |
|
|
// {
|
|
|
} |
|
|
// Program.ProductDate = aa.ToString("yyyy-MM-dd");
|
|
|
comboBox1.Text = Program.Shift; |
|
|
// //Program.ProductDate = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//comboBox1.Text = Program.Shift;
|
|
|
|
|
|
|
|
|
|
|
|
//textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) +
|
|
|
|
|
|
// Program.ProductDate.Substring(8, 2);
|
|
|
|
|
|
|
|
|
textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + |
|
|
|
|
|
Program.ProductDate.Substring(8, 2); |
|
|
|
|
|
if (IsStart == false) |
|
|
if (IsStart == false) |
|
|
{ |
|
|
{ |
|
|
timer1.Enabled = false; |
|
|
timer1.Enabled = false; |
|
@ -206,33 +210,11 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
DataTable pdt3 = null; |
|
|
DataTable pdt3 = null; |
|
|
|
|
|
|
|
|
|
|
|
SetBatchText(); |
|
|
|
|
|
|
|
|
DateTime aa = GetDateTime(); |
|
|
|
|
|
|
|
|
|
|
|
if (aa.Hour >= 8 && aa.Hour < 20) |
|
|
|
|
|
{ |
|
|
|
|
|
Program.Shift = "A班"; |
|
|
|
|
|
Program.ProductDate = aa.ToString("yyyy-MM-dd"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Program.Shift = "B班"; |
|
|
|
|
|
if (aa.Hour >= 0 && aa.Hour < 8) |
|
|
|
|
|
{ |
|
|
|
|
|
Program.ProductDate = aa.AddDays(-1).ToString("yyyy-MM-dd"); |
|
|
|
|
|
//Program.ProductDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Program.ProductDate = aa.ToString("yyyy-MM-dd"); |
|
|
|
|
|
//Program.ProductDate = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
comboBox1.Text = Program.Shift; |
|
|
//LogHelper.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + |
|
|
|
|
|
Program.ProductDate.Substring(8, 2); |
|
|
|
|
|
LogHelper.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
PingReply reply = p1.Send(Program.IP); //发送主机名或Ip地址
|
|
|
PingReply reply = p1.Send(Program.IP); //发送主机名或Ip地址
|
|
@ -841,13 +823,13 @@ namespace InjectionPC |
|
|
timer1.Interval = Program.interVal; |
|
|
timer1.Interval = Program.interVal; |
|
|
timer1.Start(); |
|
|
timer1.Start(); |
|
|
} |
|
|
} |
|
|
void ReloadProduceDate() |
|
|
//void ReloadProduceDate()
|
|
|
{ |
|
|
//{
|
|
|
if (DateTime.Parse(Program.ProductDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) |
|
|
// if (DateTime.Parse(Program.ProductDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))
|
|
|
{ |
|
|
// {
|
|
|
FrmLogin.SetProductDate(); |
|
|
// FrmLogin.SetProductDate();
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
//}
|
|
|
|
|
|
|
|
|
private void label12_Click(object sender, EventArgs e) |
|
|
private void label12_Click(object sender, EventArgs e) |
|
|
{ |
|
|
{ |
|
@ -964,7 +946,7 @@ namespace InjectionPC |
|
|
if (result == DialogResult.OK) |
|
|
if (result == DialogResult.OK) |
|
|
{ |
|
|
{ |
|
|
#region 生成条码
|
|
|
#region 生成条码
|
|
|
|
|
|
SetBatchText(); |
|
|
ProductBLL pbll = new ProductBLL(); |
|
|
ProductBLL pbll = new ProductBLL(); |
|
|
|
|
|
|
|
|
//查询零件号
|
|
|
//查询零件号
|
|
@ -1338,12 +1320,6 @@ namespace InjectionPC |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static bool IsNumeric(string str) |
|
|
|
|
|
{ |
|
|
|
|
|
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$"); |
|
|
|
|
|
return reg1.IsMatch(str); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 补打条码
|
|
|
/// 补打条码
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
@ -1356,45 +1332,37 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DateTime GetDateTime() |
|
|
//public DateTime GetDateTime()
|
|
|
{ |
|
|
//{
|
|
|
string sql = ""; |
|
|
// string sql = "";
|
|
|
DateTime time; |
|
|
// DateTime time;
|
|
|
DataTable dt; |
|
|
// DataTable dt;
|
|
|
try |
|
|
// try
|
|
|
{ |
|
|
// {
|
|
|
sql = @"select convert(char(23),getdate(),121) as time"; |
|
|
// sql = @"select convert(char(23),getdate(),121) as time";
|
|
|
|
|
|
|
|
|
dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; |
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
//time = Convert.ToDateTime(dt.Rows[0]["time"].ToString());
|
|
|
|
|
|
time = DateTime.ParseExact(dt.Rows[0]["time"].ToString(), "yyyy-MM-dd HH:mm:ss.fff", |
|
|
|
|
|
System.Globalization.CultureInfo.CurrentCulture); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
time = DateTime.Now; |
|
|
|
|
|
} |
|
|
|
|
|
return time; |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|
|
|
|
|
return DateTime.Now; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void ReportInitialize() |
|
|
// dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
|
{ |
|
|
// if (dt != null && dt.Rows.Count > 0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //time = Convert.ToDateTime(dt.Rows[0]["time"].ToString());
|
|
|
|
|
|
// time = DateTime.ParseExact(dt.Rows[0]["time"].ToString(), "yyyy-MM-dd HH:mm:ss.fff",
|
|
|
|
|
|
// System.Globalization.CultureInfo.CurrentCulture);
|
|
|
|
|
|
|
|
|
} |
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// time = DateTime.Now;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return time;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
|
|
|
|
// return DateTime.Now;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
private void ReportFetchRecord() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 切换一下计划
|
|
|
/// 切换一下计划
|
|
@ -1515,64 +1483,6 @@ namespace InjectionPC |
|
|
//Process.Start(@"C:\windows\system32\osk.exe");
|
|
|
//Process.Start(@"C:\windows\system32\osk.exe");
|
|
|
ShowInputPanel(); |
|
|
ShowInputPanel(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private const Int32 WM_SYSCOMMAND = 274; |
|
|
|
|
|
|
|
|
|
|
|
private const UInt32 SC_CLOSE = 61536; |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern int RegisterWindowMessage(string lpString); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//显示屏幕键盘
|
|
|
|
|
|
|
|
|
|
|
|
public static int ShowInputPanel() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
dynamic file = "C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe"; |
|
|
|
|
|
|
|
|
|
|
|
if (!System.IO.File.Exists(file)) |
|
|
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
Process.Start(file); |
|
|
|
|
|
|
|
|
|
|
|
//return SetUnDock(); //不知SetUnDock()是什么,所以直接注释返回1
|
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
catch (Exception) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
return 255; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e) |
|
|
private void button1_Click(object sender, EventArgs e) |
|
|
{ |
|
|
{ |
|
|
if (textBox3.Text.Trim() != ConfigurationManager.AppSettings["Psw"]) |
|
|
if (textBox3.Text.Trim() != ConfigurationManager.AppSettings["Psw"]) |
|
@ -1585,13 +1495,13 @@ namespace InjectionPC |
|
|
{ |
|
|
{ |
|
|
panel3.Visible = false; |
|
|
panel3.Visible = false; |
|
|
textBox3.Text = ""; |
|
|
textBox3.Text = ""; |
|
|
string code = "",productName="", reportName=""; |
|
|
string code = "", productName = "", reportName = ""; |
|
|
BarCodeModel md = new BarCodeModel(); |
|
|
BarCodeModel md = new BarCodeModel(); |
|
|
BarCodeBLL bll = new BarCodeBLL(); |
|
|
BarCodeBLL bll = new BarCodeBLL(); |
|
|
ProductBLL pbll = new ProductBLL(); |
|
|
ProductBLL pbll = new ProductBLL(); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (code_g=="") |
|
|
if (code_g == "") |
|
|
{ |
|
|
{ |
|
|
MessageBox.Show("请选择要补打的条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
|
MessageBox.Show("请选择要补打的条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
|
return; |
|
|
return; |
|
@ -1645,7 +1555,7 @@ namespace InjectionPC |
|
|
row["StationNo"] = Program.station; |
|
|
row["StationNo"] = Program.station; |
|
|
row["OneBarCode"] = md.OneBarCode; |
|
|
row["OneBarCode"] = md.OneBarCode; |
|
|
row["BarCode"] = code_g; |
|
|
row["BarCode"] = code_g; |
|
|
row["ProductName"] = productName+";"; |
|
|
row["ProductName"] = productName + ";"; |
|
|
row["IsImport"] = md.Import; |
|
|
row["IsImport"] = md.Import; |
|
|
if (productName.Contains("右")) |
|
|
if (productName.Contains("右")) |
|
|
{ |
|
|
{ |
|
@ -1714,10 +1624,102 @@ namespace InjectionPC |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void textBox3_KeyDown(object sender, KeyEventArgs e) |
|
|
|
|
|
|
|
|
private const Int32 WM_SYSCOMMAND = 274; |
|
|
|
|
|
|
|
|
|
|
|
private const UInt32 SC_CLOSE = 61536; |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] |
|
|
|
|
|
|
|
|
|
|
|
private static extern int RegisterWindowMessage(string lpString); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//显示屏幕键盘
|
|
|
|
|
|
|
|
|
|
|
|
public static int ShowInputPanel() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
dynamic file = "C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe"; |
|
|
|
|
|
|
|
|
|
|
|
if (!System.IO.File.Exists(file)) |
|
|
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
Process.Start(file); |
|
|
|
|
|
|
|
|
|
|
|
//return SetUnDock(); //不知SetUnDock()是什么,所以直接注释返回1
|
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
catch (Exception) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
return 255; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static bool IsNumeric(string str) |
|
|
|
|
|
{ |
|
|
|
|
|
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$"); |
|
|
|
|
|
return reg1.IsMatch(str); |
|
|
|
|
|
} |
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置班组和批次
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
void SetBatchText() |
|
|
{ |
|
|
{ |
|
|
|
|
|
// DateTime aa = GetDateTime();
|
|
|
|
|
|
DateTime aa = BasicDAL.GetServerTime(); |
|
|
|
|
|
|
|
|
|
|
|
if (aa.Hour >= 8 && aa.Hour < 20) |
|
|
|
|
|
{ |
|
|
|
|
|
Program.Shift = "A班"; |
|
|
|
|
|
Program.ProductDate = aa.ToString("yyyy-MM-dd"); |
|
|
} |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Program.Shift = "B班"; |
|
|
|
|
|
if (aa.Hour >= 0 && aa.Hour < 8) |
|
|
|
|
|
{ |
|
|
|
|
|
Program.ProductDate = aa.AddDays(-1).ToString("yyyy-MM-dd"); |
|
|
|
|
|
//Program.ProductDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
Program.ProductDate = aa.ToString("yyyy-MM-dd"); |
|
|
|
|
|
//Program.ProductDate = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
comboBox1.Text = Program.Shift; |
|
|
|
|
|
textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + |
|
|
|
|
|
Program.ProductDate.Substring(8, 2); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|