Ver código fonte

69为空时,空着不显示条码0000

qinqi 1 ano atrás
pai
commit
d4bd69ff57

+ 10 - 1
DK.Basics/InvoiceLayout/Items/TextItem.cs

@@ -1176,7 +1176,16 @@ namespace Dongke.WinForm.Controls.InvoiceLayout
                 {
                     if (this._barcodeFormat == "FONT_CODE_EAN_13")
                     {
-                        string vv = EAN13((value + "").PadRight(12, '0'));
+                        string v69 = value + "";
+                        if (string.IsNullOrWhiteSpace(v69))
+                        {
+                            return;
+                        }
+                        string vv = EAN13(v69.PadRight(12, '0'));
+                        if (string.IsNullOrWhiteSpace(vv))
+                        {
+                            return;
+                        }
                         //graphics.DrawString(vv, _fontDraw, Brushes.Black, this.SimpleShape.Bounds);
                         StringFormat stringFormat = StringFormat.GenericDefault;
                         stringFormat.Alignment = StringAlignment.Center;

+ 11 - 2
DK.Service/InvoiceLayout/Items/TextItem.cs

@@ -1086,8 +1086,17 @@ namespace Dongke.WinForm.Controls.InvoiceLayout
 				if (this._itemStyle == ItemStyle.Barcode)
 				{
                     if (this._barcodeFormat == "FONT_CODE_EAN_13")
-                    {
-                        string vv = EAN13((value + "").PadRight(12, '0'));
+					{
+						string v69 = value + "";
+						if (string.IsNullOrWhiteSpace(v69))
+						{
+							return;
+						}
+						string vv = EAN13(v69.PadRight(12, '0'));
+						if (string.IsNullOrWhiteSpace(vv))
+						{
+							return;
+						}
 						StringFormat stringFormat = StringFormat.GenericDefault;
 						stringFormat.Alignment = StringAlignment.Center;
 						stringFormat.LineAlignment = StringAlignment.Far;