Browse Source

条码入库解析

callm 1 year ago
parent
commit
4719111b02

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

@@ -53,22 +53,25 @@
             this.label8 = new System.Windows.Forms.Label();
             this.GenBarCode = new System.Windows.Forms.Button();
             this.BarcodeIO = new System.Windows.Forms.DataGridView();
+            this.PrintBarCode = new System.Windows.Forms.Button();
+            this.PrinterList = new System.Windows.Forms.ComboBox();
+            this.label9 = new System.Windows.Forms.Label();
+            this.ChooseAll = new System.Windows.Forms.Button();
+            this.pr_orispeccode2 = new System.Windows.Forms.TextBox();
+            this.原厂型号 = new System.Windows.Forms.Label();
+            this.GenBoxCode = new System.Windows.Forms.CheckBox();
+            this.es_custcode = new UAS_BARCODEIO.SearchTextBox();
+            this.PrintBox = new System.Windows.Forms.Button();
             this.CheckBox = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pr_orispeccode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bi_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bi_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bi_outboxcode = 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();
-            this.pr_orispeccode2 = new System.Windows.Forms.TextBox();
-            this.原厂型号 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.Prodiodetail)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.BarcodeIO)).BeginInit();
             this.SuspendLayout();
@@ -190,7 +193,7 @@
             // 
             // PR_CODE
             // 
-            this.PR_CODE.Location = new System.Drawing.Point(168, 763);
+            this.PR_CODE.Location = new System.Drawing.Point(1445, 192);
             this.PR_CODE.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.PR_CODE.Name = "PR_CODE";
             this.PR_CODE.Size = new System.Drawing.Size(436, 35);
@@ -200,7 +203,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(27, 760);
+            this.label3.Location = new System.Drawing.Point(1276, 192);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(133, 38);
@@ -209,7 +212,7 @@
             // 
             // INQTY
             // 
-            this.INQTY.Location = new System.Drawing.Point(168, 895);
+            this.INQTY.Location = new System.Drawing.Point(1445, 324);
             this.INQTY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.INQTY.Name = "INQTY";
             this.INQTY.Size = new System.Drawing.Size(436, 35);
@@ -219,7 +222,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(27, 892);
+            this.label4.Location = new System.Drawing.Point(1276, 324);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(133, 38);
@@ -228,7 +231,7 @@
             // 
             // DC
             // 
-            this.DC.Location = new System.Drawing.Point(168, 973);
+            this.DC.Location = new System.Drawing.Point(1445, 402);
             this.DC.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.DC.Name = "DC";
             this.DC.Size = new System.Drawing.Size(436, 35);
@@ -238,7 +241,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(27, 970);
+            this.label5.Location = new System.Drawing.Point(1276, 402);
             this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(58, 38);
@@ -247,7 +250,7 @@
             // 
             // LOTNO
             // 
-            this.LOTNO.Location = new System.Drawing.Point(168, 1057);
+            this.LOTNO.Location = new System.Drawing.Point(1445, 486);
             this.LOTNO.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.LOTNO.Name = "LOTNO";
             this.LOTNO.Size = new System.Drawing.Size(436, 35);
@@ -257,7 +260,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(27, 1054);
+            this.label6.Location = new System.Drawing.Point(1276, 486);
             this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(103, 38);
@@ -266,7 +269,7 @@
             // 
             // ZXBZ
             // 
-            this.ZXBZ.Location = new System.Drawing.Point(168, 1141);
+            this.ZXBZ.Location = new System.Drawing.Point(1445, 570);
             this.ZXBZ.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ZXBZ.Name = "ZXBZ";
             this.ZXBZ.Size = new System.Drawing.Size(436, 35);
@@ -276,7 +279,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(27, 1138);
+            this.label7.Location = new System.Drawing.Point(1276, 570);
             this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(133, 38);
@@ -305,7 +308,7 @@
             // 
             // GenBarCode
             // 
-            this.GenBarCode.Location = new System.Drawing.Point(673, 768);
+            this.GenBarCode.Location = new System.Drawing.Point(1922, 200);
             this.GenBarCode.Name = "GenBarCode";
             this.GenBarCode.Size = new System.Drawing.Size(169, 45);
             this.GenBarCode.TabIndex = 34;
@@ -324,18 +327,115 @@
             this.pr_orispeccode,
             this.bi_prodcode,
             this.bi_barcode,
+            this.bi_outboxcode,
             this.bi_inqty1,
             this.bi_vendbarcode,
             this.bi_madedate,
             this.pr_spec1,
             this.pr_detail1});
-            this.BarcodeIO.Location = new System.Drawing.Point(1295, 182);
+            this.BarcodeIO.Location = new System.Drawing.Point(27, 731);
             this.BarcodeIO.Name = "BarcodeIO";
             this.BarcodeIO.RowHeadersWidth = 82;
             this.BarcodeIO.RowTemplate.Height = 23;
