|
|
|
@ -2,13 +2,18 @@ package com.glxp.api.util.udi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.InvCountOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import com.glxp.api.util.gs1.AI;
|
|
|
|
|
import com.glxp.api.util.gs1.AIs;
|
|
|
|
|
import com.glxp.api.util.gs1.Gs1128Decoder;
|
|
|
|
|
import com.glxp.api.util.gs1.Gs1128Engine;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
@ -107,7 +112,6 @@ public class FilterUdiUtils {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static UdiEntity getGLXPUdi(String data) {
|
|
|
|
|
String batchNo = "";
|
|
|
|
|
String produceDate = "";
|
|
|
|
@ -122,9 +126,13 @@ public class FilterUdiUtils {
|
|
|
|
|
batchNo = spilts[4];
|
|
|
|
|
if (spilts.length > 6) {
|
|
|
|
|
serialNo = spilts[5];
|
|
|
|
|
if (serialNo != null && serialNo.equals("")) {
|
|
|
|
|
serialNo = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(batchNo)) {
|
|
|
|
|
batchNo = null;
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isEmpty(serialNo)) {
|
|
|
|
|
serialNo = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -161,6 +169,7 @@ public class FilterUdiUtils {
|
|
|
|
|
return prefix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static UdiEntity getDrugInfo(String data) {
|
|
|
|
|
UdiEntity udiEntity = new UdiEntity();
|
|
|
|
|
String prefix = data.substring(0, 7);
|
|
|
|
@ -170,9 +179,11 @@ public class FilterUdiUtils {
|
|
|
|
|
udiEntity.setProduceDate(null);
|
|
|
|
|
udiEntity.setUdi(prefix);
|
|
|
|
|
udiEntity.setSerialNo(serialNo);
|
|
|
|
|
udiEntity.setProductType(2);
|
|
|
|
|
return udiEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static UdiProductEntity transUdi(UdiProductEntity data) {
|
|
|
|
|
UdiEntity udiEntity = getUdi(data.getCode());
|
|
|
|
|
if (udiEntity != null) {
|
|
|
|
@ -212,4 +223,32 @@ public class FilterUdiUtils {
|
|
|
|
|
+ "#" + Optional.ofNullable(warehouseEntity.getSerialNo()).orElse("") + "#" + "#";
|
|
|
|
|
return udiCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String transGlxpNoSerStr(List<UdiRelevanceResponse> udiRelevanceResponses, InvCountOrderDetailEntity invCountOrderDetail) {
|
|
|
|
|
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = getMinDi(udiRelevanceResponses);
|
|
|
|
|
String udiCode = "#" + udiRelevanceResponse.getNameCode() + "#" + StrUtil.trimToEmpty(invCountOrderDetail.getProduceDate()) + "#" + StrUtil.trimToEmpty(invCountOrderDetail.getExpireDate()) +
|
|
|
|
|
"#" + StrUtil.trimToEmpty(invCountOrderDetail.getBatchNo()) + "#" + "#" + "#";
|
|
|
|
|
return udiCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static UdiRelevanceResponse getMinDi(List<UdiRelevanceResponse> udiRelevanceResponses) {
|
|
|
|
|
if (udiRelevanceResponses.size() > 1) {
|
|
|
|
|
for (UdiRelevanceResponse temp : udiRelevanceResponses) {
|
|
|
|
|
if (IntUtil.value(temp.getIsUseDy())) {
|
|
|
|
|
if (temp.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (temp.getDiType() == ConstantStatus.DITYPE_MAIN) {
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return udiRelevanceResponses.get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|