Prechádzať zdrojové kódy

盛威尔入库条码打印

callm 11 mesiacov pred
rodič
commit
99c0a84abb

+ 2 - 2
UAS_BARCODEIO/DataHelper.cs

@@ -9,9 +9,9 @@ namespace UAS_BARCODEIO
     public class DataHelper
     {
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=SENGWILL;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11598)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=SENGWILL;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sengwill.hicp.net)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
-        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=SENGWILL;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11598)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=SENGWILL;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sengwill.hicp.net)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         public static OracleConnection connection = null;
         OracleCommand command = null;
         int ReconnectTime = 0;

+ 61 - 0
UAS_BARCODEIO/PrinterCombox.Designer.cs

@@ -0,0 +1,61 @@
+namespace UAS_BARCODEIO
+{
+    partial class PrinterCombox
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.PrinterList = new System.Windows.Forms.ComboBox();
+            this.SuspendLayout();
+            // 
+            // PrinterList
+            // 
+            this.PrinterList.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.PrinterList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.PrinterList.FormattingEnabled = true;
+            this.PrinterList.Location = new System.Drawing.Point(0, 0);
+            this.PrinterList.Margin = new System.Windows.Forms.Padding(6);
+            this.PrinterList.Name = "PrinterList";
+            this.PrinterList.Size = new System.Drawing.Size(378, 32);
+            this.PrinterList.TabIndex = 0;
+            // 
+            // PrinterCombox
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.PrinterList);
+            this.Margin = new System.Windows.Forms.Padding(6);
+            this.Name = "PrinterCombox";
+            this.Size = new System.Drawing.Size(378, 45);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.ComboBox PrinterList;
+    }
+}

+ 53 - 0
UAS_BARCODEIO/PrinterCombox.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing.Printing;
+
+namespace UAS_BARCODEIO
+{
+    public partial class PrinterCombox : UserControl
+    {
+        public PrinterCombox()
+        {
+            InitializeComponent();
+        }
+
+        public override string Text
+        {
+            get
+            {
+                return PrinterList.Text;
+            }
+
+            set
+            {
+                PrinterList.Text = value;
+            }
+        }
+
+        private void PrinterCombox_Load(object sender, EventArgs e)
+        {
+            try
+            {
+                PrintDocument print = new PrintDocument();
+                string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
+
+                foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称
+                {
+                    PrinterList.Items.Add(sPrint);
+                    if (sPrint == sDefault)
+                        PrinterList.SelectedIndex = PrinterList.Items.IndexOf(sPrint);
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+        }
+    }
+}

+ 120 - 0
UAS_BARCODEIO/PrinterCombox.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>

+ 1 - 1
UAS_BARCODEIO/SearchTextBox.Designer.cs

@@ -1,4 +1,4 @@
-using FastReport.Editor;
+
 
 namespace UAS_BARCODEIO
 {

+ 12 - 12
UAS_BARCODEIO/UAS_BARCODEIO.csproj

@@ -29,7 +29,7 @@
     <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
+    <PlatformTarget>x86</PlatformTarget>
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
@@ -53,17 +53,8 @@
     <ApplicationIcon>print.ico</ApplicationIcon>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="FastReport, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>.\FastReport.dll</HintPath>
-    </Reference>
-    <Reference Include="FastReport.Bars, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>.\FastReport.Bars.dll</HintPath>
-    </Reference>
-    <Reference Include="FastReport.Editor, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>.\FastReport.Editor.dll</HintPath>
+    <Reference Include="ICSharpCode.SharpZipLib">
+      <HintPath>tool\ICSharpCode.SharpZipLib.dll</HintPath>
     </Reference>
     <Reference Include="Interop.BarTender, Version=10.1.4.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -159,6 +150,12 @@
     <Compile Include="PaginationDbFind.Designer.cs">
       <DependentUpon>PaginationDbFind.cs</DependentUpon>
     </Compile>
+    <Compile Include="PrinterCombox.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="PrinterCombox.Designer.cs">
+      <DependentUpon>PrinterCombox.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="SearchTextBox.cs">
@@ -205,6 +202,9 @@
     <EmbeddedResource Include="PaginationDbFind.resx">
       <DependentUpon>PaginationDbFind.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="PrinterCombox.resx">
+      <DependentUpon>PrinterCombox.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>PublicResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>

+ 1 - 1
UAS_BARCODEIO/app.config

@@ -24,4 +24,4 @@
             </setting>
         </UAS_BARCODEIO.Properties.Settings>
     </userSettings>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

BIN
UAS_BARCODEIO/tool/ICSharpCode.SharpZipLib.dll


+ 106 - 32
UAS_BARCODEIO/入库条码规则解析.Designer.cs

@@ -50,14 +50,20 @@
             this.Barcode = new System.Windows.Forms.TextBox();
             this.label8 = new System.Windows.Forms.Label();
             this.GenBarCode = new System.Windows.Forms.Button();
-            this.es_custcode = new UAS_BARCODEIO.SearchTextBox();
             this.BarcodeIO = new System.Windows.Forms.DataGridView();
-            this.PrintBarCode = new System.Windows.Forms.Button();
             this.CheckBox = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.bi_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bi_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bi_inqty1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bi_vendbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bi_madedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_spec1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_detail1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.PrintBarCode = new System.Windows.Forms.Button();
+            this.PrinterList = new System.Windows.Forms.ComboBox();
+            this.label9 = new System.Windows.Forms.Label();
+            this.es_custcode = new UAS_BARCODEIO.SearchTextBox();
+            this.ChooseAll = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.Prodiodetail)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.BarcodeIO)).BeginInit();
             this.SuspendLayout();
