|
|
|
@@ -24,6 +24,7 @@ object StockQtyRoundSupport { |
|
|
|
return qty.stripTrailingZeros().scale() > 0 |
|
|
|
} |
|
|
|
|
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 56 | v1.0.6 | 2026-10-14 */ |
|
|
|
fun applyIfRequested( |
|
|
|
currentQty: BigDecimal, |
|
|
|
currentRemarks: String?, |
|
|
|
@@ -51,6 +52,7 @@ object StockQtyRoundSupport { |
|
|
|
return after to mergeRemark(currentRemarks, withReason) |
|
|
|
} |
|
|
|
|
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 56 | v1.0.6 | 2026-10-14 */ |
|
|
|
fun parseMode(raw: String?): Mode? { |
|
|
|
val value = raw?.trim()?.uppercase() ?: return null |
|
|
|
if (value.isEmpty()) return null |
|
|
|
@@ -61,6 +63,7 @@ object StockQtyRoundSupport { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 56 | v1.0.6 | 2026-10-14 */ |
|
|
|
fun roundQty(before: BigDecimal, mode: Mode, customQty: BigDecimal?): BigDecimal { |
|
|
|
return when (mode) { |
|
|
|
Mode.HALF_UP -> before.setScale(0, RoundingMode.HALF_UP) |
|
|
|
@@ -79,6 +82,7 @@ object StockQtyRoundSupport { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 56 | v1.0.6 | 2026-10-14 */ |
|
|
|
fun buildTag( |
|
|
|
mode: Mode, |
|
|
|
before: BigDecimal, |
|
|
|
@@ -90,6 +94,7 @@ object StockQtyRoundSupport { |
|
|
|
return "[QTY_ROUND mode=${mode.name} before=${plain(before)} after=${plain(after)} source=$source by=${sanitize(by)} at=${at.format(AT_FORMAT)}]" |
|
|
|
} |
|
|
|
|
|
|
|
/** FP-MTMS Version Checklist | Functions Ref. No. 56 | v1.0.6 | 2026-10-14 */ |
|
|
|
fun mergeRemark(existing: String?, tag: String): String { |
|
|
|
val stripped = existing?.replace(TAG_REGEX, "")?.trim().orEmpty() |
|
|
|
val merged = if (stripped.isEmpty()) tag else "$tag $stripped" |
|
|
|
|