Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

caosy 6 years ago
parent
commit
58d4f74f1c

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

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UAS_出货标签打印));
             this.pi_inoutno_label = new System.Windows.Forms.Label();
@@ -37,7 +38,7 @@
             this.pib_id = new System.Windows.Forms.Label();
             this.pi_cardcode = new System.Windows.Forms.Label();
             this.Fresh = new System.Windows.Forms.LinkLabel();
-            this.RefreshDBConnect = new System.Windows.Forms.Timer();
+            this.RefreshDBConnect = new System.Windows.Forms.Timer(this.components);
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -64,7 +65,7 @@
             this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.dataGridViewTextBoxColumn23 = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.MidSource = new System.Windows.Forms.BindingSource();
+            this.MidSource = new System.Windows.Forms.BindingSource(this.components);
             this.ChooseAll = new System.Windows.Forms.Button();
             this.ExportFileDialog = new System.Windows.Forms.FolderBrowserDialog();
             this.AttachInfo = new System.Windows.Forms.Button();
@@ -155,6 +156,7 @@
             this.MidLabelAutoPrint = new System.Windows.Forms.CheckBox();
             this.MidLabelCombox = new System.Windows.Forms.ComboBox();
             this.OutBoxLabel = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
+            this.OnlyOneRow = new System.Windows.Forms.CheckBox();
             this.AllLabel = new System.Windows.Forms.CheckBox();
             this.AddNewOutBox = new System.Windows.Forms.Button();
             this.LogingOut = new System.Windows.Forms.LinkLabel();
@@ -167,7 +169,7 @@
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
             this.Reset = new System.Windows.Forms.Button();
             this.GetPDdata = new System.Windows.Forms.Button();
-            this.OnlyOneRow = new System.Windows.Forms.CheckBox();
+            this.ResetHBXH = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridPrcode)).BeginInit();
@@ -909,6 +911,7 @@
             // 
             // groupBoxWithBorder1
             // 
+            this.groupBoxWithBorder1.Controls.Add(this.ResetHBXH);
             this.groupBoxWithBorder1.Controls.Add(this.label18);
             this.groupBoxWithBorder1.Controls.Add(this.MidBoxEnd);
             this.groupBoxWithBorder1.Controls.Add(this.MidBoxBegin);
@@ -1462,6 +1465,18 @@
             this.OutBoxLabel.TabStop = false;
             this.OutBoxLabel.Text = "外箱标签";
             // 
+            // OnlyOneRow
+            // 
+            this.OnlyOneRow.AutoSize = true;
+            this.OnlyOneRow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.OnlyOneRow.Location = new System.Drawing.Point(107, 93);
+            this.OnlyOneRow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.OnlyOneRow.Name = "OnlyOneRow";
+            this.OnlyOneRow.Size = new System.Drawing.Size(63, 21);
+            this.OnlyOneRow.TabIndex = 94;
+            this.OnlyOneRow.Text = "仅单行";
+            this.OnlyOneRow.UseVisualStyleBackColor = true;
+            // 
             // AllLabel
             // 
             this.AllLabel.AutoSize = true;
@@ -1604,17 +1619,17 @@
             this.GetPDdata.UseVisualStyleBackColor = true;
             this.GetPDdata.Click += new System.EventHandler(this.GetPDdata_Click);
             // 
-            // OnlyOneRow
+            // ResetHBXH
             // 
-            this.OnlyOneRow.AutoSize = true;
-            this.OnlyOneRow.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OnlyOneRow.Location = new System.Drawing.Point(107, 93);
-            this.OnlyOneRow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.OnlyOneRow.Name = "OnlyOneRow";
-            this.OnlyOneRow.Size = new System.Drawing.Size(63, 21);
-            this.OnlyOneRow.TabIndex = 94;
-            this.OnlyOneRow.Text = "仅单行";
-            this.OnlyOneRow.UseVisualStyleBackColor = true;
+            this.ResetHBXH.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ResetHBXH.Location = new System.Drawing.Point(40, 177);
+            this.ResetHBXH.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.ResetHBXH.Name = "ResetHBXH";
+            this.ResetHBXH.Size = new System.Drawing.Size(92, 26);
+            this.ResetHBXH.TabIndex = 112;
+            this.ResetHBXH.Text = "重置合并序号";
+            this.ResetHBXH.UseVisualStyleBackColor = true;
+            this.ResetHBXH.Click += new System.EventHandler(this.ResetHBXH_Click);
             // 
             // UAS_出货标签打印
             // 
