Browse Source

添加批量打印功能

章政 6 years ago
parent
commit
d09be8a4e2

+ 201 - 0
UAS-出货标签管理(贸易版)/DateCodeSetAndPrint.Designer.cs

@@ -0,0 +1,201 @@
+namespace UAS_LabelMachine
+{
+    partial class DateCodeSetAndPrint
+    {
+        /// <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.SetValueAndPrint = new System.Windows.Forms.Button();
+            this.loadingCircle1 = new UAS_LabelMachine.CustomControl.SetLoading.LoadingCircle();
+            this.SetValue = new System.Windows.Forms.Button();
+            this.lotno_label = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.lotno = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.datecode = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.Nums = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.loadingCircle2 = new UAS_LabelMachine.CustomControl.SetLoading.LoadingCircle();
+            this.SuspendLayout();
+            // 
+            // SetValueAndPrint
+            // 
+            this.SetValueAndPrint.Location = new System.Drawing.Point(191, 168);
+            this.SetValueAndPrint.Margin = new System.Windows.Forms.Padding(2);
+            this.SetValueAndPrint.Name = "SetValueAndPrint";
+            this.SetValueAndPrint.Size = new System.Drawing.Size(77, 20);
+            this.SetValueAndPrint.TabIndex = 0;
+            this.SetValueAndPrint.Text = "设置并打印";
+            this.SetValueAndPrint.UseVisualStyleBackColor = true;
+            // 
+            // loadingCircle1
+            // 
+            this.loadingCircle1.Active = false;
+            this.loadingCircle1.Color = System.Drawing.Color.DarkGray;
+            this.loadingCircle1.InnerCircleRadius = 5;
+            this.loadingCircle1.Location = new System.Drawing.Point(205, 80);
+            this.loadingCircle1.Margin = new System.Windows.Forms.Padding(2);
+            this.loadingCircle1.Name = "loadingCircle1";
+            this.loadingCircle1.NumberSpoke = 12;
+            this.loadingCircle1.OuterCircleRadius = 11;
+            this.loadingCircle1.RotationSpeed = 100;
+            this.loadingCircle1.Size = new System.Drawing.Size(0, 0);
+            this.loadingCircle1.SpokeThickness = 2;
+            this.loadingCircle1.StylePreset = UAS_LabelMachine.CustomControl.SetLoading.LoadingCircle.StylePresets.MacOSX;
+            this.loadingCircle1.TabIndex = 2;
+            this.loadingCircle1.Text = "loadingCircle1";
+            // 
+            // SetValue
+            // 
+            this.SetValue.Location = new System.Drawing.Point(106, 168);
+            this.SetValue.Margin = new System.Windows.Forms.Padding(2);
+            this.SetValue.Name = "SetValue";
+            this.SetValue.Size = new System.Drawing.Size(71, 20);
+            this.SetValue.TabIndex = 3;
+            this.SetValue.Text = "设置值";
+            this.SetValue.UseVisualStyleBackColor = true;
+            // 
+            // lotno_label
+            // 
+            this.lotno_label.AutoSize = true;
+            this.lotno_label.Location = new System.Drawing.Point(68, 46);
+            this.lotno_label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.lotno_label.Name = "lotno_label";
+            this.lotno_label.Size = new System.Drawing.Size(35, 12);
+            this.lotno_label.TabIndex = 4;
+            this.lotno_label.Text = "LotNo";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(68, 88);
+            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(53, 12);
+            this.label2.TabIndex = 5;
+            this.label2.Text = "DateCode";
+            // 
+            // lotno
+            // 
+            this.lotno.ID = null;
+            this.lotno.Location = new System.Drawing.Point(134, 44);
+            this.lotno.Margin = new System.Windows.Forms.Padding(2);
+            this.lotno.Name = "lotno";
+            this.lotno.Size = new System.Drawing.Size(152, 21);
+            this.lotno.Str = null;
+            this.lotno.Str1 = null;
+            this.lotno.Str2 = null;
+            this.lotno.TabIndex = 6;
+            // 
+            // datecode
+            // 
+            this.datecode.ID = null;
+            this.datecode.Location = new System.Drawing.Point(134, 83);
+            this.datecode.Margin = new System.Windows.Forms.Padding(2);
+            this.datecode.Name = "datecode";
+            this.datecode.Size = new System.Drawing.Size(152, 21);
+            this.datecode.Str = null;
+            this.datecode.Str1 = null;
+            this.datecode.Str2 = null;
+            this.datecode.TabIndex = 7;
+            // 
+            // Nums
+            // 
+            this.Nums.ID = null;
+            this.Nums.Location = new System.Drawing.Point(134, 123);
+            this.Nums.Margin = new System.Windows.Forms.Padding(2);
+            this.Nums.Name = "Nums";
+            this.Nums.Size = new System.Drawing.Size(152, 21);
+            this.Nums.Str = null;
+            this.Nums.Str1 = null;
+            this.Nums.Str2 = null;
+            this.Nums.TabIndex = 10;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(68, 128);
+            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(29, 12);
+            this.label1.TabIndex = 9;
+            this.label1.Text = "数量";
+            // 
+            // loadingCircle2
+            // 
+            this.loadingCircle2.Active = false;
+            this.loadingCircle2.Color = System.Drawing.Color.DarkGray;
+            this.loadingCircle2.InnerCircleRadius = 5;
+            this.loadingCircle2.Location = new System.Drawing.Point(205, 120);
+            this.loadingCircle2.Margin = new System.Windows.Forms.Padding(2);
+            this.loadingCircle2.Name = "loadingCircle2";
+            this.loadingCircle2.NumberSpoke = 12;
+            this.loadingCircle2.OuterCircleRadius = 11;
+            this.loadingCircle2.RotationSpeed = 100;
+            this.loadingCircle2.Size = new System.Drawing.Size(0, 0);
+            this.loadingCircle2.SpokeThickness = 2;
+            this.loadingCircle2.StylePreset = UAS_LabelMachine.CustomControl.SetLoading.LoadingCircle.StylePresets.MacOSX;
+            this.loadingCircle2.TabIndex = 8;
+            this.loadingCircle2.Text = "loadingCircle2";
+            // 
+            // DateCodeSetAndPrint
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(365, 212);
+            this.Controls.Add(this.Nums);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.loadingCircle2);
+            this.Controls.Add(this.datecode);
+            this.Controls.Add(this.lotno);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.lotno_label);
+            this.Controls.Add(this.SetValue);
+            this.Controls.Add(this.loadingCircle1);
+            this.Controls.Add(this.SetValueAndPrint);
+            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Name = "DateCodeSetAndPrint";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "DateCodeSetAndPrint";
+            this.Load += new System.EventHandler(this.DateCodeSetAndPrint_Load);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button SetValueAndPrint;
+        private CustomControl.SetLoading.LoadingCircle loadingCircle1;
+        private System.Windows.Forms.Button SetValue;
+        private System.Windows.Forms.Label lotno_label;
+        private System.Windows.Forms.Label label2;
+        private CustomControl.EnterTextBox lotno;
+        private CustomControl.EnterTextBox datecode;
+        private CustomControl.EnterTextBox Nums;
+        private System.Windows.Forms.Label label1;
+        private CustomControl.SetLoading.LoadingCircle loadingCircle2;
+    }
+}

