Browse Source

新增本地参数维护功能

callm 4 years ago
parent
commit
9661574f62

+ 3 - 1
UAS-出货标签管理(泽天)/Entity/SystemInf.cs

@@ -7,6 +7,8 @@ namespace UAS_LabelMachine.Entity
 {
     class SystemInf
     {
-       public static DataHelper dh;
+        public static DataHelper dh;
+
+        public static SqliteDBHelper sdh;
     }
 }

+ 3 - 1
UAS-出货标签管理(泽天)/Login.cs

@@ -15,6 +15,7 @@ namespace UAS_LabelMachine
     {
         DataHelper dh;
         DataTable dt;
+        SqliteDBHelper sdh;
 
         public Login()
         {
@@ -76,12 +77,13 @@ namespace UAS_LabelMachine
             //切换至用户选择的数据源
             string ConnectionString = "Connection Timeout=0;Pooling=false;Password=" + Ms_Pwd + ";User ID=" + MasterCombox.SelectedValue.ToString() + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + IP.Text + ")(PORT=" + DataHelper.OraclePort + ")))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
             DataHelper.DBConnectionString = ConnectionString;
+            SystemInf.sdh = sdh = new SqliteDBHelper(MasterCombox.SelectedValue + ".db3");
             //设置了Connection,重新执行构造函数,重置数据库连接
             dh = new DataHelper();
             string oMsg = "";
             if (HttpHandler.CheckUserLogin(UserName.Text, PassWord.Text, MasterCombox.SelectedValue.ToString(), out oMsg))
             {
-              DataTable  dt1 = (DataTable)dh.ExecuteSql("select em_name,em_type from employee where em_code='" + UserName.Text + "'", "select");
+                DataTable dt1 = (DataTable)dh.ExecuteSql("select em_name,em_type from employee where em_code='" + UserName.Text + "'", "select");
                 if (dt1.Rows.Count > 0)
                 {
                     User.UserName = dt1.Rows[0]["em_name"].ToString();

+ 230 - 0
UAS-出货标签管理(泽天)/MachineSetting.Designer.cs

@@ -0,0 +1,230 @@
+namespace UAS_LabelMachine
+{
+    partial class MachineSetting
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.ps_split = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.ps_dataindex = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.ps_resetport = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.ps_sendport = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.ps_receiveport = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.ps_ip = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.label23 = new System.Windows.Forms.Label();
+            this.label22 = new System.Windows.Forms.Label();
+            this.label21 = new System.Windows.Forms.Label();
+            this.label20 = new System.Windows.Forms.Label();
+            this.label19 = new System.Windows.Forms.Label();
+            this.label18 = new System.Windows.Forms.Label();
+            this.SaveSetting = new System.Windows.Forms.Button();
+            this.SuspendLayout();
+            // 
+            // ps_split
+            // 
+            this.ps_split.ID = null;
+            this.ps_split.Location = new System.Drawing.Point(276, 362);
+            this.ps_split.Margin = new System.Windows.Forms.Padding(6);
+            this.ps_split.Name = "ps_split";
+            this.ps_split.Size = new System.Drawing.Size(186, 35);
+            this.ps_split.Str = null;
+            this.ps_split.Str1 = null;
+            this.ps_split.Str2 = null;
+            this.ps_split.TabIndex = 28;
+            // 
+            // ps_dataindex
+            // 
+            this.ps_dataindex.ID = null;
+            this.ps_dataindex.Location = new System.Drawing.Point(276, 312);
+            this.ps_dataindex.Margin = new System.Windows.Forms.Padding(6);
+            this.ps_dataindex.Name = "ps_dataindex";
+            this.ps_dataindex.Size = new System.Drawing.Size(186, 35);
+            this.ps_dataindex.Str = null;
+            this.ps_dataindex.Str1 = null;
+            this.ps_dataindex.Str2 = null;
+            this.ps_dataindex.TabIndex = 27;
+            // 
+            // ps_resetport
+            // 
+            this.ps_resetport.ID = null;
+            this.ps_resetport.Location = new System.Drawing.Point(276, 264);
+            this.ps_resetport.Margin = new System.Windows.Forms.Padding(6);
+            this.ps_resetport.Name = "ps_resetport";
+            this.ps_resetport.Size = new System.Drawing.Size(186, 35);
+            this.ps_resetport.Str = null;
+            this.ps_resetport.Str1 = null;
+            this.ps_resetport.Str2 = null;
+            this.ps_resetport.TabIndex = 26;
+            // 
+            // ps_sendport
+            // 
+            this.ps_sendport.ID = null;
+            this.ps_sendport.Location = new System.Drawing.Point(276, 214);
+            this.ps_sendport.Margin = new System.Windows.Forms.Padding(6);
+            this.ps_sendport.Name = "ps_sendport";
+            this.ps_sendport.Size = new System.Drawing.Size(186, 35);
+            this.ps_sendport.Str = null;
+            this.ps_sendport.Str1 = null;
+            this.ps_sendport.Str2 = null;
+            this.ps_sendport.TabIndex = 25;
+            // 
+            // ps_receiveport
+            // 
+            this.ps_receiveport.ID = null;
+            this.ps_receiveport.Location = new System.Drawing.Point(276, 166);
+            this.ps_receiveport.Margin = new System.Windows.Forms.Padding(6);
+            this.ps_receiveport.Name = "ps_receiveport";
+            this.ps_receiveport.Size = new System.Drawing.Size(186, 35);
+            this.ps_receiveport.Str = null;
+            this.ps_receiveport.Str1 = null;
+            this.ps_receiveport.Str2 = null;
+            this.ps_receiveport.TabIndex = 24;
+            // 
+            // ps_ip
+            // 
+            this.ps_ip.ID = null;
+            this.ps_ip.Location = new System.Drawing.Point(276, 114);
+            this.ps_ip.Margin = new System.Windows.Forms.Padding(6);
+            this.ps_ip.Name = "ps_ip";
+            this.ps_ip.Size = new System.Drawing.Size(186, 35);
+            this.ps_ip.Str = null;
+            this.ps_ip.Str1 = null;
+            this.ps_ip.Str2 = null;
+            this.ps_ip.TabIndex = 23;
+            // 
+            // label23
+            // 
+            this.label23.AutoSize = true;
+            this.label23.Location = new System.Drawing.Point(40, 370);
+            this.label23.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label23.Name = "label23";
+            this.label23.Size = new System.Drawing.Size(94, 24);
+            this.label23.TabIndex = 22;
+            this.label23.Text = "分隔符:";
+            // 
+            // label22
+            // 
+            this.label22.AutoSize = true;
+            this.label22.Location = new System.Drawing.Point(40, 322);
+            this.label22.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label22.Name = "label22";
+            this.label22.Size = new System.Drawing.Size(118, 24);
+            this.label22.TabIndex = 21;
+            this.label22.Text = "数据索引:";
+            // 
+            // label21
+            // 
+            this.label21.AutoSize = true;
+            this.label21.Location = new System.Drawing.Point(40, 271);
+            this.label21.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label21.Name = "label21";
+            this.label21.Size = new System.Drawing.Size(166, 24);
+            this.label21.TabIndex = 20;
+            this.label21.Text = "设备复位端口:";
+            // 
+            // label20
+            // 
+            this.label20.AutoSize = true;
+            this.label20.Location = new System.Drawing.Point(40, 223);
+            this.label20.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label20.Name = "label20";
+            this.label20.Size = new System.Drawing.Size(166, 24);
+            this.label20.TabIndex = 19;
+            this.label20.Text = "发送指令端口:";
+            // 
+            // label19
+            // 
+            this.label19.AutoSize = true;
+            this.label19.Location = new System.Drawing.Point(40, 173);
+            this.label19.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label19.Name = "label19";
+            this.label19.Size = new System.Drawing.Size(166, 24);
+            this.label19.TabIndex = 18;
+            this.label19.Text = "接收数据端口:";
+            // 
+            // label18
+            // 
+            this.label18.AutoSize = true;
+            this.label18.Location = new System.Drawing.Point(40, 119);
+            this.label18.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label18.Name = "label18";
+            this.label18.Size = new System.Drawing.Size(46, 24);
+            this.label18.TabIndex = 17;
+            this.label18.Text = "IP:";
+            // 
+            // SaveSetting
+            // 
+            this.SaveSetting.Location = new System.Drawing.Point(458, 535);
+            this.SaveSetting.Name = "SaveSetting";
+            this.SaveSetting.Size = new System.Drawing.Size(130, 50);
+            this.SaveSetting.TabIndex = 29;
+            this.SaveSetting.Text = "保存";
+            this.SaveSetting.UseVisualStyleBackColor = true;
+            this.SaveSetting.Click += new System.EventHandler(this.SaveSetting_Click);
+            // 
+            // MachineSetting
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1038, 682);
+            this.Controls.Add(this.SaveSetting);
+            this.Controls.Add(this.ps_split);
+            this.Controls.Add(this.ps_dataindex);
+            this.Controls.Add(this.ps_resetport);
+            this.Controls.Add(this.ps_sendport);
+            this.Controls.Add(this.ps_receiveport);
+            this.Controls.Add(this.ps_ip);
+            this.Controls.Add(this.label23);
+            this.Controls.Add(this.label22);
+            this.Controls.Add(this.label21);
+            this.Controls.Add(this.label20);
+            this.Controls.Add(this.label19);
+            this.Controls.Add(this.label18);
+            this.Name = "MachineSetting";
+            this.Text = "贴标机参数设置";
+            this.Load += new System.EventHandler(this.MachineSetting_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private CustomControl.EnterTextBox ps_split;
+        private CustomControl.EnterTextBox ps_dataindex;
+        private CustomControl.EnterTextBox ps_resetport;
+        private CustomControl.EnterTextBox ps_sendport;
+        private CustomControl.EnterTextBox ps_receiveport;
+        private CustomControl.EnterTextBox ps_ip;
+        private System.Windows.Forms.Label label23;
+        private System.Windows.Forms.Label label22;
+        private System.Windows.Forms.Label label21;
+        private System.Windows.Forms.Label label20;
+        private System.Windows.Forms.Label label19;
+        private System.Windows.Forms.Label label18;
+        private System.Windows.Forms.Button SaveSetting;
+    }
+}

+ 55 - 0
UAS-出货标签管理(泽天)/MachineSetting.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using UAS_LabelMachine.Entity;
+
+namespace UAS_LabelMachine
+{
+    public partial class MachineSetting : Form
+    {
+
+        SqliteDBHelper sdh = SystemInf.sdh;
+
+        public MachineSetting()
+        {
+            InitializeComponent();
+        }
+
+        private void MachineSetting_Load(object sender, EventArgs e)
+        {
+            DataTable dt = (DataTable)sdh.ExecuteSql("select * from ParamSetting", "select");
+            if (dt.Rows.Count > 0)
+            {
+                ps_ip.Text = dt.Rows[0]["ps_ip"].ToString();
+                ps_receiveport.Text = dt.Rows[0]["ps_receiveport"].ToString();
+                ps_sendport.Text = dt.Rows[0]["ps_sendport"].ToString();
+                ps_resetport.Text = dt.Rows[0]["ps_resetport"].ToString();
+                ps_dataindex.Text = dt.Rows[0]["ps_dataindex"].ToString();
+                ps_split.Text = dt.Rows[0]["ps_split"].ToString();
+            }
+        }
+
+        private void SaveSetting_Click(object sender, EventArgs e)
+        {
+            string sql = "";
+            if (sdh.getRowCount("ParamSetting") > 0)
+            {
+                sql = "update ParamSetting set ps_ip='" + ps_ip.Text + "',ps_receiveport='" + ps_receiveport.Text + "',ps_sendport='" + ps_sendport.Text + "',ps_resetport='" + ps_resetport.Text + "',ps_dataindex='" + ps_dataindex.Text + "',ps_split='" + ps_split.Text + "' where ps_id=1";
+                sdh.ExecuteSql(sql, "update");
+            }
+            else
+            {
+                sql = "insert into ParamSetting(ps_id,ps_ip,ps_receiveport,ps_sendport,ps_resetport,ps_dataindex,ps_split)";
+                sql += "values(1,'" + ps_ip.Text + "','" + ps_receiveport.Text + "','" + ps_sendport.Text + "','" + ps_resetport.Text + "','" + ps_dataindex.Text + "','" + ps_split.Text + "')";
+                sdh.ExecuteSql(sql, "insert");
+            }
+            MessageBox.Show("保存成功");
+            Close();
+        }
+    }
+}

+ 120 - 0
UAS-出货标签管理(泽天)/MachineSetting.resx

@@ -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>

+ 921 - 0
UAS-出货标签管理(泽天)/PublicMethod/SqliteDBHelper.cs

@@ -0,0 +1,921 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SQLite;
+using System.IO;
+using System.Text;
+using System.Windows.Forms;
+
+namespace UAS_LabelMachine
+{
+    class SqliteDBHelper
+    {
+        private string _fileName;
+        private string _connectionString;
+        private SQLiteConnection _odcConnection = null;
+        private SQLiteCommand command = null;
+
+        public SqliteDBHelper(string fileName)
+        {
+            this._fileName = fileName;
+            this._connectionString = @"Data Source=" + fileName + ";";
+            Open();
+        }
+
+        public void Open()
+        {
+            try
+            {
+                // 建立连接
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                // 打开连接
+                this._odcConnection.Open();
+                ExecuteSql("select 1 from ParamSetting", "select");
+            }
+            catch (Exception ex)
+            {
+                string sql = "create table ParamSetting (ps_id char(50),ps_ip char(50),ps_receiveport char(50),ps_sendport char(50),";
+                sql += "ps_resetport char(50),ps_dataindex char(50),ps_split char(50))";
+                ExecuteSql(sql.ToString(), "select");
+            }
+        }
+
+        public void ExecuteZip()
+        {
+            command = new SQLiteCommand("Vacuum", this._odcConnection);
+            command.ExecuteNonQuery();
+        }
+
+        public void Close()
+        {
+            this._odcConnection.Close();
+        }
+
+
+        public DataTable GetDataTable(string sql)
+        {
+            DataTable ds = new DataTable();
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
+            try
+            {
+                adapter.Fill(ds);
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("sql語句: " + sql + " 執行失敗!" + ex.Message);
+            }
+            adapter.Dispose();
+            return ds;
+        }
+
+        public DataSet GetDataSet(string sql)
+        {
+            DataSet ds = new DataSet();
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
+            try
+            {
+                adapter.Fill(ds);
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("sql語句: " + sql + " 執行失敗!" + ex.Message);
+            }
+            adapter.Dispose();
+            return ds;
+        }
+
+        public void Reconnect(SQLiteCommand cmd)
+        {
+            if (cmd.Connection.State == ConnectionState.Closed)
+            {
+                cmd.Connection.Open();
+                //超时重连
+            }
+        }
+
+        /// <summary>
+        /// 根据表名获取该表字段数据类型
+        /// </summary>
+        public DataTable GetColumnDataType(string TableName)
+        {
+            DataTable dt = new DataTable();
+            command = new SQLiteCommand("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            ad.Fill(dt);
+            ad.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 获取第一行第一列的信息
+        /// </summary>
+        public object getFieldDataByCondition(string TableName, string Field, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select " + Field + " from " + TableName + " where " + Condition;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter();
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            if (dt.Rows.Count > 0)
+            {
+                return dt.Rows[0][0];
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
+        {
+            command = new SQLiteCommand(sql, _odcConnection);
+            SQLiteDataAdapter adapter = new SQLiteDataAdapter();
+            adapter.UpdateBatchSize = param1[0].Length;
+            //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
+            //将第一个数组的下标固定为0作为循环添加的参数的名称
+            for (int i = 0; i < param.Length; i++)
+            {
+                command.Parameters.Add(new SQLiteParameter(param[i].ToString(), param1[i]));
+            }
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+
+            }
+        }
+
+        /// <summary>
+        /// 插入DataTable到Access数据库
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="TableName"></param>
+        public void SaveDataTable(DataTable dt, string TableName)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Clear();
+            sb.Append("insert into " + TableName + " (");
+            string field = "";
+            string valuefield = "";
+            for (int i = 0; i < dt.Columns.Count; i++)
+            {
+                if (i != dt.Columns.Count - 1)
+                {
+                    field += dt.Columns[i].ColumnName + ",";
+                    valuefield += "?,";
+                }
+                else
+                {
+                    field += dt.Columns[i].ColumnName + "";
+                    valuefield += "?";
+                }
+            }
+            sb.Append(field + ") values(" + valuefield + ")");
+            SQLiteTransaction tx = this._odcConnection.BeginTransaction();
+            command = new SQLiteCommand();
+            command.Connection = this._odcConnection;
+            command.Transaction = tx;
+            string sql = sb.ToString();
+            try
+            {
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    command.CommandText = sql;
+                    for (int j = 0; j < dt.Columns.Count; j++)
+                    {
+                        command.Parameters.AddWithValue(dt.Columns[j].ColumnName, dt.Rows[i][j]);
+                    }
+                    try
+                    {
+                        command.ExecuteNonQuery();
+                        command.Parameters.Clear();
+                    }
+                    catch (Exception e)
+                    {
+                        MessageBox.Show(e.Message.ToString());
+                    }
+                }
+                tx.Commit();
+            }
+            catch (Exception E)
+            {
+                tx.Rollback();
+                throw new Exception(E.Message);
+            }
+        }
+
+        public void BatchInsert(string tableName, DataTable dt)
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Clear();
+            sb.Append("update  " + tableName + " set  ");
+            for (int i = 0; i < dt.Columns.Count; i++)
+            {
+                if (dt.Columns[i].ColumnName.ToUpper() != "PIB_ID" && dt.Columns[i].ColumnName.ToUpper() != "PIB_DATECODE" && dt.Columns[i].ColumnName.ToUpper() != "PIB_LOTNO")
+                {
+                    if (i != dt.Columns.Count - 1)
+                    {
+                        sb.Append(dt.Columns[i].ColumnName + "=?,");
+                    }
+                    else
+                    {
+                        sb.Append(dt.Columns[i].ColumnName + "=?");
+                    }
+                }
+            }
+            sb.Append(" where pib_id=?");
+            SQLiteTransaction tx = this._odcConnection.BeginTransaction();
+            command = new SQLiteCommand();
+            command.Connection = this._odcConnection;
+            command.Transaction = tx;
+            string sql = sb.ToString();
+            try
+            {
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    command.CommandText = sql;
+                    for (int j = 0; j < dt.Columns.Count; j++)
+                    {
+                        if (dt.Columns[j].ColumnName.ToUpper() != "PIB_ID" && dt.Columns[j].ColumnName.ToUpper() != "PIB_DATECODE" && dt.Columns[j].ColumnName.ToUpper() != "PIB_LOTNO")
+                            command.Parameters.AddWithValue(dt.Columns[j].ColumnName, dt.Rows[i][j]);
+                    }
+                    command.Parameters.AddWithValue("pib_id", dt.Rows[i]["pib_id"]);
+                    try
+                    {
+                        command.ExecuteNonQuery();
+                        command.Parameters.Clear();
+                    }
+                    catch (Exception e)
+                    {
+                        MessageBox.Show(e.Message.ToString());
+                    }
+                }
+                tx.Commit();
+            }
+            catch (Exception E)
+            {
+                tx.Rollback();
+                throw new Exception(E.Message);
+            }
+
+        }
+
+        /// <summary>
+        /// 获取指定表的记录的条数 ,带条件
+        /// </summary>
+        /// <returns></returns>
+        public int getRowCount(string TableName, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select count(1) from " + TableName + " where " + Condition;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            ad.Fill(dt);
+            ad.Dispose();
+            return int.Parse(dt.Rows[0][0].ToString());
+        }
+
+        /// <summary>
+        /// 获取指定表的记录的条数 ,不带条件
+        /// </summary>
+        /// <param name="TableName"></param>
+        /// <returns></returns>
+        public int getRowCount(string TableName)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select count(1) from " + TableName;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            ad.Fill(dt);
+            ad.Dispose();
+            return int.Parse(dt.Rows[0][0].ToString());
+        }
+
+        /// <summary>
+        /// 通过表名和获取单行的记录
+        /// </summary>
+        public DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += AddField(Fields);
+            sql += " from " + TableName + " where " + Condition + " and rownum=1";
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 按分页获取数据
+        /// </summary>
+        /// <param name="TableName">表名</param>
+        /// <param name="Fields">查询字段</param>
+        /// <param name="CurrentPage">当前页面</param>
+        /// <param name="PageSize">页面展示条数</param>
+        /// <param name="Caller"></param>
+        /// <returns></returns>
+        // SELECT * FROM (SELECT   A.*  FROM (SELECT* FROM datalist) A WHERE ROWNUM <= 50) WHERE ROWNUM >= 21
+        public DataTable getFieldsDatasByPageing(string TableName, string Fields, int CurrentPage, int PageSize, string Caller, params string[] condition)
+        {
+            DataTable dt = new DataTable();
+            StringBuilder sql = new StringBuilder();
+            //先查询出配置出去的列
+            //获取查询的列
+            string[] caption = GetCaptionFromField(Fields);
+            //获取对应列的描述
+            string[] field = GetField(Fields);
+            sql.Append(" select * from (select RowNum RN, A.* from (select ");
+            sql.Append(AddField(caption));
+            if (condition.Length > 0)
+            {
+                if (condition[0] != null && condition[0].Trim() != "")
+                    sql.Append(" from " + TableName + " where " + condition[0] + " ) A where ROWNUM <=" + CurrentPage * PageSize + ") where RN>" + (CurrentPage - 1) * PageSize);
+                else
+                    sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
+            }
+            command = new SQLiteCommand(sql.ToString(), this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            ad.Fill(dt);
+            ad.Dispose();
+            dt.Columns.RemoveAt(0);
+            foreach (DataColumn dc in dt.Columns)
+            {
+                dc.ColumnName = field[dt.Columns.IndexOf(dc)];
+                dc.Caption = caption[dt.Columns.IndexOf(dc)];
+            }
+            return dt;
+        }
+
+        /// <summary>
+        /// 通过表名,字段和条件获取DataTable类型的数据
+        /// </summary>
+        public DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += AddField(Fields);
+            sql += " from " + TableName + " where " + Condition;
+
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            return dt;
+        }
+
+        /// <summary>
+        /// 通过表名,字段获取DataTable类型的数据
+        /// </summary>
+        public DataTable getFieldsDatas(string TableName, string Fields)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select ";
+            sql += Fields;
+            sql += " from " + TableName;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            return dt;
+        }
+
+
+        /// <summary>
+        /// 获取DbFind的数据的DataTable的结构
+        /// </summary>
+        /// <param name="field"></param>
+        /// <param name="caller"></param>
+        /// <returns></returns>
+        public DataTable GetDbFindDataTable(string field, string caller)
+        {
+            string sql = "select * from dbfindsetui where ds_caller='" + caller + "' and ds_whichui='" + field + "'";
+            DataTable dt = (DataTable)ExecuteSql(sql, "select");
+            if (dt.Rows.Count != 0)
+            {
+                //通过#号分割字段
+                string[] dbfield = dt.Rows[0]["ds_findtoui"].ToString().Split('#');
+                string[] cnfield = dt.Rows[0]["ds_dbcaption"].ToString().Split('#');
+                //获取查询要查询的Table
+                string dbtable = dt.Rows[0]["ds_tables"].ToString();
+                //拼接查询的字段
+                for (int i = 0; i < dbfield.Length; i++)
+                {
+                    dbfield[i] = dbfield[i].Split(',')[0];
+                }
+                //新建一个空的DataTable
+                DataTable dt1 = new DataTable();
+                //往空的DataTable添加结构,ColumnName是中文,Caption是实际的字段名称
+                for (int i = 0; i < cnfield.Length; i++)
+                {
+                    dt1.Columns.Add(cnfield[i]);
+                    dt1.Columns[i].Caption = dbfield[i];
+                }
+                //返回一个带有结构的空的DataTable
+                //DbFind.BindTable1 = dbtable;
+                return dt1;
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// 检测内容是否存在
+        /// </summary>
+        /// <param name="TableName"></param>
+        /// <param name="Condition"></param>
+        /// <returns></returns>
+        public bool CheckExist(string TableName, string Condition)
+        {
+            string sql = "select count(1) from " + TableName + " where " + Condition;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            DataTable dt = new DataTable();
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+            return int.Parse(dt.Rows[0][0].ToString()) > 0;
+        }
+
+        /// <summary>
+        /// 直接执行SQL,同时传入SQL的类型
+        /// </summary>
+        /// <param name="SQL"></param>
+        /// <param name="Type"></param>
+        /// <returns></returns>
+        public object ExecuteSql(string SQL, string Type)
+        {
+            object result = null;
+            command = new SQLiteCommand(SQL, this._odcConnection);
+            Reconnect(command);
+            switch (Type.ToUpper())
+            {
+                case "SELECT":
+                    SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+                    result = new DataTable();
+                    try
+                    {
+                        ad.Fill((DataTable)result);
+                    }
+                    catch (Exception)
+                    {
+                        this._odcConnection = new SQLiteConnection(this._connectionString);
+                        this._odcConnection.Open();
+                        command = new SQLiteCommand(SQL, this._odcConnection);
+                        ad = new SQLiteDataAdapter();
+                        ad.SelectCommand = command;
+                        ad.Fill((DataTable)result);
+                    }
+                    break;
+                case "DELETE":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new SQLiteConnection(this._connectionString);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+                case "UPDATE":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new SQLiteConnection(this._connectionString);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+                case "INSERT":
+                    try
+                    {
+                        result = command.ExecuteNonQuery();
+                    }
+                    catch (Exception)
+                    {
+                        command.Connection = new SQLiteConnection(this._connectionString);
+                        command.Connection.Open();
+                        result = command.ExecuteNonQuery();
+                    }
+                    break;
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 为了同步BS端的条码维护,检测时允许问号的存在,在检测时默认将问号换成:Param参数
+        /// </summary>
+        /// <param name="SQL"></param>
+        public void CheckSQL(string SQL)
+        {
+            SQL = SQL.Replace("?", ":Param");
+            command = new SQLiteCommand(SQL, this._odcConnection);
+            command.ExecuteNonQuery();
+
+        }
+
+        public int GetDistinctRowCount(string TableName, string Field)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select distinct count('" + Field + "') from " + TableName;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter(command);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+
+            return int.Parse(dt.Rows[0][0].ToString());
+        }
+
+        /// <summary>
+        /// 根据Caller获取流水号
+        /// </summary>
+        /// <param name="Caller"></param>
+        /// <returns></returns>
+        public string GetSerialNumberByCaller(string Caller)
+        {
+            string SerialNumber = getFieldDataByCondition("MaxNumbers", "mn_number", "mn_tablename='" + Caller + "'").ToString();
+            UpdateByCondition("MaxNumbers", "mn_number=mn_number+1", "mn_tablename='" + Caller + "'");
+            return SerialNumber;
+        }
+
+        /// <summary>
+        /// 通过序列的名称获取序列
+        /// </summary>
+        /// <param name="SeqName"></param>
+        /// <returns></returns>
+        public string GetSEQ(string SeqName)
+        {
+            DataTable dt = new DataTable();
+            dt = (DataTable)ExecuteSql("SELECT " + SeqName + ".NEXTVAL FROM DUAL", "select");
+            return dt.Rows[0][0].ToString();
+        }
+
+        /// <summary>
+        /// 通过序列的名称获取序列
+        /// </summary>
+        /// <param name="SeqName"></param>
+        /// <returns></returns>
+        public string[] GetSEQ(string SeqName, int Num)
+        {
+            DataTable dt = new DataTable();
+            dt = (DataTable)ExecuteSql("SELECT " + SeqName + ".nextval  FROM DUAL CONNECT BY LEVEL<=" + Num, "select");
+            string[] SerialNum = new string[dt.Rows.Count];
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                SerialNum[i] = dt.Rows[i][0].ToString();
+            }
+            return SerialNum;
+        }
+
+        /// <summary>
+        /// 取Configs表中的配置,进行该客户是否执行某个操作
+        /// </summary>
+        /// <param name="Code"></param>
+        /// <param name="Caller"></param>
+        /// <returns></returns>
+        public object GetConfig(string Code, string Caller)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select Data from configs where code='" + Code + "' and caller='" + Caller + "'";
+            dt = (DataTable)ExecuteSql(sql, "select");
+            if (dt.Rows.Count == 0)
+            {
+                return "";
+            }
+            else
+            {
+                return dt.Rows[0]["Data"];
+            }
+        }
+
+
+        //将数据类型的列类型转换为DataTable
+        public DataTable DataTypeColumnToDataTable(DataTable dt)
+        {
+            DataTable dt1 = new DataTable();
+            dt1.Rows.Add();
+            foreach (DataRow dr in dt.Rows)
+            {
+                dt1.Columns.Add(dr[0].ToString());
+                int index = dt.Rows.IndexOf(dr);
+                if (dr[1].ToString() == "NUMBER")
+                {
+                    dt1.Rows[0][index] = 0;
+                }
+                if (dr[1].ToString() == "VARCHAR2")
+                {
+                    dt1.Rows[0][index] = "这是一段文字";
+                }
+                if (dr[1].ToString() == "DATE")
+                {
+                    dt1.Rows[0][index] = DateTime.Now.ToString("yyyy-MM-dd");
+                }
+                if (dr[1].ToString() == "FLOAT")
+                {
+                    dt1.Rows[0][index] = 1.0;
+                }
+                if (dr[1].ToString() == "CLOB")
+                {
+                    dt1.Rows[0][index] = "一段长文字";
+                }
+            }
+            return dt1;
+        }
+
+
+        /// <summary>
+        /// 通过条件更新
+        /// </summary>
+        /// <param name="TableName"></param>
+        /// <param name="update"></param>
+        /// <param name="condition"></param>
+        public int UpdateByCondition(string TableName, string update, string condition)
+        {
+            string sql = "update " + TableName + " set " + update + " where " + condition;
+            command = new SQLiteCommand(sql, this._odcConnection);
+            int Rowcount = 0;
+            Reconnect(command);
+            try
+            {
+                Rowcount = command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                command.Connection = new SQLiteConnection(this._connectionString);
+                command.Connection.Open();
+                Rowcount = command.ExecuteNonQuery();
+            }
+            return Rowcount;
+        }
+
+
+        /// <summary>
+        /// 出现异常进行回滚的执行方法
+        /// </summary>
+        /// <param name="SQL"></param>
+        public void ExecuteSQLTran(params string[] SQL)
+        {
+            SQLiteTransaction tx = this._odcConnection.BeginTransaction();
+            command = new SQLiteCommand();
+            command.Connection = this._odcConnection;
+            command.Transaction = tx;
+            try
+            {
+                foreach (string sql in SQL)
+                {
+                    if (!String.IsNullOrEmpty(sql))
+                    {
+                        command.CommandText = sql;
+                        try
+                        {
+                            command.ExecuteNonQuery();
+                        }
+                        catch (Exception)
+                        {
+                            command.Connection = new SQLiteConnection(this._connectionString);
+                            command.Connection.Open();
+                            command.ExecuteNonQuery();
+                        }
+                    }
+                }
+                tx.Commit();
+            }
+            catch (Exception E)
+            {
+                tx.Rollback();
+                throw new Exception(E.Message);
+            }
+        }
+
+        /// <summary>
+        /// 用于将string 的数组转换成SQL的查询内容
+        /// </summary>
+        /// <param name="Fields"></param>
+        /// <returns></returns>
+        private string AddField(string[] Fields)
+        {
+            string sql = " ";
+            foreach (string field in Fields)
+            {
+                sql += field + ",";
+            }
+            return sql.Substring(0, sql.Length - 1);
+        }
+        /// <summary>
+        /// 通过查询的内容获取到字段的描述
+        /// </summary>
+        /// <param name="field"></param>
+        /// <returns></returns>
+        private static string[] GetCaptionFromField(string field)
+        {
+            string[] caption = field.Split(',');
+            for (int i = 0; i < caption.Length; i++)
+            {
+                caption[i] = caption[i].Substring(0, caption[i].LastIndexOf("as")).Trim();
+            }
+            return caption;
+        }
+
+        /// <summary>
+        /// 通过查询的语句获取查询的字段
+        /// </summary>
+        /// <param name="field"></param>
+        /// <returns></returns>
+        private static string[] GetField(string field)
+        {
+            string[] fields = field.Split(',');
+            for (int i = 0; i < fields.Length; i++)
+            {
+                fields[i] = fields[i].Substring(fields[i].LastIndexOf("as") + 2, fields[i].Length - fields[i].LastIndexOf("as") - 2).Trim();
+            }
+            return fields;
+        }
+
+        public object GetLabelParam(string sql)
+        {
+            DataTable dt = new DataTable();
+            command = new SQLiteCommand(sql, this._odcConnection);
+            Reconnect(command);
+            SQLiteDataAdapter ad = new SQLiteDataAdapter();
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                this._odcConnection = new SQLiteConnection(this._connectionString);
+                this._odcConnection.Open();
+                command = new SQLiteCommand(sql, this._odcConnection);
+                ad = new SQLiteDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            if (dt.Rows.Count > 0)
+            {
+                ad.Dispose();
+
+                return dt.Rows[0][0];
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        public static string[] GetParamFromSQL(string SQL)
+        {
+            string[] par = SQL.Split(':');
+            //用来存参数的数组
+            StringBuilder[] addpar = new StringBuilder[par.Length - 1];
+            string[] param = new string[par.Length - 1];
+            for (int i = 0; i < par.Length - 1; i++)
+            {
+                //新建一个char类型的数组用来存储每个字节的变量
+                char[] c = par[i + 1].ToCharArray();
+                addpar[i] = new StringBuilder();
+
+                for (int j = 0; j < c.Length; j++)
+                {
+                    if (c[j] != ' ' && c[j] != ',' && c[j] != ')')
+                    {
+                        addpar[i].Append(c[j]);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+            }
+            for (int i = 0; i < par.Length - 1; i++)
+            {
+                param[i] = addpar[i].ToString();
+            }
+            return param;
+        }
+
+
+        public void AddColumFromDataTable(DataTable dt, string tablename)
+        {
+            DataTable dt2 = (DataTable)ExecuteSql("select * from " + tablename + "  limit 0,1", "select");
+            foreach (DataColumn item in dt.Columns)
+            {
+                if (!dt2.Columns.Contains(item.ToString()))
+                {
+                    switch (item.DataType.ToString())
+                    {
+                        case "System.String":
+                            ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] VARCHAR(200) NULL", "update");
+                            break;
+                        case "System.Decimal":
+                            ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] NUMERIC NULL", "update");
+                            break;
+                        case "System.DateTime":
+                            ExecuteSql("alter table " + tablename + " add [" + item.ToString() + "] DATE NULL", "update");
+                            break;
+                        default:
+                            break;
+                    }
+                }
+            }
+        }
+    }
+}

+ 18 - 10
UAS-出货标签管理(泽天)/UAS-出货标签管理(泽天).csproj

@@ -48,7 +48,7 @@
     <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
+    <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
@@ -112,6 +112,10 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>tool\FastReport.Editor.dll</HintPath>
     </Reference>
+    <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>tool\ICSharpCode.SharpZipLib.dll</HintPath>
+    </Reference>
     <Reference Include="Interop.LabelManager2">
       <HintPath>..\..\..\UAS_WinForm\UAS-出货标签管理\bin\Debug\Interop.LabelManager2.dll</HintPath>
       <EmbedInteropTypes>False</EmbedInteropTypes>
@@ -125,6 +129,9 @@
     <Reference Include="System" />
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Data.SQLite">
+      <HintPath>tool\System.Data.SQLite.dll</HintPath>
+    </Reference>
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Web" />
@@ -244,6 +251,12 @@
     <Compile Include="Login.Designer.cs">
       <DependentUpon>Login.cs</DependentUpon>
     </Compile>
+    <Compile Include="MachineSetting.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="MachineSetting.Designer.cs">
+      <DependentUpon>MachineSetting.cs</DependentUpon>
+    </Compile>
     <Compile Include="PowerSetting.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -265,6 +278,7 @@
     <Compile Include="PublicMethod\HttpHandler.cs" />
     <Compile Include="PublicMethod\LogicHandler.cs" />
     <Compile Include="PublicMethod\LogManager.cs" />
+    <Compile Include="PublicMethod\SqliteDBHelper.cs" />
     <Compile Include="Service References\Vivo_BoxReelRelation\Reference.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
@@ -353,6 +367,9 @@
     <EmbeddedResource Include="Login.resx">
       <DependentUpon>Login.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="MachineSetting.resx">
+      <DependentUpon>MachineSetting.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="PowerSetting.resx">
       <DependentUpon>PowerSetting.cs</DependentUpon>
     </EmbeddedResource>
@@ -705,15 +722,6 @@
     <None Include="Resources\preview_16px_25980_easyicon.net.png" />
   </ItemGroup>
   <ItemGroup>
-    <COMReference Include="BarTender">
-      <Guid>{D58562C1-E51B-11CF-8941-00A024A9083F}</Guid>
-      <VersionMajor>7</VersionMajor>
-      <VersionMinor>75</VersionMinor>
-      <Lcid>0</Lcid>
-      <WrapperTool>tlbimp</WrapperTool>
-      <Isolated>False</Isolated>
-      <EmbedInteropTypes>False</EmbedInteropTypes>
-    </COMReference>
     <COMReference Include="stdole">
       <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
       <VersionMajor>2</VersionMajor>

+ 190 - 74
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs

@@ -76,13 +76,11 @@
             this.SetPrintStatus_label = new System.Windows.Forms.Label();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.label1 = new System.Windows.Forms.Label();
-            this.PackOutBox = new System.Windows.Forms.Button();
             this.PrintStatus = new System.Windows.Forms.Button();
             this.label3 = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.bi_inman = new System.Windows.Forms.Label();
             this.pib_inman = new System.Windows.Forms.Label();
-            this.PackMidBox = new System.Windows.Forms.Button();
             this.CustomerLabel = new System.Windows.Forms.Button();
             this.Combindetail = new System.Windows.Forms.CheckBox();
             this.label8 = new System.Windows.Forms.Label();
@@ -94,6 +92,17 @@
             this.GetPDdata = new System.Windows.Forms.Button();
             this.Com = new System.IO.Ports.SerialPort(this.components);
             this.ShowMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.label11 = new System.Windows.Forms.Label();
+            this.pib_indate = new System.Windows.Forms.Label();
+            this.ShowMenu_Total = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.清除明细ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.标签维护ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.打印唛头ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.附加信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.打印状态ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.标签自定义ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.重置单据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.同步出货数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.groupBoxWithBorder2 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.CloseSerialPort = new System.Windows.Forms.Button();
             this.ConnectCom = new System.Windows.Forms.Button();
@@ -127,6 +136,8 @@
             this.SingleBoxBegin = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.label12 = new System.Windows.Forms.Label();
             this.label7 = new System.Windows.Forms.Label();
+            this.PackMidBox = new System.Windows.Forms.Button();
+            this.PackOutBox = new System.Windows.Forms.Button();
             this.Input = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.LabelInf = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
@@ -187,10 +198,11 @@
             this.OutboxCapacity = new System.Windows.Forms.NumericUpDown();
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
-            this.label11 = new System.Windows.Forms.Label();
-            this.pib_indate = new System.Windows.Forms.Label();
+            this.MenuManage = new System.Windows.Forms.Button();
+            this.贴标机参数设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+            this.ShowMenu_Total.SuspendLayout();
             this.groupBoxWithBorder2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridPrcode)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
@@ -227,25 +239,27 @@
             // LabelMainTain
             // 
             this.LabelMainTain.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.LabelMainTain.Location = new System.Drawing.Point(776, 12);
+            this.LabelMainTain.Location = new System.Drawing.Point(970, 10);
             this.LabelMainTain.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.LabelMainTain.Name = "LabelMainTain";
             this.LabelMainTain.Size = new System.Drawing.Size(128, 52);
             this.LabelMainTain.TabIndex = 57;
             this.LabelMainTain.Text = "标签维护";
             this.LabelMainTain.UseVisualStyleBackColor = true;
+            this.LabelMainTain.Visible = false;
             this.LabelMainTain.Click += new System.EventHandler(this.LabelMaintain_Click);
             // 
             // CleanDetail
             // 
             this.CleanDetail.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CleanDetail.Location = new System.Drawing.Point(592, 12);
+            this.CleanDetail.Location = new System.Drawing.Point(970, 10);
             this.CleanDetail.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.CleanDetail.Name = "CleanDetail";
             this.CleanDetail.Size = new System.Drawing.Size(128, 52);
             this.CleanDetail.TabIndex = 66;
             this.CleanDetail.Text = "清除明细";
             this.CleanDetail.UseVisualStyleBackColor = true;
+            this.CleanDetail.Visible = false;
             this.CleanDetail.Click += new System.EventHandler(this.CleanDetail_Click);
             // 
             // pib_id
@@ -507,13 +521,14 @@
             // AttachInfo
             // 
             this.AttachInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AttachInfo.Location = new System.Drawing.Point(776, 78);
+            this.AttachInfo.Location = new System.Drawing.Point(970, 76);
             this.AttachInfo.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.AttachInfo.Name = "AttachInfo";
             this.AttachInfo.Size = new System.Drawing.Size(128, 52);
             this.AttachInfo.TabIndex = 85;
             this.AttachInfo.Text = "附加信息设置";
             this.AttachInfo.UseVisualStyleBackColor = true;
+            this.AttachInfo.Visible = false;
             this.AttachInfo.Click += new System.EventHandler(this.AttachInfo_Click);
             // 
             // pi_date
@@ -541,7 +556,7 @@
             // ExportData
             // 
             this.ExportData.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ExportData.Location = new System.Drawing.Point(592, 78);
+            this.ExportData.Location = new System.Drawing.Point(754, 24);
             this.ExportData.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.ExportData.Name = "ExportData";
             this.ExportData.Size = new System.Drawing.Size(128, 52);
@@ -560,6 +575,7 @@
             this.PrintFooter.TabIndex = 89;
             this.PrintFooter.Text = "打印唛头";
             this.PrintFooter.UseVisualStyleBackColor = true;
+            this.PrintFooter.Visible = false;
             this.PrintFooter.Click += new System.EventHandler(this.PrintFooter_Click);
             // 
             // SetPrintStatus_label
@@ -596,19 +612,6 @@
             this.label1.TabIndex = 95;
             this.label1.Text = "DC校验";
             // 
-            // PackOutBox
-            // 
-            this.PackOutBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PackOutBox.Location = new System.Drawing.Point(122, 96);
-            this.PackOutBox.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
-            this.PackOutBox.Name = "PackOutBox";
-            this.PackOutBox.Size = new System.Drawing.Size(128, 52);
-            this.PackOutBox.TabIndex = 96;
-            this.PackOutBox.Text = "封箱";
-            this.PackOutBox.UseVisualStyleBackColor = true;
-            this.PackOutBox.Visible = false;
-            this.PackOutBox.Click += new System.EventHandler(this.Pack_Click);
-            // 
             // PrintStatus
             // 
             this.PrintStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -619,6 +622,7 @@
             this.PrintStatus.TabIndex = 97;
             this.PrintStatus.Text = "打印状态";
             this.PrintStatus.UseVisualStyleBackColor = true;
+            this.PrintStatus.Visible = false;
             this.PrintStatus.Click += new System.EventHandler(this.PrintStatus_Click);
             // 
             // label3
@@ -663,30 +667,18 @@
             this.pib_inman.Size = new System.Drawing.Size(0, 36);
             this.pib_inman.TabIndex = 101;
             // 
-            // PackMidBox
-            // 
-            this.PackMidBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PackMidBox.Location = new System.Drawing.Point(114, 36);
-            this.PackMidBox.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
-            this.PackMidBox.Name = "PackMidBox";
-            this.PackMidBox.Size = new System.Drawing.Size(128, 52);
-            this.PackMidBox.TabIndex = 102;
-            this.PackMidBox.Text = "封中盒";
-            this.PackMidBox.UseVisualStyleBackColor = true;
-            this.PackMidBox.Visible = false;
-            this.PackMidBox.Click += new System.EventHandler(this.PackMidBox_Click);
-            // 
             // CustomerLabel
             // 
             this.CustomerLabel.Enabled = false;
             this.CustomerLabel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CustomerLabel.Location = new System.Drawing.Point(592, 144);
+            this.CustomerLabel.Location = new System.Drawing.Point(970, 142);
             this.CustomerLabel.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.CustomerLabel.Name = "CustomerLabel";
             this.CustomerLabel.Size = new System.Drawing.Size(168, 52);
             this.CustomerLabel.TabIndex = 103;
             this.CustomerLabel.Text = "标签自定义";
             this.CustomerLabel.UseVisualStyleBackColor = true;
+            this.CustomerLabel.Visible = false;
             this.CustomerLabel.Click += new System.EventHandler(this.CustomerLabel_Click);
             // 
             // Combindetail
@@ -761,13 +753,14 @@
             // Reset
             // 
             this.Reset.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Reset.Location = new System.Drawing.Point(776, 144);
+            this.Reset.Location = new System.Drawing.Point(970, 142);
             this.Reset.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.Reset.Name = "Reset";
             this.Reset.Size = new System.Drawing.Size(128, 52);
             this.Reset.TabIndex = 110;
             this.Reset.Text = "重置单据";
             this.Reset.UseVisualStyleBackColor = true;
+            this.Reset.Visible = false;
             this.Reset.Click += new System.EventHandler(this.Reset_Click);
             // 
             // GetPDdata
@@ -780,6 +773,7 @@
             this.GetPDdata.TabIndex = 111;
             this.GetPDdata.Text = "同步出货数据";
             this.GetPDdata.UseVisualStyleBackColor = true;
+            this.GetPDdata.Visible = false;
             this.GetPDdata.Click += new System.EventHandler(this.GetPDdata_Click);
             // 
             // ShowMenu
@@ -789,6 +783,92 @@
             this.ShowMenu.Size = new System.Drawing.Size(61, 4);
             this.ShowMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ShowMenu_ItemClicked);
             // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label11.Location = new System.Drawing.Point(850, 339);
+            this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(127, 36);
+            this.label11.TabIndex = 114;
+            this.label11.Text = "装箱日期";
+            // 
+            // pib_indate
+            // 
+            this.pib_indate.AutoSize = true;
+            this.pib_indate.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pib_indate.Location = new System.Drawing.Point(988, 340);
+            this.pib_indate.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pib_indate.Name = "pib_indate";
+            this.pib_indate.Size = new System.Drawing.Size(0, 36);
+            this.pib_indate.TabIndex = 115;
+            // 
+            // ShowMenu_Total
+            // 
+            this.ShowMenu_Total.ImageScalingSize = new System.Drawing.Size(32, 32);
+            this.ShowMenu_Total.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.清除明细ToolStripMenuItem,
+            this.标签维护ToolStripMenuItem,
+            this.打印唛头ToolStripMenuItem,
+            this.附加信息ToolStripMenuItem,
+            this.打印状态ToolStripMenuItem,
+            this.标签自定义ToolStripMenuItem,
+            this.重置单据ToolStripMenuItem,
+            this.同步出货数据ToolStripMenuItem,
+            this.贴标机参数设置ToolStripMenuItem});
+            this.ShowMenu_Total.Name = "ShowMenu";
+            this.ShowMenu_Total.Size = new System.Drawing.Size(257, 328);
+            this.ShowMenu_Total.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ShowMenu_Total_ItemClicked);
+            // 
+            // 清除明细ToolStripMenuItem
+            // 
+            this.清除明细ToolStripMenuItem.Name = "清除明细ToolStripMenuItem";
+            this.清除明细ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.清除明细ToolStripMenuItem.Text = "清除明细";
+            // 
+            // 标签维护ToolStripMenuItem
+            // 
+            this.标签维护ToolStripMenuItem.Name = "标签维护ToolStripMenuItem";
+            this.标签维护ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.标签维护ToolStripMenuItem.Text = "标签维护";
+            // 
+            // 打印唛头ToolStripMenuItem
+            // 
+            this.打印唛头ToolStripMenuItem.Name = "打印唛头ToolStripMenuItem";
+            this.打印唛头ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.打印唛头ToolStripMenuItem.Text = "打印唛头";
+            // 
+            // 附加信息ToolStripMenuItem
+            // 
+            this.附加信息ToolStripMenuItem.Name = "附加信息ToolStripMenuItem";
+            this.附加信息ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.附加信息ToolStripMenuItem.Text = "附加信息";
+            // 
+            // 打印状态ToolStripMenuItem
+            // 
+            this.打印状态ToolStripMenuItem.Name = "打印状态ToolStripMenuItem";
+            this.打印状态ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.打印状态ToolStripMenuItem.Text = "打印状态";
+            // 
+            // 标签自定义ToolStripMenuItem
+            // 
+            this.标签自定义ToolStripMenuItem.Name = "标签自定义ToolStripMenuItem";
+            this.标签自定义ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.标签自定义ToolStripMenuItem.Text = "标签自定义";
+            // 
+            // 重置单据ToolStripMenuItem
+            // 
+            this.重置单据ToolStripMenuItem.Name = "重置单据ToolStripMenuItem";
+            this.重置单据ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.重置单据ToolStripMenuItem.Text = "重置单据";
+            // 
+            // 同步出货数据ToolStripMenuItem
+            // 
+            this.同步出货数据ToolStripMenuItem.Name = "同步出货数据ToolStripMenuItem";
+            this.同步出货数据ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.同步出货数据ToolStripMenuItem.Text = "同步出货数据";
+            // 
             // groupBoxWithBorder2
             // 
             this.groupBoxWithBorder2.Controls.Add(this.CloseSerialPort);
@@ -845,7 +925,7 @@
             this.Weight.AutoSize = true;
             this.Weight.Font = new System.Drawing.Font("微软雅黑", 30F);
             this.Weight.ForeColor = System.Drawing.Color.Red;
-            this.Weight.Location = new System.Drawing.Point(14, 62);
+            this.Weight.Location = new System.Drawing.Point(16, 64);
             this.Weight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Weight.Name = "Weight";
             this.Weight.Size = new System.Drawing.Size(0, 104);
@@ -1084,7 +1164,7 @@
             // 
             this.label18.AutoSize = true;
             this.label18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label18.Location = new System.Drawing.Point(130, 246);
+            this.label18.Location = new System.Drawing.Point(132, 248);
             this.label18.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(24, 31);
@@ -1119,7 +1199,7 @@
             // 
             this.label16.AutoSize = true;
             this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label16.Location = new System.Drawing.Point(126, 118);
+            this.label16.Location = new System.Drawing.Point(128, 120);
             this.label16.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(24, 31);
@@ -1154,7 +1234,7 @@
             // 
             this.label12.AutoSize = true;
             this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label12.Location = new System.Drawing.Point(14, 178);
+            this.label12.Location = new System.Drawing.Point(16, 180);
             this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(110, 31);
@@ -1165,13 +1245,39 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(10, 54);
+            this.label7.Location = new System.Drawing.Point(12, 56);
             this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(110, 31);
             this.label7.TabIndex = 76;
             this.label7.Text = "单盘范围";
             // 
+            // PackMidBox
+            // 
+            this.PackMidBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.PackMidBox.Location = new System.Drawing.Point(114, 36);
+            this.PackMidBox.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
+            this.PackMidBox.Name = "PackMidBox";
+            this.PackMidBox.Size = new System.Drawing.Size(128, 52);
+            this.PackMidBox.TabIndex = 102;
+            this.PackMidBox.Text = "封中盒";
+            this.PackMidBox.UseVisualStyleBackColor = true;
+            this.PackMidBox.Visible = false;
+            this.PackMidBox.Click += new System.EventHandler(this.PackMidBox_Click);
+            // 
+            // PackOutBox
+            // 
+            this.PackOutBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.PackOutBox.Location = new System.Drawing.Point(122, 96);
+            this.PackOutBox.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
+            this.PackOutBox.Name = "PackOutBox";
+            this.PackOutBox.Size = new System.Drawing.Size(128, 52);
+            this.PackOutBox.TabIndex = 96;
+            this.PackOutBox.Text = "封箱";
+            this.PackOutBox.UseVisualStyleBackColor = true;
+            this.PackOutBox.Visible = false;
+            this.PackOutBox.Click += new System.EventHandler(this.Pack_Click);
+            // 
             // Input
             // 
             this.Input.ID = null;
