1
yangle
2023-12-01 65803a6e5864ea62822f08be2a6ebf3a1af00b3a
1
10个文件已修改
247 ■■■■■ 已修改文件
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.Designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
Binary files differ
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;
    }
}
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, "提示");
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
Binary files differ
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
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb
Binary files differ
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";