yangle
2023-12-01 f7f6134e118664230f8077ef2193c8d44ff0bf00
读取数据
2个文件已修改
29个文件已添加
9501 ■■■■■ 已修改文件
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/App.config 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/DBHelper.cs 257 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Resources.Designer.cs 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Resources.resx 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Settings.Designer.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Settings.settings 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Newtonsoft.Json.dll 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Newtonsoft.Json.xml 8558 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe.config 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.Properties.Resources.resources 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.ReadyDataForm.resources 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CopyComplete 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt 13 ●●●●● 补丁 | 查看 | 原始文档 | 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/WFormReadData_SMR/packages.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR.sln 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/App.config
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>
WFormSynchronizeData_SMR/WFormReadData_SMR/DBHelper.cs
New file
@@ -0,0 +1,257 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WFormReadData_SMR
{
    public class DBHelper
    {
        private SqlConnection MainCn;//创建连接对象
        SqlTransaction MainTran;
        public string sServer;
        public string sDataBase;
        public string sUser;
        public string sPassword;
        //开始事务
        public void BeginTran()
        {
            if (!this.CnOpen())
                return;
            MainTran = MainCn.BeginTransaction();
        }
        //结束事务
        public void Commit()
        {
            MainTran.Commit();
            CnClose();
        }
        //回滚事务
        public void RollBack()
        {
            MainTran.Rollback();
            CnClose();
        }
        public DBHelper()
        {
            sServer = "47.96.97.237,15127";
            sDataBase = "HX_LMESsys";
            sUser = "HX_USER";
            sPassword = "lc@841022";
            //斯莫尔
            //sServer = "10.11.18.195";
            //sDataBase = "HX_LMESsys_test";
            //sUser = "HX_USER";
            //sPassword = "lc@841022";
        }
        private bool CnOpen()//OPEN数据库连接
        {
            if (sServer == "" || sServer == "没有找到!")
            {
                throw new Exception("错误的服务器名!" + System.Environment.CurrentDirectory);
            }
            if (sDataBase == "" || sDataBase == "没有找到!")
            {
                throw new Exception("错误的数据库名!");
            }
            if (MainCn == null)
            {
                MainCn = new SqlConnection("Data Source=" + sServer + ";DataBase=" + sDataBase + ";User ID=" + sUser + ";PWD=" + sPassword + ";max pool size=32767");
            }
            if (MainCn.State == System.Data.ConnectionState.Closed)
            {
                try
                {
                    MainCn.Open();
                    return true;
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message + "," + sServer + "," + sDataBase);
                }
            }
            else
                return true;
        }
        public void CnClose()//关闭数据库连接
        {
            if (MainCn != null)
                MainCn.Close();
        }
        public void CnDispose()//释放资源
        {
            if (MainCn != null)
            {
                MainCn.Dispose();
                MainCn = null;
            }
        }
        /// <summary>
        /// 执行SQL无返回值
        /// </summary>
        /// <param name="procName"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public void RunProc(string procName)
        {
            if (!this.CnOpen())
            {
                return;
                //sErrMessage = "连接数据库失败!";
            }
            try
            {
                SqlCommand cmd = new SqlCommand(procName, MainCn);
                cmd.CommandTimeout = 600;
                cmd.Transaction = MainTran;
                cmd.ExecuteNonQuery();
                return;
            }
            catch (Exception e)
            {
                throw (e);
                //return;
            }
        }
        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="procName"></param>
        /// <param name="sErrMessage"></param>
        /// <returns></returns>
        public void RunProc(string procName, ref string sErr)
        {
            if (!this.CnOpen())
            {
                sErr = "连接数据库失败!";
                return;
            }
            try
            {
                //ClsPub.sSQLInfo = procName;
                SqlCommand cmd = new SqlCommand(procName, MainCn);
                cmd.CommandTimeout = 600;
                cmd.Transaction = MainTran;
                cmd.ExecuteNonQuery();
                return;
            }
            catch (Exception e)
            {
                sErr = e.Message;
                //ClsPub.sErrInfo = e.Message;
                throw (e);
                //return;
            }
        }
        /// <summary>
        /// 递入参数执行SQL并返回DATASET
        /// </summary>
        /// <param name="procName">执行语句</param>
        /// <param name="prams">参数</param>
        /// <param name="tbName">表名</param>
        /// <param name="sErrMessage">异常信息</param>
        /// <returns></returns>
        public DataSet RunProcReturn(string procName, SqlParameter[] prams, string tbName)
        {
            SqlDataAdapter dap = CreateDataAdaper(procName, prams);
            if (dap == null)
                return null;
            DataSet ds = new DataSet();
            try
            {
                 //ClsPub.sSQLInfo = procName;
                dap.Fill(ds, tbName);
                return ds;
            }
            catch (Exception e)
            {
                //ClsPub.sErrInfo = e.Message;
                throw (e);
                return null;
            }
        }
        /// <summary>
        /// 执行SQL并返回DATASET
        /// </summary>
        /// <param name="procName">执行语句</param>
        /// <param name="tbName">表名</param>
        /// <param name="sErrMessage">异常信息</param>
        /// <returns></returns>
        public DataSet RunProcReturn(string procName, string tbName)
        {
            SqlDataAdapter dap = CreateDataAdaper(procName, null);
            DataSet ds = new DataSet();
            try
            {
                //ClsPub.sSQLInfo = procName;
                dap.Fill(ds, tbName);
                return ds;
            }
            catch (Exception e)
            {
                //ClsPub.sErrInfo = e.Message;
                throw (e);
                return null;
            }
        }
        /// <summary>
        /// 执行SQL并返回DATASET和错误信息
        /// </summary>
        /// <param name="procName">执行语句</param>
        /// <param name="tbName">表名</param>
        /// <param name="sErrMessage">异常信息</param>
        /// <returns></returns>
        public DataSet RunProcReturn(string procName, string tbName, ref string sErr)
        {
            SqlDataAdapter dap = CreateDataAdaper(procName, null);
            DataSet ds = new DataSet();
            try
            {
                 //ClsPub.sSQLInfo = procName;
                dap.Fill(ds, tbName);
                return ds;
            }
            catch (Exception e)
            {
                sErr = e.Message;
                //ClsPub.sErrInfo = e.Message;
                return null;
            }
        }
        private SqlDataAdapter CreateDataAdaper(string procName, SqlParameter[] prams)
        {
            if (this.CnOpen())
            {
                SqlDataAdapter dap = new SqlDataAdapter(procName, MainCn);
                dap.SelectCommand.CommandType = CommandType.Text;
                dap.SelectCommand.CommandTimeout = 600;
                dap.SelectCommand.Transaction = MainTran;
                if (prams != null)
                {
                    foreach (SqlParameter parameter in prams)
                        dap.SelectCommand.Parameters.Add(parameter);
                }
                dap.SelectCommand.Parameters.Add(new SqlParameter("ReturnValue", SqlDbType.Int, 4,
                    ParameterDirection.ReturnValue, false, 0, 0,
                    string.Empty, DataRowVersion.Default, null));
                return dap;
            }
            else
            {
                return null;
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/Program.cs
New file
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WFormReadData_SMR
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ReadyDataForm());
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/AssemblyInfo.cs
New file
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WFormReadData_SMR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WFormReadData_SMR")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("3d7dbe9b-e166-4cff-a4ac-d3a1e2885018")]
// 程序集的版本信息由下列四个值组成:
//
//      主版本
//      次版本
//      生成号
//      修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Resources.Designer.cs
New file
@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本: 4.0.30319.42000
//
//     对此文件的更改可能导致不正确的行为,如果
//     重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WFormReadData_SMR.Properties
{
    /// <summary>
    ///   强类型资源类,用于查找本地化字符串等。
    /// </summary>
    // 此类是由 StronglyTypedResourceBuilder
    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
    // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
    // (以 /str 作为命令选项),或重新生成 VS 项目。
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources
    {
        private static global::System.Resources.ResourceManager resourceMan;
        private static global::System.Globalization.CultureInfo resourceCulture;
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources()
        {
        }
        /// <summary>
        ///   返回此类使用的缓存 ResourceManager 实例。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager
        {
            get
            {
                if ((resourceMan == null))
                {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WFormReadData_SMR.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        /// <summary>
        ///   重写当前线程的 CurrentUICulture 属性,对
        ///   使用此强类型资源类的所有资源查找执行重写。
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture
        {
            get
            {
                return resourceCulture;
            }
            set
            {
                resourceCulture = value;
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Resources.resx
New file
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Settings.Designer.cs
New file
@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WFormReadData_SMR.Properties
{
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
    {
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        public static Settings Default
        {
            get
            {
                return defaultInstance;
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/Properties/Settings.settings
New file
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
  <Profiles>
    <Profile Name="(Default)" />
  </Profiles>
  <Settings />
</SettingsFile>
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.Designer.cs
New file
@@ -0,0 +1,62 @@

namespace WFormReadData_SMR
{
    partial class ReadyDataForm
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要修改
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.btnReadData = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // btnReadData
            //
            this.btnReadData.Location = new System.Drawing.Point(55, 47);
            this.btnReadData.Name = "btnReadData";
            this.btnReadData.Size = new System.Drawing.Size(114, 35);
            this.btnReadData.TabIndex = 1;
            this.btnReadData.Text = "读取数据";
            this.btnReadData.UseVisualStyleBackColor = true;
            this.btnReadData.Click += new System.EventHandler(this.btnReadData_Click);
            //
            // 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.btnReadData);
            this.Name = "ReadyDataForm";
            this.Text = "Form1";
            this.ResumeLayout(false);
        }
        #endregion
        private System.Windows.Forms.Button btnReadData;
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.cs
New file
@@ -0,0 +1,96 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WFormReadData_SMR
{
    public partial class ReadyDataForm : Form
    {
        public DBHelper oCN = new DBHelper();
        public ReadyDataForm()
        {
            InitializeComponent();
        }
        private void btnReadData_Click(object sender, EventArgs e)
        {
            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 = list[i]["HEmpCode"].ToString();
                        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);
                        }
                    }
                    else
                    {
                        //CustomWriteLog("时间不在保存范围内", DateTime.Now.ToString("yyyy-MM-dd"));
                    }
                }
            }
        }
    }
}
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm.resx
New file
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
WFormSynchronizeData_SMR/WFormReadData_SMR/WFormReadData_SMR.csproj
New file
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{3D7DBE9B-E166-4CFF-A4AC-D3A1E2885018}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>WFormReadData_SMR</RootNamespace>
    <AssemblyName>WFormReadData_SMR</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="DBHelper.cs" />
    <Compile Include="ReadyDataForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ReadyDataForm.Designer.cs">
      <DependentUpon>ReadyDataForm.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <EmbeddedResource Include="ReadyDataForm.resx">
      <DependentUpon>ReadyDataForm.cs</DependentUpon>
    </EmbeddedResource>
    <None Include="packages.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Newtonsoft.Json.dll
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/Newtonsoft.Json.xml
New file
Diff too large
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe.config
New file
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs
New file
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.Properties.Resources.resources
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.ReadyDataForm.resources
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CopyComplete
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.CoreCompileInputs.cache
New file
@@ -0,0 +1 @@
006313194e028b3bea3d1ba326f7350b8b28f981
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
New file
@@ -0,0 +1,13 @@
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\WFormReadData_SMR.exe.config
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\bin\Debug\WFormReadData_SMR.exe
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
E:\智云mes\SRM\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.CoreCompileInputs.cache
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
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/WFormReadData_SMR/packages.config
New file
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
</packages>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR.sln
@@ -5,6 +5,8 @@
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WFormSynchronizeData_SMR", "WFormSynchronizeData_SMR\WFormSynchronizeData_SMR.csproj", "{7D884B31-A12C-48D4-AA79-EAF174D3FEA8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WFormReadData_SMR", "WFormReadData_SMR\WFormReadData_SMR.csproj", "{3D7DBE9B-E166-4CFF-A4AC-D3A1E2885018}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@
        {7D884B31-A12C-48D4-AA79-EAF174D3FEA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {7D884B31-A12C-48D4-AA79-EAF174D3FEA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {7D884B31-A12C-48D4-AA79-EAF174D3FEA8}.Release|Any CPU.Build.0 = Release|Any CPU
        {3D7DBE9B-E166-4CFF-A4AC-D3A1E2885018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {3D7DBE9B-E166-4CFF-A4AC-D3A1E2885018}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {3D7DBE9B-E166-4CFF-A4AC-D3A1E2885018}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {3D7DBE9B-E166-4CFF-A4AC-D3A1E2885018}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE