Sfoglia il codice sorgente

修改空指针BUG

callm 7 anni fa
parent
commit
d0e8a4ecf1

+ 10 - 2
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -493,7 +493,11 @@ namespace UAS_LabelMachine
                     DataTable dt = (DataTable)MidSource.DataSource;
                     if (CollectionUnit.Text == "盒")
                     {
-                        string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
+                        string la_id = "";
+                        if (SingleLabelCombox.SelectedValue != null)
+                        {
+                            la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
+                        }
                         string cl_labelname = SingleLabelCombox.Text;
                         string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
                         for (int i = 0; i < LabelInf.RowCount; i++)
@@ -519,7 +523,11 @@ namespace UAS_LabelMachine
                                 //当前行的索引随循环增长
                                 CurrentRowIndex = i;
                                 if (SingleLabelAutoPrint.Checked)
-                                    AutoPrintSingleLabel(la_id, LabelUrl);
+                                {
+                                    if (la_id != "")
+                                        AutoPrintSingleLabel(la_id, LabelUrl);
+                                    else MessageBox.Show("未维护单盘标签");
+                                }
                                 if (MidLabelAutoPrint.Checked)
                                     AutoPrintMidLabel();
                                 SetOutBoxCode2(true);

+ 31 - 29
UAS-出货标签管理/生成条码.Designer.cs

@@ -41,6 +41,8 @@
             this.GenerateBarCode = new UAS_LabelMachine.CustomControl.NormalButton();
             this.Screen = new UAS_LabelMachine.CustomControl.NormalButton();
             this.ProdIoInfDGV = new UAS_LabelMachine.CustomControl.DataGridViewWithSerialNum();
+            this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
+            this.ResetSerialNum = new UAS_LabelMachine.CustomControl.NormalButton();
             this.Choose = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.pd_orderdetno = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.pd_pdno = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -58,8 +60,6 @@
             this.mid_qty = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mid_num = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mid_remain = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.pi_inoutno = new UAS_LabelMachine.CustomControl.EnterTextBox();
-            this.ResetSerialNum = new UAS_LabelMachine.CustomControl.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.ProdIoInfDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -205,11 +205,35 @@
             this.ProdIoInfDGV.Location = new System.Drawing.Point(0, 125);
             this.ProdIoInfDGV.Name = "ProdIoInfDGV";
             this.ProdIoInfDGV.RowTemplate.Height = 23;
-            this.ProdIoInfDGV.Size = new System.Drawing.Size(964, 350);
+            this.ProdIoInfDGV.Size = new System.Drawing.Size(1200, 427);
             this.ProdIoInfDGV.TabIndex = 151;
             this.ProdIoInfDGV.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.ProdIoInfDGV_CellEndEdit);
             this.ProdIoInfDGV.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.ProdIoInfDGV_CellPainting);
             // 
+            // pi_inoutno
+            // 
+            this.pi_inoutno.ID = null;
+            this.pi_inoutno.Location = new System.Drawing.Point(128, 29);
+            this.pi_inoutno.Name = "pi_inoutno";
+            this.pi_inoutno.Size = new System.Drawing.Size(121, 21);
+            this.pi_inoutno.Str = null;
+            this.pi_inoutno.Str1 = null;
+            this.pi_inoutno.Str2 = null;
+            this.pi_inoutno.TabIndex = 149;
+            this.pi_inoutno.Tag = "cu_name";
+            this.pi_inoutno.KeyDown += new System.Windows.Forms.KeyEventHandler(this.bi_inoutno_KeyDown);
+            // 
+            // ResetSerialNum
+            // 
+            this.ResetSerialNum.Image = ((System.Drawing.Image)(resources.GetObject("ResetSerialNum.Image")));
+            this.ResetSerialNum.Location = new System.Drawing.Point(529, 78);
+            this.ResetSerialNum.Name = "ResetSerialNum";
+            this.ResetSerialNum.Size = new System.Drawing.Size(64, 24);
+            this.ResetSerialNum.TabIndex = 161;
+            this.ResetSerialNum.Text = "流水重置";
+            this.ResetSerialNum.UseVisualStyleBackColor = true;
+            this.ResetSerialNum.Click += new System.EventHandler(this.ResetSerialNum_Click);
+            // 
             // Choose
             // 
             this.Choose.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
