获取扫码关联关系批次号等

dev_unify
yewj 5 months ago
parent ab094e6611
commit 9143281b2e

@ -36,11 +36,13 @@ import com.glxp.api.req.inout.PostOrderRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.basic.UdiRlSupResponse;
import com.glxp.api.res.collect.RelCodeDetailResponse;
import com.glxp.api.res.inout.AddCodeResult;
import com.glxp.api.res.inout.IoCodeTempResponse;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.collect.RelCodeBatchService;
import com.glxp.api.service.collect.RelCodeDetailService;
import com.glxp.api.service.inout.*;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
@ -919,6 +921,8 @@ public class IoCodeTempController extends BaseController {
@Resource
RelCodeBatchService relCodeBatchService;
@Resource
RelCodeDetailService relCodeDetailService;
//前端扫码提交(药品)
@AuthRuleAnnotation("")
@ -955,7 +959,21 @@ public class IoCodeTempController extends BaseController {
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
udiEntity.setSerialNo(addOrderRequest.getSerialNo());
}
if (StrUtil.isEmpty(udiEntity.getBatchNo())) {
IoCodeLostEntity codeLostEntity = codeLostService.findByCode(code);
if (codeLostEntity != null) {
udiEntity.setBatchNo(codeLostEntity.getBatchNo());
udiEntity.setProduceDate(codeLostEntity.getProduceDate());
udiEntity.setExpireDate(codeLostEntity.getExpireDate());
} else {
RelCodeDetailResponse codeRelEntity = relCodeDetailService.findByCode(code);
if (codeRelEntity != null) {
udiEntity.setBatchNo(codeRelEntity.getBatchNo());
udiEntity.setProduceDate(DateUtil.formatDate(codeRelEntity.getMadeDate(), "yyMMdd"));
udiEntity.setExpireDate(DateUtil.formatDate(codeRelEntity.getValidateDate(), "yyMMdd"));
}
}
}
//批次号校验
//判断此产品是否开启允许无批次号
UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi());
@ -986,7 +1004,6 @@ public class IoCodeTempController extends BaseController {
}
}
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(udiEntity.getUdi());
long recent = 0;
if (udiRelevanceResponse.getRecentDateTime() != null)

@ -13,6 +13,7 @@ import java.util.List;
@Mapper
public interface RelCodeDetailMapper extends BaseMapperPlus<RelCodeDetailMapper,RelCodeDetail,RelCodeDetail> {
List<RelCodeDetailResponse> filterList(RelCodeDetailRequest relCodeDetailRequest);
}

@ -28,20 +28,21 @@ public class RelCodeDetailService extends ServiceImpl<RelCodeDetailMapper, RelCo
/**
*
*
* @param relCodeDetailRequest
* @return
*/
public RelCodeDetailResponse scanCode(RelCodeDetailRequest relCodeDetailRequest) {
String curCode = relCodeDetailRequest.getCurCode();
String parentCode = relCodeDetailRequest.getParentCode();
if(StrUtil.isBlank(curCode)){
if (StrUtil.isBlank(curCode)) {
throw new JsonException("追溯码不能为空");
}
if (curCode.endsWith("\u001D")) {
curCode = curCode.replace("\u001D", "");
}
UdiEntity curCodeUdi = FilterUdiUtils.getUdi(curCode);
if (curCodeUdi == null){
if (curCodeUdi == null) {
throw new JsonException("无效条码!");
}
RelCodeDetailResponse relCodeDetailResponse = new RelCodeDetailResponse();
@ -49,39 +50,39 @@ public class RelCodeDetailService extends ServiceImpl<RelCodeDetailMapper, RelCo
.eq(BasicProductsEntity::getNameCode, curCodeUdi.getUdi())
.last("limit 1");
BasicProductsEntity cur = basicProductsDao.selectOne(cw);
if(cur == null){
if (cur == null) {
throw new JsonException("产品信息不存在");
}
//是否已存在数据库中
List<RelCodeDetail> list = this.baseMapper.selectList(new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getCurCode, curCode));
if (CollUtil.isNotEmpty(list)){
if (CollUtil.isNotEmpty(list)) {
throw new JsonException("当前条码关联关系已被维护!");
}
if(StrUtil.isNotBlank(parentCode)){
if (StrUtil.isNotBlank(parentCode)) {
if (parentCode.endsWith("\u001D")) {
parentCode = parentCode.replace("\u001D", "");
}
if(StrUtil.equals(curCode,parentCode)){
if (StrUtil.equals(curCode, parentCode)) {
throw new JsonException("录入条码重复!");
}
UdiEntity parentCodeUdi = FilterUdiUtils.getUdi(parentCode);
if (parentCodeUdi == null){
if (parentCodeUdi == null) {
throw new JsonException("无效父级条码!");
}
LambdaQueryWrapper<BasicProductsEntity> pw = new LambdaQueryWrapper<BasicProductsEntity>()
.eq(BasicProductsEntity::getNameCode, parentCodeUdi.getUdi())
.last("limit 1");
BasicProductsEntity parent = basicProductsDao.selectOne(pw);
if(parent == null){
if (parent == null) {
throw new JsonException("父级产品信息不存在");
}
if(!StrUtil.equals(parent.getUuid(),cur.getUuid())){
if (!StrUtil.equals(parent.getUuid(), cur.getUuid())) {
throw new JsonException("当前条码不是同一产品");
}
if(Integer.valueOf(parent.getPackLevel()) - Integer.valueOf(cur.getPackLevel()) != 1){
if (Integer.valueOf(parent.getPackLevel()) - Integer.valueOf(cur.getPackLevel()) != 1) {
throw new JsonException("当前条码不属于子条码");
}
}else {
} else {
parentCode = "0";
}
relCodeDetailResponse.setCurCode(curCode);
@ -99,6 +100,7 @@ public class RelCodeDetailService extends ServiceImpl<RelCodeDetailMapper, RelCo
/**
*
*
* @param relCodeDetailRequest
* @return
*/
@ -113,4 +115,16 @@ public class RelCodeDetailService extends ServiceImpl<RelCodeDetailMapper, RelCo
return this.baseMapper.filterList(relCodeDetailRequest);
}
public RelCodeDetailResponse findByCode(String code) {
RelCodeDetailRequest relCodeDetailRequest = new RelCodeDetailRequest();
relCodeDetailRequest.setCurCode(code);
List<RelCodeDetailResponse> relCodeDetailResponse = filterList(relCodeDetailRequest);
if (CollUtil.isNotEmpty(relCodeDetailResponse)) {
return relCodeDetailResponse.get(0);
} else {
return null;
}
}
}

@ -697,8 +697,10 @@ public class IoAddInoutService {
} else
return null;
}
@Resource
IoCodeLostService codeLostService;
public String checkOriginCode(IoCodeTempEntity warehouseEntity) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(warehouseEntity.getCode());

Loading…
Cancel
Save