@@ -1491,7 +1597,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(14, 353);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(276, 355);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(136, 52);
@@ -1506,7 +1612,7 @@
             this.SingleLabelAutoPrint.Checked = true;
             this.SingleLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(22, 190);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(24, 192);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(142, 35);
@@ -1553,7 +1659,7 @@
             this.CurrentRowOnly.Checked = true;
             this.CurrentRowOnly.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CurrentRowOnly.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CurrentRowOnly.Location = new System.Drawing.Point(166, 194);
+            this.CurrentRowOnly.Location = new System.Drawing.Point(168, 196);
             this.CurrentRowOnly.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.CurrentRowOnly.Name = "CurrentRowOnly";
             this.CurrentRowOnly.Size = new System.Drawing.Size(166, 35);
@@ -1579,7 +1685,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(14, 246);
+            this.label2.Location = new System.Drawing.Point(16, 248);
             this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(62, 31);
@@ -1603,7 +1709,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(14, 310);
+            this.label5.Location = new System.Drawing.Point(16, 312);
             this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(62, 31);
@@ -1637,7 +1743,7 @@
             this.MidLabelAutoPrint.Checked = true;
             this.MidLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.MidLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidLabelAutoPrint.Location = new System.Drawing.Point(10, 190);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(12, 192);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(142, 35);
