|
|
|
@ -8,6 +8,7 @@ import com.glxp.udidl.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.udidl.admin.entity.udi.ProductInfoEntity;
|
|
|
|
|
import com.glxp.udidl.admin.entity.udid.UdiEntity;
|
|
|
|
|
import com.glxp.udidl.admin.req.FilterUdiInfoRequest;
|
|
|
|
|
import com.glxp.udidl.admin.req.MutiScanRequest;
|
|
|
|
|
import com.glxp.udidl.admin.req.ProductInfoFilterRequest;
|
|
|
|
|
import com.glxp.udidl.admin.res.BaseResponse;
|
|
|
|
|
import com.glxp.udidl.admin.res.PageSimpleResponse;
|
|
|
|
@ -53,7 +54,6 @@ public class UdiInfoController {
|
|
|
|
|
} else {
|
|
|
|
|
filterUdiRelRequest.setDiType(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查出UUID
|
|
|
|
|
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
|
|
|
|
|
productInfoFilterRequest.setNameCode(nameCode);
|
|
|
|
@ -127,6 +127,122 @@ public class UdiInfoController {
|
|
|
|
|
return ResultVOUtils.success(udiAppResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("udi/basic/app/mutilScan")
|
|
|
|
|
public BaseResponse mutilScan(MutiScanRequest mutiScanRequest) {
|
|
|
|
|
if (StrUtil.isEmpty(mutiScanRequest.getCode())) {
|
|
|
|
|
return ResultVOUtils.error(500, "条码不能为空!");
|
|
|
|
|
}
|
|
|
|
|
String code = "";
|
|
|
|
|
String originCode = mutiScanRequest.getOriginCode();
|
|
|
|
|
if (originCode == null)
|
|
|
|
|
originCode = "";
|
|
|
|
|
code = originCode + mutiScanRequest.getCode();
|
|
|
|
|
String newCode = mutiScanRequest.getCode();
|
|
|
|
|
//重复判断
|
|
|
|
|
if (StrUtil.isNotEmpty(mutiScanRequest.getOriginCode())) {
|
|
|
|
|
String tempOriginCode = mutiScanRequest.getOriginCode();
|
|
|
|
|
if (tempOriginCode.endsWith("\u001D")) {
|
|
|
|
|
tempOriginCode = tempOriginCode.replace("\u001D", "");
|
|
|
|
|
}
|
|
|
|
|
UdiEntity originUdiEntity = FilterUdiUtils.getUdi(tempOriginCode);
|
|
|
|
|
if (StrUtil.isNotEmpty(newCode)) {
|
|
|
|
|
if (newCode.startsWith("10")) {
|
|
|
|
|
if (StrUtil.isNotEmpty(originUdiEntity.getBatchNo())) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "批次号重复添加");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
String msg = checkNewCode(originUdiEntity, newCode);
|
|
|
|
|
if (msg != null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (newCode.startsWith("17")) {
|
|
|
|
|
if (StrUtil.isNotEmpty(originUdiEntity.getExpireDate())) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "失效日期重复添加");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
String msg = checkNewCode(originUdiEntity, newCode);
|
|
|
|
|
if (msg != null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (newCode.startsWith("11")) {
|
|
|
|
|
if (StrUtil.isNotEmpty(originUdiEntity.getProduceDate())) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "生产日期重复添加");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
String msg = checkNewCode(originUdiEntity, newCode);
|
|
|
|
|
if (msg != null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (newCode.startsWith("21")) {
|
|
|
|
|
if (StrUtil.isNotEmpty(originUdiEntity.getSerialNo())) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "序列号重复添加");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
String msg = checkNewCode(originUdiEntity, newCode);
|
|
|
|
|
if (msg != null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, msg);
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "格式错误");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
if (udiEntity == null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "UDI码格式错误");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getBatchNo())) {
|
|
|
|
|
if (code.endsWith("10" + udiEntity.getBatchNo())) {
|
|
|
|
|
code = code + "\u001D";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(code);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String checkNewCode(UdiEntity originEnity, String newCode) {
|
|
|
|
|
UdiEntity newEntity = FilterUdiUtils.getUdi(originEnity.getUdi() + newCode);
|
|
|
|
|
if (newEntity == null || originEnity == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(originEnity.getBatchNo()) && StrUtil.isNotEmpty(newEntity.getBatchNo())) {
|
|
|
|
|
return "批次号重复添加!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(originEnity.getProduceDate()) && StrUtil.isNotEmpty(newEntity.getProduceDate())) {
|
|
|
|
|
return "生产日期重复添加!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(originEnity.getExpireDate()) && StrUtil.isNotEmpty(newEntity.getExpireDate())) {
|
|
|
|
|
return "失效日期重复添加!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(originEnity.getSerialNo()) && StrUtil.isNotEmpty(newEntity.getSerialNo())) {
|
|
|
|
|
return "序列号重复添加!";
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取同步库UDI信息
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|