提交todo

dev_unify
yewj 4 months ago
parent 72d4d04a8d
commit b3da30fdc4

@ -334,7 +334,7 @@ public class IoCheckInoutService {
if (vailBatchNo) { if (vailBatchNo) {
bizEntity = orderDetailBizService.findByUnique(codeEntity.getOrderId(), codeEntity.getRelId(), codeEntity.getBatchNo()); bizEntity = orderDetailBizService.findByUnique(codeEntity.getOrderId(), codeEntity.getRelId(), codeEntity.getBatchNo());
} else { } else {
bizEntity = orderDetailBizService.findByUnique(codeEntity.getOrderId(), codeEntity.getRelId(), codeEntity.getBatchNo(), codeEntity.getProduceDate(), codeEntity.getExpireDate()); bizEntity = orderDetailBizService.findByUnique(codeEntity.getOrderId(), codeEntity.getRelId(), codeEntity.getBatchNo(), null, null);
} }
if (bizEntity == null) { if (bizEntity == null) {
return "非此单产品!"; return "非此单产品!";

@ -1,6 +1,7 @@
package com.glxp.api.service.inout.impl; package com.glxp.api.service.inout.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -279,7 +280,7 @@ public class IoCodeTempService {
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) { if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
udiEntity.setSerialNo(addOrderRequest.getSerialNo()); udiEntity.setSerialNo(addOrderRequest.getSerialNo());
} }
RelCodeDetailResponse codeRelEntity = null; RelCodeDetailResponse relCodeDetailResponse = relCodeDetailService.findByCode(code);
if (StrUtil.isEmpty(udiEntity.getBatchNo())) { if (StrUtil.isEmpty(udiEntity.getBatchNo())) {
IoCodeLostEntity codeLostEntity = codeLostService.findByCode(code); IoCodeLostEntity codeLostEntity = codeLostService.findByCode(code);
if (codeLostEntity != null) { if (codeLostEntity != null) {
@ -287,14 +288,51 @@ public class IoCodeTempService {
udiEntity.setProduceDate(codeLostEntity.getProduceDate()); udiEntity.setProduceDate(codeLostEntity.getProduceDate());
udiEntity.setExpireDate(codeLostEntity.getExpireDate()); udiEntity.setExpireDate(codeLostEntity.getExpireDate());
} else { } else {
codeRelEntity = relCodeDetailService.findByCode(code); if (relCodeDetailResponse != null) {
if (codeRelEntity != null) { udiEntity.setBatchNo(relCodeDetailResponse.getBatchNo());
udiEntity.setBatchNo(codeRelEntity.getBatchNo()); udiEntity.setProduceDate(DateUtil.formatDate(relCodeDetailResponse.getMadeDate(), "yyMMdd"));
udiEntity.setProduceDate(DateUtil.formatDate(codeRelEntity.getMadeDate(), "yyMMdd")); udiEntity.setExpireDate(DateUtil.formatDate(relCodeDetailResponse.getValidateDate(), "yyMMdd"));
udiEntity.setExpireDate(DateUtil.formatDate(codeRelEntity.getValidateDate(), "yyMMdd")); } else {
// 还是为空就调用查码明细的结构
AuthCompany authCompany = authCompanyMapper.selectOne(
new QueryWrapper<AuthCompany>().last("limit 1")
);
if (authCompany != null) {
AlihealthYljgLocaCodedetailReqeust alihealthYljgLocaCodedetailReqeust = new AlihealthYljgLocaCodedetailReqeust();
alihealthYljgLocaCodedetailReqeust.setAppSecret(authCompany.getAppSecret());
AlihealthYljgCodedetailReqeust alihealthYljgCodedetailReqeust = new AlihealthYljgCodedetailReqeust();
alihealthYljgCodedetailReqeust.setRef_ent_id(authCompany.getRefEntId());
alihealthYljgCodedetailReqeust.setCodes(code);
alihealthYljgCodedetailReqeust.setApp_key(authCompany.getAppId());
alihealthYljgLocaCodedetailReqeust.setAlihealthYljgCodedetailReqeust(alihealthYljgCodedetailReqeust);
BaseResponse<List<RelCodeBatch>> response = alihealthYljgUtils.codedetail(alihealthYljgLocaCodedetailReqeust);
if (response.getCode() == 20000) {
List<RelCodeBatch> relCodeBatchList = response.getData();
if (relCodeBatchList != null && relCodeBatchList.size() > 0) {
RelCodeBatch relCodeBatch = relCodeBatchList.get(0);
IoCodeLostEntity connLostEntity = new IoCodeLostEntity();
connLostEntity.setId(IdUtil.getSnowflakeNextId());
connLostEntity.setCode(relCodeBatch.getCurCode());
connLostEntity.setBatchNo(relCodeBatch.getBatchNo());
connLostEntity.setProduceDate(relCodeBatch.getMadeDate());
connLostEntity.setExpireDate(relCodeBatch.getValidateDate());
connLostEntity.setBatchNo(relCodeBatch.getBatchNo());
codeLostService.saveOrUpdate(connLostEntity);
udiEntity.setBatchNo(connLostEntity.getBatchNo());
udiEntity.setProduceDate(connLostEntity.getProduceDate());
udiEntity.setExpireDate(connLostEntity.getExpireDate());
}
} else {
log.error("拉取阿里码明细访问失败===" + response.getMessage());
} }
} }
} }
}
}
//批次号校验 //批次号校验
//判断此产品是否开启允许无批次号 //判断此产品是否开启允许无批次号
UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi()); UdiProductEntity udiInfoEntity = udiProductService.findByNameCode(udiEntity.getUdi());
@ -384,62 +422,10 @@ public class IoCodeTempService {
} }
if (IntUtil.value(udiRelevanceResponse.getPackLevel()) == 0) { if (IntUtil.value(udiRelevanceResponse.getPackLevel()) == 0) {
RelCodeDetailResponse relCodeDetailResponse = relCodeDetailService.findByCode(code);
if (relCodeDetailResponse == null) { if (relCodeDetailResponse == null) {
return ResultVOUtils.error(500, "请先上传关联关系!"); return ResultVOUtils.error(500, "请先上传关联关系!");
} }
} }
try {
// 调用阿里获取码信息
List<IoCodeTempEntity> ioCodeTempEntities = ioCodeTempDao.selectList(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getCode, code));
IoCodeTempEntity codeTempEntity =new IoCodeTempEntity();
if (CollUtil.isNotEmpty(ioCodeTempEntities)) {
codeTempEntity = ioCodeTempEntities.get(0);
}
List<RelCodeBatch> navList = relCodeBatchService.list(new LambdaQueryWrapper<RelCodeBatch>()
.eq(RelCodeBatch::getCurCode, code));
// 还是为空就调用查码明细的结构
if (navList == null || navList.size() == 0) {
AuthCompany authCompany = authCompanyMapper.selectOne(
new QueryWrapper<AuthCompany>().last("limit 1")
);
if (authCompany != null) {
AlihealthYljgLocaCodedetailReqeust alihealthYljgLocaCodedetailReqeust = new AlihealthYljgLocaCodedetailReqeust();
alihealthYljgLocaCodedetailReqeust.setErpId(codeTempEntity.getSupId());
alihealthYljgLocaCodedetailReqeust.setAppSecret(authCompany.getAppSecret());
AlihealthYljgCodedetailReqeust alihealthYljgCodedetailReqeust = new AlihealthYljgCodedetailReqeust();
alihealthYljgCodedetailReqeust.setRef_ent_id(authCompany.getRefEntId());
alihealthYljgCodedetailReqeust.setCodes(code);
alihealthYljgCodedetailReqeust.setApp_key(authCompany.getAppId());
alihealthYljgLocaCodedetailReqeust.setAlihealthYljgCodedetailReqeust(alihealthYljgCodedetailReqeust);
BaseResponse<List<RelCodeBatch>> response = alihealthYljgUtils.codedetail(alihealthYljgLocaCodedetailReqeust);
if (response.getCode() == 20000) {
List<RelCodeBatch> relCodeBatchList = response.getData();
if (relCodeBatchList != null && relCodeBatchList.size() > 0) {
for (RelCodeBatch relCodeBatch : relCodeBatchList) {
RelCodeBatch relCodeBatchOne = relCodeBatchService.getOne(new QueryWrapper<RelCodeBatch>().eq("productCode", relCodeBatch.getProductCode())
.last("limit 1")
);
if (Objects.isNull(relCodeBatchOne)) {
relCodeBatch.setCreateUser(codeTempEntity.getSupId());
relCodeBatch.setCreateTime(new Date());
relCodeBatchService.save(relCodeBatch);
} else {
relCodeBatchService.update(relCodeBatch, new QueryWrapper<RelCodeBatch>().eq("productCode", relCodeBatch.getProductCode()));
}
}
}
} else {
log.error("拉取阿里码明细访问失败===" + response.getMessage());
}
}
}
}catch (Exception e){
log.error("拉取阿里码明细访问失败===" + e.getMessage());
}
//先生成扫码单据 //先生成扫码单据
IoOrderEntity orderEntity = orderService.findByBillNo(orderId); IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
String inBatch = ""; String inBatch = "";
@ -523,9 +509,9 @@ public class IoCodeTempService {
codeEnttity.setSerialNo(udiEntity.getSerialNo()); codeEnttity.setSerialNo(udiEntity.getSerialNo());
codeEnttity.setDeptCode(invWarehouseEntity.getParentId()); codeEnttity.setDeptCode(invWarehouseEntity.getParentId());
codeEnttity.setInvCode(addOrderRequest.getInvCode()); codeEnttity.setInvCode(addOrderRequest.getInvCode());
if (codeRelEntity != null) { if (relCodeDetailResponse != null) {
codeEnttity.setParentCode(codeRelEntity.getParentCode()); codeEnttity.setParentCode(relCodeDetailResponse.getParentCode());
RelCodeDetail relCodeDetail = relCodeDetailService.getOneByCode(codeRelEntity.getParentCode()); RelCodeDetail relCodeDetail = relCodeDetailService.getOneByCode(relCodeDetailResponse.getParentCode());
if (relCodeDetail != null) { if (relCodeDetail != null) {
codeEnttity.setGrantPaCode(relCodeDetail.getParentCode()); codeEnttity.setGrantPaCode(relCodeDetail.getParentCode());
} }
@ -594,7 +580,8 @@ public class IoCodeTempService {
orderEntity.setFromType(ConstantStatus.FROM_WEBNEW); orderEntity.setFromType(ConstantStatus.FROM_WEBNEW);
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT); orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
AuthAdmin authAdmin = customerService.getUserBean();; AuthAdmin authAdmin = customerService.getUserBean();
;
orderEntity.setCreateUser(authAdmin.getId() + ""); orderEntity.setCreateUser(authAdmin.getId() + "");
orderEntity.setCreateTime(new Date()); orderEntity.setCreateTime(new Date());
orderEntity.setUpdateUser(authAdmin.getId() + ""); orderEntity.setUpdateUser(authAdmin.getId() + "");
@ -682,36 +669,34 @@ public class IoCodeTempService {
relCodeBatchService.threadUpdateIoCodeTempEntity(code); relCodeBatchService.threadUpdateIoCodeTempEntity(code);
} }
} }
RelCodeBatch relCodeBatchOne = relCodeBatchService.getOne(new QueryWrapper<RelCodeBatch>().eq("curCode", code)
.last("limit 1")
);
if(relCodeBatchOne!=null){
String mabeDate = relCodeBatchOne.getMadeDate();
String validateDate = relCodeBatchOne.getValidateDate();
if(mabeDate.length() > 10){
mabeDate =mabeDate.replace("-","").substring(2,8);
}
if(validateDate.length() > 10){
validateDate = validateDate.replace("-","").substring(2,8);
}
genDetaiEntity.setBatchNo(relCodeBatchOne.getBatchNo());
genDetaiEntity.setProduceDate(mabeDate);
genDetaiEntity.setExpireDate(validateDate);
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity(); // if(relCodeBatchOne!=null){
ioOrderDetailBizEntity.setBatchNo(relCodeBatchOne.getBatchNo()); // String mabeDate = relCodeBatchOne.getMadeDate();
ioOrderDetailBizEntity.setProductDate( mabeDate); // String validateDate = relCodeBatchOne.getValidateDate();
ioOrderDetailBizEntity.setExpireDate(validateDate); //
//
ioOrderDetailBizDao.update(ioOrderDetailBizEntity, // if(mabeDate.length() > 10){
new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk",orderEntity.getBillNo()) // mabeDate =mabeDate.replace("-","").substring(2,8);
); //
// genDetaiEntity.setExpireDate(relCodeBatchOne.getValidateDate()); // }
} // if(validateDate.length() > 10){
// validateDate = validateDate.replace("-","").substring(2,8);
//
// }
// genDetaiEntity.setBatchNo(relCodeBatchOne.getBatchNo());
// genDetaiEntity.setProduceDate(mabeDate);
// genDetaiEntity.setExpireDate(validateDate);
//
// IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
// ioOrderDetailBizEntity.setBatchNo(relCodeBatchOne.getBatchNo());
// ioOrderDetailBizEntity.setProductDate( mabeDate);
// ioOrderDetailBizEntity.setExpireDate(validateDate);
//
// ioOrderDetailBizDao.update(ioOrderDetailBizEntity,
// new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk",orderEntity.getBillNo())
// );
//// genDetaiEntity.setExpireDate(relCodeBatchOne.getValidateDate());
// }
addCodeResult.setOrderId(orderId); addCodeResult.setOrderId(orderId);
transInoutService.genOrderDetailCode(orderEntity, genDetaiEntity); transInoutService.genOrderDetailCode(orderEntity, genDetaiEntity);
return ResultVOUtils.success(addCodeResult); return ResultVOUtils.success(addCodeResult);

Loading…
Cancel
Save