+ 24 - 0
UAS-出货标签管理(贸易版)/DateCodeSetAndPrint.cs

@@ -0,0 +1,24 @@
+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;
+
+namespace UAS_LabelMachine
+{
+    public partial class DateCodeSetAndPrint : Form
+    {
+        public DateCodeSetAndPrint()
+        {
+            InitializeComponent();
+        }
+
+        private void DateCodeSetAndPrint_Load(object sender, EventArgs e)
+        {
+
+        }
+    }
+}

+ 120 - 0
UAS-出货标签管理(贸易版)/DateCodeSetAndPrint.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>

+ 57 - 18
UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs

@@ -11,27 +11,27 @@ namespace UAS_LabelMachine
     public class DataHelper
     {
 
-        //海创外网地址
-        private readonly string ConnectionStrings = "Data Source=cmityj.gicp.net/orcl;User ID=HC_TEST;PassWord=select!#%*(";
-        //海创ERP地址
-        public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
-        //海创FTP
-        public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
-        //Oracle端口
-        public static readonly string OraclePort = "1521";
-        //需要显示的账套
-        public static readonly string Masters = "HC_TEST";
-
-        ////凯而高地址
-        //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=KRG_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=112.25.154.186)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////凯而高ERP地址
-        //public static readonly string ERPAddesss = "http://112.25.154.186:8099/ERP/";
-        ////凯而高FTP
-        //public static readonly string FTPAdress = "ftp://112.25.154.186:21|KEGFTP|Admin1@#";
+        ////海创外网地址
+        //private readonly string ConnectionStrings = "Data Source=cmityj.gicp.net/orcl;User ID=HC_TEST;PassWord=select!#%*(";
+        ////海创ERP地址
+        //public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
+        ////海创FTP
+        //public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
         ////Oracle端口
         //public static readonly string OraclePort = "1521";
         ////需要显示的账套
-        //public static readonly string Masters = "GOLDEN";
+        //public static readonly string Masters = "HC_TEST";
+
+        //凯而高地址
+        private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=KRG_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=112.25.154.186)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        //凯而高ERP地址
+        public static readonly string ERPAddesss = "http://112.25.154.186:8099/ERP/";
+        //凯而高FTP
+        public static readonly string FTPAdress = "ftp://112.25.154.186:21|KEGFTP|Admin1@#";
+        //Oracle端口
+        public static readonly string OraclePort = "1521";
+        //需要显示的账套
+        public static readonly string Masters = "GOLDEN";
 
         ////凯而高
         //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=KRG_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.12)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
