Browse Source

入库规则型号解析

callm 11 months ago
parent
commit
e462612b1a

+ 8 - 4
UAS_BARCODEIO/LogicHandler.cs

@@ -60,14 +60,18 @@ namespace UAS_BARCODEIO
             SerialNum = param[2];
         }
 
-        public static void GetWeekData(string iWeek, string iQTY, string iBrand, out string madedate, out string inqty)
+        public static void GetWeekData(string iWeek, string iQTY, string iBrand,string iSPec,string iLotNO,out string madedate, out string inqty,out string lotno,out string spec)
         {
             madedate = "";
             inqty = "";
-            string[] param = new string[] { iWeek, iQTY, iBrand, madedate, inqty };
+            lotno = "";
+            spec = "";
+            string[] param = new string[] { iWeek, iQTY, iBrand, iSPec, iLotNO, madedate, inqty , lotno, spec };
             dh.CallProcedure("SP_WEEKTODATE", ref param);
-            madedate = param[3];
-            inqty = param[4];
+            madedate = param[5];
+            inqty = param[6];
+            lotno = param[7];
+            spec = param[8];
         }
 
         /// <summary>

+ 7 - 3
UAS_BARCODEIO/入库条码规则解析.cs

@@ -128,7 +128,7 @@ namespace UAS_BARCODEIO
                 //分割后的字符串数组需要大于设置的参数解析
                 if (str.Length < dt.Rows.Count)
                 {
-                    MessageBox.Show("无条码解析规则");
+                    MessageBox.Show("解析参数与解析规则不匹配");
                     return;
                 }
                 for (int i = 0; i < dt.Rows.Count; i++)
@@ -155,9 +155,13 @@ namespace UAS_BARCODEIO
                 }
                 string madedate;
                 string outqty;
-                LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), out madedate, out outqty);
+                string lotno;
+                string spec;
+                LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), pr_orispeccode3.Text,LOTNO.Text, out madedate, out outqty, out lotno,out spec);
                 DC.Text = madedate;
                 INQTY.Text = outqty;
+                LOTNO.Text = lotno;
+                pr_orispeccode3.Text = spec;
             }
         }
         bool AutoSized = false;
@@ -451,7 +455,7 @@ namespace UAS_BARCODEIO
 
         private void PrintStockBarCode_Click(object sender, EventArgs e)
         {
-            库存条码打印 form=new 库存条码打印();
+            库存条码打印 form = new 库存条码打印();
             form.ShowDialog();
         }
     }

+ 71 - 59
UAS_BARCODEIO/库存条码打印.Designer.cs

@@ -36,7 +36,7 @@
             this.label5 = new System.Windows.Forms.Label();
             this.LOTNO = new System.Windows.Forms.TextBox();
             this.label6 = new System.Windows.Forms.Label();
-            this.pr_zxbz = new System.Windows.Forms.TextBox();
+            this.pr_zxbzs = new System.Windows.Forms.TextBox();
             this.label7 = new System.Windows.Forms.Label();
             this.Barcode = new System.Windows.Forms.TextBox();
             this.label8 = new System.Windows.Forms.Label();
@@ -46,7 +46,7 @@
             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.pr_orispeccode = new System.Windows.Forms.TextBox();
             this.原厂型号 = new System.Windows.Forms.Label();
             this.GenBoxCode = new System.Windows.Forms.CheckBox();
             this.pr_brand = new System.Windows.Forms.TextBox();
@@ -55,12 +55,13 @@
             this.label10 = new System.Windows.Forms.Label();
             this.bar_indate = new System.Windows.Forms.DateTimePicker();
             this.label2 = new System.Windows.Forms.Label();
-            this.PR_CODE = new UAS_BARCODEIO.SearchTextBox();
+            this.pr_code = new UAS_BARCODEIO.SearchTextBox();
+            this.QueryBarcode = new System.Windows.Forms.Button();
             this.CheckBox = new System.Windows.Forms.DataGridViewCheckBoxColumn();
