扫码关联关系问题

dev_unify
yewj 5 months ago
parent e75234fc27
commit de4621f59d

@ -8,7 +8,9 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.RedissonCacheKey;
import com.glxp.api.controller.BaseController;
import com.glxp.api.dao.inout.IoCodeTempDao;
import com.glxp.api.entity.collect.RelCodeBatch;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.req.collect.RelCodeBatchRequest;
import com.glxp.api.req.collect.RelCodeDetailRequest;
import com.glxp.api.res.PageSimpleResponse;
@ -138,6 +140,8 @@ public class RelCodeBatchController extends BaseController {
return ResultVOUtils.success(list);
}
@Resource
IoCodeTempDao ioCodeTempDao;
/**
*
@ -146,8 +150,12 @@ public class RelCodeBatchController extends BaseController {
* @return
*/
@GetMapping("/udiwms/relCode/updateIoCodeTempEntity")
public BaseResponse threadUpdateIoCodeTempEntity(@RequestParam("parentCode") String parentCode) {
public BaseResponse threadUpdateIoCodeTempEntity(@RequestParam("parentCode") String parentCode, @RequestParam("id") Integer id) {
if (StrUtil.isBlank(parentCode)) return ResultVOUtils.error(500, "层级编码格式错误!");
IoCodeTempEntity codeTempEntity = new IoCodeTempEntity();
codeTempEntity.setId(id);
codeTempEntity.setDrugLink(1);
ioCodeTempDao.updateById(codeTempEntity);
relCodeBatchService.threadUpdateIoCodeTempEntity(parentCode);
return ResultVOUtils.success();
}

@ -43,6 +43,7 @@ import com.glxp.api.service.basic.*;
import com.glxp.api.service.collect.RelCodeBatchService;
import com.glxp.api.service.inout.*;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.service.inv.*;
import com.glxp.api.service.inv.impl.InvProductServiceNew;
import com.glxp.api.service.purchase.SupCertService;
@ -962,10 +963,8 @@ public class IoCodeTempController extends BaseController {
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
}
String orderId = addOrderRequest.getBillNo();
//过期提醒:
if (IntUtil.value(bussinessTypeEntity.getCheckExpire()) == 1 && !addOrderRequest.isIgnoreExpire()) {
if (StrUtil.isNotEmpty(udiEntity.getExpireDate())) {
@ -1044,6 +1043,9 @@ public class IoCodeTempController extends BaseController {
if (StrUtil.isEmpty(exitLocalEntity.getSupId()) || exitLocalEntity.getRelId() == null) {
return ResultVOUtils.error(500, "当前追溯码已存在,且存在异常未处理!");
}
if (StringUtils.isNotBlank(exitLocalEntity.getSerialNo())) {
return ResultVOUtils.error(500, "重复扫码!");
}
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode(), null);
BeanUtils.copyProperties(exitLocalEntity, genDetaiEntity);
@ -1063,10 +1065,6 @@ public class IoCodeTempController extends BaseController {
}
if (StringUtils.isNotBlank(exitLocalEntity.getSerialNo())) {
return ResultVOUtils.error(500, "重复扫码!");
}
BaseResponse invRes = checkInv(bussinessTypeEntity, exitLocalEntity);
if (invRes != null) {
return invRes;
@ -1089,8 +1087,10 @@ public class IoCodeTempController extends BaseController {
}
}
}
if (exitLocalEntity == null) {
if (codeTempService.ieExitRel(code, orderId)) {
return ResultVOUtils.error(500, "当前追溯码已上传关联关系,请勿重复扫码!");
}
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
codeEnttity.setCode(code);
codeEnttity.setOrderId(orderId);

@ -37,6 +37,7 @@ import com.glxp.api.service.basic.EntrustReceService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.*;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.service.inout.impl.IoOrderInvoiceService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.util.CustomUtil;

@ -32,6 +32,7 @@ import com.glxp.api.service.basic.EntrustReceService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.*;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.service.sync.SpsSyncDownloadService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.util.*;

@ -30,6 +30,7 @@ import com.glxp.api.service.auth.WarehouseBussinessTypeService;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.inout.*;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.service.inv.DeviceInspectTaskDetailService;
import com.glxp.api.service.inv.DeviceInspectTaskService;
import com.glxp.api.service.sync.SyncEditLogService;

@ -490,7 +490,7 @@ public class ThrProductsAddDiController {
thrProductsAdddiEntity.setStatus(1); //未审核
thrProductsAdddiEntity.setType(2);
thrProductsAdddiEntity.setCustomerId(Long.parseLong(customerId));
if (thrProductsAdddiEntity.getProductsType() == 2){
if (thrProductsAdddiEntity.getProductsType() == 2) {
thrProductsAdddiEntity.setMajorStatus(1);
}
thrProductsAddDiService.insertThrProducts(thrProductsAdddiEntity);
@ -498,9 +498,9 @@ public class ThrProductsAddDiController {
try {
CodeRel codeRel = new CodeRel();
if(thrProductsAdddiEntity.getProductsType() == null || thrProductsAdddiEntity.getProductsType() == 1){
if (thrProductsAdddiEntity.getProductsType() == null || thrProductsAdddiEntity.getProductsType() == 1) {
codeRel.setDiNameCode(thrProductsAdddiEntity.getNameCode());
}else {
} else {
codeRel.setDrugCode(thrProductsAdddiEntity.getNameCode());
}
codeRel.setYbbm(thrProductsAdddiEntity.getYbbm());
@ -508,8 +508,8 @@ public class ThrProductsAddDiController {
codeRel.setTyshxyh(thrProductsAdddiEntity.getTyshxydm());
codeRel.setUpdateTime(new Date());
erpBasicClient.updateCodeRelDetail(codeRel);
}catch (Exception e){
System.out.println("上传多码融合:"+e);
} catch (Exception e) {
System.out.println("上传多码融合:" + e);
}

@ -179,4 +179,10 @@ public class IoCodeTempEntity {
return reCount;
}
/**
*
*/
@TableField(value = "parentCode")
private String parentCode;
}

@ -13,14 +13,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.basic.BasicProductsDao;
import com.glxp.api.dao.collect.RelCodeBatchMapper;
import com.glxp.api.dao.inout.IoCodeTempDao;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.collect.RelCodeBatch;
import com.glxp.api.entity.collect.RelCodeDetail;
import com.glxp.api.entity.inout.IoCodeTempEntity;
@ -31,7 +30,7 @@ import com.glxp.api.res.collect.RelCodeBatchResponse;
import com.glxp.api.res.collect.RelCodeDetailByParentCodeResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.ProductInfoService;
import com.glxp.api.service.inout.IoCodeTempService;
import com.glxp.api.service.basic.UdiProductService;
import com.glxp.api.util.HttpClient;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
@ -63,6 +62,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
/**
*
*
* @param file
*/
@Transactional(rollbackFor = Exception.class)
@ -70,11 +70,11 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
try {
String fileName = file.getOriginalFilename();
String suffix = FileUtil.getSuffix(fileName);
if(! "xml".equals(suffix)){
throw new JsonException("仅支持XML文件类型错误"+suffix);
if (!"xml".equals(suffix)) {
throw new JsonException("仅支持XML文件类型错误" + suffix);
}
log.info(file.getSize()+"文件长度");
if(file.getSize() > 5 * 1024 *1024){
log.info(file.getSize() + "文件长度");
if (file.getSize() > 5 * 1024 * 1024) {
throw new JsonException("上传文件超过5M");
}
List<RelCodeDetail> relCodeDetails = new ArrayList<>();
@ -83,7 +83,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
Element rootElement = XmlUtil.getRootElement(document);
//截取Relation
NodeList relation = rootElement.getElementsByTagName("Relation");
if(relation == null){
if (relation == null) {
throw new JsonException("XML文件解析错误");
}
Element relationE = (Element) relation.item(0);
@ -94,7 +94,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
String comment = relationE.getAttribute("comment");
//截取Batch
NodeList batch = rootElement.getElementsByTagName("Batch");
if(batch == null){
if (batch == null) {
throw new JsonException("XML文件解析错误");
}
AuthAdmin user = customerService.getUserBean();
@ -115,7 +115,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
// relCodeBatch.setMadeDate(DateUtil.parse(madeDate,"yyyy-MM-dd"));
String validateDate = batchE.getAttribute("validateDate");
// relCodeBatch.setValidateDate(DateUtil.offsetDay(DateUtil.parse(validateDate,"yyyy-MM-dd"),1));
relCodeBatch.setValidateDate(String.valueOf(DateUtil.offsetDay(DateUtil.parse(validateDate,"yyyy-MM-dd"),1)));
relCodeBatch.setValidateDate(String.valueOf(DateUtil.offsetDay(DateUtil.parse(validateDate, "yyyy-MM-dd"), 1)));
String workShop = batchE.getAttribute("workShop");
relCodeBatch.setWorkShop(workShop);
String lineName = batchE.getAttribute("lineName");
@ -143,7 +143,7 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
String packLayer = codeE.getAttribute("packLayer");
relCodeDetail.setPackLayer(Integer.valueOf(packLayer));
String parentCode = codeE.getAttribute("parentCode");
relCodeDetail.setParentCode(StrUtil.isNotBlank(parentCode)?parentCode:"0");
relCodeDetail.setParentCode(StrUtil.isNotBlank(parentCode) ? parentCode : "0");
String flag = codeE.getAttribute("flag");
relCodeDetail.setFlag(Integer.valueOf(flag));
relCodeDetails.add(relCodeDetail);
@ -151,26 +151,27 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
}
}
relCodeDetailService.saveBatch(relCodeDetails);
}catch (Exception e){
throw new JsonException("上传失败:"+e.getMessage());
} catch (Exception e) {
throw new JsonException("上传失败:" + e.getMessage());
}
}
/**
*
*
* @param relCodeBatchRequest
*/
@Transactional(rollbackFor = Exception.class)
public void add(RelCodeBatchRequest relCodeBatchRequest) {
List<RelCodeDetailRequest> detailList = relCodeBatchRequest.getDetailList();
if(CollUtil.isEmpty(detailList)){
if (CollUtil.isEmpty(detailList)) {
throw new JsonException("关联明细不能为空!");
}
AuthAdmin user = customerService.getUserBean();
RelCodeDetailRequest relCodeDetailRequest = detailList.get(0);
RelCodeBatch relCodeBatch = new RelCodeBatch();
BeanUtils.copyProperties(relCodeBatchRequest,relCodeBatch);
BeanUtils.copyProperties(relCodeBatchRequest, relCodeBatch);
relCodeBatch.setCreateTime(new Date());
relCodeBatch.setCreateUser(user.getUserName());
relCodeBatch.setUpdateTime(new Date());
@ -181,11 +182,11 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
relCodeBatch.setErpId(customerId);
this.save(relCodeBatch);
List<RelCodeDetail> relCodeDetails = new ArrayList<>();
for(RelCodeDetailRequest request : detailList){
for (RelCodeDetailRequest request : detailList) {
RelCodeDetail relCodeDetail = new RelCodeDetail();
String parentCode = request.getParentCode();
request.setParentCode(StrUtil.isNotBlank(parentCode)?parentCode:"0");
BeanUtils.copyProperties(request,relCodeDetail);
request.setParentCode(StrUtil.isNotBlank(parentCode) ? parentCode : "0");
BeanUtils.copyProperties(request, relCodeDetail);
relCodeDetail.setBatchIdFk(relCodeBatch.getId());
relCodeDetails.add(relCodeDetail);
}
@ -205,19 +206,19 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
@Transactional(rollbackFor = Exception.class)
public void delete(Long id) {
if(id == null){
if (id == null) {
throw new JsonException("id 不能为空");
}
relCodeDetailService.remove(new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getBatchIdFk,id));
relCodeDetailService.remove(new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getBatchIdFk, id));
this.removeById(id);
}
@Transactional(rollbackFor = Exception.class)
public void addRelCodeSpellBox(List<RelCodeBatchRequest> relCodeBatchRequests) {
if (CollUtil.isEmpty(relCodeBatchRequests)){
if (CollUtil.isEmpty(relCodeBatchRequests)) {
throw new JsonException("单据信息异常!");
}
relCodeBatchRequests.forEach( item -> {
relCodeBatchRequests.forEach(item -> {
this.add(item);
});
}
@ -225,17 +226,17 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
@Transactional(rollbackFor = Exception.class)
public void deleteDetail(String curCode) {
List<RelCodeDetail> list = relCodeDetailService.list(new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getParentCode, curCode));
if (CollUtil.isNotEmpty(list)){
if (CollUtil.isNotEmpty(list)) {
List<Integer> batchIds = list.stream().map(RelCodeDetail::getBatchIdFk).collect(Collectors.toList());
this.removeBatchByIds(batchIds);
relCodeDetailService.remove(new LambdaQueryWrapper<RelCodeDetail>().in(RelCodeDetail::getBatchIdFk,batchIds));
relCodeDetailService.remove(new LambdaQueryWrapper<RelCodeDetail>().in(RelCodeDetail::getBatchIdFk, batchIds));
}
}
@Transactional(rollbackFor = Exception.class)
public void deleteAllDetail(List<RelCodeDetailRequest> detailList) {
if (CollUtil.isNotEmpty(detailList)){
detailList.forEach( item -> {
if (CollUtil.isNotEmpty(detailList)) {
detailList.forEach(item -> {
String curCode = item.getCurCode();
this.deleteDetail(curCode);
});
@ -257,12 +258,12 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
BaseResponse<Object> baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<Object>>() {
});
if (baseResponse.getCode() == 20000){
if (baseResponse.getCode() == 20000) {
Integer id = relCodeBatchRequest.getId();
return this.update( new LambdaUpdateWrapper<RelCodeBatch>().set(RelCodeBatch::getUploadFlagUp,1).eq(RelCodeBatch::getId,id));
}else {
return this.update(new LambdaUpdateWrapper<RelCodeBatch>().set(RelCodeBatch::getUploadFlagUp, 1).eq(RelCodeBatch::getId, id));
} else {
Integer id = relCodeBatchRequest.getId();
this.update( new LambdaUpdateWrapper<RelCodeBatch>().set(RelCodeBatch::getUploadFlagUp,2).eq(RelCodeBatch::getId,id));
this.update(new LambdaUpdateWrapper<RelCodeBatch>().set(RelCodeBatch::getUploadFlagUp, 2).eq(RelCodeBatch::getId, id));
return false;
}
} catch (Exception e) {
@ -300,29 +301,29 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
/**
* parentCode
*/
public boolean UpdateDetailByParentCode(String parentCode,Integer uploadFlagDown) {
public boolean UpdateDetailByParentCode(String parentCode, Integer uploadFlagDown) {
List<RelCodeDetailByParentCodeResponse> list = this.detailByParentCode(parentCode);
if (CollUtil.isNotEmpty(list)) {
for (int i = 0; i < list.size(); i++) {
try {
RelCodeDetailByParentCodeResponse relCodeDetailByParentCodeResponse = list.get(i);
this.saveDetailByParentCode(relCodeDetailByParentCodeResponse,uploadFlagDown);
this.saveDetailByParentCode(relCodeDetailByParentCodeResponse, uploadFlagDown);
List<RelCodeDetailByParentCodeResponse> relCodeDetailSons = relCodeDetailByParentCodeResponse.getRelCodeDetailSons();
if (CollUtil.isNotEmpty(relCodeDetailSons)) {
this.saveDetailByParentCode(relCodeDetailByParentCodeResponse,uploadFlagDown);
this.saveDetailByParentCode(relCodeDetailByParentCodeResponse, uploadFlagDown);
}
}catch (Exception e){
log.error("拉取国家同步库进行更新失败:[" + parentCode + "]" );
} catch (Exception e) {
log.error("拉取国家同步库进行更新失败:[" + parentCode + "]");
log.error(e.getMessage(), e);
}
}
return true;
}else
} else
return false;
}
public void saveDetailByParentCode( RelCodeDetailByParentCodeResponse relCodeDetailByParentCodeResponse,Integer uploadFlagDown) {
public void saveDetailByParentCode(RelCodeDetailByParentCodeResponse relCodeDetailByParentCodeResponse, Integer uploadFlagDown) {
String productCode = relCodeDetailByParentCodeResponse.getProductCode();
String subTypeNo = relCodeDetailByParentCodeResponse.getSubTypeNo();
String batchNo = relCodeDetailByParentCodeResponse.getBatchNo();
@ -366,29 +367,29 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
if (CollUtil.isNotEmpty(navList)) return true;
//3、查不到进行远程拉取更新
return this.UpdateDetailByParentCode(parentCode,0);
return this.UpdateDetailByParentCode(parentCode, 0);
}
public List<RelCodeDetailByParentCodeResponse> detailByParentCodeSpms(String parentCode,Integer uploadFlagDown) {
public List<RelCodeDetailByParentCodeResponse> detailByParentCodeSpms(String parentCode, Integer uploadFlagDown) {
List<RelCodeDetailByParentCodeResponse> respList = new ArrayList<>();
List<RelCodeBatch> list = this.list(new LambdaQueryWrapper<RelCodeBatch>().eq(RelCodeBatch::getParentCode, parentCode));
if (CollUtil.isEmpty(list)){
if (CollUtil.isEmpty(list)) {
respList = this.detailByParentCode(parentCode);
for (int i = 0; i < respList.size(); i++) {
try {
RelCodeDetailByParentCodeResponse relCodeDetailByParentCodeResponse = respList.get(i);
this.saveDetailByParentCode(relCodeDetailByParentCodeResponse,uploadFlagDown);
this.saveDetailByParentCode(relCodeDetailByParentCodeResponse, uploadFlagDown);
List<RelCodeDetailByParentCodeResponse> relCodeDetailSons = relCodeDetailByParentCodeResponse.getRelCodeDetailSons();
if (CollUtil.isNotEmpty(relCodeDetailSons)) {
relCodeDetailSons.forEach( item -> {
this.saveDetailByParentCode(item,uploadFlagDown);
relCodeDetailSons.forEach(item -> {
this.saveDetailByParentCode(item, uploadFlagDown);
});
}
}catch (Exception e){
log.error("拉取国家同步库进行更新失败:[" + parentCode + "]" );
} catch (Exception e) {
log.error("拉取国家同步库进行更新失败:[" + parentCode + "]");
log.error(e.getMessage(), e);
}
}
@ -423,31 +424,35 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
@Resource
IoCodeTempDao ioCodeTempDao;
@Resource
UdiProductService udiProductService;
public void threadUpdateIoCodeTempEntity(String parentCode){
public void threadUpdateIoCodeTempEntity(String parentCode) {
List<IoCodeTempEntity> ioCodeTempEntities = ioCodeTempDao.selectList(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getCode, parentCode));
if (CollUtil.isNotEmpty(ioCodeTempEntities)){
if (CollUtil.isNotEmpty(ioCodeTempEntities)) {
//1、排除掉层级是1的
UdiEntity udi = FilterUdiUtils.getUdi(parentCode);
if (udi == null)
return;
String udi1 = udi.getUdi();
ProductInfoEntity byNameCode = productInfoService.findByNameCode(udi1);
UdiProductEntity udiProductEntity = udiProductService.findByNameCode(udi1);
if (udiProductEntity == null)
return;
List<RelCodeBatch> navList = this.list(new LambdaQueryWrapper<RelCodeBatch>()
.eq(RelCodeBatch::getParentCode, parentCode));
if ( (byNameCode != null && "1".equals(byNameCode.getPackLevel()))
|| (CollUtil.isNotEmpty(navList))
){
if ((udiProductEntity != null && "1".equals(udiProductEntity.getPackLevel()))
|| (CollUtil.isNotEmpty(navList))
) {
//打上匹配到了药品关联关系的标记
for (int i = 0; i < ioCodeTempEntities.size(); i++) {
IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i);
ioCodeTempEntity.setDrugLink(1);
ioCodeTempDao.updateById(ioCodeTempEntity);
}
}else {
} else {
ThreadUtil.execAsync(() -> {
asynThreadUpdateIoCodeTempEntity(parentCode,ioCodeTempEntities);
asynThreadUpdateIoCodeTempEntity(parentCode, ioCodeTempEntities);
});
}
}
@ -455,15 +460,15 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
}
public void asynThreadUpdateIoCodeTempEntity(String parentCode,List<IoCodeTempEntity> ioCodeTempEntities){
if (this.batchExist(parentCode)){
public void asynThreadUpdateIoCodeTempEntity(String parentCode, List<IoCodeTempEntity> ioCodeTempEntities) {
if (this.batchExist(parentCode)) {
//打上匹配到了药品关联关系的标记
for (int i = 0; i < ioCodeTempEntities.size(); i++) {
IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i);
ioCodeTempEntity.setDrugLink(1);
ioCodeTempDao.updateById(ioCodeTempEntity);
}
}else {
} else {
//打上匹配不到了药品关联关系的标记
for (int i = 0; i < ioCodeTempEntities.size(); i++) {
IoCodeTempEntity ioCodeTempEntity = ioCodeTempEntities.get(i);

@ -13,6 +13,7 @@ import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.inout.*;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.vo.basic.InvProductNewVo;
import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.exception.JsonException;

@ -15,6 +15,7 @@ import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.IBasicBusTypePreService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.service.inout.impl.IoOrderInvoiceService;
import com.glxp.api.service.inv.impl.InvProductServiceNew;
import com.glxp.api.service.system.SystemParamConfigService;

@ -27,6 +27,7 @@ import com.glxp.api.res.inout.IoOrderDetailCodeResponse;
import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.inout.impl.IoCodeService;
import com.glxp.api.service.inout.impl.IoCodeTempService;
import com.glxp.api.service.inout.impl.IoOrderInvoiceService;
import com.glxp.api.service.inv.InvPreinDetailService;
import com.glxp.api.service.inv.InvPreinOrderService;

@ -1,53 +0,0 @@
package com.glxp.api.service.inout;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.req.inout.FilterCodeRequest;
import com.glxp.api.res.inout.IoCodeTempResponse;
import com.glxp.api.util.page.TableDataInfo;
import java.util.List;
public interface IoCodeTempService {
IoCodeTempEntity selectById(Integer id);
int insert(IoCodeTempEntity codeEnttity);
int deleteById(Integer id);
boolean insertBatch(List<IoCodeTempEntity> codeEnttities);
int updateById(IoCodeTempEntity codeEnttity);
int updateByOrderId(IoCodeTempEntity codeTempEntity);
IoCodeTempEntity findByUnique(String orderId, String code);
List<IoCodeTempEntity> findByOrderId(String billNo);
TableDataInfo<IoCodeTempEntity> findByOrderId(FilterCodeRequest filterCodeRequest);
int deleteByBillNo(String orderId);
/**
*
*
* @param filterCodeRequest
* @return
*/
List<IoCodeTempResponse> findCodeList(FilterCodeRequest filterCodeRequest);
Boolean checkTempCode(IoCodeTempEntity ioCodeTempEntity);
boolean isExit(String orderId);
/**
*
* @param newBillNo
* @param oldBillNo
* @return
*/
boolean copyCodeTemp(String newBillNo, String oldBillNo);
}

@ -1,20 +1,19 @@
package com.glxp.api.service.inout.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.inout.IoCodeDao;
import com.glxp.api.dao.inout.IoCodeTempDao;
import com.glxp.api.entity.collect.RelCodeDetail;
import com.glxp.api.entity.inout.IoCodeEntity;
import com.glxp.api.entity.inout.IoCodeTempEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.req.inout.FilterCodeRequest;
import com.glxp.api.res.inout.IoCodeTempResponse;
import com.glxp.api.service.inout.IoCodeTempService;
import com.glxp.api.service.collect.RelCodeDetailService;
import com.glxp.api.util.BeanCopyUtils;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.page.PageQuery;
import com.glxp.api.util.page.TableDataInfo;
import org.springframework.beans.BeanUtils;
@ -28,7 +27,7 @@ import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class IoCodeTempServiceImpl implements IoCodeTempService {
public class IoCodeTempService {
@Resource
IoCodeTempDao ioCodeTempDao;
@ -36,48 +35,48 @@ public class IoCodeTempServiceImpl implements IoCodeTempService {
@Resource
IoCodeDao ioCodeDao;
@Override
public IoCodeTempEntity selectById(Integer id) {
return ioCodeTempDao.selectById(id);
}
@Override
public int insert(IoCodeTempEntity codeEnttity) {
codeEnttity.setId(null);
return ioCodeTempDao.insert(codeEnttity);
}
@Override
public int deleteById(Integer id) {
return ioCodeTempDao.deleteById(id);
}
@Override
public boolean insertBatch(List<IoCodeTempEntity> codeEnttities) {
return ioCodeTempDao.insertBatch(codeEnttities);
}
@Override
public List<IoCodeTempEntity> findByOrderId(String billNo) {
return ioCodeTempDao.selectList(new QueryWrapper<IoCodeTempEntity>().eq("orderId", billNo));
}
@Override
public int updateById(IoCodeTempEntity codeEnttity) {
return ioCodeTempDao.updateById(codeEnttity);
}
@Override
public int updateByOrderId(IoCodeTempEntity codeTempEntity) {
return ioCodeTempDao.update(codeTempEntity, new QueryWrapper<IoCodeTempEntity>().eq("orderId", codeTempEntity.getOrderId()));
}
@Override
public IoCodeTempEntity findByUnique(String orderId, String code) {
return ioCodeTempDao.selectOne(new QueryWrapper<IoCodeTempEntity>().eq("orderId", orderId).eq("code", code));
}
@Override
public TableDataInfo<IoCodeTempEntity> findByOrderId(FilterCodeRequest filterCodeRequest) {
PageQuery pageQuery = new PageQuery();
BeanCopyUtils.copy(filterCodeRequest, pageQuery);
@ -85,12 +84,12 @@ public class IoCodeTempServiceImpl implements IoCodeTempService {
return TableDataInfo.build(page);
}
@Override
public int deleteByBillNo(String orderId) {
return ioCodeTempDao.delete(new QueryWrapper<IoCodeTempEntity>().eq("orderId", orderId));
}
@Override
public List<IoCodeTempResponse> findCodeList(FilterCodeRequest filterCodeRequest) {
if (null != filterCodeRequest && null != filterCodeRequest.getPage() && null != filterCodeRequest.getLimit()) {
PageHelper.offsetPage((filterCodeRequest.getPage() - 1) * filterCodeRequest.getLimit(), filterCodeRequest.getLimit());
@ -98,7 +97,7 @@ public class IoCodeTempServiceImpl implements IoCodeTempService {
return ioCodeTempDao.selectCodeList(filterCodeRequest);
}
@Override
public Boolean checkTempCode(IoCodeTempEntity ioCodeTempEntity) {
QueryWrapper<IoCodeTempEntity> ew = new QueryWrapper<>();
@ -115,23 +114,39 @@ public class IoCodeTempServiceImpl implements IoCodeTempService {
return true;
}
@Override
public boolean isExit(String orderId) {
return ioCodeTempDao.exists(new QueryWrapper<IoCodeTempEntity>().eq("orderId", orderId));
}
@Override
@Resource
RelCodeDetailService relCodeDetailService;
public boolean ieExitRel(String code, String orderId) {
boolean ret = false;
RelCodeDetail relCodeDetail = relCodeDetailService.getOne(new LambdaQueryWrapper<RelCodeDetail>().eq(RelCodeDetail::getCurCode, code));
if (relCodeDetail != null) {
ret = ioCodeTempDao.exists(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getOrderId, orderId).eq(IoCodeTempEntity::getCode, relCodeDetail.getParentCode()));
if (!ret) {
ret = ioCodeTempDao.exists(new LambdaQueryWrapper<IoCodeTempEntity>().eq(IoCodeTempEntity::getOrderId, orderId).eq(IoCodeTempEntity::getParentCode, code));
}
}
return ret;
}
public boolean copyCodeTemp(String newBillNo, String oldBillNo) {
//获取旧列表数据
FilterCodeRequest filterCodeRequest = new FilterCodeRequest();
filterCodeRequest.setOrderId(oldBillNo);
List<IoCodeEntity> oldIoCodeEntityList = ioCodeDao.filterCodeList(filterCodeRequest);
if (CollUtil.isNotEmpty(oldIoCodeEntityList)){
if (CollUtil.isNotEmpty(oldIoCodeEntityList)) {
List<IoCodeTempEntity> newIoCodeTempEntityList = new ArrayList<>(oldIoCodeEntityList.size());
//遍历修改新单号为新订单号
oldIoCodeEntityList.forEach( x -> {
oldIoCodeEntityList.forEach(x -> {
IoCodeTempEntity ioCodeTempEntity = new IoCodeTempEntity();
BeanUtils.copyProperties(x,ioCodeTempEntity);
BeanUtils.copyProperties(x, ioCodeTempEntity);
ioCodeTempEntity.setOrderId(newBillNo);
ioCodeTempEntity.setId(null);
ioCodeTempEntity.setUpdateTime(new Date());

@ -3,7 +3,7 @@ server:
spring:
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
jdbc-url: jdbc:p6spy:mysql://192.168.0.44:3306/udi_spms_ct?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_spms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
hikari:

@ -1092,5 +1092,9 @@ CALL Pro_Temp_ColumnWork('thr_products_add_di', 'majorStatus',
1);
CALL Pro_Temp_ColumnWork('io_code_temp', 'parentCode',
' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''父级编码''',
1);

Loading…
Cancel
Save