|
|
@ -1,13 +1,17 @@
|
|
|
|
package com.glxp.api.service.inout;
|
|
|
|
package com.glxp.api.service.inout;
|
|
|
|
|
|
|
|
|
|
|
|
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.update.UpdateWrapper;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
import com.glxp.api.constant.ConstantType;
|
|
|
|
import com.glxp.api.constant.ConstantType;
|
|
|
|
|
|
|
|
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
import com.glxp.api.entity.auth.SysWorkplace;
|
|
|
|
import com.glxp.api.entity.auth.SysWorkplace;
|
|
|
@ -44,6 +48,7 @@ import com.glxp.api.util.udi.UdiCalCountUtil;
|
|
|
|
import com.glxp.api.vo.basic.InvProductNewVo;
|
|
|
|
import com.glxp.api.vo.basic.InvProductNewVo;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -162,11 +167,7 @@ public class AddCoodeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.info("批量处理药品码开始,共{}个", codeList.size());
|
|
|
|
log.info("批量处理药品码开始,共{}个", codeList.size());
|
|
|
|
// 1. 预处理:标准化追溯码列表
|
|
|
|
// 1. 预处理:标准化追溯码列表
|
|
|
|
List<String> processedCodes = codeList.stream()
|
|
|
|
List<String> processedCodes = codeList.stream().filter(StringUtils::isNotBlank).map(String::trim).map(code -> code.endsWith("\u001D") ? code.replace("\u001D", "") : code).collect(Collectors.toList());
|
|
|
|
.filter(StringUtils::isNotBlank)
|
|
|
|
|
|
|
|
.map(String::trim)
|
|
|
|
|
|
|
|
.map(code -> code.endsWith("\u001D") ? code.replace("\u001D", "") : code)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 批量解析UDI实体
|
|
|
|
// 2. 批量解析UDI实体
|
|
|
|
Map<String, UdiEntity> udiEntityMap = new HashMap<>();
|
|
|
|
Map<String, UdiEntity> udiEntityMap = new HashMap<>();
|
|
|
@ -176,7 +177,7 @@ public class AddCoodeService {
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
if (udiEntity != null) {
|
|
|
|
if (udiEntity != null) {
|
|
|
|
udiEntityMap.put(code, udiEntity);
|
|
|
|
udiEntityMap.put(code, udiEntity);
|
|
|
|
nameCodes.put(code, udiEntity.getUdi());
|
|
|
|
nameCodes.put(udiEntity.getUdi(), code);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
VailCodeResultResponse invalidResponse = new VailCodeResultResponse();
|
|
|
|
VailCodeResultResponse invalidResponse = new VailCodeResultResponse();
|
|
|
|
invalidResponse.setCode(code);
|
|
|
|
invalidResponse.setCode(code);
|
|
|
@ -197,7 +198,7 @@ public class AddCoodeService {
|
|
|
|
String orderId = ioOrderEntity != null ? ioOrderEntity.getBillNo() : null;
|
|
|
|
String orderId = ioOrderEntity != null ? ioOrderEntity.getBillNo() : null;
|
|
|
|
|
|
|
|
|
|
|
|
// 获取业务类型
|
|
|
|
// 获取业务类型
|
|
|
|
String action = ioOrderEntity.getAction();
|
|
|
|
String action = addOrderCodeRequest.getAction();
|
|
|
|
if (action == null) {
|
|
|
|
if (action == null) {
|
|
|
|
if (IntUtil.value(addOrderCodeRequest.getInoutType()) == 2) {
|
|
|
|
if (IntUtil.value(addOrderCodeRequest.getInoutType()) == 2) {
|
|
|
|
action = ConstantType.SPLIT_RETURN;
|
|
|
|
action = ConstantType.SPLIT_RETURN;
|
|
|
@ -213,7 +214,8 @@ public class AddCoodeService {
|
|
|
|
String invCode = authAdmin.getLocInvCode();
|
|
|
|
String invCode = authAdmin.getLocInvCode();
|
|
|
|
|
|
|
|
|
|
|
|
// 批量获取UDI相关信息
|
|
|
|
// 批量获取UDI相关信息
|
|
|
|
List<String> udiCodes = new ArrayList<>(nameCodes.values());
|
|
|
|
List<String> udiCodes = new ArrayList<>();
|
|
|
|
|
|
|
|
nameCodes.keySet().forEach(code -> udiCodes.add(code));
|
|
|
|
Map<String, UdiRelevanceResponse> udiRelevanceMap = udiRelevanceService.batchSelectByNameCodes(udiCodes);
|
|
|
|
Map<String, UdiRelevanceResponse> udiRelevanceMap = udiRelevanceService.batchSelectByNameCodes(udiCodes);
|
|
|
|
if (udiRelevanceMap == null) {
|
|
|
|
if (udiRelevanceMap == null) {
|
|
|
|
return ResultVOUtils.error(500, "药品字典不存在此产品!");
|
|
|
|
return ResultVOUtils.error(500, "药品字典不存在此产品!");
|
|
|
@ -235,84 +237,123 @@ public class AddCoodeService {
|
|
|
|
vailCodeResultResponses.add(invalidResponse);
|
|
|
|
vailCodeResultResponses.add(invalidResponse);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(invCode);
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 获取组编号
|
|
|
|
// 4. 获取组编号
|
|
|
|
Integer groupNumber = getMaxGroupNumber() == null ? 1 : getMaxGroupNumber() + 1;
|
|
|
|
Integer groupNumber = getMaxGroupNumber() == null ? 1 : getMaxGroupNumber() + 1;
|
|
|
|
// 5. 配置线程池
|
|
|
|
// 5. 配置线程池
|
|
|
|
int processors = Runtime.getRuntime().availableProcessors();
|
|
|
|
int processors = Runtime.getRuntime().availableProcessors();
|
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(Math.min(processors * 2, 10));
|
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(Math.min(processors * 2, 10));
|
|
|
|
|
|
|
|
// 准备请求参数
|
|
|
|
|
|
|
|
AddOrderRequest addOrderRequest = new AddOrderRequest();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(addOrderCodeRequest, addOrderRequest);
|
|
|
|
|
|
|
|
addOrderRequest.setBillNo(orderId);
|
|
|
|
|
|
|
|
addOrderRequest.setInvCode(invCode);
|
|
|
|
|
|
|
|
IoOrderEntity isExit = orderService.findByBillNo(orderId);
|
|
|
|
|
|
|
|
IoOrderEntity orderEntity = new IoOrderEntity();
|
|
|
|
|
|
|
|
if (isExit == null) {
|
|
|
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
|
|
|
orderEntity.setBillNo(orderNo);
|
|
|
|
|
|
|
|
orderEntity.setCorpOrderId(addOrderRequest.getCorpOrderId());
|
|
|
|
|
|
|
|
orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
|
|
|
orderEntity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
|
|
|
orderEntity.setFromCorp(addOrderRequest.getFromCorp());
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getFromInvCode())) {
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity1 = invWarehouseService.findByInvSubByCode(addOrderRequest.getFromInvCode());
|
|
|
|
|
|
|
|
orderEntity.setFromDeptCode(invWarehouseEntity1.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
orderEntity.setFromInvCode(addOrderRequest.getFromInvCode());
|
|
|
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_WEBNEW);
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
|
|
|
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
|
|
|
orderEntity.setCreateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
orderEntity.setUpdateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
orderEntity.setCustomerId(authAdmin.getCustomerId() + "");
|
|
|
|
|
|
|
|
orderEntity.setDeptCode(invWarehouseEntity.getParentId());
|
|
|
|
|
|
|
|
orderEntity.setCheckPreInOrders(addOrderRequest.getCheckPreInOrders());
|
|
|
|
|
|
|
|
orderEntity.setInvCode(addOrderRequest.getInvCode());
|
|
|
|
|
|
|
|
orderEntity.setOrderType(addOrderRequest.getOrderType());
|
|
|
|
|
|
|
|
orderEntity.setBusType(bussinessTypeEntity.getBusType());
|
|
|
|
|
|
|
|
orderEntity.setSickerAdNum(addOrderRequest.getSickerAdNum());
|
|
|
|
|
|
|
|
orderEntity.setWorkPlaceCode(addOrderRequest.getWorkPlaceCode());
|
|
|
|
|
|
|
|
orderEntity.setSplitBusType(addOrderRequest.getSplitBusType());
|
|
|
|
|
|
|
|
orderEntity.setFifoSplit(addOrderRequest.getFifoSplit());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderEntity.setSplitBusType(addOrderRequest.getSplitBusType());
|
|
|
|
|
|
|
|
// orderEntity.setWorkPlaceQueueCode(queueCode);
|
|
|
|
|
|
|
|
orderEntity.setProductType(2);
|
|
|
|
|
|
|
|
orderEntity.setFifoSplitTag(addOrderRequest.getFifoSplitTag());
|
|
|
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
|
|
|
addOrderRequest.setBillNo(orderNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 创建异步任务
|
|
|
|
// 创建异步任务
|
|
|
|
List<CompletableFuture<VailCodeResultResponse>> futures = udiEntityMap.entrySet().stream()
|
|
|
|
List<CompletableFuture<VailCodeResultResponse>> futures = udiEntityMap.entrySet().stream().map(entry -> {
|
|
|
|
.map(entry -> {
|
|
|
|
String code = entry.getKey();
|
|
|
|
String code = entry.getKey();
|
|
|
|
UdiEntity udiEntity = entry.getValue();
|
|
|
|
UdiEntity udiEntity = entry.getValue();
|
|
|
|
return CompletableFuture.supplyAsync(() -> {
|
|
|
|
return CompletableFuture.supplyAsync(() -> {
|
|
|
|
VailCodeResultResponse resultResponse = new VailCodeResultResponse();
|
|
|
|
VailCodeResultResponse resultResponse = new VailCodeResultResponse();
|
|
|
|
resultResponse.setCode(code);
|
|
|
|
resultResponse.setCode(code);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
addOrderRequest.setCode(code);
|
|
|
|
// 准备请求参数
|
|
|
|
if (IntUtil.value(addOrderCodeRequest.getInoutType()) == 2) {
|
|
|
|
AddOrderRequest addOrderRequest = new AddOrderRequest();
|
|
|
|
addOrderRequest.setAction(ConstantType.SPLIT_RETURN);
|
|
|
|
BeanUtils.copyProperties(addOrderCodeRequest, addOrderRequest);
|
|
|
|
} else {
|
|
|
|
addOrderRequest.setBillNo(orderId);
|
|
|
|
addOrderRequest.setAction(ConstantType.SPLIT_OUT);
|
|
|
|
addOrderRequest.setCode(code);
|
|
|
|
}
|
|
|
|
addOrderRequest.setInvCode(invCode);
|
|
|
|
addOrderRequest.setFromCorp(ConstantType.SPLIT_CORP);
|
|
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(addOrderCodeRequest.getInoutType()) == 2) {
|
|
|
|
|
|
|
|
addOrderRequest.setAction(ConstantType.SPLIT_RETURN);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
addOrderRequest.setAction(ConstantType.SPLIT_OUT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
addOrderRequest.setFromCorp(ConstantType.SPLIT_CORP);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置批次信息
|
|
|
|
// 设置批次信息
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getBatchNo())) {
|
|
|
|
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
|
|
|
|
udiEntity.setBatchNo(addOrderRequest.getBatchNo());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getProduceDate())) {
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getProduceDate())) {
|
|
|
|
udiEntity.setProduceDate(addOrderRequest.getProduceDate());
|
|
|
|
udiEntity.setProduceDate(addOrderRequest.getProduceDate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getExpireDate())) {
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getExpireDate())) {
|
|
|
|
udiEntity.setExpireDate(addOrderRequest.getExpireDate());
|
|
|
|
udiEntity.setExpireDate(addOrderRequest.getExpireDate());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getSerialNo())) {
|
|
|
|
udiEntity.setSerialNo(addOrderRequest.getSerialNo());
|
|
|
|
udiEntity.setSerialNo(addOrderRequest.getSerialNo());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 处理药品追溯码
|
|
|
|
// 处理药品追溯码
|
|
|
|
BaseResponse baseResponse = addDrugOrder(addOrderRequest, udiEntity, code, groupNumber, bussinessTypeEntity, udiRelevanceMap.get(udiEntity.getUdi()), authAdmin);
|
|
|
|
BaseResponse baseResponse = addDrugOrder(addOrderRequest, udiEntity, code, groupNumber, bussinessTypeEntity, udiRelevanceMap.get(udiEntity.getUdi()), authAdmin, invWarehouseEntity);
|
|
|
|
// 处理结果
|
|
|
|
// 处理结果
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
resultResponse.setStatus(1);
|
|
|
|
resultResponse.setStatus(1);
|
|
|
|
resultResponse.setErrMsg("正确");
|
|
|
|
resultResponse.setErrMsg("正确");
|
|
|
|
AddCodeResult temp = (AddCodeResult) baseResponse.getData();
|
|
|
|
AddCodeResult temp = (AddCodeResult) baseResponse.getData();
|
|
|
|
// 使用同步块保证线程安全
|
|
|
|
// 使用同步块保证线程安全
|
|
|
|
synchronized (addCodeResult) {
|
|
|
|
synchronized (addCodeResult) {
|
|
|
|
if (StringUtils.isBlank(addCodeResult.getOrderId())) {
|
|
|
|
if (StringUtils.isBlank(addCodeResult.getOrderId())) {
|
|
|
|
addCodeResult.setOrderId(temp.getOrderId());
|
|
|
|
addCodeResult.setOrderId(temp.getOrderId());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
resultResponse.setStatus(2);
|
|
|
|
|
|
|
|
resultResponse.setErrMsg(baseResponse.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("处理追溯码异常: {}, 码值: {}", e.getMessage(), code);
|
|
|
|
|
|
|
|
resultResponse.setStatus(2);
|
|
|
|
|
|
|
|
resultResponse.setErrMsg("处理异常: " + e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
resultResponse.setStatus(2);
|
|
|
|
|
|
|
|
resultResponse.setErrMsg(baseResponse.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("处理追溯码异常: {}, 码值: {}", ExceptionUtils.getStackTrace(e), code);
|
|
|
|
|
|
|
|
resultResponse.setStatus(2);
|
|
|
|
|
|
|
|
resultResponse.setErrMsg("处理异常: " + e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return resultResponse;
|
|
|
|
return resultResponse;
|
|
|
|
}, executor);
|
|
|
|
}, executor);
|
|
|
|
})
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 收集结果
|
|
|
|
// 收集结果
|
|
|
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
|
|
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
|
|
|
futures.stream()
|
|
|
|
futures.stream().map(CompletableFuture::join).forEach(vailCodeResultResponses::add);
|
|
|
|
.map(CompletableFuture::join)
|
|
|
|
|
|
|
|
.forEach(vailCodeResultResponses::add);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
executor.shutdown();
|
|
|
|
executor.shutdown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> codeTempEntities = codeTempService.findByOrderId(addOrderRequest.getBillNo());
|
|
|
|
|
|
|
|
genOrderDetailCodeBatch(orderEntity, codeTempEntities);
|
|
|
|
addCodeResult.setVailCodeResultResponses(vailCodeResultResponses);
|
|
|
|
addCodeResult.setVailCodeResultResponses(vailCodeResultResponses);
|
|
|
|
log.info("批量处理药品追溯码完成,共{}个,耗时{}ms", codeList.size(), (System.currentTimeMillis() - startTime));
|
|
|
|
log.info("批量处理药品追溯码完成,共{}个,耗时{}ms", codeList.size(), (System.currentTimeMillis() - startTime));
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
@ -322,8 +363,7 @@ public class AddCoodeService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 药品扫码添加校验
|
|
|
|
* 药品扫码添加校验
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public BaseResponse addDrugOrder(AddOrderRequest addOrderRequest, UdiEntity udiEntity, String code, Integer groupNumber,
|
|
|
|
public BaseResponse addDrugOrder(AddOrderRequest addOrderRequest, UdiEntity udiEntity, String code, Integer groupNumber, BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse udiRelevanceResponse, AuthAdmin authAdmin, InvWarehouseEntity invWarehouseEntity) {
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse udiRelevanceResponse, AuthAdmin authAdmin) {
|
|
|
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
AddCodeResult addCodeResult = new AddCodeResult();
|
|
|
|
AddCodeResult addCodeResult = new AddCodeResult();
|
|
|
|
|
|
|
|
|
|
|
@ -359,13 +399,9 @@ public class AddCoodeService {
|
|
|
|
// 层级标识校验
|
|
|
|
// 层级标识校验
|
|
|
|
boolean packLevelValid;
|
|
|
|
boolean packLevelValid;
|
|
|
|
if (bussinessTypeEntity.isUse()) {
|
|
|
|
if (bussinessTypeEntity.isUse()) {
|
|
|
|
packLevelValid = isPackLevelValid(udiRelevanceResponse.getUseMaxLevel(),
|
|
|
|
packLevelValid = isPackLevelValid(udiRelevanceResponse.getUseMaxLevel(), IntUtil.value(udiRelevanceResponse.getPackLevel()), udiRelevanceResponse.getUseLevel());
|
|
|
|
IntUtil.value(udiRelevanceResponse.getPackLevel()),
|
|
|
|
|
|
|
|
udiRelevanceResponse.getUseLevel());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
packLevelValid = isPackLevelValid(udiRelevanceResponse.getDistributeMaxLevel(),
|
|
|
|
packLevelValid = isPackLevelValid(udiRelevanceResponse.getDistributeMaxLevel(), IntUtil.value(udiRelevanceResponse.getPackLevel()), udiRelevanceResponse.getDistributeLevel());
|
|
|
|
IntUtil.value(udiRelevanceResponse.getPackLevel()),
|
|
|
|
|
|
|
|
udiRelevanceResponse.getDistributeLevel());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!packLevelValid) {
|
|
|
|
if (!packLevelValid) {
|
|
|
|
return ResultVOUtils.error(500, "当前产品不支持采集该包装层级追溯码!");
|
|
|
|
return ResultVOUtils.error(500, "当前产品不支持采集该包装层级追溯码!");
|
|
|
@ -387,7 +423,6 @@ public class AddCoodeService {
|
|
|
|
addOrderRequest.setFromCorp(fromCorp);
|
|
|
|
addOrderRequest.setFromCorp(fromCorp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 4. 优化订单处理流程
|
|
|
|
// 4. 优化订单处理流程
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(addOrderRequest.getInvCode());
|
|
|
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
String inBatch = "";
|
|
|
|
String inBatch = "";
|
|
|
|
if (StringUtils.isBlank(orderId) || orderEntity == null) {
|
|
|
|
if (StringUtils.isBlank(orderId) || orderEntity == null) {
|
|
|
@ -475,6 +510,7 @@ public class AddCoodeService {
|
|
|
|
queueCode = addOrderRequest.getWorkPlaceQueueCode();
|
|
|
|
queueCode = addOrderRequest.getWorkPlaceQueueCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
orderEntity.setWorkPlaceQueueCode(queueCode);
|
|
|
|
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
|
|
|
|
IoCodeTempEntity codeEnttity = new IoCodeTempEntity();
|
|
|
|
codeEnttity.setCode(code);
|
|
|
|
codeEnttity.setCode(code);
|
|
|
|
codeEnttity.setOrderId(orderId);
|
|
|
|
codeEnttity.setOrderId(orderId);
|
|
|
@ -563,10 +599,8 @@ public class AddCoodeService {
|
|
|
|
codeEnttity.setReCount(codeEnttity.getMyReCount() + udiCalCountUtil.getCirActCount(udiRelevanceResponse));
|
|
|
|
codeEnttity.setReCount(codeEnttity.getMyReCount() + udiCalCountUtil.getCirActCount(udiRelevanceResponse));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (unitFk == null)
|
|
|
|
if (unitFk == null) return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
return ResultVOUtils.error(500, "耗材字典不存在此产品!");
|
|
|
|
else return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
else
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "当前供应商不存在此配送产品!");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!(bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_RETURN) || bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT))) {
|
|
|
|
if (!(bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_RETURN) || bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT))) {
|
|
|
@ -576,44 +610,6 @@ public class AddCoodeService {
|
|
|
|
return corpResponse;
|
|
|
|
return corpResponse;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IoOrderEntity isExit = orderService.findByBillNo(orderId);
|
|
|
|
|
|
|
|
if (isExit == null) {
|
|
|
|
|
|
|
|
orderEntity = new IoOrderEntity();
|
|
|
|
|
|
|
|
orderEntity.setBillNo(orderId);
|
|
|
|
|
|
|
|
orderEntity.setCorpOrderId(addOrderRequest.getCorpOrderId());
|
|
|
|
|
|
|
|
orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
|
|
|
orderEntity.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
|
|
|
orderEntity.setFromCorp(addOrderRequest.getFromCorp());
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(addOrderRequest.getFromInvCode())) {
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity1 = invWarehouseService.findByInvSubByCode(addOrderRequest.getFromInvCode());
|
|
|
|
|
|
|
|
orderEntity.setFromDeptCode(invWarehouseEntity1.getParentId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
orderEntity.setFromInvCode(addOrderRequest.getFromInvCode());
|
|
|
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_WEBNEW);
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
|
|
|
|
|
|
|
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
|
|
|
|
|
|
|
|
orderEntity.setCreateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
|
|
|
orderEntity.setUpdateUser(authAdmin.getId() + "");
|
|
|
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
orderEntity.setCustomerId(authAdmin.getCustomerId() + "");
|
|
|
|
|
|
|
|
orderEntity.setDeptCode(invWarehouseEntity.getParentId());
|
|
|
|
|
|
|
|
orderEntity.setCheckPreInOrders(addOrderRequest.getCheckPreInOrders());
|
|
|
|
|
|
|
|
orderEntity.setInvCode(addOrderRequest.getInvCode());
|
|
|
|
|
|
|
|
orderEntity.setOrderType(addOrderRequest.getOrderType());
|
|
|
|
|
|
|
|
orderEntity.setBusType(bussinessTypeEntity.getBusType());
|
|
|
|
|
|
|
|
orderEntity.setSickerAdNum(addOrderRequest.getSickerAdNum());
|
|
|
|
|
|
|
|
orderEntity.setWorkPlaceCode(addOrderRequest.getWorkPlaceCode());
|
|
|
|
|
|
|
|
orderEntity.setSplitBusType(addOrderRequest.getSplitBusType());
|
|
|
|
|
|
|
|
orderEntity.setFifoSplit(addOrderRequest.getFifoSplit());
|
|
|
|
|
|
|
|
orderEntity.setSplitBusType(addOrderRequest.getSplitBusType());
|
|
|
|
|
|
|
|
orderEntity.setWorkPlaceQueueCode(queueCode);
|
|
|
|
|
|
|
|
orderEntity.setProductType(2);
|
|
|
|
|
|
|
|
orderEntity.setFifoSplitTag(addOrderRequest.getFifoSplitTag());
|
|
|
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT)) {
|
|
|
|
if (bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT)) {
|
|
|
|
//工位上货 只允许上货一个产品 开关以及控制
|
|
|
|
//工位上货 只允许上货一个产品 开关以及控制
|
|
|
|
IoCollectSet collectSet = collectSetService.getSet();
|
|
|
|
IoCollectSet collectSet = collectSetService.getSet();
|
|
|
@ -621,8 +617,7 @@ public class AddCoodeService {
|
|
|
|
if (orderEntity != null && StrUtil.isNotEmpty(orderEntity.getWorkPlaceQueueCode())) {
|
|
|
|
if (orderEntity != null && StrUtil.isNotEmpty(orderEntity.getWorkPlaceQueueCode())) {
|
|
|
|
SysWorkplace sysWorkplace = sysWorkplaceService.getOne(new LambdaQueryWrapper<SysWorkplace>().eq(SysWorkplace::getWorkplaceId, addOrderRequest.getWorkPlaceCode()));
|
|
|
|
SysWorkplace sysWorkplace = sysWorkplaceService.getOne(new LambdaQueryWrapper<SysWorkplace>().eq(SysWorkplace::getWorkplaceId, addOrderRequest.getWorkPlaceCode()));
|
|
|
|
if (sysWorkplace.getQueueStatus() == 1) {
|
|
|
|
if (sysWorkplace.getQueueStatus() == 1) {
|
|
|
|
SysWorkplaceQueue workplaceQueue = sysWorkplaceQueueService.getOne(new LambdaQueryWrapper<SysWorkplaceQueue>()
|
|
|
|
SysWorkplaceQueue workplaceQueue = sysWorkplaceQueueService.getOne(new LambdaQueryWrapper<SysWorkplaceQueue>().eq(SysWorkplaceQueue::getCode, orderEntity.getWorkPlaceQueueCode()));
|
|
|
|
.eq(SysWorkplaceQueue::getCode, orderEntity.getWorkPlaceQueueCode()));
|
|
|
|
|
|
|
|
if (workplaceQueue != null) {
|
|
|
|
if (workplaceQueue != null) {
|
|
|
|
//判断槽位产品是否一样
|
|
|
|
//判断槽位产品是否一样
|
|
|
|
if (StrUtil.isNotBlank(workplaceQueue.getRelId())) {
|
|
|
|
if (StrUtil.isNotBlank(workplaceQueue.getRelId())) {
|
|
|
@ -652,8 +647,7 @@ public class AddCoodeService {
|
|
|
|
//校验完成 获取当前槽位 绑定产品
|
|
|
|
//校验完成 获取当前槽位 绑定产品
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysWorkplaceQueue sysWorkplaceQueue = sysWorkplaceQueueService.getOne(new LambdaQueryWrapper<SysWorkplaceQueue>()
|
|
|
|
SysWorkplaceQueue sysWorkplaceQueue = sysWorkplaceQueueService.getOne(new LambdaQueryWrapper<SysWorkplaceQueue>().eq(SysWorkplaceQueue::getCode, orderEntity.getWorkPlaceQueueCode()).last("limit 1"));
|
|
|
|
.eq(SysWorkplaceQueue::getCode, orderEntity.getWorkPlaceQueueCode()));
|
|
|
|
|
|
|
|
if (sysWorkplaceQueue.getRelId() == null) {
|
|
|
|
if (sysWorkplaceQueue.getRelId() == null) {
|
|
|
|
//虚拟槽位这个时候就要设置
|
|
|
|
//虚拟槽位这个时候就要设置
|
|
|
|
if (sysWorkplace.getQueueStatus() == 0) {
|
|
|
|
if (sysWorkplace.getQueueStatus() == 0) {
|
|
|
@ -669,8 +663,7 @@ public class AddCoodeService {
|
|
|
|
isSame = true;
|
|
|
|
isSame = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!isSame)
|
|
|
|
if (!isSame) return ResultVOUtils.error(507, "当前单据下只允许上货单一产品!");
|
|
|
|
return ResultVOUtils.error(507, "当前单据下只允许上货单一产品!");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (orderEntity != null && CollUtil.isNotEmpty(codeEnttitys) && IntUtil.value(collectSet.getSplitOutOnlyProductSwitch())) {
|
|
|
|
} else if (orderEntity != null && CollUtil.isNotEmpty(codeEnttitys) && IntUtil.value(collectSet.getSplitOutOnlyProductSwitch())) {
|
|
|
|
for (IoCodeTempEntity ioOrderDetailCodeEntity : codeEnttitys) {
|
|
|
|
for (IoCodeTempEntity ioOrderDetailCodeEntity : codeEnttitys) {
|
|
|
@ -700,8 +693,7 @@ public class AddCoodeService {
|
|
|
|
genDetaiEntity = codeEnttity;
|
|
|
|
genDetaiEntity = codeEnttity;
|
|
|
|
if (baseResponse == null) {
|
|
|
|
if (baseResponse == null) {
|
|
|
|
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
baseResponse = checkSupId(bussinessTypeEntity, codeEnttity, unitFk);
|
|
|
|
if (baseResponse != null)
|
|
|
|
if (baseResponse != null) return baseResponse;
|
|
|
|
return baseResponse;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (baseResponse.getCode() == 501) {
|
|
|
|
if (baseResponse.getCode() == 501) {
|
|
|
|
return baseResponse;
|
|
|
|
return baseResponse;
|
|
|
@ -763,8 +755,7 @@ public class AddCoodeService {
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(codeEnttity);
|
|
|
|
if (errMsg != null) {
|
|
|
|
if (errMsg != null) {
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
} else
|
|
|
|
} else codeTempService.insert(codeEnttity);
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
|
|
|
// 查询是否存在药品关联信息 后将结果更新至 temp表
|
|
|
|
// 查询是否存在药品关联信息 后将结果更新至 temp表
|
|
|
|
updateRelCode(bussinessTypeEntity, code);
|
|
|
|
updateRelCode(bussinessTypeEntity, code);
|
|
|
|
// relCodeBatchService.threadUpdateIoCodeTempEntity(code);
|
|
|
|
// relCodeBatchService.threadUpdateIoCodeTempEntity(code);
|
|
|
@ -773,13 +764,12 @@ public class AddCoodeService {
|
|
|
|
String errMsg = ioCheckInoutService.checkDrugNoPiCode(codeEnttity);
|
|
|
|
String errMsg = ioCheckInoutService.checkDrugNoPiCode(codeEnttity);
|
|
|
|
if (errMsg != null) {
|
|
|
|
if (errMsg != null) {
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
return ResultVOUtils.error(500, errMsg);
|
|
|
|
} else
|
|
|
|
} else codeTempService.insert(codeEnttity);
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
|
|
|
|
// 异步调用 查询是否存在药品关联信息 后将结果更新至 temp表
|
|
|
|
// 异步调用 查询是否存在药品关联信息 后将结果更新至 temp表
|
|
|
|
updateRelCode(bussinessTypeEntity, code);
|
|
|
|
updateRelCode(bussinessTypeEntity, code);
|
|
|
|
// relCodeBatchService.threadUpdateIoCodeTempEntity(code);
|
|
|
|
// relCodeBatchService.threadUpdateIoCodeTempEntity(code);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
checkPrice(codeEnttity, bussinessTypeEntity, inBatch, codeEnttitys);
|
|
|
|
// checkPrice(codeEnttity, bussinessTypeEntity, inBatch, codeEnttity);
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
codeTempService.insert(codeEnttity);
|
|
|
|
updateRelCode(bussinessTypeEntity, code);
|
|
|
|
updateRelCode(bussinessTypeEntity, code);
|
|
|
|
|
|
|
|
|
|
|
@ -787,11 +777,113 @@ public class AddCoodeService {
|
|
|
|
// relCodeBatchService.threadUpdateIoCodeTempEntity(code);
|
|
|
|
// relCodeBatchService.threadUpdateIoCodeTempEntity(code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
orderService.update(orderEntity);
|
|
|
|
addCodeResult.setOrderId(orderId);
|
|
|
|
addCodeResult.setOrderId(orderId);
|
|
|
|
transInoutService.genOrderDetailCode(orderEntity, genDetaiEntity);
|
|
|
|
// genOrderDetailCode(orderEntity, genDetaiEntity);
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
return ResultVOUtils.success(addCodeResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private IoOrderDetailCodeDao orderDetailCodeDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<IoOrderDetailCodeEntity> genOrderDetailCode(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity) {
|
|
|
|
|
|
|
|
List<IoOrderDetailCodeEntity> ioOrderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().select("id", "count", "reCount", "bindRlFk", "batchNo", "price").eq("orderIdFk", orderEntity.getBillNo()));
|
|
|
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectSupGroupById(codeTempEntity.getRelId(), codeTempEntity.getSupId());
|
|
|
|
|
|
|
|
if (codeTempEntity.getPrice() == null && udiRelevanceResponse.getPrice() != null) {
|
|
|
|
|
|
|
|
codeTempService.updateById(IoCodeTempEntity.builder().id(codeTempEntity.getId()).price(udiRelevanceResponse.getPrice()).build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(ioOrderDetailCodeEntities)) {
|
|
|
|
|
|
|
|
orderDetailCodeDao.insert(ioAddInoutService.buildEntity(orderEntity, codeTempEntity, udiRelevanceResponse));
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().select("id", "count", "reCount", "bindRlFk", "batchNo", "price").eq("orderIdFk", orderEntity.getBillNo()));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// && BigDecimalUtil.equalTo(IntUtil.value(orderDetailCodeEntity.getPrice()), IntUtil.value(codeTempEntity.getPrice())
|
|
|
|
|
|
|
|
boolean isUpdate = false;
|
|
|
|
|
|
|
|
for (IoOrderDetailCodeEntity orderDetailCodeEntity : ioOrderDetailCodeEntities) {
|
|
|
|
|
|
|
|
if (orderDetailCodeEntity.getBindRlFk().longValue() == udiRelevanceResponse.getId().longValue() && StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo()).equals(StrUtil.trimToEmpty(codeTempEntity.getBatchNo()))) {
|
|
|
|
|
|
|
|
orderDetailCodeEntity.setCount(orderDetailCodeEntity.getCount() + codeTempEntity.getMyCount());
|
|
|
|
|
|
|
|
orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getReCount() + codeTempEntity.getMyReCount());
|
|
|
|
|
|
|
|
UpdateWrapper<IoOrderDetailCodeEntity> updateWrapper = new UpdateWrapper<>();
|
|
|
|
|
|
|
|
updateWrapper.set("count", orderDetailCodeEntity.getCount()).set("reCount", orderDetailCodeEntity.getReCount());
|
|
|
|
|
|
|
|
orderDetailCodeEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
orderDetailCodeDao.updateCount(orderDetailCodeEntity);
|
|
|
|
|
|
|
|
isUpdate = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isUpdate) {
|
|
|
|
|
|
|
|
orderDetailCodeDao.insert(ioAddInoutService.buildEntity(orderEntity, codeTempEntity, udiRelevanceResponse));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ioOrderDetailCodeEntities;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 批量处理码实体生成订单明细码
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param orderEntity 订单实体
|
|
|
|
|
|
|
|
* @param codeTempEntities 码实体列表
|
|
|
|
|
|
|
|
* @return 处理后的订单明细码列表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public List<IoOrderDetailCodeEntity> genOrderDetailCodeBatch(IoOrderEntity orderEntity, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(codeTempEntities)) {
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前订单的所有明细码
|
|
|
|
|
|
|
|
List<IoOrderDetailCodeEntity> ioOrderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().select("id", "count", "reCount", "bindRlFk", "batchNo", "price").eq("orderIdFk", orderEntity.getBillNo()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 按照关联ID和批次号分组码实体
|
|
|
|
|
|
|
|
Map<String, List<IoCodeTempEntity>> groupedTempEntities = codeTempEntities.stream().collect(Collectors.groupingBy(entity -> entity.getRelId() + ":" + StrUtil.trimToEmpty(entity.getBatchNo())));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理每个分组
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<IoCodeTempEntity>> entry : groupedTempEntities.entrySet()) {
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> group = entry.getValue();
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(group)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IoCodeTempEntity representative = group.get(0);
|
|
|
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectSupGroupById(representative.getRelId(), representative.getSupId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算该组的总数量
|
|
|
|
|
|
|
|
int totalCount = group.stream().mapToInt(IoCodeTempEntity::getMyCount).sum();
|
|
|
|
|
|
|
|
int totalReCount = group.stream().mapToInt(IoCodeTempEntity::getMyReCount).sum();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新价格信息
|
|
|
|
|
|
|
|
for (IoCodeTempEntity entity : group) {
|
|
|
|
|
|
|
|
if (entity.getPrice() == null && udiRelevanceResponse != null && udiRelevanceResponse.getPrice() != null) {
|
|
|
|
|
|
|
|
codeTempService.updateById(IoCodeTempEntity.builder().id(entity.getId()).price(udiRelevanceResponse.getPrice()).build());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果没有现有明细码或未找到匹配的明细码,则创建新的
|
|
|
|
|
|
|
|
boolean isUpdate = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(ioOrderDetailCodeEntities)) {
|
|
|
|
|
|
|
|
for (IoOrderDetailCodeEntity orderDetailCodeEntity : ioOrderDetailCodeEntities) {
|
|
|
|
|
|
|
|
if (orderDetailCodeEntity.getBindRlFk().longValue() == representative.getRelId().longValue() && StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo()).equals(StrUtil.trimToEmpty(representative.getBatchNo()))) {
|
|
|
|
|
|
|
|
// 更新现有明细码的数量
|
|
|
|
|
|
|
|
orderDetailCodeEntity.setCount(orderDetailCodeEntity.getCount() + totalCount);
|
|
|
|
|
|
|
|
orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getReCount() + totalReCount);
|
|
|
|
|
|
|
|
orderDetailCodeEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
orderDetailCodeDao.updateCount(orderDetailCodeEntity);
|
|
|
|
|
|
|
|
isUpdate = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果没有更新现有记录,则创建新记录
|
|
|
|
|
|
|
|
if (!isUpdate) {
|
|
|
|
|
|
|
|
orderDetailCodeDao.insert(buildEntity(orderEntity, representative, udiRelevanceResponse, totalCount, totalReCount));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 返回最新的明细码列表
|
|
|
|
|
|
|
|
return orderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().select("id", "count", "reCount", "bindRlFk", "batchNo", "price").eq("orderIdFk", orderEntity.getBillNo()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getMaxGroupNumber() {
|
|
|
|
public Integer getMaxGroupNumber() {
|
|
|
|
Integer groupNumber = codeTempService.selectMaxGroupNumber();
|
|
|
|
Integer groupNumber = codeTempService.selectMaxGroupNumber();
|
|
|
|
return groupNumber;
|
|
|
|
return groupNumber;
|
|
|
@ -845,8 +937,7 @@ public class AddCoodeService {
|
|
|
|
long recentTime = Math.abs(recent * 24 * 60 * 60 * 1000);
|
|
|
|
long recentTime = Math.abs(recent * 24 * 60 * 60 * 1000);
|
|
|
|
long resultTime = expireTime - System.currentTimeMillis();
|
|
|
|
long resultTime = expireTime - System.currentTimeMillis();
|
|
|
|
if (resultTime > 0 && resultTime < recentTime) {
|
|
|
|
if (resultTime > 0 && resultTime < recentTime) {
|
|
|
|
long time = udiRelevanceResponse.getIsDateBy() == 2
|
|
|
|
long time = udiRelevanceResponse.getIsDateBy() == 2 ? resultTime / (60 * 60 * 1000) // 单位:小时
|
|
|
|
? resultTime / (60 * 60 * 1000) // 单位:小时
|
|
|
|
|
|
|
|
: resultTime / (24 * 60 * 60 * 1000); // 单位:天
|
|
|
|
: resultTime / (24 * 60 * 60 * 1000); // 单位:天
|
|
|
|
String unit = udiRelevanceResponse.getIsDateBy() == 2 ? "时" : "天";
|
|
|
|
String unit = udiRelevanceResponse.getIsDateBy() == 2 ? "时" : "天";
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + unit + ",是否确定继续添加?");
|
|
|
|
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + unit + ",是否确定继续添加?");
|
|
|
@ -904,31 +995,30 @@ public class AddCoodeService {
|
|
|
|
|
|
|
|
|
|
|
|
public List<IoCodeTempEntity> isExitLocalList(String code, List<IoCodeTempEntity> codeEnttityList) {
|
|
|
|
public List<IoCodeTempEntity> isExitLocalList(String code, List<IoCodeTempEntity> codeEnttityList) {
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
List<IoCodeTempEntity> codeTempEntities = codeEnttityList.stream()
|
|
|
|
List<IoCodeTempEntity> codeTempEntities = codeEnttityList.stream().filter(item -> {
|
|
|
|
.filter(item -> {
|
|
|
|
if (item.getCode().equals(code)) {
|
|
|
|
if (item.getCode().equals(code)) {
|
|
|
|
if (StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
if (StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!StrUtil.emptyIfNull(item.getNameCode()).equals(StrUtil.emptyIfNull(udiEntity.getUdi()))) {
|
|
|
|
if (!StrUtil.emptyIfNull(item.getNameCode()).equals(StrUtil.emptyIfNull(udiEntity.getUdi()))) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!StrUtil.emptyIfNull(item.getBatchNo()).toUpperCase(Locale.ROOT).equals(StrUtil.emptyIfNull(udiEntity.getBatchNo()).toUpperCase(Locale.ROOT))) {
|
|
|
|
if (!StrUtil.emptyIfNull(item.getBatchNo()).toUpperCase(Locale.ROOT).equals(StrUtil.emptyIfNull(udiEntity.getBatchNo()).toUpperCase(Locale.ROOT))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getProduceDate()).equals(StrUtil.emptyIfNull(udiEntity.getProduceDate()))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}).sorted(Comparator.comparing(IoCodeTempEntity::getInBatchNo)).collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getProduceDate()).equals(StrUtil.emptyIfNull(udiEntity.getProduceDate()))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getExpireDate()).equals(StrUtil.emptyIfNull(udiEntity.getExpireDate()))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StrUtil.emptyIfNull(item.getSerialNo()).equals(StrUtil.emptyIfNull(udiEntity.getSerialNo()))) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(IoCodeTempEntity::getInBatchNo)).collect(Collectors.toList());
|
|
|
|
Collections.reverse(codeTempEntities);
|
|
|
|
Collections.reverse(codeTempEntities);
|
|
|
|
return codeTempEntities;
|
|
|
|
return codeTempEntities;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -970,13 +1060,11 @@ public class AddCoodeService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param purType 1:入账库;2:预验收库;3:寄售库
|
|
|
|
* @param purType 1:入账库;2:预验收库;3:寄售库
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse
|
|
|
|
public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse udiRelevanceEntity, Integer purType) {
|
|
|
|
udiRelevanceEntity, Integer purType) {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getUseDyCount() == 2) {
|
|
|
|
if (bussinessTypeEntity.getUseDyCount() == 2) {
|
|
|
|
if (IntUtil.value(udiRelevanceEntity.getPurType()) == IntUtil.value(purType)) {
|
|
|
|
if (IntUtil.value(udiRelevanceEntity.getPurType()) == IntUtil.value(purType)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
} else return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1006,8 +1094,7 @@ public class AddCoodeService {
|
|
|
|
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
|
|
|
|
return ResultVOUtils.error(501, "耗材字典不存在此产品!");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
codeEnttity.setStatus(0);
|
|
|
|
codeEnttity.setStatus(0);
|
|
|
|
if (codeEnttity.getRelId() == null)
|
|
|
|
if (codeEnttity.getRelId() == null) codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
codeEnttity.setRelId(udiRelevanceEntities.get(0).getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -1015,8 +1102,7 @@ public class AddCoodeService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
//校验供应商是否配送此产品
|
|
|
|
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity
|
|
|
|
public BaseResponse checkCorp(IoCodeTempEntity codeEnttity, BasicBussinessTypeEntity bussinessTypeEntity, String unitFk) {
|
|
|
|
bussinessTypeEntity, String unitFk) {
|
|
|
|
|
|
|
|
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
|
|
|
|
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeEnttity.getCode());
|
|
|
|
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
|
|
|
|
companyProductRelevanceRequest.setNameCode(udiEntity.getUdi());
|
|
|
@ -1047,11 +1133,7 @@ public class AddCoodeService {
|
|
|
|
* @param codeEnttitys 码实体列表
|
|
|
|
* @param codeEnttitys 码实体列表
|
|
|
|
* @return 是否处理成功
|
|
|
|
* @return 是否处理成功
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private boolean handleCodeCheckAndUpdate(BasicBussinessTypeEntity bussinessTypeEntity,
|
|
|
|
private boolean handleCodeCheckAndUpdate(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity genDetaiEntity, IoCodeTempEntity exitLocalEntity, String inBatch, List<IoCodeTempEntity> codeEnttitys) {
|
|
|
|
IoCodeTempEntity genDetaiEntity,
|
|
|
|
|
|
|
|
IoCodeTempEntity exitLocalEntity,
|
|
|
|
|
|
|
|
String inBatch,
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> codeEnttitys) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (bussinessTypeEntity.getCheckWebNew() == 1 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
if (bussinessTypeEntity.getCheckWebNew() == 1 && bussinessTypeEntity.isCheckEnable()) {
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
|
String errMsg = ioCheckInoutService.checkCode(genDetaiEntity);
|
|
|
@ -1073,17 +1155,11 @@ public class AddCoodeService {
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
if (bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
if (bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
//1.获取当前批次已出库数量
|
|
|
|
//1.获取当前批次已出库数量
|
|
|
|
Integer outCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "",
|
|
|
|
Integer outCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_OUT);
|
|
|
|
exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(),
|
|
|
|
|
|
|
|
exitLocalEntity.getInvCode(), ConstantType.TYPE_OUT);
|
|
|
|
|
|
|
|
//2.获取当前批次入库数量
|
|
|
|
//2.获取当前批次入库数量
|
|
|
|
Integer inCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "",
|
|
|
|
Integer inCount = invProductServiceNew.selectCountByInBatch(exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT);
|
|
|
|
exitLocalEntity.getBatchNo(), bussinessTypeEntity, exitLocalEntity.getInBatchNo(),
|
|
|
|
|
|
|
|
exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT);
|
|
|
|
|
|
|
|
if ((IntUtil.value(inCount) - IntUtil.value(outCount) - IntUtil.value(exitLocalEntity.getReCount())) < 0) {
|
|
|
|
if ((IntUtil.value(inCount) - IntUtil.value(outCount) - IntUtil.value(exitLocalEntity.getReCount())) < 0) {
|
|
|
|
InvProductNewVo nextInvProduct = invProductServiceNew.selectNextInBatch(bussinessTypeEntity,
|
|
|
|
InvProductNewVo nextInvProduct = invProductServiceNew.selectNextInBatch(bussinessTypeEntity, exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), exitLocalEntity.getInvCode(), ConstantType.TYPE_PUT, exitLocalEntity.getInBatchNo());
|
|
|
|
exitLocalEntity.getRelId() + "", exitLocalEntity.getBatchNo(), exitLocalEntity.getInvCode(),
|
|
|
|
|
|
|
|
ConstantType.TYPE_PUT, exitLocalEntity.getInBatchNo());
|
|
|
|
|
|
|
|
if (nextInvProduct != null) {
|
|
|
|
if (nextInvProduct != null) {
|
|
|
|
genDetaiEntity.setPrice(nextInvProduct.getPrice());
|
|
|
|
genDetaiEntity.setPrice(nextInvProduct.getPrice());
|
|
|
|
genDetaiEntity.setInBatchNo(nextInvProduct.getInBatchNo());
|
|
|
|
genDetaiEntity.setInBatchNo(nextInvProduct.getInBatchNo());
|
|
|
@ -1114,8 +1190,7 @@ public class AddCoodeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//校验供应商唯一性
|
|
|
|
//校验供应商唯一性
|
|
|
|
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity
|
|
|
|
public BaseResponse checkSupId(BasicBussinessTypeEntity bussinessTypeEntity, IoCodeTempEntity codeEnttity, String unitFk) {
|
|
|
|
codeEnttity, String unitFk) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT) || bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_RETURN)))
|
|
|
|
if ((bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_OUT) || bussinessTypeEntity.getAction().equals(ConstantType.SPLIT_RETURN)))
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -1144,8 +1219,7 @@ public class AddCoodeService {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void checkPrice(IoCodeTempEntity codeTempEntity, BasicBussinessTypeEntity bussinessTypeEntity, String
|
|
|
|
public void checkPrice(IoCodeTempEntity codeTempEntity, BasicBussinessTypeEntity bussinessTypeEntity, String inBatch, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
inBatch, List<IoCodeTempEntity> codeTempEntities) {
|
|
|
|
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
String priceFifo = systemParamConfigService.selectValueByParamKey("price_fifo");
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
if (IntUtil.value(priceFifo) > 0) {
|
|
|
|
//入库时添加入库批号
|
|
|
|
//入库时添加入库批号
|
|
|
@ -1166,10 +1240,45 @@ public class AddCoodeService {
|
|
|
|
if (bussinessTypeEntity.getUseDyCount() == 2) {
|
|
|
|
if (bussinessTypeEntity.getUseDyCount() == 2) {
|
|
|
|
if (udiRelevanceService.findPurType(relId) == IntUtil.value(purType)) {
|
|
|
|
if (udiRelevanceService.findPurType(relId) == IntUtil.value(purType)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
} else return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IoOrderDetailCodeEntity buildEntity(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity, UdiRelevanceResponse udiRelevanceResponse, int totalCount, int totalReCount) {
|
|
|
|
|
|
|
|
IoOrderDetailCodeEntity ioOrderDetailCodeEntity = new IoOrderDetailCodeEntity();
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setOrderIdFk(orderEntity.getBillNo());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setBindRlFk(udiRelevanceResponse.getId());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setUuidFk(udiRelevanceResponse.getUuid());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setBatchNo(codeTempEntity.getBatchNo());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setNameCode(codeTempEntity.getNameCode());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setProductDate(codeTempEntity.getProduceDate());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setExpireDate(codeTempEntity.getExpireDate());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setCoName(udiRelevanceResponse.getCpmctymc());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setCertCode(udiRelevanceResponse.getZczbhhzbapzbh());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setYlqxzcrbarmc(udiRelevanceResponse.getYlqxzcrbarmc());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setManufacturer(udiRelevanceResponse.getManufactory());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setMeasname(udiRelevanceResponse.getMeasname());
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(udiRelevanceResponse.getGgxh())) {
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setSpec(udiRelevanceResponse.getBzgg());
|
|
|
|
|
|
|
|
} else ioOrderDetailCodeEntity.setSpec(udiRelevanceResponse.getGgxh());
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(udiRelevanceResponse.getMeasname())) {
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setMeasname(udiRelevanceResponse.getUseLevelUnit());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setSupId(codeTempEntity.getSupId());
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setProductType(codeTempEntity.getProductType());
|
|
|
|
|
|
|
|
if (codeTempEntity.getPrice() == null) {
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setPrice(udiRelevanceResponse.getPrice());
|
|
|
|
|
|
|
|
codeTempEntity.setPrice(udiRelevanceResponse.getPrice());
|
|
|
|
|
|
|
|
codeTempService.updateById(codeTempEntity);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setPrice(codeTempEntity.getPrice());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setCount(totalCount);
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setReCount(totalReCount);
|
|
|
|
|
|
|
|
ioOrderDetailCodeEntity.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
return ioOrderDetailCodeEntity;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|