@@ -1830,5 +1845,6 @@
         private System.Windows.Forms.Button GetPDdata;
         private System.Windows.Forms.CheckBox AllLabel;
         private System.Windows.Forms.CheckBox OnlyOneRow;
+        private System.Windows.Forms.Button ResetHBXH;
     }
 }

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

@@ -594,7 +594,7 @@ namespace UAS_LabelMachine
                     {
                         CustomerLabel.Enabled = true;
                     }
-       
+
                     OutBoxNum_Click(new object(), new EventArgs());
                     LoadPrcodeData();
                     //获取条码规则
@@ -1030,7 +1030,7 @@ namespace UAS_LabelMachine
                     MidReport.Print();
                     dh.UpdateByCondition("prodiobarcode", "pib_midifprint=-1", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1 in (" + pib_outboxcode1 + ")");
                     SelectRowIndex = -1;
-                    LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "打印中盒" + pib_outboxcode1.Replace("'",""), "打印成功");
+                    LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "打印中盒" + pib_outboxcode1.Replace("'", ""), "打印成功");
                 }
                 Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
                 Properties.Settings.Default.Save();
@@ -1897,7 +1897,8 @@ namespace UAS_LabelMachine
             {
                 CombindetailTwo.Checked = false;
             }
-            if (LoadCheck) {
+            if (LoadCheck)
+            {
                 LoadPrcodeData();
                 string response = "";
                 string[] param = new string[] { PI_ID, "1", response };
@@ -1980,5 +1981,11 @@ namespace UAS_LabelMachine
             dh.UpdateByCondition("CS$InoutPrcode", "collectednum=(select nvl(sum(pib_qty),0) from prodiobarcode where pib_inoutno=pd_inoutno and pib_pdno=pd_pdno)", "pd_inoutno='" + pi_inoutno.Text + "'");
             MessageBox.Show("同步出货单明细数据成功", "提示");
         }
+
+        private void ResetHBXH_Click(object sender, EventArgs e)
+        {
+            dh.ExecuteSql("update prodiodetail set PD_HBXH_USER=pd_pdno where pd_inoutno='" + pi_inoutno.Text + "'", "update");
+            MessageBox.Show("重置序号成功", "提示");
+        }
     }
 }

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

+ 12 - 11
UAS-出货标签管理(贸易版)/Login.cs

@@ -14,6 +14,7 @@ namespace UAS_LabelMachine
         DataHelper dh;
         SqliteDBHelper sdh;
         DataTable dt;
+        DataTable Masterdt;
 
         public Login()
         {
@@ -33,21 +34,21 @@ namespace UAS_LabelMachine
             SystemInf.dh = dh = new DataHelper();
             SystemInf.sdh = sdh = new SqliteDBHelper("LabelPrint.db3");
             //获取账套信息
-            dt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from master ", "select");
-            DataTable MasterDB = dt.Clone();
-            for (int i = 0; i < dt.Rows.Count; i++)
+            Masterdt = (DataTable)dh.ExecuteSql("select ma_function,ms_pwd,ma_user from master ", "select");
+            DataTable MasterDB = Masterdt.Clone();
+            for (int i = 0; i < Masterdt.Rows.Count; i++)
             {
-                if (DataHelper.Masters.Contains(dt.Rows[i]["ma_user"].ToString()))
+                if (DataHelper.Masters.Contains(Masterdt.Rows[i]["ma_user"].ToString()))
                 {
                     DataRow dr = MasterDB.NewRow();
-                    dr["ma_user"] = dt.Rows[i]["ma_user"];
-                    dr["ma_function"] = dt.Rows[i]["ma_function"];
+                    dr["ma_user"] = Masterdt.Rows[i]["ma_user"];
+                    dr["ma_function"] = Masterdt.Rows[i]["ma_function"];
                     MasterDB.Rows.Add(dr);
                 }
             }
             MasterCombox.DisplayMember = "ma_function";
             MasterCombox.ValueMember = "ma_user";
-            MasterCombox.DataSource = dt;
+            MasterCombox.DataSource = Masterdt;
             //读取上次登陆时的用户名和选择的账套
             UserName.Text = Properties.Settings.Default.LastLoginUser;
             MasterCombox.Text = Properties.Settings.Default.LastLoginMaster;
@@ -67,10 +68,10 @@ namespace UAS_LabelMachine
         {
             //根据匹配的账套在DataTable查找到对应的密码
             string Ms_Pwd = "";
-            for (int i = 0; i < dt.Rows.Count; i++)
+            for (int i = 0; i < Masterdt.Rows.Count; i++)
             {
-                if (MasterCombox.SelectedValue == dt.Rows[i]["ma_user"])
-                    Ms_Pwd = dt.Rows[i]["ms_pwd"].ToString();
+                if (MasterCombox.SelectedValue == Masterdt.Rows[i]["ma_user"])
+                    Ms_Pwd = Masterdt.Rows[i]["ms_pwd"].ToString();
             }
             //切换至用户选择的数据源
             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)));";