@@ -109,6 +115,8 @@
             this.Prodiodetail.RowTemplate.Height = 37;
             this.Prodiodetail.Size = new System.Drawing.Size(1232, 543);
             this.Prodiodetail.TabIndex = 19;
+            this.Prodiodetail.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Prodiodetail_CellClick);
+            this.Prodiodetail.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Prodiodetail_CellContentClick);
             this.Prodiodetail.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.Prodiodetail_CellPainting);
             this.Prodiodetail.SelectionChanged += new System.EventHandler(this.Prodiodetail_SelectionChanged);
             // 
@@ -282,24 +290,6 @@
             this.GenBarCode.UseVisualStyleBackColor = true;
             this.GenBarCode.Click += new System.EventHandler(this.GenBarCode_Click);
             // 
-            // es_custcode
-            // 
-            this.es_custcode.AllPower = null;
-            this.es_custcode.Caller = null;
-            this.es_custcode.Condition = null;
-            this.es_custcode.DBTitle = null;
-            this.es_custcode.FormName = null;
-            this.es_custcode.Location = new System.Drawing.Point(167, 108);
-            this.es_custcode.Name = "es_custcode";
-            this.es_custcode.Power = null;
-            this.es_custcode.ReturnData = null;
-            this.es_custcode.SelectField = null;
-            this.es_custcode.SetValueField = null;
-            this.es_custcode.Size = new System.Drawing.Size(437, 35);
-            this.es_custcode.TabIndex = 31;
-            this.es_custcode.TableName = null;
-            this.es_custcode.TextBoxEnable = false;
-            // 
             // BarcodeIO
             // 
             this.BarcodeIO.AllowUserToAddRows = false;
@@ -308,33 +298,35 @@
             this.BarcodeIO.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.BarcodeIO.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.CheckBox,
+            this.bi_prodcode,
             this.bi_barcode,
             this.bi_inqty1,
             this.bi_vendbarcode,
-            this.bi_madedate});
+            this.bi_madedate,
+            this.pr_spec1,
+            this.pr_detail1});
             this.BarcodeIO.Location = new System.Drawing.Point(1295, 182);
             this.BarcodeIO.Name = "BarcodeIO";
             this.BarcodeIO.RowHeadersWidth = 82;
             this.BarcodeIO.RowTemplate.Height = 23;
-            this.BarcodeIO.Size = new System.Drawing.Size(750, 543);
+            this.BarcodeIO.Size = new System.Drawing.Size(829, 543);
             this.BarcodeIO.TabIndex = 35;
             // 
-            // PrintBarCode
-            // 
-            this.PrintBarCode.Location = new System.Drawing.Point(889, 768);
-            this.PrintBarCode.Name = "PrintBarCode";
-            this.PrintBarCode.Size = new System.Drawing.Size(169, 45);
-            this.PrintBarCode.TabIndex = 36;
-            this.PrintBarCode.Text = "打印条码";
-            this.PrintBarCode.UseVisualStyleBackColor = true;
-            this.PrintBarCode.Click += new System.EventHandler(this.PrintBarCode_Click);
-            // 
             // CheckBox
             // 
             this.CheckBox.DataPropertyName = "CheckBox";
             this.CheckBox.HeaderText = "勾选";
             this.CheckBox.MinimumWidth = 10;
             this.CheckBox.Name = "CheckBox";
+            this.CheckBox.Width = 200;
+            // 
+            // bi_prodcode
+            // 
+            this.bi_prodcode.DataPropertyName = "bi_prodcode";
+            this.bi_prodcode.HeaderText = "料号";
+            this.bi_prodcode.MinimumWidth = 10;
+            this.bi_prodcode.Name = "bi_prodcode";
+            this.bi_prodcode.Width = 200;
             // 
             // bi_barcode
             // 
@@ -368,11 +360,87 @@
             this.bi_madedate.Name = "bi_madedate";
             this.bi_madedate.Width = 200;
             // 