@@ -1689,7 +1795,7 @@
             // 
             this.DiffDetno.AutoSize = true;
             this.DiffDetno.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffDetno.Location = new System.Drawing.Point(250, 378);
+            this.DiffDetno.Location = new System.Drawing.Point(252, 380);
             this.DiffDetno.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffDetno.Name = "DiffDetno";
             this.DiffDetno.Size = new System.Drawing.Size(133, 34);
@@ -1701,7 +1807,7 @@
             // 
             this.DiffCPN.AutoSize = true;
             this.DiffCPN.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffCPN.Location = new System.Drawing.Point(250, 334);
+            this.DiffCPN.Location = new System.Drawing.Point(252, 336);
             this.DiffCPN.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffCPN.Name = "DiffCPN";
             this.DiffCPN.Size = new System.Drawing.Size(135, 34);
@@ -1713,7 +1819,7 @@
             // 
             this.BoxCount.AutoSize = true;
             this.BoxCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.BoxCount.Location = new System.Drawing.Point(262, 374);
+            this.BoxCount.Location = new System.Drawing.Point(264, 376);
             this.BoxCount.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.BoxCount.Name = "BoxCount";
             this.BoxCount.Size = new System.Drawing.Size(0, 31);
@@ -1723,7 +1829,7 @@
             // 
             this.DiffLotNo.AutoSize = true;
             this.DiffLotNo.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffLotNo.Location = new System.Drawing.Point(250, 286);