@@ -1146,6 +1146,45 @@ namespace UAS_LabelMachine
             command.Dispose();
         }
 
+        /// <summary>
+        /// 调用存储过程
+        /// </summary>
+        /// <param name="ProcedureName"></param>
+        /// <param name="param"></param>
+        public void CallProcedure(string ProcedureName, DataTable upload)
+        {
+            StringBuilder sql = new StringBuilder();
+            sql.Append("declare barcode BarCodeUpload_arr;begin barcode:=BarCodeUpload_arr(");
+            for (int i = 0; i < upload.Rows.Count; i++)
+            {
+                //特殊语句,传递回拼接的ID给到跟新本地数据
+                sql.Append("BarCodeUpload(");
+                for (int j = 0; j < upload.Columns.Count; j++)
+                {
+                    sql.Append("'" + upload.Rows[i][j].ToString() + "',");
+                }
+                sql.Remove(sql.Length - 1, 1);
+                sql.Append("),");
+            }
+            sql.Remove(sql.Length - 1, 1);
+            sql.Append(");sp_uploadbarcode(barcode);END;");
+            command = new OracleCommand();
+            command.Connection = connection;
+            command.CommandText = sql.ToString();
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(DBConnectionString);
+                connection.Open();
+                command.Connection = connection;
+                command.ExecuteNonQuery();
+            }
+            command.Dispose();
+        }
+
         /// <summary>
         /// 出现异常进行回滚的执行方法
         /// </summary>

+ 9 - 0
UAS-出货标签管理(贸易版)/UAS-出货标签管理(贸易版).csproj

@@ -221,6 +221,12 @@
     <Compile Include="CustomControl\SearchTextBox.Designer.cs">
       <DependentUpon>SearchTextBox.cs</DependentUpon>
     </Compile>
+    <Compile Include="DateCodeSetAndPrint.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="DateCodeSetAndPrint.Designer.cs">
+      <DependentUpon>DateCodeSetAndPrint.cs</DependentUpon>
+    </Compile>
     <Compile Include="DbFind.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -334,6 +340,9 @@
     <EmbeddedResource Include="CustomControl\SearchTextBox.resx">
       <DependentUpon>SearchTextBox.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="DateCodeSetAndPrint.resx">
+      <DependentUpon>DateCodeSetAndPrint.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="DbFind.resx">
       <DependentUpon>DbFind.cs</DependentUpon>
     </EmbeddedResource>

+ 15 - 14
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs

@@ -98,6 +98,7 @@
             this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem();
+            this.下载模板ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.ImportExcel = new System.Windows.Forms.OpenFileDialog();
             this.cu_code = new UAS_LabelMachine.CustomControl.SearchTextBox();
             this.groupBoxWithBorder1 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
@@ -185,7 +186,6 @@
             this.OutBoxLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
             this.pi_class = new System.Windows.Forms.Label();
-            this.下载模板ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             ((System.ComponentModel.ISupportInitialize)(this.Si_ItemDGV)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             this.Menu.SuspendLayout();
@@ -764,45 +764,51 @@
             this.下载模板ToolStripMenuItem});
             this.Menu.Name = "Menu";
             this.Menu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
-            this.Menu.Size = new System.Drawing.Size(153, 180);
+            this.Menu.Size = new System.Drawing.Size(149, 158);
             this.Menu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.Menu_ItemClicked);
             // 
             // toolStripMenuItem1
             // 
             this.toolStripMenuItem1.Name = "toolStripMenuItem1";