-            this.BarcodeIO.Size = new System.Drawing.Size(829, 543);
+            this.BarcodeIO.Size = new System.Drawing.Size(2097, 595);
             this.BarcodeIO.TabIndex = 35;
             // 
+            // PrintBarCode
+            // 
+            this.PrintBarCode.Location = new System.Drawing.Point(1922, 273);
+            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(1445, 654);
+            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(1276, 648);
+            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 = "打印机列表";
+            // 
+            // ChooseAll
+            // 
+            this.ChooseAll.Location = new System.Drawing.Point(27, 731);
+            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);
+            // 
+            // pr_orispeccode2
+            // 
+            this.pr_orispeccode2.Location = new System.Drawing.Point(1445, 258);
+            this.pr_orispeccode2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.pr_orispeccode2.Name = "pr_orispeccode2";
+            this.pr_orispeccode2.Size = new System.Drawing.Size(436, 35);
+            this.pr_orispeccode2.TabIndex = 41;
+            // 
+            // 原厂型号
+            // 
+            this.原厂型号.AutoSize = true;
+            this.原厂型号.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.原厂型号.Location = new System.Drawing.Point(1276, 258);
+            this.原厂型号.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.原厂型号.Name = "原厂型号";
+            this.原厂型号.Size = new System.Drawing.Size(133, 38);
+            this.原厂型号.TabIndex = 40;
+            this.原厂型号.Text = "原厂型号";
+            // 
+            // GenBoxCode
+            // 
+            this.GenBoxCode.AutoSize = true;
+            this.GenBoxCode.Location = new System.Drawing.Point(1295, 121);
+            this.GenBoxCode.Name = "GenBoxCode";
+            this.GenBoxCode.Size = new System.Drawing.Size(138, 28);
+            this.GenBoxCode.TabIndex = 42;
+            this.GenBoxCode.Text = "生成箱号";
+            this.GenBoxCode.UseVisualStyleBackColor = true;
+            // 
+            // 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;
+            // 
+            // PrintBox
+            // 
+            this.PrintBox.Location = new System.Drawing.Point(1922, 352);
+            this.PrintBox.Name = "PrintBox";
+            this.PrintBox.Size = new System.Drawing.Size(169, 45);
+            this.PrintBox.TabIndex = 43;
+            this.PrintBox.Text = "打印箱号";
+            this.PrintBox.UseVisualStyleBackColor = true;
+            this.PrintBox.Click += new System.EventHandler(this.PrintBox_Click);
+            // 
             // CheckBox
             // 
             this.CheckBox.DataPropertyName = "CheckBox";
@@ -368,6 +468,14 @@
             this.bi_barcode.Name = "bi_barcode";
             this.bi_barcode.Width = 200;
             // 
+            // bi_outboxcode
+            // 
+            this.bi_outboxcode.DataPropertyName = "bi_outboxcode";
+            this.bi_outboxcode.HeaderText = "外箱条码";
+            this.bi_outboxcode.MinimumWidth = 10;
+            this.bi_outboxcode.Name = "bi_outboxcode";
+            this.bi_outboxcode.Width = 200;
+            // 
             // bi_inqty1
             // 
             this.bi_inqty1.DataPropertyName = "bi_inqty";
@@ -408,87 +516,13 @@
             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);
-            // 
-            // pr_orispeccode2
-            // 
-            this.pr_orispeccode2.Location = new System.Drawing.Point(168, 829);
-            this.pr_orispeccode2.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.pr_orispeccode2.Name = "pr_orispeccode2";
-            this.pr_orispeccode2.Size = new System.Drawing.Size(436, 35);
-            this.pr_orispeccode2.TabIndex = 41;
-            // 
-            // 原厂型号
-            // 
-            this.原厂型号.AutoSize = true;
-            this.原厂型号.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.原厂型号.Location = new System.Drawing.Point(27, 826);
-            this.原厂型号.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.原厂型号.Name = "原厂型号";
-            this.原厂型号.Size = new System.Drawing.Size(133, 38);
-            this.原厂型号.TabIndex = 40;
-            this.原厂型号.Text = "原厂型号";
-            // 
             // 入库条码规则解析
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(2136, 1225);
+            this.ClientSize = new System.Drawing.Size(2136, 1338);
+            this.Controls.Add(this.PrintBox);
+            this.Controls.Add(this.GenBoxCode);
             this.Controls.Add(this.pr_orispeccode2);
             this.Controls.Add(this.原厂型号);
             this.Controls.Add(this.ChooseAll);
@@ -552,15 +586,6 @@
         private System.Windows.Forms.ComboBox PrinterList;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.Button ChooseAll;
-        private System.Windows.Forms.DataGridViewCheckBoxColumn CheckBox;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode;
-        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.DataGridViewTextBoxColumn pd_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn pr_brand;
@@ -570,6 +595,18 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn bi_inqty;
         private System.Windows.Forms.TextBox pr_orispeccode2;
         private System.Windows.Forms.Label 原厂型号;