+            this.DiffLotNo.Location = new System.Drawing.Point(252, 288);
             this.DiffLotNo.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffLotNo.Name = "DiffLotNo";
             this.DiffLotNo.Size = new System.Drawing.Size(118, 34);
@@ -1735,7 +1841,7 @@
             // 
             this.DiffDC.AutoSize = true;
             this.DiffDC.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffDC.Location = new System.Drawing.Point(250, 234);
+            this.DiffDC.Location = new System.Drawing.Point(252, 236);
             this.DiffDC.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffDC.Name = "DiffDC";
             this.DiffDC.Size = new System.Drawing.Size(121, 34);
@@ -1747,7 +1853,7 @@
             // 
             this.OnlyOneRow.AutoSize = true;
             this.OnlyOneRow.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.OnlyOneRow.Location = new System.Drawing.Point(250, 186);
+            this.OnlyOneRow.Location = new System.Drawing.Point(252, 188);
             this.OnlyOneRow.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.OnlyOneRow.Name = "OnlyOneRow";
             this.OnlyOneRow.Size = new System.Drawing.Size(111, 34);
@@ -1759,7 +1865,7 @@
             // 
             this.AllLabel.AutoSize = true;
             this.AllLabel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AllLabel.Location = new System.Drawing.Point(18, 190);