-            this.pr_orispeccode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_orispeccode4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_prodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_code = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.bar_outboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.bar_outboxcode1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_remain = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_vendbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.bar_madedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -148,13 +149,13 @@
             this.label6.TabIndex = 26;
             this.label6.Text = "LotNo";
             // 
-            // pr_zxbz
+            // pr_zxbzs
             // 
-            this.pr_zxbz.Location = new System.Drawing.Point(199, 584);
-            this.pr_zxbz.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.pr_zxbz.Name = "pr_zxbz";
-            this.pr_zxbz.Size = new System.Drawing.Size(436, 35);
-            this.pr_zxbz.TabIndex = 30;
+            this.pr_zxbzs.Location = new System.Drawing.Point(199, 584);
+            this.pr_zxbzs.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.pr_zxbzs.Name = "pr_zxbzs";
+            this.pr_zxbzs.Size = new System.Drawing.Size(436, 35);
+            this.pr_zxbzs.TabIndex = 30;
             // 
             // label7
             // 
@@ -205,10 +206,10 @@
             this.BarcodeIO.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.BarcodeIO.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.CheckBox,
-            this.pr_orispeccode,
+            this.pr_orispeccode4,
             this.bar_prodcode,
             this.bar_code,
-            this.bar_outboxcode,
+            this.bar_outboxcode1,
             this.bar_remain,
             this.bar_vendbarcode,
             this.bar_madedate,
@@ -260,14 +261,14 @@
             this.ChooseAll.UseVisualStyleBackColor = true;
             this.ChooseAll.Click += new System.EventHandler(this.ChooseAll_Click);
             // 
-            // pr_orispeccode2
+            // pr_orispeccode
             // 
-            this.pr_orispeccode2.Enabled = false;
-            this.pr_orispeccode2.Location = new System.Drawing.Point(199, 249);
-            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.pr_orispeccode.Enabled = false;
+            this.pr_orispeccode.Location = new System.Drawing.Point(199, 249);
+            this.pr_orispeccode.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.pr_orispeccode.Name = "pr_orispeccode";
+            this.pr_orispeccode.Size = new System.Drawing.Size(436, 35);
+            this.pr_orispeccode.TabIndex = 41;
             // 
             // 原厂型号
             // 
@@ -344,25 +345,34 @@
             this.label2.TabIndex = 47;
             this.label2.Text = "入库日期";
             // 
-            // PR_CODE
-            // 
-            this.PR_CODE.AllPower = null;
-            this.PR_CODE.Caller = null;
-            this.PR_CODE.Condition = null;
-            this.PR_CODE.DBTitle = null;
-            this.PR_CODE.Enabled = false;
-            this.PR_CODE.FormName = null;
-            this.PR_CODE.Location = new System.Drawing.Point(199, 43);
-            this.PR_CODE.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.PR_CODE.Name = "PR_CODE";
-            this.PR_CODE.Power = null;
-            this.PR_CODE.ReturnData = null;
-            this.PR_CODE.SelectField = null;
-            this.PR_CODE.SetValueField = null;
-            this.PR_CODE.Size = new System.Drawing.Size(436, 35);
-            this.PR_CODE.TabIndex = 21;
-            this.PR_CODE.TableName = null;
-            this.PR_CODE.TextBoxEnable = false;
+            // pr_code
+            // 
+            this.pr_code.AllPower = null;
+            this.pr_code.Caller = null;
+            this.pr_code.Condition = null;
+            this.pr_code.DBTitle = null;
+            this.pr_code.FormName = null;
+            this.pr_code.Location = new System.Drawing.Point(199, 43);
+            this.pr_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
+            this.pr_code.Name = "pr_code";
+            this.pr_code.Power = null;
+            this.pr_code.ReturnData = null;
+            this.pr_code.SelectField = null;
+            this.pr_code.SetValueField = null;
+            this.pr_code.Size = new System.Drawing.Size(436, 35);
+            this.pr_code.TabIndex = 21;
+            this.pr_code.TableName = null;
+            this.pr_code.TextBoxEnable = false;
+            // 
+            // QueryBarcode
+            // 
+            this.QueryBarcode.Location = new System.Drawing.Point(549, 181);
+            this.QueryBarcode.Name = "QueryBarcode";
+            this.QueryBarcode.Size = new System.Drawing.Size(101, 45);
+            this.QueryBarcode.TabIndex = 48;
+            this.QueryBarcode.Text = "查询";
+            this.QueryBarcode.UseVisualStyleBackColor = true;
+            this.QueryBarcode.Click += new System.EventHandler(this.QueryBarcode_Click);
             // 
             // CheckBox
             // 
