From 57c5362da3743a80adbf30cf8ca55e0116611eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E9=97=BB=E9=A3=8E?= Date: Fri, 26 Jun 2026 19:57:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=89=A9=E5=93=81=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=AE=A2=E6=88=B7=E7=A7=BB=E8=87=B3=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E4=BA=8C=E7=BB=B4=E7=A0=81=E4=B8=8B=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/ops_android/printer/PrintHelper.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/ops_android/printer/PrintHelper.kt b/app/src/main/java/com/example/ops_android/printer/PrintHelper.kt index 2a206a4..876612d 100644 --- a/app/src/main/java/com/example/ops_android/printer/PrintHelper.kt +++ b/app/src/main/java/com/example/ops_android/printer/PrintHelper.kt @@ -248,7 +248,9 @@ object PrintHelper { textY = drawTextBlock(canvas, "", "位置:${item.containerBreadcrumb}", textX, textY, textMaxWidth, maxLines = 4, textSize = 25f, lineSpacingExtra = 4f) } - if (textY < maxTextY && !item.linkedCustomers.isNullOrEmpty()) { + canvas.drawLine(dividerX.toFloat(), padding.toFloat(), dividerX.toFloat(), maxTextY.toFloat(), sepPaint) + + if (!item.linkedCustomers.isNullOrEmpty()) { val customerNames = item.linkedCustomers .mapNotNull { c -> listOfNotNull(c.first_name, c.last_name) @@ -256,11 +258,14 @@ object PrintHelper { .ifBlank { null } } .joinToString(", ") - textY = drawTextBlock(canvas, "", "客户:$customerNames", textX, textY, textMaxWidth, maxLines = 2, textSize = 25f, lineSpacingExtra = 4f) + val customerText = "客户:$customerNames" + val customerY = qrY + qrSize + 4 + val leftTextMaxWidth = (dividerX - padding * 2).toFloat() + if (customerY < maxTextY) { + drawTextBlock(canvas, "", customerText, padding.toFloat(), customerY.toFloat(), leftTextMaxWidth, maxLines = 2, textSize = 20f, lineSpacingExtra = 2f) + } } - canvas.drawLine(dividerX.toFloat(), padding.toFloat(), dividerX.toFloat(), maxTextY.toFloat(), sepPaint) - if (!item.serial_number.isNullOrBlank()) { canvas.drawLine(padding.toFloat(), maxTextY.toFloat(), (widthDots - padding).toFloat(), maxTextY.toFloat(), sepPaint)