+            this.AllLabel.Location = new System.Drawing.Point(20, 192);
             this.AllLabel.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.AllLabel.Name = "AllLabel";
             this.AllLabel.Size = new System.Drawing.Size(190, 35);
@@ -1782,7 +1888,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(226, 14);
+            this.LogingOut.Location = new System.Drawing.Point(228, 16);
             this.LogingOut.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(82, 41);
@@ -1810,7 +1916,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(30, 306);
+            this.label10.Location = new System.Drawing.Point(32, 308);
             this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(62, 31);
@@ -1821,7 +1927,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(30, 246);
+            this.label6.Location = new System.Drawing.Point(32, 248);
             this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(62, 31);
@@ -1876,26 +1982,23 @@
             this.OutBoxCombox.TabIndex = 78;
             this.OutBoxCombox.SelectedIndexChanged += new System.EventHandler(this.OutBoxCombox_SelectedIndexChanged);
             // 
-            // label11
+            // MenuManage
             // 
-            this.label11.AutoSize = true;
-            this.label11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label11.Location = new System.Drawing.Point(850, 339);
-            this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.label11.Name = "label11";
-            this.label11.Size = new System.Drawing.Size(127, 36);
-            this.label11.TabIndex = 114;
-            this.label11.Text = "装箱日期";
+            this.MenuManage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.MenuManage.Location = new System.Drawing.Point(592, 24);
+            this.MenuManage.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
+            this.MenuManage.Name = "MenuManage";
+            this.MenuManage.Size = new System.Drawing.Size(128, 52);
+            this.MenuManage.TabIndex = 117;
+            this.MenuManage.Text = "后台管理";
+            this.MenuManage.UseVisualStyleBackColor = true;
+            this.MenuManage.Click += new System.EventHandler(this.MenuManage_Click);
             // 