-            this.toolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
+            this.toolStripMenuItem1.Size = new System.Drawing.Size(148, 22);
             this.toolStripMenuItem1.Text = "采集策略设置";
             // 
             // toolStripMenuItem2
             // 
             this.toolStripMenuItem2.Name = "toolStripMenuItem2";
-            this.toolStripMenuItem2.Size = new System.Drawing.Size(152, 22);
+            this.toolStripMenuItem2.Size = new System.Drawing.Size(148, 22);
             this.toolStripMenuItem2.Text = "附加信息设置";
             // 
             // toolStripMenuItem3
             // 
             this.toolStripMenuItem3.Name = "toolStripMenuItem3";
-            this.toolStripMenuItem3.Size = new System.Drawing.Size(152, 22);
+            this.toolStripMenuItem3.Size = new System.Drawing.Size(148, 22);
             this.toolStripMenuItem3.Text = "导出数据";
             // 
             // toolStripMenuItem4
             // 
             this.toolStripMenuItem4.Name = "toolStripMenuItem4";
-            this.toolStripMenuItem4.Size = new System.Drawing.Size(152, 22);
+            this.toolStripMenuItem4.Size = new System.Drawing.Size(148, 22);
             this.toolStripMenuItem4.Text = "权限设置";
             // 
             // toolStripMenuItem5
             // 
             this.toolStripMenuItem5.Name = "toolStripMenuItem5";
-            this.toolStripMenuItem5.Size = new System.Drawing.Size(152, 22);
+            this.toolStripMenuItem5.Size = new System.Drawing.Size(148, 22);
             this.toolStripMenuItem5.Text = "标签维护";
             // 
             // toolStripMenuItem6
             // 
             this.toolStripMenuItem6.Name = "toolStripMenuItem6";
-            this.toolStripMenuItem6.Size = new System.Drawing.Size(152, 22);
+            this.toolStripMenuItem6.Size = new System.Drawing.Size(148, 22);
             this.toolStripMenuItem6.Text = "条码导入生成";
             // 
+            // 下载模板ToolStripMenuItem
+            // 
+            this.下载模板ToolStripMenuItem.Name = "下载模板ToolStripMenuItem";
+            this.下载模板ToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
+            this.下载模板ToolStripMenuItem.Text = "下载模板";
+            // 
             // ImportExcel
             // 
             this.ImportExcel.FileName = "ImportExcel";
@@ -1193,6 +1199,7 @@
             this.LabelInf.Size = new System.Drawing.Size(1251, 326);
             this.LabelInf.TabIndex = 27;
             this.LabelInf.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.LabelInf_CellEndEdit);
+            this.LabelInf.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.LabelInf_CellMouseClick);
             this.LabelInf.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.LabelInf_CellPainting);
             this.LabelInf.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.LabelInf_CellValueChanged);
             this.LabelInf.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.LabelInf_DataError);
@@ -1795,12 +1802,6 @@
             this.pi_class.TabIndex = 90;
             this.pi_class.Visible = false;
             // 
-            // 下载模板ToolStripMenuItem
-            // 
-            this.下载模板ToolStripMenuItem.Name = "下载模板ToolStripMenuItem";
-            this.下载模板ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
-            this.下载模板ToolStripMenuItem.Text = "下载模板";
-            // 
             // UAS_出货标签打印
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

+ 92 - 8
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -306,12 +306,9 @@ namespace UAS_LabelMachine
         /// <param name="e"></param>
         private void SaveGrid_Click(object sender, EventArgs e)
         {
-            DataTable savedt = (LabelInf.DataSource as DataTable);
-            if (savedt != null && savedt.GetChanges() != null)
-            {
-                dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
-                MessageBox.Show("保存成功!");
-            }
+            DataTable dt = (DataTable)sdh.ExecuteSql("select pib_id,pib_outboxcode1,pib_outboxcode2,pib_custmidboxcode,pib_custoutboxcode,pib_lotno,pib_datecode,pib_ifupload,pib_ifpick,pib_ifprint from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_ifpick=-1   ", "select");
+            dh.CallProcedure("sp_uploadbarcode", dt);
+            MessageBox.Show("保存成功!");
         }
 
         //放大镜选择后出发的事件
@@ -1585,7 +1582,7 @@ namespace UAS_LabelMachine
             {
                 //检验查询的字段和本地数据库字段是否匹配
                 sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
-                sdh.BatchInsert("prodiobarcode", LabelInfDataTable);
+                //sdh.BatchInsert("prodiobarcode", LabelInfDataTable);
             }
             sql.Clear();
             sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by rownum ");
