|
|
|
@@ -69,11 +69,13 @@ data class OnPackZipResult( |
|
|
|
|
|
|
|
private data class OnPackBmpExportItem( |
|
|
|
val codeLower: String, |
|
|
|
/** ZIP / template file stem (e.g. `pp2211` or `pp2211-2` for expiry multi-JO). */ |
|
|
|
/** ZIP / template file stem. First JO stays `pp2211` so operators select that template. */ |
|
|
|
val fileStem: String, |
|
|
|
val itemId: Long, |
|
|
|
val stockInLineId: Long, |
|
|
|
val itemCode: String, |
|
|
|
/** Code BMP text. When that item has 2+ JOs, first bag shows `PP2211-1`. */ |
|
|
|
val printItemCode: String, |
|
|
|
val productName: String, |
|
|
|
val planDate: LocalDate?, |
|
|
|
) |
|
|
|
@@ -164,6 +166,11 @@ class PlasticBagPrinterService( |
|
|
|
fun onPackExpiryFileStem(itemCodeLower: String, indexOneBased: Int, totalForItem: Int): String = |
|
|
|
if (totalForItem > 1 && indexOneBased > 1) "$itemCodeLower-$indexOneBased" else itemCodeLower |
|
|
|
|
|
|
|
fun onPackExpiryPrintCode(itemCode: String, indexOneBased: Int, totalForItem: Int): String { |
|
|
|
val code = itemCode.trim().uppercase() |
|
|
|
return if (totalForItem > 1) "$code-$indexOneBased" else code |
|
|
|
} |
|
|
|
|
|
|
|
/** ISO `yyyy-MM-dd`, compact `yyyyMMdd`, or already `Expiry Date yyyyMMdd`. */ |
|
|
|
fun formatLaserExpiryParam(expiryDate: String?): String { |
|
|
|
val raw = expiryDate?.trim().orEmpty() |
|
|
|
@@ -325,6 +332,7 @@ class PlasticBagPrinterService( |
|
|
|
itemId = itemId, |
|
|
|
stockInLineId = stockInLineId, |
|
|
|
itemCode = itemCode, |
|
|
|
printItemCode = itemCode, |
|
|
|
productName = productName, |
|
|
|
planDate = jo?.planStart?.toLocalDate(), |
|
|
|
) |
|
|
|
@@ -789,7 +797,11 @@ class PlasticBagPrinterService( |
|
|
|
} |
|
|
|
if (includeExpiry) { |
|
|
|
items.mapIndexed { index, item -> |
|
|
|
item.copy(fileStem = onPackExpiryFileStem(codeLower, index + 1, items.size)) |
|
|
|
val n = index + 1 |
|
|
|
item.copy( |
|
|
|
fileStem = onPackExpiryFileStem(codeLower, n, items.size), |
|
|
|
printItemCode = onPackExpiryPrintCode(item.itemCode, n, items.size), |
|
|
|
) |
|
|
|
} |
|
|
|
} else { |
|
|
|
items |
|
|
|
@@ -879,7 +891,7 @@ class PlasticBagPrinterService( |
|
|
|
ONPACK_PRODUCT_BMP_HEIGHT, |
|
|
|
) |
|
|
|
val codeBmp = createMonochromeBitmapFixed( |
|
|
|
item.itemCode, |
|
|
|
item.printItemCode, |
|
|
|
ONPACK_CODE_BMP_WIDTH, |
|
|
|
ONPACK_CODE_BMP_HEIGHT, |
|
|
|
) |
|
|
|
|