Эх сурвалжийг харах

添加按照物料进行条码生成

章政 7 жил өмнө
parent
commit
8bc0e78ed7

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

@@ -637,7 +637,6 @@
             this.PackMidBox.TabIndex = 102;
             this.PackMidBox.Text = "封中盒";
             this.PackMidBox.UseVisualStyleBackColor = true;
-            this.PackMidBox.Visible = false;
             this.PackMidBox.Click += new System.EventHandler(this.PackMidBox_Click);
             // 
             // CustomerLabel
@@ -849,7 +848,7 @@
             // 
             this.label18.AutoSize = true;
             this.label18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label18.Location = new System.Drawing.Point(61, 136);
+            this.label18.Location = new System.Drawing.Point(60, 135);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(13, 17);
             this.label18.TabIndex = 90;
@@ -883,7 +882,7 @@
             // 
             this.label16.AutoSize = true;
             this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label16.Location = new System.Drawing.Point(60, 73);
+            this.label16.Location = new System.Drawing.Point(59, 72);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(13, 17);
             this.label16.TabIndex = 87;
@@ -917,7 +916,7 @@
             // 
             this.label12.AutoSize = true;
             this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label12.Location = new System.Drawing.Point(4, 108);
+            this.label12.Location = new System.Drawing.Point(3, 107);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(56, 17);
             this.label12.TabIndex = 77;
@@ -927,7 +926,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(4, 30);
+            this.label7.Location = new System.Drawing.Point(3, 29);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(56, 17);
             this.label7.TabIndex = 76;
@@ -1190,7 +1189,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(-15, 174);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(-44, 173);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(68, 26);
@@ -1205,7 +1204,7 @@
             this.SingleLabelAutoPrint.Checked = true;
             this.SingleLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(7, 95);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(6, 94);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1263,7 +1262,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(6, 121);
+            this.label2.Location = new System.Drawing.Point(5, 120);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(32, 17);
             this.label2.TabIndex = 92;
@@ -1286,7 +1285,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(5, 155);
+            this.label5.Location = new System.Drawing.Point(4, 154);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(32, 17);
             this.label5.TabIndex = 50;
@@ -1319,7 +1318,7 @@
             this.MidLabelAutoPrint.Checked = true;
             this.MidLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.MidLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidLabelAutoPrint.Location = new System.Drawing.Point(7, 93);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(6, 92);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(75, 21);
@@ -1362,7 +1361,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(105, 6);
+            this.LogingOut.Location = new System.Drawing.Point(104, 5);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(42, 21);
             this.LogingOut.TabIndex = 77;
@@ -1388,7 +1387,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(5, 149);
+            this.label10.Location = new System.Drawing.Point(4, 148);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(32, 17);
             this.label10.TabIndex = 90;
@@ -1398,7 +1397,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(4, 112);
+            this.label6.Location = new System.Drawing.Point(3, 111);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(32, 17);
             this.label6.TabIndex = 87;
@@ -1504,18 +1503,18 @@
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridPrcode)).EndInit();
-            this.groupBoxWithBorder1.ResumeLayout(true);
+            this.groupBoxWithBorder1.ResumeLayout(false);
             this.groupBoxWithBorder1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LabelInf)).EndInit();
-            this.SingleLabel.ResumeLayout(true);
+            this.SingleLabel.ResumeLayout(false);
             this.SingleLabel.PerformLayout();
-            this.MidLabel.ResumeLayout(true);
+            this.MidLabel.ResumeLayout(false);
             this.MidLabel.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.MidboxCapacity)).EndInit();
-            this.OutBoxLabel.ResumeLayout(true);
+            this.OutBoxLabel.ResumeLayout(false);
             this.OutBoxLabel.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.OutboxCapacity)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }

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

@@ -791,15 +791,34 @@ namespace UAS_LabelMachine
                     MidOutBoxCodeIndex.Clear();
                     SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
                     SelectMidBoxCode = LabelInf.Rows[SelectRowIndex].Cells["pib_outboxcode1"].Value.ToString();
-                }
-                for (int i = 0; i < LabelInf.Rows.Count; i++)
-                {
-                    if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == SelectMidBoxCode)
+                    for (int i = SelectRowIndex; i > 0; i--)
                     {
-                        if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                        if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode)
                         {
-                            MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
-                            MidOutBoxCodeIndex.Add(i);
+                            if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                            {
+                                MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
+                                MidOutBoxCodeIndex.Add(i);
+                            }
+                        }
+                        else
+                        {
+                            break;
+                        }
+                    }
+                    for (int i = SelectRowIndex; i < LabelInf.Rows.Count - 1; i++)
+                    {
+                        if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode)
+                        {
+                            if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                            {
+                                MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
+                                MidOutBoxCodeIndex.Add(i);
+                            }
+                        }
+                        else
+                        {
+                            break;
                         }
                     }
                 }