+        private System.Windows.Forms.CheckBox GenBoxCode;
+        private System.Windows.Forms.Button PrintBox;
+        private System.Windows.Forms.DataGridViewCheckBoxColumn CheckBox;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bi_prodcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bi_barcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bi_outboxcode;
+        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;
     }
 }
 

+ 83 - 4
UAS_BARCODEIO/入库条码规则解析.cs

@@ -5,7 +5,9 @@ using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
 using System.Drawing.Printing;
+using System.Linq;
 using System.Windows.Forms;
+using static System.Runtime.CompilerServices.RuntimeHelpers;
 
 namespace UAS_BARCODEIO
 {
@@ -18,6 +20,8 @@ namespace UAS_BARCODEIO
 
         Document SingleDoc;
 
+        Document OutDoc;
+
         DataTable Dbfind;
 
         //自适应屏幕
@@ -69,6 +73,7 @@ namespace UAS_BARCODEIO
             }
 
             SingleDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BARCODE.lab");
+            OutDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BOXCODE.lab");
             asc.controllInitializeSize(this);
             asc.controlAutoSize(this);
 
@@ -230,6 +235,13 @@ namespace UAS_BARCODEIO
                 MessageBox.Show("物料采集后超出入库单数量" + PR_CODE.Text);
                 return;
             }
+            string outboxcode = "";
+            if (GenBoxCode.Checked)
+            {
+                string[] param = new string[] { PR_CODE.Text, "", outboxcode };
+                dh.CallProcedure("SP_GETBOX", ref param);
+                outboxcode = param[2].Replace("BOX:", "");
+            }
             //生成条码数量
             int barcount = NowInqty % Minpackage == 0 ? NowInqty / Minpackage : (NowInqty / Minpackage) + 1;
             List<string> bi_inqty = new List<string>();
@@ -266,8 +278,8 @@ namespace UAS_BARCODEIO
                 bi_madedate.Add(DC.Text);
             }
             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 " +
+                 "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE,BI_OUTBOXCODE)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,'" + outboxcode + "' " +
                  " 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();
@@ -276,7 +288,7 @@ namespace UAS_BARCODEIO
 
         private void LoadBarcodeioData(string pr_code)
         {
-            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,pr_orispeccode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
+            string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_outboxcode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode,pr_orispeccode 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);
         }
@@ -351,7 +363,7 @@ namespace UAS_BARCODEIO
                 LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
                 Console.WriteLine(Prodiodetail.Rows[e.RowIndex].Cells["pr_brand"].Value.ToString());
                 es_custcode.Text = Prodiodetail.Rows[e.RowIndex].Cells["pr_brand"].Value.ToString();
-                PR_CODE.Text= Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString();
+                PR_CODE.Text = Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString();
                 LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
             }
         }
@@ -363,5 +375,72 @@ namespace UAS_BARCODEIO
                 BarcodeIO.Rows[i].Cells["CheckBox"].Value = true;
             }
         }
+
+        private void PrintBox_Click(object sender, EventArgs e)
+        {
+            List<string> outboxcode = new List<string>();
+            for (int i = 0; i < BarcodeIO.Rows.Count; i++)
+            {
+                if (BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue != null && BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue.ToString() == "True")
+                {
+                    if (!outboxcode.Contains(BarcodeIO.Rows[i].Cells["bi_outboxcode"].FormattedValue))
+                    {
+                        outboxcode.Add(BarcodeIO.Rows[i].Cells["bi_outboxcode"].Value.ToString());
+                    }
+                }
+            }
+            string[] box = outboxcode.ToArray();
+            for (int i = 0; i < box.Length; i++)
+            {
+                string sql = "select bi_outboxcode,sum(bi_inqty)bi_inqty,max(bi_datecode)bi_datecode,max(bi_vendbarcode)bi_vendbarcode,max(to_char(bi_madedate,'yyyy-mm-dd'))bi_madedate," +
+                    "max(pr_detail)pr_detail,max(pr_spec)pr_spec,max(bi_prodcode)bi_prodcode,max(pr_orispeccode)pr_orispeccode,max(pr_detail)pr_detail from barcodeio left join product on bi_prodcode=pr_code where bi_outboxcode='" + box[i] + "' group by bi_outboxcode";
+                DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
+                for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
+                {
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "BARCODE")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_outboxcode"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_madedate"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_vendbarcode"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_inqty"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_prodcode"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_spec"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_detail"].ToString();
+                    }
+                    if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
+                    {
+                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_orispeccode"].ToString();
+                    }
+                }
+                OutDoc.Printer.SwitchTo(PrinterList.Text);
+                OutDoc.PrintDocument();
+            }
+        }
     }
 }

+ 1 - 25
UAS_BARCODEIO/入库条码规则解析.resx

@@ -171,31 +171,7 @@
   <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="pr_orispeccode.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">
+  <metadata name="bi_outboxcode.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">