|
|
|
@ -644,24 +644,20 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
} |
|
|
|
|
|
|
|
LabelSettingData labelSetting = labelSettingDataList.get(0); |
|
|
|
if (queryParams == null) { |
|
|
|
queryParams = new HashMap<>(); |
|
|
|
} |
|
|
|
if (!printFlag) { |
|
|
|
// 生成前缀:A+site+YYYYMMDD |
|
|
|
String prefix = "A" + "5520250929"; |
|
|
|
List<String> unitIds = Collections.singletonList(prefix+"00000001"); |
|
|
|
queryParams.put("unitIds", unitIds); |
|
|
|
if ("IFST".equalsIgnoreCase(ifsDBName)) { |
|
|
|
// 测试库(IFST)保留现有默认测试数据 |
|
|
|
queryParams.put("consignmentId", "1654576"); |
|
|
|
queryParams.put("jobNo", "71305202"); |
|
|
|
queryParams.put("lineNo", "1"); |
|
|
|
queryParams.put("relNo", "1"); |
|
|
|
queryParams.put("lineItemNo", 0); |
|
|
|
if (isPreviewNeedManualIfsParams(labelSetting.getLabelType())) { |
|
|
|
// 外箱/内箱标签:真实数据预览时必须由用户输入IFS参数 |
|
|
|
normalizePreviewIfsParams(queryParams); |
|
|
|
} else { |
|
|
|
queryParams.put("consignmentId", "1773845"); |
|
|
|
queryParams.put("jobNo", "71330430"); |
|
|
|
queryParams.put("lineNo", "19"); |
|
|
|
queryParams.put("relNo", "1"); |
|
|
|
queryParams.put("lineItemNo",0); |
|
|
|
// 其他标签沿用原有默认参数策略,避免影响已有功能 |
|
|
|
fillDefaultPreviewIfsParams(queryParams); |
|
|
|
} |
|
|
|
} |
|
|
|
// 使用真实数据生成ZPL代码 |
|
|
|
@ -799,6 +795,76 @@ public class ReportLabelListServiceImpl extends ServiceImpl<ReportLabelListMappe |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 仅外箱/内箱标签在真实数据预览时要求手工输入IFS查询参数 |
|
|
|
*/ |
|
|
|
private boolean isPreviewNeedManualIfsParams(String labelType) { |
|
|
|
if (StringUtils.isBlank(labelType)) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
String normalizedLabelType = labelType.trim(); |
|
|
|
return "外箱标签".equals(normalizedLabelType) || "内箱标签".equals(normalizedLabelType); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 非外箱/内箱标签真实预览沿用历史默认参数 |
|
|
|
*/ |
|
|
|
private void fillDefaultPreviewIfsParams(Map<String, Object> queryParams) { |
|
|
|
if ("IFST".equalsIgnoreCase(ifsDBName)) { |
|
|
|
queryParams.putIfAbsent("consignmentId", "1654576"); |
|
|
|
queryParams.putIfAbsent("jobNo", "71305202"); |
|
|
|
queryParams.putIfAbsent("lineNo", "1"); |
|
|
|
queryParams.putIfAbsent("relNo", "1"); |
|
|
|
queryParams.putIfAbsent("lineItemNo", 0); |
|
|
|
} else { |
|
|
|
queryParams.putIfAbsent("consignmentId", "1773845"); |
|
|
|
queryParams.putIfAbsent("jobNo", "71330430"); |
|
|
|
queryParams.putIfAbsent("lineNo", "19"); |
|
|
|
queryParams.putIfAbsent("relNo", "1"); |
|
|
|
queryParams.putIfAbsent("lineItemNo", 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 外箱/内箱标签真实预览参数校验与标准化 |
|
|
|
*/ |
|
|
|
private void normalizePreviewIfsParams(Map<String, Object> queryParams) { |
|
|
|
Integer consignmentId = parseRequiredIntegerParam(queryParams, "consignmentId", "发货单ID"); |
|
|
|
String jobNo = parseRequiredStringParam(queryParams, "jobNo", "作业单号"); |
|
|
|
String lineNo = parseRequiredStringParam(queryParams, "lineNo", "行号"); |
|
|
|
String relNo = parseRequiredStringParam(queryParams, "relNo", "关联号"); |
|
|
|
Integer lineItemNo = parseRequiredIntegerParam(queryParams, "lineItemNo", "行项目号"); |
|
|
|
|
|
|
|
queryParams.put("consignmentId", consignmentId); |
|
|
|
queryParams.put("jobNo", jobNo); |
|
|
|
queryParams.put("lineNo", lineNo); |
|
|
|
queryParams.put("relNo", relNo); |
|
|
|
queryParams.put("lineItemNo", lineItemNo); |
|
|
|
} |
|
|
|
|
|
|
|
private String parseRequiredStringParam(Map<String, Object> queryParams, String key, String fieldName) { |
|
|
|
Object value = queryParams.get(key); |
|
|
|
if (value == null || StringUtils.isBlank(value.toString())) { |
|
|
|
throw new RuntimeException("真实数据预览请填写" + fieldName); |
|
|
|
} |
|
|
|
return value.toString().trim(); |
|
|
|
} |
|
|
|
|
|
|
|
private Integer parseRequiredIntegerParam(Map<String, Object> queryParams, String key, String fieldName) { |
|
|
|
Object value = queryParams.get(key); |
|
|
|
if (value == null || StringUtils.isBlank(value.toString())) { |
|
|
|
throw new RuntimeException("真实数据预览请填写" + fieldName); |
|
|
|
} |
|
|
|
try { |
|
|
|
if (value instanceof Number) { |
|
|
|
return ((Number) value).intValue(); |
|
|
|
} |
|
|
|
return Integer.parseInt(value.toString().trim()); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
throw new RuntimeException(fieldName + "必须为整数"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据客户编码解析标签编号(仅当前端传了customerId时生效) |
|
|
|
*/ |
|
|
|
|