@@ -1605,36 +1624,64 @@ namespace UAS_LabelMachine
         {
             if (LabelInf.Rows.Count > 0)
             {
-                DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2)", "select");
-                string pibcustoutboxcode = dh.getFieldDataByCondition("prodiobarcode", "pib_custoutboxcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + LabelInf.Rows[LabelInf.Rows.Count - 1].Cells["pib_outboxcode2"].Value.ToString() + "' and pib_custoutboxcode is not null").ToString();
                 GetBarCodeRule(out Prefix, out Suffix, out MaxNum, out NumLength, out Radix);
-                if (Radix > 0)
+                List<string> OutBoxCode = new List<string>();
+                List<string> PIBID = new List<string>();
+                for (int i = 0; i < LabelInf.Rows.Count; i++)
                 {
-                    //生成外箱条码
-                    for (int i = 0; i < dt.Rows.Count; i++)
+                    if (LabelInf.Rows[i].Cells["pib_custoutboxcode"].Value.ToString() == "")
                     {
-                        List<string> OutBoxCode = new List<string>();
-                        List<string> PIBOUTBOXCODE2 = new List<string>();
+                        PIBID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
                         string serialcode = BaseUtil.DToAny(MaxNum, Radix);
                         for (int k = serialcode.ToString().Length; k < NumLength; k++)
                         {
                             serialcode = "0" + serialcode;
                         }
-                        if (pibcustoutboxcode == "")
+                        if (i + 1 < LabelInf.Rows.Count)
                         {
-                            OutBoxCode.Add(Prefix + serialcode + Suffix);
-                            MaxNum = MaxNum + 1;
-                        }
-                        else
-                        {
-                            OutBoxCode.Add(pibcustoutboxcode);
+                            string FPrcode = LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString();
+                            string BPrcode = LabelInf.Rows[i + 1].Cells["pib_prodcode"].Value.ToString();
+                            if (FPrcode != BPrcode)
+                            {
+                                MaxNum = MaxNum + 1;
+                            }
                         }
-                        PIBOUTBOXCODE2.Add(dt.Rows[i]["pib_outboxcode2"].ToString());
-                        dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_outboxcode2=:pib_outboxcode2 and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBOUTBOXCODE2.ToArray());
+                        OutBoxCode.Add(Prefix + serialcode + Suffix);
                     }
-                    dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
                 }
+                dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_id=:pib_id and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBID.ToArray());
+                MaxNum = MaxNum + 1;
+                dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
                 LoadGridData(sender, e);
+                //DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2)", "select");
+                //string pibcustoutboxcode = dh.getFieldDataByCondition("prodiobarcode", "pib_custoutboxcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + LabelInf.Rows[LabelInf.Rows.Count - 1].Cells["pib_outboxcode2"].Value.ToString() + "' and pib_custoutboxcode is not null").ToString();
+                //GetBarCodeRule(out Prefix, out Suffix, out MaxNum, out NumLength, out Radix);
+                //if (Radix > 0)
+                //{
+                //    //生成外箱条码
+                //    for (int i = 0; i < dt.Rows.Count; i++)
+                //    {
+                //        List<string> OutBoxCode = new List<string>();
+                //        List<string> PIBOUTBOXCODE2 = new List<string>();
+                //        string serialcode = BaseUtil.DToAny(MaxNum, Radix);
+                //        for (int k = serialcode.ToString().Length; k < NumLength; k++)
+                //        {
+                //            serialcode = "0" + serialcode;
+                //        }
+                //        if (pibcustoutboxcode == "")
+                //        {
+                //            OutBoxCode.Add(Prefix + serialcode + Suffix);
+                //            MaxNum = MaxNum + 1;
+                //        }
+                //        else
+                //        {
+                //            OutBoxCode.Add(pibcustoutboxcode);
+                //        }
+                //        PIBOUTBOXCODE2.Add(dt.Rows[i]["pib_outboxcode2"].ToString());
+                //        dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_outboxcode2=:pib_outboxcode2 and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBOUTBOXCODE2.ToArray());
+                //    }
+                //    dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
+                //}
             }
         }