fix: prepare mixed-SKU dropship acceptance data

This commit is contained in:
2026-09-11 16:21:14 +08:00
parent 51ce609ab1
commit 010475a4c3
4 changed files with 38 additions and 4 deletions
@@ -358,8 +358,18 @@ public class InboundCartonLabelService implements CartonLabelBindingResolver {
Map<Long, List<InboundCartonLabelSkuMapper.SkuRow>> skuRowsByLabel) {
List<InboundCartonLabelSkuMapper.SkuRow> lines = skuRowsByLabel.get(label.getId());
if (lines == null || lines.isEmpty()) return label.getSkuCode();
return lines.stream().map(InboundCartonLabelSkuMapper.SkuRow::getSkuCode)
.filter(StringUtils::hasText).distinct().collect(java.util.stream.Collectors.joining(" / "));
List<String> skuCodes = lines.stream().map(InboundCartonLabelSkuMapper.SkuRow::getSkuCode)
.filter(StringUtils::hasText).map(String::trim).distinct().toList();
if (skuCodes.isEmpty()) return label.getSkuCode();
String joined = String.join(" / ", skuCodes);
if (joined.codePointCount(0, joined.length()) <= 64) return joined;
String suffix = " / +" + Math.max(0, skuCodes.size() - 1) + " SKU";
int firstLimit = 64 - suffix.codePointCount(0, suffix.length());
String first = skuCodes.get(0);
if (first.codePointCount(0, first.length()) > firstLimit) {
first = first.substring(0, first.offsetByCodePoints(0, firstLimit));
}
return first + suffix;
}
private void requireIds(long tenantId, long inboundId) {