Explorar o código

可以自行设置打印数量

章政 %!s(int64=6) %!d(string=hai) anos
pai
achega
cae2158756

+ 60 - 11
UAS-出货标签管理(吉利通)/DateCodeSetAndPrint.Designer.cs

@@ -35,12 +35,15 @@
             this.label2 = new System.Windows.Forms.Label();
             this.lotno = new UAS_LabelMachine.CustomControl.EnterTextBox();
             this.datecode = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.Nums = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.loadingCircle2 = new UAS_LabelMachine.CustomControl.SetLoading.LoadingCircle();
             this.SuspendLayout();
             // 
             // SetValueAndPrint
             // 
             this.SetValueAndPrint.Location = new System.Drawing.Point(191, 168);
-            this.SetValueAndPrint.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.SetValueAndPrint.Margin = new System.Windows.Forms.Padding(2);
             this.SetValueAndPrint.Name = "SetValueAndPrint";
             this.SetValueAndPrint.Size = new System.Drawing.Size(77, 20);
             this.SetValueAndPrint.TabIndex = 0;
@@ -52,8 +55,8 @@
             this.loadingCircle1.Active = false;
             this.loadingCircle1.Color = System.Drawing.Color.DarkGray;
             this.loadingCircle1.InnerCircleRadius = 5;
-            this.loadingCircle1.Location = new System.Drawing.Point(205, 106);
-            this.loadingCircle1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.loadingCircle1.Location = new System.Drawing.Point(205, 80);
+            this.loadingCircle1.Margin = new System.Windows.Forms.Padding(2);
             this.loadingCircle1.Name = "loadingCircle1";
             this.loadingCircle1.NumberSpoke = 12;
             this.loadingCircle1.OuterCircleRadius = 11;
@@ -67,7 +70,7 @@
             // SetValue
             // 
             this.SetValue.Location = new System.Drawing.Point(106, 168);
-            this.SetValue.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.SetValue.Margin = new System.Windows.Forms.Padding(2);
             this.SetValue.Name = "SetValue";
             this.SetValue.Size = new System.Drawing.Size(71, 20);
             this.SetValue.TabIndex = 3;
@@ -77,7 +80,7 @@
             // lotno_label
             // 
             this.lotno_label.AutoSize = true;
-            this.lotno_label.Location = new System.Drawing.Point(68, 66);
+            this.lotno_label.Location = new System.Drawing.Point(68, 46);
             this.lotno_label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.lotno_label.Name = "lotno_label";
             this.lotno_label.Size = new System.Drawing.Size(35, 12);
@@ -87,7 +90,7 @@
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(68, 110);
+            this.label2.Location = new System.Drawing.Point(68, 88);
             this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(53, 12);
@@ -97,8 +100,8 @@
             // lotno
             // 
             this.lotno.ID = null;
-            this.lotno.Location = new System.Drawing.Point(134, 64);
-            this.lotno.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.lotno.Location = new System.Drawing.Point(134, 44);
+            this.lotno.Margin = new System.Windows.Forms.Padding(2);
             this.lotno.Name = "lotno";
             this.lotno.Size = new System.Drawing.Size(152, 21);
             this.lotno.Str = null;
@@ -109,8 +112,8 @@
             // datecode
             // 
             this.datecode.ID = null;
-            this.datecode.Location = new System.Drawing.Point(134, 109);
-            this.datecode.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.datecode.Location = new System.Drawing.Point(134, 83);
+            this.datecode.Margin = new System.Windows.Forms.Padding(2);
             this.datecode.Name = "datecode";
             this.datecode.Size = new System.Drawing.Size(152, 21);
             this.datecode.Str = null;
@@ -118,11 +121,53 @@
             this.datecode.Str2 = null;
             this.datecode.TabIndex = 7;
             // 
+            // Nums
+            // 
+            this.Nums.ID = null;
+            this.Nums.Location = new System.Drawing.Point(134, 123);
+            this.Nums.Margin = new System.Windows.Forms.Padding(2);
+            this.Nums.Name = "Nums";
+            this.Nums.Size = new System.Drawing.Size(152, 21);
+            this.Nums.Str = null;
+            this.Nums.Str1 = null;
+            this.Nums.Str2 = null;
+            this.Nums.TabIndex = 10;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(68, 128);
+            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(29, 12);
+            this.label1.TabIndex = 9;
+            this.label1.Text = "数量";
+            // 
+            // loadingCircle2
+            // 
+            this.loadingCircle2.Active = false;
+            this.loadingCircle2.Color = System.Drawing.Color.DarkGray;
+            this.loadingCircle2.InnerCircleRadius = 5;
+            this.loadingCircle2.Location = new System.Drawing.Point(205, 120);
+            this.loadingCircle2.Margin = new System.Windows.Forms.Padding(2);
+            this.loadingCircle2.Name = "loadingCircle2";
+            this.loadingCircle2.NumberSpoke = 12;
+            this.loadingCircle2.OuterCircleRadius = 11;
+            this.loadingCircle2.RotationSpeed = 100;
+            this.loadingCircle2.Size = new System.Drawing.Size(0, 0);
+            this.loadingCircle2.SpokeThickness = 2;
+            this.loadingCircle2.StylePreset = UAS_LabelMachine.CustomControl.SetLoading.LoadingCircle.StylePresets.MacOSX;
+            this.loadingCircle2.TabIndex = 8;
+            this.loadingCircle2.Text = "loadingCircle2";
+            // 
             // DateCodeSetAndPrint
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(365, 212);
+            this.Controls.Add(this.Nums);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.loadingCircle2);
             this.Controls.Add(this.datecode);
             this.Controls.Add(this.lotno);
             this.Controls.Add(this.label2);