@@ -372,13 +382,13 @@
             this.CheckBox.Name = "CheckBox";
             this.CheckBox.Width = 200;
             // 
-            // pr_orispeccode
+            // pr_orispeccode4
             // 
-            this.pr_orispeccode.DataPropertyName = "pr_orispeccode";
-            this.pr_orispeccode.HeaderText = "型号";
-            this.pr_orispeccode.MinimumWidth = 10;
-            this.pr_orispeccode.Name = "pr_orispeccode";
-            this.pr_orispeccode.Width = 200;
+            this.pr_orispeccode4.DataPropertyName = "pr_orispeccode";
+            this.pr_orispeccode4.HeaderText = "型号";
+            this.pr_orispeccode4.MinimumWidth = 10;
+            this.pr_orispeccode4.Name = "pr_orispeccode4";
+            this.pr_orispeccode4.Width = 200;
             // 
             // bar_prodcode
             // 
@@ -396,13 +406,13 @@
             this.bar_code.Name = "bar_code";
             this.bar_code.Width = 200;
             // 
-            // bar_outboxcode
+            // bar_outboxcode1
             // 
-            this.bar_outboxcode.DataPropertyName = "bar_outboxcode";
-            this.bar_outboxcode.HeaderText = "外箱条码";
-            this.bar_outboxcode.MinimumWidth = 10;
-            this.bar_outboxcode.Name = "bar_outboxcode";
-            this.bar_outboxcode.Width = 200;
+            this.bar_outboxcode1.DataPropertyName = "BAR_OUTBOXCODE1";
+            this.bar_outboxcode1.HeaderText = "外箱条码";
+            this.bar_outboxcode1.MinimumWidth = 10;
+            this.bar_outboxcode1.Name = "bar_outboxcode1";
+            this.bar_outboxcode1.Width = 200;
             // 
             // bar_remain
             // 
@@ -449,13 +459,14 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(2136, 1338);
+            this.Controls.Add(this.QueryBarcode);
             this.Controls.Add(this.label2);
             this.Controls.Add(this.bar_indate);
             this.Controls.Add(this.pr_orispeccode3);
             this.Controls.Add(this.label10);
             this.Controls.Add(this.PrintBox);
             this.Controls.Add(this.GenBoxCode);
-            this.Controls.Add(this.pr_orispeccode2);
+            this.Controls.Add(this.pr_orispeccode);
             this.Controls.Add(this.原厂型号);
             this.Controls.Add(this.ChooseAll);
             this.Controls.Add(this.label9);
@@ -466,7 +477,7 @@
             this.Controls.Add(this.label8);
             this.Controls.Add(this.Barcode);
             this.Controls.Add(this.pr_brand);
-            this.Controls.Add(this.pr_zxbz);
+            this.Controls.Add(this.pr_zxbzs);
             this.Controls.Add(this.label7);
             this.Controls.Add(this.LOTNO);
             this.Controls.Add(this.label6);
@@ -474,7 +485,7 @@
             this.Controls.Add(this.label5);
             this.Controls.Add(this.INQTY);
             this.Controls.Add(this.label4);