@@ -2231,7 +2228,7 @@ namespace UAS_LabelMachine
                     result = ExportFileDialog.ShowDialog();
                     if (result == DialogResult.OK)
                     {
-                        File.Copy(System.Windows.Forms.Application.StartupPath+ "\\导入模板.xlsx", ExportFileDialog.SelectedPath+ "\\导入模板.xlsx",true);
+                        File.Copy(System.Windows.Forms.Application.StartupPath + "\\导入模板.xlsx", ExportFileDialog.SelectedPath + "\\导入模板.xlsx", true);
                         System.Diagnostics.Process.Start(ExportFileDialog.SelectedPath + "\\导入模板.xlsx");
                     }
                     break;
@@ -2531,5 +2528,92 @@ namespace UAS_LabelMachine
                 MessageBox.Show(ex.Message);
             }
         }
+
+        int rowindex = 0;
+
+        private void LabelInf_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
+        {
+            if (e.Button == MouseButtons.Right)
+            {
+                rowindex = e.RowIndex;
+                DateCodeSetAndPrint date = new DateCodeSetAndPrint();
+                date.Controls["SetValue"].Click += SetValue_ButtonClick;
+                date.Controls["SetValueAndPrint"].Click += SetValueAndPrint_ButtonClick;
+                date.ShowDialog();
+            }
+        }
+
+        private void SetValue_ButtonClick(object sender, EventArgs e)
+        {
+            Button setvalue = sender as Button;
+            string pdno = LabelInf.Rows[rowindex].Cells["pib_pdno"].Value.ToString();
+            string datecode = setvalue.FindForm().Controls["datecode"].Text;
+            string lotno = setvalue.FindForm().Controls["lotno"].Text;
+            string nums = setvalue.FindForm().Controls["Nums"].Text;
+            string year = "0";
+            string month = "0";
+            string day = "0";
+            string sql = "update prodiobarcode set pib_autoset=-1,pib_ifrecheck=-1,pib_ifpick=-1,pib_ifmodify=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_id in (select pib_id from prodiobarcode where  pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno;
+            if (datecode != "")
+            {
+                sql += "  and (pib_datecode='' or pib_datecode is null) ";
+            }
+            if (lotno != "")
+            {
+                sql += " and (pib_lotno='' or pib_lotno is null) ";
+            }
+            if (nums == "")
+            {
+                sql += ")";
+            }
+            else
+            {
+                sql += " limit 0," + nums + ")";
+            }
+            sdh.ExecuteSql(sql, "update");
+            LoadGridData();
+            setvalue.FindForm().Close();
+        }
+
+        private void SetValueAndPrint_ButtonClick(object sender, EventArgs e)
+        {
+            Button setvalueandprint = sender as Button;
+            string pdno = LabelInf.Rows[rowindex].Cells["pib_pdno"].Value.ToString();
+            string datecode = setvalueandprint.FindForm().Controls["datecode"].Text;
+            string lotno = setvalueandprint.FindForm().Controls["lotno"].Text;
+            string nums = setvalueandprint.FindForm().Controls["Nums"].Text;
+            string year = "0";
+            string month = "0";
+            string day = "0";
+            string sql = "update prodiobarcode set pib_autoset=-1,pib_ifrecheck=-1,pib_ifpick=-1,pib_ifmodify=-1,pib_ifprint=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_id in (select pib_id from prodiobarcode where  pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno;
+            string PrintSQL = "select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno;
+            if (datecode != "")
+            {
+                sql += " and (pib_datecode='' or pib_datecode is null) ";
+                PrintSQL += " and (pib_datecode='' or pib_datecode is null) ";
+            }
+            if (lotno != "")
+            {
+                sql += " and (pib_lotno='' or pib_lotno is null) ";
+                PrintSQL += " and (pib_lotno='' or pib_lotno is null) ";
+            }
+            if (nums == "")
+            {
+                sql += ")";
+            }
+            else
+            {
+                sql += " limit 0," + nums + ")";
+                PrintSQL += " limit 0," + nums;
+            }
+            DataTable pibid_dt = (DataTable)sdh.ExecuteSql(PrintSQL, "select");
+            sdh.ExecuteSql(sql, "update");
+            for (int i = 0; i < pibid_dt.Rows.Count; i++)
+            {
+                Print.BarTender.SinglePrint(SingleFormat, SingleLabelParam, pibid_dt.Rows[i]["pib_id"].ToString());
+            }
+            setvalueandprint.FindForm().Close();
+        }
+
     }
 }