@@ -219,9 +243,11 @@
             // 
             // pd_orderdetno
             // 
+            this.pd_orderdetno.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
             this.pd_orderdetno.DataPropertyName = "pd_orderdetno";
             this.pd_orderdetno.HeaderText = "订单序号";
             this.pd_orderdetno.Name = "pd_orderdetno";
+            this.pd_orderdetno.Width = 78;
             // 
             // pd_pdno
             // 
@@ -326,35 +352,11 @@
             this.mid_remain.Name = "mid_remain";
             this.mid_remain.ReadOnly = true;
             // 
-            // pi_inoutno
-            // 
-            this.pi_inoutno.ID = null;
-            this.pi_inoutno.Location = new System.Drawing.Point(128, 29);
-            this.pi_inoutno.Name = "pi_inoutno";
-            this.pi_inoutno.Size = new System.Drawing.Size(121, 21);
-            this.pi_inoutno.Str = null;
-            this.pi_inoutno.Str1 = null;
-            this.pi_inoutno.Str2 = null;
-            this.pi_inoutno.TabIndex = 149;
-            this.pi_inoutno.Tag = "cu_name";
-            this.pi_inoutno.KeyDown += new System.Windows.Forms.KeyEventHandler(this.bi_inoutno_KeyDown);
-            // 
-            // ResetSerialNum
-            // 
-            this.ResetSerialNum.Image = ((System.Drawing.Image)(resources.GetObject("ResetSerialNum.Image")));
-            this.ResetSerialNum.Location = new System.Drawing.Point(529, 78);
-            this.ResetSerialNum.Name = "ResetSerialNum";
-            this.ResetSerialNum.Size = new System.Drawing.Size(64, 24);
-            this.ResetSerialNum.TabIndex = 161;
-            this.ResetSerialNum.Text = "流水重置";
-            this.ResetSerialNum.UseVisualStyleBackColor = true;
-            this.ResetSerialNum.Click += new System.EventHandler(this.ResetSerialNum_Click);
-            // 
             // 生成条码
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(965, 477);
+            this.ClientSize = new System.Drawing.Size(1201, 554);
             this.Controls.Add(this.ResetSerialNum);
             this.Controls.Add(this.SetMidCapacity);
             this.Controls.Add(this.MidCapacity);
@@ -394,6 +396,7 @@
         private System.Windows.Forms.Label MidCapacity_label;
         private CustomControl.NumOnlyTextBox MidCapacity;
         private CustomControl.NormalButton SetMidCapacity;
+        private CustomControl.NormalButton ResetSerialNum;
         private System.Windows.Forms.DataGridViewCheckBoxColumn Choose;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_orderdetno;
         private System.Windows.Forms.DataGridViewTextBoxColumn pd_pdno;
@@ -411,6 +414,5 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn mid_qty;
         private System.Windows.Forms.DataGridViewTextBoxColumn mid_num;
         private System.Windows.Forms.DataGridViewTextBoxColumn mid_remain;
-        private CustomControl.NormalButton ResetSerialNum;
     }
 }

+ 10 - 1
UAS-出货标签管理/生成条码.cs

@@ -199,7 +199,16 @@ namespace UAS_LabelMachine
                     //最小包装数
                     int pr_zxbzs = int.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
                     //中盒容量
-                    int mid_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_qty"].FormattedValue.ToString());
+                    int mid_qty;
+                    try
+                    {
+                        mid_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_qty"].FormattedValue.ToString());
+                    }
+                    catch (Exception)
+                    {
+                        MessageBox.Show("请检查中盒容量");
+                        return;
+                    }
                     //如果中盘盒数量为1且有尾数则表示一箱未装满
                     int mid_num = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_num"].FormattedValue.ToString());
                     //中盒尾数

+ 0 - 51
UAS-出货标签管理/生成条码.resx

@@ -205,57 +205,6 @@
   <metadata name="mid_remain.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="Choose.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_orderdetno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_pdno.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_prodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_detail.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_ordercode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_brand.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_unit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_totalqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_qty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pr_zxbzs.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="mid_qty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="mid_num.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="mid_remain.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <data name="ResetSerialNum.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         R0lGODlhUgAXAIQAAK/G1qjB1dzn6bTK2MfZ46rE1arD1/D4+/n//d/o7/X6/ez1/K7D1tLj6+Pt9ubx