-            this.Controls.Add(this.PR_CODE);
+            this.Controls.Add(this.pr_code);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.label1);
             this.Margin = new System.Windows.Forms.Padding(6);
@@ -499,7 +510,7 @@
         private System.Windows.Forms.Label label5;
         private System.Windows.Forms.TextBox LOTNO;
         private System.Windows.Forms.Label label6;
-        private System.Windows.Forms.TextBox pr_zxbz;
+        private System.Windows.Forms.TextBox pr_zxbzs;
         private System.Windows.Forms.Label label7;
         private System.Windows.Forms.TextBox pr_brand;
         private System.Windows.Forms.TextBox Barcode;
@@ -510,7 +521,7 @@
         private System.Windows.Forms.ComboBox PrinterList;
         private System.Windows.Forms.Label label9;
         private System.Windows.Forms.Button ChooseAll;
-        private System.Windows.Forms.TextBox pr_orispeccode2;
+        private System.Windows.Forms.TextBox pr_orispeccode;
         private System.Windows.Forms.Label 原厂型号;
         private System.Windows.Forms.CheckBox GenBoxCode;
         private System.Windows.Forms.Button PrintBox;
@@ -518,12 +529,13 @@
         private System.Windows.Forms.Label label10;
         private System.Windows.Forms.DateTimePicker bar_indate;
         private System.Windows.Forms.Label label2;
-        private UAS_BARCODEIO.SearchTextBox PR_CODE;
+        private UAS_BARCODEIO.SearchTextBox pr_code;
+        private System.Windows.Forms.Button QueryBarcode;
         private System.Windows.Forms.DataGridViewCheckBoxColumn CheckBox;
-        private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_orispeccode4;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_prodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_code;
-        private System.Windows.Forms.DataGridViewTextBoxColumn bar_outboxcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn bar_outboxcode1;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_remain;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_vendbarcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn bar_madedate;

+ 73 - 64
UAS_BARCODEIO/库存条码打印.cs

@@ -54,13 +54,13 @@ namespace UAS_BARCODEIO
 
         private void Form1_Load(object sender, EventArgs e)
         {
-            PR_CODE.TableName = "product ";
-            PR_CODE.SelectField = "pr_code # 物料编号 ,pr_orispeccode3 # 原厂型号 ,pr_brand # 品牌,pr_zxbz # 最小包装";
-            PR_CODE.FormName = Name;
-            PR_CODE.DBTitle = "解析规则查询";
-            PR_CODE.SetValueField = new string[] { "pr_brand", "pr_zxbz" };
-            PR_CODE.Condition = "";
-            PR_CODE.DbChange += nr_rule_DBChange;
+            pr_code.TableName = "product";
+            pr_code.SelectField = "pr_code # 物料编号 ,pr_orispeccode # 原厂型号 ,pr_brand # 品牌,pr_zxbzs # 最小包装";
+            pr_code.FormName = Name;
+            pr_code.DBTitle = "物料资料查询";
+            pr_code.SetValueField = new string[] { "pr_code", "pr_orispeccode", "pr_brand", "pr_zxbzs" };
+            pr_code.Condition = "";
+            pr_code.DbChange += nr_rule_DBChange;
 
             SystemInf.dh = dh;
             try
@@ -74,7 +74,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");
+            OutDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BOXCODESTOCK.lab");
             asc.controllInitializeSize(this);
             asc.controlAutoSize(this);
 
@@ -91,7 +91,7 @@ namespace UAS_BARCODEIO
 
         private void nr_rule_DBChange(object sender, EventArgs e)
         {
-            Dbfind = PR_CODE.ReturnData;
+            Dbfind = pr_code.ReturnData;
             BaseUtil.SetFormValue(this.Controls, Dbfind);
         }
 
@@ -146,9 +146,13 @@ namespace UAS_BARCODEIO
                 }
                 string madedate;
                 string outqty;
