|
|
|
@ -191,6 +191,9 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
|
|
|
|
@Override |
|
|
|
public void printLabel(PrintLabelRequest printRequest) { |
|
|
|
if (StringUtils.isBlank(printRequest.getSite())) { |
|
|
|
throw new RuntimeException(labelSettingI18n.text("label.error.printSiteRequired")); |
|
|
|
} |
|
|
|
String rfidFlag = null; |
|
|
|
// 根据当前用户查找默认打印标签reportId |
|
|
|
DefaultLabelSettingData inData = new DefaultLabelSettingData(); |
|
|
|
@ -213,14 +216,21 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
try { |
|
|
|
// 1. 构建查询参数Map |
|
|
|
Map<String, Object> queryParams = new HashMap<>(); |
|
|
|
queryParams.put("site", printRequest.getSite()); |
|
|
|
queryParams.put("site", printRequest.getSubSite()); |
|
|
|
List<String> unitIds; |
|
|
|
if (StringUtils.isNotBlank(printRequest.getReceiptNo())) { |
|
|
|
unitIds = handlingUnitService.getHandlingUnitsBySiteAndOrderRef2(printRequest.getSite(), printRequest.getReceiptNo()).stream() |
|
|
|
unitIds = handlingUnitService.getHandlingUnitsBySiteAndOrderRef2(printRequest.getSubSite(), printRequest.getReceiptNo()).stream() |
|
|
|
.map(HandlingUnit::getUnitId) |
|
|
|
.toList(); |
|
|
|
if (unitIds.isEmpty()) { |
|
|
|
throw new RuntimeException(labelSettingI18n.text("label.error.receiptUnitsNotFound", |
|
|
|
printRequest.getSite(), printRequest.getReceiptNo())); |
|
|
|
} |
|
|
|
} else { |
|
|
|
unitIds = Collections.singletonList(printRequest.getUnitId()); |
|
|
|
unitIds = resolveRequestedUnitIds(printRequest); |
|
|
|
} |
|
|
|
if (unitIds.isEmpty()) { |
|
|
|
throw new RuntimeException(labelSettingI18n.text("label.error.printUnitsRequired")); |
|
|
|
} |
|
|
|
queryParams.put("unitIds", unitIds); |
|
|
|
// 可以根据需要添加更多参数 |
|
|
|
@ -793,7 +803,7 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
private Map<String, Object> buildCommonQueryParams(PrintLabelRequest printRequest) { |
|
|
|
Map<String, Object> queryParams = new HashMap<>(); |
|
|
|
queryParams.put("site", printRequest.getSite()); |
|
|
|
queryParams.put("unitIds", printRequest.getUnitIds()); |
|
|
|
queryParams.put("unitIds", resolveRequestedUnitIds(printRequest)); |
|
|
|
// ifs外箱标签视图 |
|
|
|
queryParams.put("consignmentId", printRequest.getConsignmentId()); |
|
|
|
queryParams.put("jobNo", printRequest.getJobNo()); |
|
|
|
@ -803,6 +813,17 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
return queryParams; |
|
|
|
} |
|
|
|
|
|
|
|
/** 单个HU和批量HU使用相同的查询条件,空请求保留为空列表,由数据源校验拦截。 */ |
|
|
|
private List<String> resolveRequestedUnitIds(PrintLabelRequest printRequest) { |
|
|
|
if (printRequest.getUnitIds() != null && !printRequest.getUnitIds().isEmpty()) { |
|
|
|
return printRequest.getUnitIds(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(printRequest.getUnitId())) { |
|
|
|
return Collections.singletonList(printRequest.getUnitId()); |
|
|
|
} |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取标签设置(labelType为空时仅按labelNo匹配) |
|
|
|
*/ |
|
|
|
|