@@ -130,10 +175,11 @@
             this.Controls.Add(this.SetValue);
             this.Controls.Add(this.loadingCircle1);
             this.Controls.Add(this.SetValueAndPrint);
-            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.Name = "DateCodeSetAndPrint";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "DateCodeSetAndPrint";
+            this.Load += new System.EventHandler(this.DateCodeSetAndPrint_Load);
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -148,5 +194,8 @@
         private System.Windows.Forms.Label label2;
         private CustomControl.EnterTextBox lotno;
         private CustomControl.EnterTextBox datecode;
+        private CustomControl.EnterTextBox Nums;
+        private System.Windows.Forms.Label label1;
+        private CustomControl.SetLoading.LoadingCircle loadingCircle2;
     }
 }

+ 5 - 0
UAS-出货标签管理(吉利通)/DateCodeSetAndPrint.cs

@@ -15,5 +15,10 @@ namespace UAS_LabelMachine
         {
             InitializeComponent();
         }
+
+        private void DateCodeSetAndPrint_Load(object sender, EventArgs e)
+        {
+
+        }
     }
 }

+ 45 - 4
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -318,6 +318,7 @@ namespace UAS_LabelMachine
                 switch (port.Tag)
                 {
                     case "PLC1":
+                        ScanGroup = BaseUtil.filterDataTable(ScanGroup, "sg_autolabel<>0");
                         //MessageLog.AppendText(msg + "\n", Color.Blue);
                         ////返回的指令和设备执行的动作对应
                         //foreach (var item in instruct)
@@ -1653,7 +1654,7 @@ namespace UAS_LabelMachine
                 guestlabeldata.Text = dt.Rows[0]["guestlabeldata"].ToString();
             }
             //获取所有的匹配脚本
-            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null and nvl(sg_autolabel,0)=0", "select");
+            ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_autolabel,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null", "select");
             RefreshProcessData();
         }
 
@@ -2263,12 +2264,30 @@ namespace UAS_LabelMachine
             string pdno = LabelInf.Rows[rowindex].Cells["pib_pdno"].Value.ToString();
             string datecode = setvalue.FindForm().Controls["datecode"].Text;
             string lotno = setvalue.FindForm().Controls["lotno"].Text;
+            string nums = setvalue.FindForm().Controls["Nums"].Text;
             string year = "0";
             string month = "0";
             string day = "0";
             string date = "";
             LogicHandler.GetTimeFromDatecode(dh1, datecode, pi_cardcode.Text, out year, out month, out day, out date);
-            adh.ExecuteSql("update prodiobarcode set pib_autoset=-1,pib_ifrecheck=-1,pib_ifpick=-1,pib_ifmodify=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "update");
+            string sql = "update prodiobarcode set pib_autoset=-1,pib_ifrecheck=-1,pib_ifpick=-1,pib_ifmodify=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_id in (select pib_id from prodiobarcode where  pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno;
+            if (datecode != "")
+            {
+                sql += "  and (pib_datecode='' or pib_datecode is null) ";
+            }
+            if (lotno != "")
+            {
+                sql += " and (pib_lotno='' or pib_lotno is null) ";
+            }
+            if (nums == "")
+            {
+                sql += ")";
+            }
+            else
+            {
+                sql += " limit 0," + nums + ")";
+            }
+            adh.ExecuteSql(sql, "update");
             LoadGridData();
             setvalue.FindForm().Close();
         }
@@ -2279,14 +2298,36 @@ namespace UAS_LabelMachine
             string pdno = LabelInf.Rows[rowindex].Cells["pib_pdno"].Value.ToString();
             string datecode = setvalueandprint.FindForm().Controls["datecode"].Text;
             string lotno = setvalueandprint.FindForm().Controls["lotno"].Text;
+            string nums = setvalueandprint.FindForm().Controls["Nums"].Text;
             string year = "0";
             string month = "0";
             string day = "0";
             string date = "";
             LogicHandler.GetTimeFromDatecode(dh1, datecode, pi_cardcode.Text, out year, out month, out day, out date);
-            adh.ExecuteSql("update prodiobarcode set pib_autoset=-1,pib_ifrecheck,pib_ifpick=-1,pib_ifmodify=-1,pib_ifprint=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "update");
+            string sql = "update prodiobarcode set pib_autoset=-1,pib_ifrecheck=-1,pib_ifpick=-1,pib_ifmodify=-1,pib_ifprint=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_id in (select pib_id from prodiobarcode where  pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno;
+            string PrintSQL = "select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno;
+            if (datecode != "")
+            {
+                sql += " and (pib_datecode='' or pib_datecode is null) ";
+                PrintSQL += " and (pib_datecode='' or pib_datecode is null) ";
+            }
+            if (lotno != "")
+            {
+                sql += " and (pib_lotno='' or pib_lotno is null) ";
+                PrintSQL += " and (pib_lotno='' or pib_lotno is null) ";
+            }
+            if (nums == "")
+            {
+                sql += ")";
+            }
+            else
+            {
+                sql += " limit 0," + nums + ")";
+                PrintSQL += " limit 0," + nums;
+            }
+            DataTable pibid_dt = (DataTable)adh.ExecuteSql(PrintSQL, "select");
+            adh.ExecuteSql(sql, "update");
             LoadGridData();
-            DataTable pibid_dt = (DataTable)adh.ExecuteSql("select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "select");
             for (int i = 0; i < pibid_dt.Rows.Count; i++)
             {
                 SinglePrint(pibid_dt.Rows[i]["pib_id"].ToString());