-                LogicHandler.GetWeekData(DC.Text, INQTY.Text, pr_brand.Text.ToUpper(), out madedate, out outqty);
+                string lotno;
+                string spec;
+                LogicHandler.GetWeekData(DC.Text, INQTY.Text, pr_brand.Text.ToUpper(), pr_orispeccode3.Text, LOTNO.Text, out madedate, out outqty, out lotno, out spec);
                 DC.Text = madedate;
                 INQTY.Text = outqty;
+                LOTNO.Text = lotno;
+                pr_orispeccode3.Text = spec;
             }
         }
         bool AutoSized = false;
@@ -160,10 +164,10 @@ namespace UAS_BARCODEIO
                 AutoSized = true;
             }
         }
-       
+
         private void GenBarCode_Click(object sender, EventArgs e)
         {
-            if (pr_orispeccode2.Text != pr_orispeccode3.Text)
+            if (pr_orispeccode.Text != pr_orispeccode3.Text)
             {
                 MessageBox.Show("解析型号和单据型号不对应");
                 return;
@@ -171,29 +175,29 @@ namespace UAS_BARCODEIO
             int Minpackage = 0;
             //本次入库数
             int NowInqty = int.Parse(INQTY.Text);
-            if (!int.TryParse(pr_zxbz.Text, out Minpackage))
+            if (!int.TryParse(pr_zxbzs.Text, out Minpackage))
             {
-                MessageBox.Show("最小包装数错误,料号" + PR_CODE.Text);
+                MessageBox.Show("最小包装数错误,料号" + pr_code.Text);
                 return;
             }
             string outboxcode = "";
             if (GenBoxCode.Checked)
             {
-                string[] param = new string[] { PR_CODE.Text, "", outboxcode };
+                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>();
-            List<string> bi_barcode = new List<string>();
-            List<string> bi_vendbarcode = new List<string>();
-            List<string> bi_madedate = new List<string>();
+            List<string> BAR_inqty = new List<string>();
+            List<string> bar_code = new List<string>();
+            List<string> bar_vendbarcode = new List<string>();
+            List<string> bar_madedate = new List<string>();
             for (int i = 0; i < barcount; i++)
             {
                 string barcode = "";
                 int OneUnit = 0;
-                string[] param = new string[] { PR_CODE.Text, "", barcode };
+                string[] param = new string[] { pr_code.Text, "", barcode };
                 dh.CallProcedure("SP_GETBARCODE", ref param);
                 barcode = param[2].Replace("BARCODE:", "");
                 //如果最后有尾数的话 
@@ -213,24 +217,24 @@ namespace UAS_BARCODEIO
                 {
                     OneUnit = Minpackage;
                 }
-                bi_inqty.Add(OneUnit.ToString());
-                bi_barcode.Add(barcode);
-                bi_vendbarcode.Add(LOTNO.Text);
-                bi_madedate.Add(DC.Text);
+                BAR_inqty.Add(OneUnit.ToString());
+                bar_code.Add(barcode);
+                bar_vendbarcode.Add(LOTNO.Text);
+                bar_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,BI_OUTBOXCODE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
-            //     "'" + pd_piclass + "','',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());
-            LoadBarcodeioData(PR_CODE.Text);
+            string sql = "insert into barcode(BAR_ID, bar_code, bar_prodcode, BAR_remain,bar_vendbarcode, " +
+                 "bar_madedate, BAR_PRODID, BAR_STATUS, BAR_CHECKMAN, BAR_INDATE,BAR_OUTBOXCODE1)select barcode_seq.nextval,:bar_code," +
+                 "'" + pr_code.Text + "',:bar_remain,:bar_vendbarcode,to_date(:bar_madedate,'yyyy-mm-dd'),pr_id,1,'管理员',sysdate,'" + outboxcode + "' " +
+                 " from product where pr_code='" + pr_code.Text + "'";
+            dh.BatchInsert(sql, new string[] { "bar_code", "bar_remain", "bar_vendbarcode", "bar_madedate" }, bar_code.ToArray(), BAR_inqty.ToArray(), bar_vendbarcode.ToArray(), bar_madedate.ToArray());
+            LoadBarcodeioData(pr_code.Text);
         }
 
         private void LoadBarcodeioData(string 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);
+            string sql = "select 0 CheckBox,bar_code,bar_remain,bar_indate,BAR_OUTBOXCODE1,bar_vendbarcode,to_char(bar_madedate,'yyyy-mm-dd')bar_madedate,pr_detail,pr_spec,bar_prodcode,pr_orispeccode from barcode left join product on bar_prodcode=pr_code where to_char(bar_indate,'yyyy-mm-dd')='" + bar_indate.Value.ToString("yyyy-MM-dd") + "' and bar_prodcode='" + pr_code + "'";
+            DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
+            BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
         }
 
         private void PrintBarCode_Click(object sender, EventArgs e)
@@ -243,43 +247,43 @@ namespace UAS_BARCODEIO
                     {
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "BARCODE")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_barcode"].Value.ToString();
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_code"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_madedate"].Value.ToString();
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_madedate"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_vendbarcode"].Value.ToString();
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_vendbarcode"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_inqty1"].Value.ToString();
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_remain"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_prodcode"].Value.ToString();
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_prodcode"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
                                 SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_spec1"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
                                 SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_detail1"].Value.ToString();
                         }
                         if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
                         {
-                            if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
-                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_orispeccode"].Value.ToString();
+                            if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                                SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_orispeccode4"].Value.ToString();
                         }
                     }
                     SingleDoc.Printer.SwitchTo(PrinterList.Text);