-            // pib_indate
+            // 贴标机参数设置ToolStripMenuItem
             // 
-            this.pib_indate.AutoSize = true;
-            this.pib_indate.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pib_indate.Location = new System.Drawing.Point(988, 340);
-            this.pib_indate.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.pib_indate.Name = "pib_indate";
-            this.pib_indate.Size = new System.Drawing.Size(0, 36);
-            this.pib_indate.TabIndex = 115;
+            this.贴标机参数设置ToolStripMenuItem.Name = "贴标机参数设置ToolStripMenuItem";
+            this.贴标机参数设置ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.贴标机参数设置ToolStripMenuItem.Text = "贴标机参数设置";
             // 
             // UAS_出货标签打印
             // 
@@ -1903,6 +2006,7 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(2548, 1464);
+            this.Controls.Add(this.MenuManage);
             this.Controls.Add(this.pib_indate);
             this.Controls.Add(this.label11);
             this.Controls.Add(this.groupBoxWithBorder2);
@@ -1956,6 +2060,7 @@
             this.SizeChanged += new System.EventHandler(this.贴标机条码打印_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+            this.ShowMenu_Total.ResumeLayout(true);
             this.groupBoxWithBorder2.ResumeLayout(true);
             this.groupBoxWithBorder2.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridPrcode)).EndInit();
@@ -2134,5 +2239,16 @@
         private System.Windows.Forms.CheckBox DiffDetno;
         private System.Windows.Forms.Label label11;
         private System.Windows.Forms.Label pib_indate;
+        private System.Windows.Forms.ContextMenuStrip ShowMenu_Total;
+        private System.Windows.Forms.ToolStripMenuItem 清除明细ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 标签维护ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 打印唛头ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 附加信息ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 打印状态ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 标签自定义ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 重置单据ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 同步出货数据ToolStripMenuItem;
+        private System.Windows.Forms.Button MenuManage;
+        private System.Windows.Forms.ToolStripMenuItem 贴标机参数设置ToolStripMenuItem;
     }
 }

+ 44 - 0
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -19,6 +19,8 @@ namespace UAS_LabelMachine
 {
     public partial class UAS_出货标签打印 : Form
     {
+
+
         //自适应屏幕
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
@@ -2261,5 +2263,47 @@ namespace UAS_LabelMachine
                 Com.DataReceived -= Com_DataReceived;
             }
         }
+
+        private void ShowMenu_Total_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
+        {
+            ShowMenu_Total.Close();
+            switch (e.ClickedItem.Text)
+            {
+                case "清除明细":
+                    CleanDetail_Click(sender, e);
+                    break;
+                case "标签维护":
+                    LabelMaintain_Click(sender, e);
+                    break;
+                case "打印唛头":
+                    PrintFooter_Click(sender, e);
+                    break;
+                case "附加信息":
+                    AttachInfo_Click(sender, e);
+                    break;
+                case "打印状态":
+                    PrintStatus_Click(sender, e);
+                    break;
+                case "标签自定义":
+                    CustomerLabel_Click(sender, e);
+                    break;
+                case "同步出货数据":
+                    GetPDdata_Click(sender, e);
+                    break;
+                case "重置单据":
+                    Reset_Click(sender, e);
+                    break;
+                case "贴标机参数设置":
+                    MachineSetting ms = new MachineSetting();
+                    BaseUtil.SetFormCenter(ms);
+                    ms.ShowDialog();
+                    break;
+            }
+        }
+
+        private void MenuManage_Click(object sender, EventArgs e)
+        {
+            ShowMenu_Total.Show(new Point(MenuManage.Location.X, MenuManage.Location.Y + 20));
+        }
     }
 }

+ 7 - 4
UAS-出货标签管理(泽天)/UAS_出货标签管理.resx

@@ -121,16 +121,19 @@
     <value>17, 17</value>
   </metadata>
   <metadata name="MidSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>179, 17</value>
+    <value>976, 22</value>
   </metadata>
   <metadata name="ExportFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>294, 17</value>
+    <value>494, 21</value>
   </metadata>
   <metadata name="Com.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>442, 17</value>
+    <value>328, 20</value>
   </metadata>
   <metadata name="ShowMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>521, 17</value>
+    <value>760, 21</value>
+  </metadata>
+  <metadata name="ShowMenu_Total.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>1175, 22</value>
   </metadata>
   <metadata name="pd_pdno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>

BIN
UAS-出货标签管理(泽天)/tool/ICSharpCode.SharpZipLib.dll


BIN
UAS-出货标签管理(泽天)/tool/System.Data.SQLite.dll