Browse Source

导入外箱号BUG调整

章政 6 years ago
parent
commit
2d6b2c696f

+ 14 - 3
UAS-出货标签管理(贸易版)/UAS_出货标签管理.Designer.cs

@@ -188,6 +188,7 @@
             this.pib_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pib_custbarcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pib_custoutboxcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_pocode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_custprodcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_custprodspec = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -1214,6 +1215,7 @@
             this.pib_qty,
             this.pib_barcode,
             this.pib_custbarcode,
+            this.pib_custoutboxcode,
             this.pd_pocode,
             this.pd_custprodcode,
             this.pd_custprodspec,
@@ -1738,12 +1740,12 @@
             // 
             // pib_pdno
             // 
-            this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.pib_pdno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
             this.pib_pdno.DataPropertyName = "pib_pdno";
             this.pib_pdno.HeaderText = "明细序号";
             this.pib_pdno.Name = "pib_pdno";
             this.pib_pdno.ReadOnly = true;
-            this.pib_pdno.Width = 96;
+            this.pib_pdno.Width = 78;
             // 
             // pib_prodcode
             // 
@@ -1844,16 +1846,24 @@
             this.pib_barcode.HeaderText = "唯一条码";
             this.pib_barcode.Name = "pib_barcode";
             this.pib_barcode.ReadOnly = true;
+            this.pib_barcode.Visible = false;
             this.pib_barcode.Width = 78;
             // 
             // pib_custbarcode
             // 
             this.pib_custbarcode.DataPropertyName = "pib_custbarcode";
-            this.pib_custbarcode.HeaderText = "客户条码";
+            this.pib_custbarcode.HeaderText = "料盘条码";
             this.pib_custbarcode.Name = "pib_custbarcode";
             this.pib_custbarcode.ReadOnly = true;
             this.pib_custbarcode.Width = 78;
             // 
+            // pib_custoutboxcode
+            // 
+            this.pib_custoutboxcode.DataPropertyName = "pib_custoutboxcode";
+            this.pib_custoutboxcode.HeaderText = "外箱条码";
+            this.pib_custoutboxcode.Name = "pib_custoutboxcode";
+            this.pib_custoutboxcode.Width = 78;
+            // 
             // pd_pocode
             // 
             this.pd_pocode.DataPropertyName = "pd_pocode";
@@ -2140,6 +2150,7 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_qty;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_barcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pib_custbarcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pib_custoutboxcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_pocode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_custprodcode;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_custprodspec;

+ 40 - 5
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -2409,7 +2409,8 @@ namespace UAS_LabelMachine
                 if (maxnum == "")
                 {
                     dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + NrCode + "','" + Prefix + "','1')", "insert");
-                    custserialnum = 1;
+                    maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'").ToString();
+                    custserialnum = int.Parse(maxnum);
                 }//如果流水号不为空则取当前流水
                 else
                 {
@@ -2440,6 +2441,7 @@ namespace UAS_LabelMachine
                 ArrayList<string> pdid = new ArrayList<string>();
                 ArrayList<string> prbrand = new ArrayList<string>();
                 ArrayList<string> pdprodcode = new ArrayList<string>();
+                ArrayList<string> pib_custoutboxcode = new ArrayList<string>();
                 //用于数量的校验
                 Dictionary<string, decimal> sumqty = new Dictionary<string, decimal>();
                 Dictionary<string, Dictionary<string, decimal>> outsumqty = new Dictionary<string, Dictionary<string, decimal>>();
@@ -2476,6 +2478,9 @@ namespace UAS_LabelMachine
                         outsumqty[pr_spec].Add(pd_pdno, pd_outqty);
                     }
                 }
+                //上一个的最小外箱号,如果箱号没有发生变化则外箱条码也不变化
+                string Lastoutbox = "";
+                string Lastoutboxcode = "";
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     string pr_spec = dt.Rows[i]["规格型号"].ToString();
@@ -2543,7 +2548,7 @@ namespace UAS_LabelMachine
                         {
                             ////使用该出货单明细行数量,并且数量置为0
                             pd_outqty = outsumqty[pr_spec][pd_pdno];
-                        }
+                        }   
                         string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
                         if (pd_outqty % zxbzs != 0)
                         {
@@ -2553,6 +2558,16 @@ namespace UAS_LabelMachine
                             {
                                 barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
                                 custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                                if (Lastoutbox != pib_outboxcode2)
+                                {
+                                    Lastoutboxcode = BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix);
+                                    pib_custoutboxcode.Add(Lastoutboxcode);
+                                    Lastoutbox = pib_outboxcode2;
+                                }
+                                else
+                                {
+                                    pib_custoutboxcode.Add(Lastoutboxcode);
+                                }
                                 piboutboxcode2.Add(pib_outboxcode2);
                                 pib_inqty.Add(zxbzs);
                                 datecode.Add(DateCode);
@@ -2565,6 +2580,16 @@ namespace UAS_LabelMachine
                                 pdprodcode.Add(pd_prodcode);
                             }
                             custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                            if (Lastoutbox != pib_outboxcode2)
+                            {
+                                Lastoutboxcode = BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix);
+                                pib_custoutboxcode.Add(Lastoutboxcode);
+                                Lastoutbox = pib_outboxcode2;
+                            }
+                            else
+                            {
+                                pib_custoutboxcode.Add(Lastoutboxcode);
+                            }
                             barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
                             pib_inqty.Add(pd_outqty % zxbzs);
                             piboutboxcode2.Add(pib_outboxcode2);
@@ -2584,6 +2609,16 @@ namespace UAS_LabelMachine
                             {
                                 barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
                                 custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                                if (Lastoutbox != pib_outboxcode2)
+                                {
+                                    Lastoutboxcode = BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix);
+                                    pib_custoutboxcode.Add(Lastoutboxcode);
+                                    Lastoutbox = pib_outboxcode2;
+                                }
+                                else
+                                {
+                                    pib_custoutboxcode.Add(Lastoutboxcode);
+                                }
                                 pib_inqty.Add(zxbzs);
                                 piboutboxcode2.Add(pib_outboxcode2);
                                 datecode.Add(DateCode);
@@ -2631,10 +2666,10 @@ namespace UAS_LabelMachine
                         sql.Clear();
                         sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
                         sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,");
-                        sql.Append("pib_outboxcode2,pib_custbarcode)values(prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,");
+                        sql.Append("pib_outboxcode2,pib_custbarcode,pib_custoutboxcode)values(prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,");
                         sql.Append("'" + pi_inoutno.Text + "'," + PI_ID + ",:pr_brand,:barcode,:pd_pdno,:pd_id,'" + pi_class.Text + "',:pib_inqty,");
-                        sql.Append(":pib_datecode,:pib_lotno,0,-1,:pd_ordercode,:pd_orderdetno,:outboxcode,:custbarcode)");
-                        dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray());
+                        sql.Append(":pib_datecode,:pib_lotno,0,-1,:pd_ordercode,:pd_orderdetno,:outboxcode,:custbarcode,:pib_custoutboxcode)");
+                        dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode", "pib_custoutboxcode" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray(), pib_custoutboxcode.ToArray());
                         //更新流水
                         dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
                         LoadGridData();

+ 3 - 0
UAS-出货标签管理(贸易版)/UAS_出货标签管理.resx

@@ -174,6 +174,9 @@
   <metadata name="pib_custbarcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pib_custoutboxcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pd_custprodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>