@@ -303,58 +307,58 @@ namespace UAS_BARCODEIO
             {
                 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))
+                    if (!outboxcode.Contains(BarcodeIO.Rows[i].Cells["BAR_OUTBOXCODE1"].FormattedValue))
                     {
-                        outboxcode.Add(BarcodeIO.Rows[i].Cells["bi_outboxcode"].Value.ToString());
+                        outboxcode.Add(BarcodeIO.Rows[i].Cells["BAR_OUTBOXCODE1"].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";
+                string sql = "select BAR_OUTBOXCODE1,sum(BAR_remain)BAR_remain,max(bar_vendbarcode)bar_vendbarcode,max(to_char(bar_madedate,'yyyy-mm-dd'))bar_madedate," +
+                    "max(pr_detail)pr_detail,max(pr_spec)pr_spec,max(bar_prodcode)bar_prodcode,max(pr_orispeccode)pr_orispeccode,max(pr_detail)pr_detail from barcode left join product on bar_prodcode=pr_code where BAR_OUTBOXCODE1='" + box[i] + "' group by BAR_OUTBOXCODE1";
                 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 (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["BAR_OUTBOXCODE1"].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 (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bar_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 (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bar_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 (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["BAR_remain"].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 (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
+                            OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bar_prodcode"].ToString();
                     }
                     if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
                     {
-                        if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
+                        if (BarcodeIO.Rows[i].Cells["bar_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)
+                        if (BarcodeIO.Rows[i].Cells["bar_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)
+                        if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
                             OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_orispeccode"].ToString();
                     }
                 }
@@ -362,5 +366,10 @@ namespace UAS_BARCODEIO
                 OutDoc.PrintDocument();
             }
         }
+
+        private void QueryBarcode_Click(object sender, EventArgs e)
+        {
+            LoadBarcodeioData(pr_code.Text);
+        }
     }
 }

+ 2 - 32
UAS_BARCODEIO/库存条码打印.resx

@@ -120,7 +120,7 @@
   <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">
+  <metadata name="pr_orispeccode4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="bar_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -129,37 +129,7 @@
   <metadata name="bar_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="bar_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bar_remain.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bar_vendbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bar_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="bar_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bar_code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="bar_outboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+  <metadata name="bar_outboxcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
   <metadata name="bar_remain.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">