+            // pr_spec1
+            // 
+            this.pr_spec1.DataPropertyName = "pr_spec";
+            this.pr_spec1.HeaderText = "规格";
+            this.pr_spec1.MinimumWidth = 10;
+            this.pr_spec1.Name = "pr_spec1";
+            this.pr_spec1.Width = 200;
+            // 
+            // pr_detail1
+            // 
+            this.pr_detail1.DataPropertyName = "pr_detail";
+            this.pr_detail1.HeaderText = "物料名称";
+            this.pr_detail1.MinimumWidth = 10;
+            this.pr_detail1.Name = "pr_detail1";
+            this.pr_detail1.Width = 200;
+            // 
+            // PrintBarCode
+            // 
+            this.PrintBarCode.Location = new System.Drawing.Point(673, 841);
+            this.PrintBarCode.Name = "PrintBarCode";
+            this.PrintBarCode.Size = new System.Drawing.Size(169, 45);
+            this.PrintBarCode.TabIndex = 36;
+            this.PrintBarCode.Text = "打印条码";
+            this.PrintBarCode.UseVisualStyleBackColor = true;
+            this.PrintBarCode.Click += new System.EventHandler(this.PrintBarCode_Click);
+            // 
+            // PrinterList
+            // 
+            this.PrinterList.FormattingEnabled = true;
+            this.PrinterList.Location = new System.Drawing.Point(1064, 775);
+            this.PrinterList.Name = "PrinterList";
+            this.PrinterList.Size = new System.Drawing.Size(312, 32);
+            this.PrinterList.TabIndex = 37;
+            // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label9.Location = new System.Drawing.Point(884, 771);
+            this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(162, 38);
+            this.label9.TabIndex = 38;
+            this.label9.Text = "打印机列表";
+            // 
+            // es_custcode
+            // 
+            this.es_custcode.AllPower = null;
+            this.es_custcode.Caller = null;
+            this.es_custcode.Condition = null;
+            this.es_custcode.DBTitle = null;
+            this.es_custcode.FormName = null;
+            this.es_custcode.Location = new System.Drawing.Point(167, 108);
+            this.es_custcode.Name = "es_custcode";
+            this.es_custcode.Power = null;
+            this.es_custcode.ReturnData = null;
+            this.es_custcode.SelectField = null;
+            this.es_custcode.SetValueField = null;
+            this.es_custcode.Size = new System.Drawing.Size(437, 35);
+            this.es_custcode.TabIndex = 31;
+            this.es_custcode.TableName = null;
+            this.es_custcode.TextBoxEnable = false;
+            // 
+            // ChooseAll
+            // 
+            this.ChooseAll.Location = new System.Drawing.Point(1295, 182);
+            this.ChooseAll.Name = "ChooseAll";
+            this.ChooseAll.Size = new System.Drawing.Size(86, 45);
+            this.ChooseAll.TabIndex = 39;
+            this.ChooseAll.Text = "全选";
+            this.ChooseAll.UseVisualStyleBackColor = true;
+            this.ChooseAll.Click += new System.EventHandler(this.ChooseAll_Click);
+            // 
             // 入库条码规则解析
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(2136, 1225);
+            this.Controls.Add(this.ChooseAll);
+            this.Controls.Add(this.label9);
+            this.Controls.Add(this.PrinterList);
             this.Controls.Add(this.PrintBarCode);
             this.Controls.Add(this.BarcodeIO);
             this.Controls.Add(this.GenBarCode);
@@ -433,11 +501,17 @@
         private System.Windows.Forms.Button GenBarCode;
         private System.Windows.Forms.DataGridView BarcodeIO;
         private System.Windows.Forms.Button PrintBarCode;
+        private System.Windows.Forms.ComboBox PrinterList;
         private System.Windows.Forms.DataGridViewCheckBoxColumn CheckBox;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bi_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_barcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_inqty1;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_vendbarcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_madedate;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_spec1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail1;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.Button ChooseAll;
     }
 }
 

+ 97 - 13
UAS_BARCODEIO/入库条码规则解析.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
+using System.Drawing.Printing;
 using System.Windows.Forms;
 
 namespace UAS_BARCODEIO
@@ -17,7 +18,7 @@ namespace UAS_BARCODEIO
         //自适应屏幕
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
-        Engine engine = new Engine();
+        Engine engine;
 
         public 入库条码规则解析()
         {
@@ -54,9 +55,29 @@ namespace UAS_BARCODEIO
             es_custcode.Condition = "";
             es_custcode.DbChange += nr_rule_DBChange;
             SystemInf.dh = dh;
+            try
+            {
+                engine = new Engine(true);
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.Message);
+                throw;
+            }
+
             format = engine.Documents.Open(Application.StartupPath + @"\BARCODE.btw");
             asc.controllInitializeSize(this);
             asc.controlAutoSize(this);
