From 65803a6e5864ea62822f08be2a6ebf3a1af00b3a Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 01 十二月 2023 15:29:01 +0800
Subject: [PATCH] 1
---
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs | 42 +++++++
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs | 199 +++++++++++++++++++++++++--------------
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache | 0
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo | 0
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb | 0
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt | 2
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs | 2
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe | 0
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe | 0
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb | 0
10 files changed, 166 insertions(+), 79 deletions(-)
diff --git a/WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo b/WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
index f267ced..e3e9b9e 100644
--- a/WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
+++ b/WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
Binary files differ
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs
index 9a28e7d..c3084e3 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs
@@ -38,6 +38,9 @@
this.ListSelect = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.HSouceName = new System.Windows.Forms.TextBox();
+ this.HSouce = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnReadData
@@ -46,14 +49,14 @@
this.btnReadData.Name = "btnReadData";
this.btnReadData.Size = new System.Drawing.Size(114, 35);
this.btnReadData.TabIndex = 1;
- this.btnReadData.Text = "璇诲彇鏁版嵁";
+ this.btnReadData.Text = "鍚姩";
this.btnReadData.UseVisualStyleBackColor = true;
this.btnReadData.Click += new System.EventHandler(this.btnReadData_Click);
//
// yg
//
this.yg.AutoSize = true;
- this.yg.Location = new System.Drawing.Point(348, 47);
+ this.yg.Location = new System.Drawing.Point(348, 66);
this.yg.Name = "yg";
this.yg.Size = new System.Drawing.Size(44, 18);
this.yg.TabIndex = 2;
@@ -61,7 +64,7 @@
//
// HEmpCode
//
- this.HEmpCode.Location = new System.Drawing.Point(398, 44);
+ this.HEmpCode.Location = new System.Drawing.Point(398, 63);
this.HEmpCode.Name = "HEmpCode";
this.HEmpCode.Size = new System.Drawing.Size(118, 28);
this.HEmpCode.TabIndex = 3;
@@ -69,7 +72,7 @@
//
// HEmpCodeName
//
- this.HEmpCodeName.Location = new System.Drawing.Point(522, 44);
+ this.HEmpCodeName.Location = new System.Drawing.Point(522, 63);
this.HEmpCodeName.Name = "HEmpCodeName";
this.HEmpCodeName.ReadOnly = true;
this.HEmpCodeName.Size = new System.Drawing.Size(82, 28);
@@ -109,11 +112,39 @@
this.timer1.Interval = 10000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
+ // HSouceName
+ //
+ this.HSouceName.Location = new System.Drawing.Point(522, 12);
+ this.HSouceName.Name = "HSouceName";
+ this.HSouceName.ReadOnly = true;
+ this.HSouceName.Size = new System.Drawing.Size(82, 28);
+ this.HSouceName.TabIndex = 10;
+ //
+ // HSouce
+ //
+ this.HSouce.Location = new System.Drawing.Point(398, 12);
+ this.HSouce.Name = "HSouce";
+ this.HSouce.Size = new System.Drawing.Size(118, 28);
+ this.HSouce.TabIndex = 9;
+ this.HSouce.KeyDown += new System.Windows.Forms.KeyEventHandler(this.HSouce_KeyDown);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(312, 15);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(80, 18);
+ this.label2.TabIndex = 8;
+ this.label2.Text = "鐢熶骇璧勬簮";
+ //
// ReadyDataForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.HSouceName);
+ this.Controls.Add(this.HSouce);
+ this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.ListSelect);
this.Controls.Add(this.btnSelect);
@@ -138,6 +169,9 @@
private System.Windows.Forms.ListBox ListSelect;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Timer timer1;
+ private System.Windows.Forms.TextBox HSouceName;
+ private System.Windows.Forms.TextBox HSouce;
+ private System.Windows.Forms.Label label2;
}
}
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs
index 7ce3e9f..4f91b32 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs
@@ -20,87 +20,101 @@
{
InitializeComponent();
}
+ public static int num = 0;
//璇诲彇鏁版嵁
private void btnReadData_Click(object sender, EventArgs e)
{
- if (this.HEmpCode.Text == "") {
-
- MessageBox.Show("璇疯緭鍏ュ憳宸ョ紪鐮�");
- }
- else
+ if (num == 0) {
+ this.btnReadData.Text = "鏆傚仠";
+ this.timer1.Enabled = true;
+ num = 1;
+ }else if (num == 1)
{
- int year = DateTime.Now.Year;
- string month = DateTime.Now.Month.ToString();
- string day = DateTime.Now.Day.ToString();
-
- string dataTime = DateTime.Now.ToString("yyyyMMdd");
- ////鍒ゆ柇鏄惁鏈夎繖涓枃浠�
- //bool flag = File.Exists($@"D:\{year}\{month}\{day}\{dataTime}.txt");
- bool flag = File.Exists($@"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\20231123.txt");
-
- if (flag)
- {
- //StreamReader stream = new StreamReader($@"D:\{year}\{month}\{day}\{dataTime}.txt", Encoding.GetEncoding("gb2312"));
- StreamReader stream = new StreamReader($@"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\20231123.txt", Encoding.GetEncoding("gb2312"));
-
- string FileData = stream.ReadToEnd();
- stream.Close();
- FileData = FileData.Substring(0, FileData.Length - 1);
- FileData = "[" + FileData + "]";
- //JSON搴忓垪鍖栬浆鎹㈠瓧鍏搁泦鍚�
- List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
- List<object> DataList = JsonConvert.DeserializeObject<List<object>>(FileData);
- foreach (JObject item in DataList)
- {
- Dictionary<string, string> dic = new Dictionary<string, string>();
- foreach (var itm in item.Properties())
- {
- dic.Add(itm.Name, itm.Value.ToString());
- }
- list.Add(dic);
- }
- //鑾峰彇褰撳墠鏃堕棿
- DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-1).ToString("yyyy-MM-dd HH:mm:ss"));
- DateTime EndTime = DateTime.Parse(DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00"));
- //寰幆闆嗗悎
- for (int i = 0; i < list.Count; i++)
- {
- DateTime NowTime = DateTime.Parse(list[i]["HDate"].ToString());
- if (NowTime >= ActionTime && NowTime < EndTime)
- {
- string HSourceCode = list[i]["HSouceNumber"].ToString();
- string HEmpCode = this.HEmpCode.Text;
- //string HEmpCode = "";
- string HType = list[i]["HBadReason"].ToString();
- string HBarCode = list[i]["HBadCodeSN"].ToString();
- int HCount = 1;
- string HCreateTime = list[i]["HDate"].ToString();
- string HDate = DateTime.Parse(list[i]["HDate"].ToString()).ToString("yyyy-MM-dd");
- string HResult = list[i]["HResult"].ToString();
- string HProcNumber = list[i]["HProcNumber"].ToString();
- int HFlag = 0;
-
- DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
-
- if (ds.Tables[0].Rows.Count == 0)
- {
- string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
-values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
- oCN.RunProc(sql);
- ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult);
- }
- }
- else
- {
- //CustomWriteLog("鏃堕棿涓嶅湪淇濆瓨鑼冨洿鍐�", DateTime.Now.ToString("yyyy-MM-dd"));
- }
- }
- }
+ this.btnReadData.Text = "鍚姩";
+ this.timer1.Enabled = false;
+ num = 0;
}
+
+
+
+// if (this.HEmpCode.Text == "") {
+
+// MessageBox.Show("璇疯緭鍏ュ憳宸ョ紪鐮�");
+// }
+// else
+// {
+// int year = DateTime.Now.Year;
+// string month = DateTime.Now.Month.ToString();
+// string day = DateTime.Now.Day.ToString();
+
+// string dataTime = DateTime.Now.ToString("yyyyMMdd");
+// ////鍒ゆ柇鏄惁鏈夎繖涓枃浠�
+// //bool flag = File.Exists($@"D:\{year}\{month}\{day}\{dataTime}.txt");
+// bool flag = File.Exists($@"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\20231123.txt");
+
+// if (flag)
+// {
+// //StreamReader stream = new StreamReader($@"D:\{year}\{month}\{day}\{dataTime}.txt", Encoding.GetEncoding("gb2312"));
+// StreamReader stream = new StreamReader($@"C:\Users\admin\Desktop\鏂板缓鏂囦欢澶� (2)\20231123.txt", Encoding.GetEncoding("gb2312"));
+
+// string FileData = stream.ReadToEnd();
+// stream.Close();
+// FileData = FileData.Substring(0, FileData.Length - 1);
+// FileData = "[" + FileData + "]";
+// //JSON搴忓垪鍖栬浆鎹㈠瓧鍏搁泦鍚�
+// List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+// List<object> DataList = JsonConvert.DeserializeObject<List<object>>(FileData);
+// foreach (JObject item in DataList)
+// {
+// Dictionary<string, string> dic = new Dictionary<string, string>();
+// foreach (var itm in item.Properties())
+// {
+// dic.Add(itm.Name, itm.Value.ToString());
+// }
+// list.Add(dic);
+// }
+// //鑾峰彇褰撳墠鏃堕棿
+// DateTime ActionTime = DateTime.Parse(DateTime.Now.AddMinutes(-1).ToString("yyyy-MM-dd HH:mm:ss"));
+// DateTime EndTime = DateTime.Parse(DateTime.Now.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00"));
+// //寰幆闆嗗悎
+// for (int i = 0; i < list.Count; i++)
+// {
+// DateTime NowTime = DateTime.Parse(list[i]["HDate"].ToString());
+// if (NowTime >= ActionTime && NowTime < EndTime)
+// {
+// string HSourceCode = list[i]["HSouceNumber"].ToString();
+// string HEmpCode = this.HEmpCode.Text;
+// //string HEmpCode = "";
+// string HType = list[i]["HBadReason"].ToString();
+// string HBarCode = list[i]["HBadCodeSN"].ToString();
+// int HCount = 1;
+// string HCreateTime = list[i]["HDate"].ToString();
+// string HDate = DateTime.Parse(list[i]["HDate"].ToString()).ToString("yyyy-MM-dd");
+// string HResult = list[i]["HResult"].ToString();
+// string HProcNumber = list[i]["HProcNumber"].ToString();
+// int HFlag = 0;
+
+// DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
+
+// if (ds.Tables[0].Rows.Count == 0)
+// {
+// string sql = $@"insert into Sb_EquipMentCollection_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
+//values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}','{HDate}','{HResult}','{HProcNumber}','{HFlag}')";
+// oCN.RunProc(sql);
+// ListSelect.Items.Add("鏉$爜:" + HBarCode + ",鏃ユ湡:" + HCreateTime + ",缁撴灉:" + HResult);
+// }
+// }
+// else
+// {
+// //CustomWriteLog("鏃堕棿涓嶅湪淇濆瓨鑼冨洿鍐�", DateTime.Now.ToString("yyyy-MM-dd"));
+// }
+// }
+// }
+// }
}
- //杈撳叆鍛樺伐缂栫爜
+ //鍛樺伐缂栫爜鍥炶溅
private void HEmpCode_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter) {
@@ -140,6 +154,11 @@
this.HEmpCode.Focus();
this.HEmpCode.Text = "";
this.HEmpCodeName.Text = "";
+
+ this.HSouce.ReadOnly = false;
+ this.HSouce.Focus();
+ this.HSouce.Text = "";
+ this.HSouceName.Text = "";
}
private void timer1_Tick(object sender, EventArgs e)
@@ -220,5 +239,39 @@
}
}
}
+
+ //鐢熶骇璧勬簮鍥炶溅
+ private void HSouce_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Enter)
+ {
+ SelectHSouc(this.HSouce.Text);
+ }
+ }
+
+ //鏌ヨ鐢熶骇璧勬簮
+ public void SelectHSouc(string HNumber)
+ {
+ try
+ {
+ DataSet ds = oCN.RunProcReturn("select * from Gy_Source where HNumber='" + HNumber + "' ", "Gy_Source");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ MessageBox.Show("鏌ユ棤鏁版嵁!");
+ }
+ else
+ {
+ string HSouceName = ds.Tables[0].Rows[0]["HName"].ToString();
+ string HSouceNumber = ds.Tables[0].Rows[0]["HNumber"].ToString();
+ this.HSouceName.Text = HSouceName;
+ this.HSouce.Text = HSouceNumber;
+ this.HSouce.ReadOnly = true;
+ }
+ }
+ catch (Exception e)
+ {
+ MessageBox.Show(this, e.Message, "鎻愮ず");
+ }
+ }
}
}
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
index f3e4243..811514a 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
Binary files differ
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
index 21602df..2b5d621 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
Binary files differ
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
index cfec242..68282c2 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
@@ -3,7 +3,6 @@
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\WFormReadData_SMR.pdb
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\Newtonsoft.Json.dll
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\Newtonsoft.Json.xml
-E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.AssemblyReference.cache
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.Properties.Resources.resources
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.ReadyDataForm.resources
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.GenerateResource.cache
@@ -11,3 +10,4 @@
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.CopyComplete
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.exe
E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.pdb
+E:\鏅轰簯mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.AssemblyReference.cache
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache
index cb9dea9..db5c7ba 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache
Binary files differ
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe
index f3e4243..811514a 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe
Binary files differ
diff --git a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb
index 21602df..2b5d621 100644
--- a/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb
+++ b/WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb
Binary files differ
diff --git a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs
index 2a914be..4486394 100644
--- a/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs
+++ b/WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs
@@ -54,7 +54,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(283, 136);
+ this.ClientSize = new System.Drawing.Size(299, 155);
this.Controls.Add(this.btnReadData);
this.Name = "Form1";
this.Text = "Form1";
--
Gitblit v1.9.1