@@ -80,7 +81,7 @@ namespace UAS_LabelMachine
             string oMsg = "";
             if (HttpHandler.CheckUserLogin(UserName.Text, PassWord.Text, MasterCombox.SelectedValue.ToString(), out oMsg))
             {
-                dt = (DataTable)dh.ExecuteSql("select em_name,em_type from employee where em_code='" + UserName.Text + "'", "select");
+                dt = (DataTable)dh.ExecuteSql("select em_name,em_type from employee where upper(em_code)='" + UserName.Text.ToUpper() + "'", "select");
                 User.UserName = dt.Rows[0]["em_name"].ToString();
                 User.UserCode = UserName.Text;
                 User.UserAccountType = dt.Rows[0]["em_type"].ToString();

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

@@ -16,7 +16,8 @@ namespace UAS_LabelMachine
         //海创ERP地址
         public static readonly string ERPAddesss = "http://cmityj.gicp.net:8099/ERP/";
         //海创FTP
-        public static readonly string FTPAdress = "ftp://cmityj.gicp.net|HCFTP|Admin1@#";
+        public static readonly string FTPAdress = "ftp://" + Properties.Settings.Default.IPAddress + "|HCFTP|Admin1@#";
+
         //Oracle端口
         public static readonly string OraclePort = "1521";
         //需要显示的账套
@@ -363,7 +364,6 @@ namespace UAS_LabelMachine
             string sql = "select ";
             sql += AddField(Fields);
             sql += " from " + TableName + " where " + Condition;
-            Console.WriteLine(sql);
             command = new OracleCommand(sql, connection);
             OracleDataAdapter ad = new OracleDataAdapter(command);
             ad.Fill(dt);
@@ -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>

+ 5 - 1
UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs

@@ -6,6 +6,7 @@ using NPOI.HSSF.Util;
 using NPOI.XSSF.UserModel;
 using System;
 using UAS_LabelMachine.Entity;
+using UAS_LabelMachine.PublicMethod;
 
 namespace UAS_LabelMachine
 {
@@ -64,10 +65,14 @@ namespace UAS_LabelMachine
                 {
                     // 2007版本
                     if (filePath.IndexOf(".xlsx") > 0)
+                    {
                         workbook = new XSSFWorkbook(fs);
+                    }
                     // 2003版本
                     else if (filePath.IndexOf(".xls") > 0)
+                    {
                         workbook = new HSSFWorkbook(fs);
+                    }
                     if (workbook != null)
                     {
                         sheet = workbook.GetSheetAt(0);//读取第一个sheet,当然也可以循环读取每个sheet
@@ -105,7 +110,6 @@ namespace UAS_LabelMachine
                                         dataTable.Columns.Add(column);
                                     }
                                 }
-
                                 //填充行
                                 for (int i = startRow; i <= rowCount; ++i)
                                 {

+ 2 - 1
UAS-出货标签管理(贸易版)/PublicMethod/GlobalEventsHandler.cs

@@ -13,7 +13,7 @@ namespace UAS_Labeling.PublicMethod
     /// </summary>
     class GlobalEventsHandler : IMessageFilter
     {
-        DataHelper dh=SystemInf.dh;
+        DataHelper dh;
         //鼠标左键点击
         public const int WM_LBUTTONDOWN = 0x0201;
         //键盘敲击事件
@@ -43,6 +43,7 @@ namespace UAS_Labeling.PublicMethod
         {
             if (User.UserAccountType != "admin")
             {
+                dh = SystemInf.dh;
                 if (dh.getRowCount("labelprintpower") > 0)
                 {
                     string sql = " select LPP_CLEANDETAIL,LPP_GENCODE,LPP_LABELMATAIN,LPP_SAVEDETAIL,LPP_COLLECTSTRATEGY,LPP_ALLCOLLECT from labelprintpower left join employee on em_code = lpp_emcode where lpp_emcode = '" + User.UserCode + "'";

+ 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);

+ 183 - 47
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;
@@ -2352,17 +2349,17 @@ namespace UAS_LabelMachine
                 {
                     custserialnum = int.Parse(maxnum);
                 }
-                dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
+                DataTable dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
                 if (dt == null)
                 {
                     MessageBox.Show("文件" + ImportExcel.FileName + "被占用");
                     return;
                 }
                 sql.Clear();
-                sql.Append("select pr_orispeccode,pd_outqty,pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno");
-                sql.Append(",pd_prodcode,pd_ordercode,pd_orderdetno from prodiodetail left join product on pd_prodcode=pr_code  ");
-                sql.Append("where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pd_outqty,");
-                sql.Append("pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,pd_id,pd_prodcode,pd_ordercode,pd_orderdetno");
+                sql.Append("select pr_orispeccode,pd_outqty-nvl(sum(pib_qty),0) pd_outqty,pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,");
+                sql.Append("pd_prodcode,pd_ordercode,pd_orderdetno from prodiodetail left join product on pd_prodcode=pr_code left join prodiobarcode  ");
+                sql.Append("on pd_id=pib_pdid  where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pd_outqty,");
+                sql.Append("pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,pd_id,pd_prodcode,pd_ordercode,pd_orderdetno order by pd_pdno");
                 DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 //需要插入的参数
                 ArrayList<string> barcode = new ArrayList<string>();
@@ -2379,6 +2376,36 @@ namespace UAS_LabelMachine
                 ArrayList<string> pdprodcode = new ArrayList<string>();
                 //用于数量的校验
                 Dictionary<string, decimal> sumqty = new Dictionary<string, decimal>();
+                Dictionary<string, Dictionary<string, decimal>> outsumqty = new Dictionary<string, Dictionary<string, decimal>>();
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    string pr_orispeccode = dt.Rows[i]["规格型号"].ToString();
+                    string qty = dt.Rows[i]["数量"].ToString();
+                    //累计Excel该型号的数量
+                    if (!sumqty.ContainsKey(pr_orispeccode))
+                    {
+                        sumqty.Add(pr_orispeccode, 0);
+                    }
+                    //累计Excel该型号的数量
+                    sumqty[pr_orispeccode] += decimal.Parse(qty);
+                }
+                for (int i = 0; i < dt1.Rows.Count; i++)
+                {
+                    //不包含型号则进行添加
+                    string pr_orispeccode = dt1.Rows[i]["pr_orispeccode"].ToString();
+                    string pd_pdno = dt1.Rows[i]["pd_pdno"].ToString();
+                    decimal pd_outqty = decimal.Parse(dt1.Rows[i]["pd_outqty"].ToString());
+                    if (!outsumqty.ContainsKey(pr_orispeccode))
+                    {
+                        Dictionary<string, decimal> dic = new Dictionary<string, decimal>();
+                        dic.Add(pd_pdno, pd_outqty);
+                        outsumqty.Add(pr_orispeccode, dic);
+                    }
+                    else
+                    {
+                        outsumqty[pr_orispeccode].Add(pd_pdno, pd_outqty);
+                    }
+                }
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     string pr_orispeccode = dt.Rows[i]["规格型号"].ToString();
@@ -2387,8 +2414,11 @@ namespace UAS_LabelMachine
                     string LotNo = "";
                     if (dt.Columns.Contains("DC/LOT NO"))
                     {
-                        DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[0];
-                        LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
+                        if (dt.Rows[i]["DC/LOT NO"].ToString().IndexOf("-") > 0)
+                        {
+                            DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[0];
+                            LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
+                        }
                     }
                     if (dt.Columns.Contains("DC"))
                     {
@@ -2409,31 +2439,41 @@ namespace UAS_LabelMachine
                     {
                         LogicHandler.FilterData(cu_code.Text, dr[0]["pr_brand"].ToString(), pr_orispeccode, qty, DateCode, LotNo, out pr_orispeccode, out qty, out DateCode, out LotNo);
                     }
-                    if (dr.Length > 0)
+                    decimal outqty = decimal.Parse(Regex.Replace(qty, @"[^\d]*", ""));
+                    for (int k = 0; k < dr.Length; k++)
                     {
-                        string pd_orderdetno = dr[0]["pd_orderdetno"].ToString();
-                        string pd_prodcode = dr[0]["pd_prodcode"].ToString();
-                        string pd_ordercode = dr[0]["pd_ordercode"].ToString();
-                        string pd_piid = dr[0]["pd_piid"].ToString();
-                        string pr_brand = dr[0]["pr_brand"].ToString();
-                        string pd_pdno = dr[0]["pd_pdno"].ToString();
-                        string pd_id = dr[0]["pd_id"].ToString();
-                        string pd_piclass = dr[0]["pd_piclass"].ToString();
-                        string pr_id = dr[0]["pr_id"].ToString();
+                        string pd_orderdetno = dr[k]["pd_orderdetno"].ToString();
+                        string pd_prodcode = dr[k]["pd_prodcode"].ToString();
+                        string pd_ordercode = dr[k]["pd_ordercode"].ToString();
+                        string pd_piid = dr[k]["pd_piid"].ToString();
+                        string pr_brand = dr[k]["pr_brand"].ToString();
+                        string pd_pdno = dr[k]["pd_pdno"].ToString();
+                        string pd_id = dr[k]["pd_id"].ToString();
+                        string pd_piclass = dr[k]["pd_piclass"].ToString();
+                        string pr_id = dr[k]["pr_id"].ToString();
                         //已导入数量
-                        decimal zxbzs = decimal.Parse(dr[0]["pr_zxbzs"].ToString());
-                        decimal outqty = decimal.Parse(Regex.Replace(qty, @"[^\d]*", ""));
+                        decimal zxbzs = decimal.Parse(dr[k]["pr_zxbzs"].ToString());
+                        decimal pd_outqty = 0;
                         decimal barcodenum = 0;
-                        if (!sumqty.ContainsKey(pr_orispeccode))
+                        if (outsumqty[pr_orispeccode][pd_pdno] == 0)
+                        {
+                            continue;
+                        }
+                        //如果导入行的数量小于改明细的出货数量
+                        if (outsumqty[pr_orispeccode][pd_pdno] >= outqty)
+                        {
+                            //使用导入明细行数量
+                            pd_outqty = outqty;
+                        }
+                        else
                         {
-                            sumqty.Add(pr_orispeccode, 0);
+                            ////使用该出货单明细行数量,并且数量置为0
+                            pd_outqty = outsumqty[pr_orispeccode][pd_pdno];
                         }
-                        //累计Excel该型号的数量
-                        sumqty[pr_orispeccode] += decimal.Parse(qty);
                         string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                        if (outqty % zxbzs != 0)
+                        if (pd_outqty % zxbzs != 0)
                         {
-                            barcodenum = Math.Floor(outqty / zxbzs) + 1;
+                            barcodenum = Math.Floor(pd_outqty / zxbzs) + 1;
                             //如果有余数先加上所有最小包最后加尾数
                             for (int j = 0; j < barcodenum - 1; j++)
                             {
@@ -2452,7 +2492,7 @@ namespace UAS_LabelMachine
                             }
                             custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
                             barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
-                            pib_inqty.Add(outqty % zxbzs);
+                            pib_inqty.Add(pd_outqty % zxbzs);
                             piboutboxcode2.Add(pib_outboxcode2);
                             datecode.Add(DateCode);
                             lotno.Add(LotNo);
@@ -2465,7 +2505,7 @@ namespace UAS_LabelMachine
                         }
                         else
                         {
-                            barcodenum = outqty / zxbzs;
+                            barcodenum = pd_outqty / zxbzs;
                             for (int j = 0; j < barcodenum; j++)
                             {
                                 barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
@@ -2482,14 +2522,16 @@ namespace UAS_LabelMachine
                                 pdprodcode.Add(pd_prodcode);
                             }
                         }
+                        outqty -= outsumqty[pr_orispeccode][pd_pdno];
+                        outsumqty[pr_orispeccode][pd_pdno] -= pd_outqty;
                     }
                 }
                 //插叙所有的统计数量
                 string ErrMsg = "";
                 foreach (var item in sumqty)
                 {
-                    dt = (DataTable)dh.ExecuteSql("select nvl(sum(pd_outqty),0)pd_outqty,pr_orispeccode from prodiodetail left join product on pr_code=pd_prodcode where pd_piid=" + PI_ID + "group by pr_orispeccode", "select");
-                    dt1 = (DataTable)dh.ExecuteSql("select nvl(sum(pib_qty),0)pib_qty,pr_orispeccode  from prodiobarcode left join product on pib_prodcode=pr_code where pib_piid=" + PI_ID + " group by pr_orispeccode", "select");
+                    dt = (DataTable)dh.ExecuteSql("select nvl(sum(pd_outqty),0)pd_outqty,pr_orispeccode from prodiodetail left join product on pr_code=pd_prodcode where pd_piid='" + PI_ID + "' group by pr_orispeccode", "select");
+                    dt1 = (DataTable)dh.ExecuteSql("select nvl(sum(pib_qty),0)pib_qty,pr_orispeccode  from prodiobarcode left join product on pib_prodcode=pr_code where pib_piid='" + PI_ID + "' group by pr_orispeccode", "select");
                     DataRow[] dr = dt.Select("pr_orispeccode='" + item.Key + "'");
                     DataRow[] dr1 = dt1.Select("pr_orispeccode='" + item.Key + "'");
                     if (dr.Length > 0)
@@ -2510,16 +2552,23 @@ namespace UAS_LabelMachine
                 }
                 if (ErrMsg == "")
                 {
-                    sql.Clear();
-                    sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
-                    sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,pib_outboxcode2,pib_custbarcode)");
-                    sql.Append(" values (prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'");
-                    sql.Append("," + PI_ID + ",:pr_brand,:barcode,:pd_pdno,:pd_id,");
-                    sql.Append("'" + pi_class.Text + "',:pib_inqty,:pib_datecode,:pib_lotno,0,0,:pd_ordercode,'',:pd_orderdetno,:outboxcode,:custbarcode)");
-                    dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray());
-                    //更新流水
-                    dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
-                    LoadGridData();
+                    if (pdprodcode.Count > 0)
+                    {
+                        sql.Clear();
+                        sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
+                        sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,pib_outboxcode2,pib_custbarcode)");
+                        sql.Append(" values (prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'");
+                        sql.Append("," + PI_ID + ",:pr_brand,:barcode,:pd_pdno,:pd_id,");
+                        sql.Append("'" + pi_class.Text + "',:pib_inqty,:pib_datecode,:pib_lotno,0,0,:pd_ordercode,'',:pd_orderdetno,:outboxcode,:custbarcode)");
+                        dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray());
+                        //更新流水
+                        dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
+                        LoadGridData();
+                    }
+                    else
+                    {
+                        MessageBox.Show("解析数据不包含出货单数据,请重新导入", "提示");
+                    }
                 }
                 else
                 {
@@ -2528,8 +2577,95 @@ namespace UAS_LabelMachine
             }
             catch (Exception ex)
             {
+                LogManager.DoLog(ex.StackTrace);
                 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();
+        }
     }
 }