+
+            PrintDocument print = new PrintDocument();
+            string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
+
+            foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称
+            {
+                PrinterList.Items.Add(sPrint);
+                if (sPrint == sDefault)
+                    PrinterList.SelectedIndex = PrinterList.Items.IndexOf(sPrint);
+            }
         }
 
         private void nr_rule_DBChange(object sender, EventArgs e)
@@ -78,7 +99,7 @@ namespace UAS_BARCODEIO
             string sql = "select pd_inqty,pd_prodcode,pr_detail,pr_spec,bi_inqty from " +
                 "(select pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail where pd_inoutno='" + pi_inoutno.Text + "' group by pd_prodcode)" +
                 " left join (select bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio " +
-                "where bi_inoutno='" + pi_inoutno.Text + "' group by bi_prodcode) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode";
+                "where bi_inoutno='" + pi_inoutno.Text + "' group by bi_prodcode) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode order by pr_code";
             DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
             BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
         }
@@ -236,20 +257,19 @@ namespace UAS_BARCODEIO
                 bi_barcode.Add(barcode);
                 bi_vendbarcode.Add(LOTNO.Text);
                 bi_madedate.Add(datecode);
-                sql = "insert into barcodeio(BI_ID, BI_BARCODE, BI_PIID, BI_PICLASS, BI_INOUTNO, BI_PDNO, BI_PDID, BI_PRODCODE, BI_INQTY,bi_vendbarcode, " +
-                   "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
-                   "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate " +
-                   " from product where pr_code='" + PR_CODE.Text + "'";
-                dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray());
-                LoadGridData();
-                LoadBarcodeioData();
             }
+            sql = "insert into barcodeio(BI_ID, BI_BARCODE, BI_PIID, BI_PICLASS, BI_INOUTNO, BI_PDNO, BI_PDID, BI_PRODCODE, BI_INQTY,bi_vendbarcode, " +
+                 "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
+                 "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate " +
+                 " from product where pr_code='" + PR_CODE.Text + "'";
+            dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray());
+            LoadGridData();
+            LoadBarcodeioData(PR_CODE.Text);
         }
 
-        private void LoadBarcodeioData()
+        private void LoadBarcodeioData(string pr_code)
         {
-
-            string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_vendbarcode,bi_madedate from barcodeio where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + PR_CODE.Text + "'";
+            string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
             DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
             BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
         }
@@ -260,9 +280,73 @@ namespace UAS_BARCODEIO
             {
                 if (BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue != null && BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue.ToString() == "True")
                 {
-
+                    for (int j = 0; j < format.SubStrings.Count; j++)
+                    {
+                        if (format.SubStrings[j].Name == "BARCODE")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_barcode"].Value.ToString();
+                        }
+                        if (format.SubStrings[j].Name == "DC")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_madedate"].Value.ToString();
+                        }
+                        if (format.SubStrings[j].Name == "LOTNO")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_vendbarcode"].Value.ToString();
+                        }
+                        if (format.SubStrings[j].Name == "QTY")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_inqty1"].Value.ToString();
+                        }
+                        if (format.SubStrings[j].Name == "PRCODE")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_prodcode"].Value.ToString();
+                        }
+                        if (format.SubStrings[j].Name == "PRSPEC")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["pr_spec1"].Value.ToString();
+                        }
+                        if (format.SubStrings[j].Name == "PRDETAIL")
+                        {
+                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                                format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["pr_detail1"].Value.ToString();
+                        }
+                    }
+                    format.PrintSetup.PrinterName = PrinterList.Text;
+                    format.PrintSetup.IdenticalCopiesOfLabel = 1;
+                    format.Print();
                 }
             }
         }
+
+        private void Prodiodetail_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
+            {
+                LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
+            }
+        }
+
+        private void Prodiodetail_CellClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
+            {
+                LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
+            }
+        }
+
+        private void ChooseAll_Click(object sender, EventArgs e)
+        {
+            for (int i = 0; i < BarcodeIO.Rows.Count; i++)
+            {
+                BarcodeIO.Rows[i].Cells["CheckBox"].Value = true;
+            }
+        }
     }
 }

+ 48 - 0
UAS_BARCODEIO/入库条码规则解析.resx

@@ -132,9 +132,51 @@
   <metadata name="bi_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pd_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_detail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pd_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bi_inqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="CheckBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bi_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bi_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bi_inqty1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bi_vendbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="bi_madedate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_spec1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_detail1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="CheckBox.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="bi_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="bi_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
@@ -147,4 +189,10 @@
   <metadata name="bi_madedate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pr_spec1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_detail1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>