|
|
|
@ -186,7 +186,7 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
//前端扫码完整性校验
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("warehouse/inout/enterCode")
|
|
|
|
|
@PostMapping("warehouse/inout/`enterCode")
|
|
|
|
|
public BaseResponse addEndterCode(@RequestBody AddEnterCodeRequest addEnterCodeRequest) {
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(addEnterCodeRequest.getCode())) {
|
|
|
|
@ -365,6 +365,14 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(500, "追溯码不能为空");
|
|
|
|
|
codeList = codeList.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
List<VailCodeResultResponse> vailCodeResultResponses = new ArrayList<>();
|
|
|
|
|
List<String> prefixes = Arrays.asList("01", "11", "17", "10", "21");
|
|
|
|
|
//判断是否多段扫码
|
|
|
|
|
String mutiCode = filterAndConcatenate(codeList, prefixes);
|
|
|
|
|
UdiEntity temp = FilterUdiUtils.getUdi(mutiCode);
|
|
|
|
|
if (temp != null) {
|
|
|
|
|
codeList.clear();
|
|
|
|
|
codeList.add(mutiCode);
|
|
|
|
|
}
|
|
|
|
|
for (String code : codeList) {
|
|
|
|
|
VailCodeResultResponse vailCodeResultResponse = new VailCodeResultResponse();
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
@ -388,6 +396,30 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String filterAndConcatenate(List<String> codeList, List<String> prefixes) {
|
|
|
|
|
Set<String> matchedPrefixes = new HashSet<>();
|
|
|
|
|
StringBuilder concatenatedResult = new StringBuilder();
|
|
|
|
|
for (String prefix : prefixes) {
|
|
|
|
|
for (String code : codeList) {
|
|
|
|
|
if (code.length() >= 2 && code.startsWith(prefix)) {
|
|
|
|
|
if (!matchedPrefixes.contains(prefix)) {
|
|
|
|
|
matchedPrefixes.add(prefix);
|
|
|
|
|
concatenatedResult.append(code);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(concatenatedResult.toString());
|
|
|
|
|
if (udiEntity != null && StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
|
|
|
|
|
if (concatenatedResult.toString().endsWith("10" + udiEntity.getBatchNo())) {
|
|
|
|
|
concatenatedResult.append("\u001D");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return concatenatedResult.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("warehouse/inout/batchAddCode")
|
|
|
|
|