|
|
|
@ -3,9 +3,13 @@ package com.glxp.api.controller.inout;
|
|
|
|
|
import com.glxp.api.annotation.CusRedissonAnnotation;
|
|
|
|
|
import com.glxp.api.constant.*;
|
|
|
|
|
import com.glxp.api.entity.basic.*;
|
|
|
|
|
import com.glxp.api.entity.collect.IoCollectOrder;
|
|
|
|
|
import com.glxp.api.entity.inv.InvProductDetailEntity;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.req.collect.CollectOrderRequest;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderDetailCodeResponse;
|
|
|
|
|
import com.glxp.api.service.collect.IoCollectOrderService;
|
|
|
|
|
import com.glxp.api.service.collect.IoCollectOriginService;
|
|
|
|
|
import com.glxp.api.service.inout.impl.IoCodeService;
|
|
|
|
|
import com.glxp.api.service.inv.impl.InvProductDetailService;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
@ -96,6 +100,10 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
IoCheckInvService checkInvService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoSplitFifoCodeService splitFifoCodeService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCollectOriginService collectOriginService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCollectOrderService collectOrderService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* PDA-----单据上传
|
|
|
|
@ -216,20 +224,48 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
if (udiEntity == null) {
|
|
|
|
|
String sptmtodi = systemParamConfigService.selectValueByParamKey(Constant.SPTM_TO_DI);
|
|
|
|
|
if (sptmtodi.equals("1")) {
|
|
|
|
|
if (code.length() == 13) {
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.findBySptm(code);
|
|
|
|
|
if (udiProductEntity != null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(508, "UDI码格式错误");
|
|
|
|
|
baseResponse.setData(udiProductEntity);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
String viewType = addEnterCodeRequest.getViewType();
|
|
|
|
|
if (viewType.equals("tagCode")){
|
|
|
|
|
IoCollectOrder collectOrder = collectOrderService.getByBillNo(code);
|
|
|
|
|
if (collectOrder == null ){
|
|
|
|
|
//=============================================//
|
|
|
|
|
//本地数据库 无此单据时 触发 用billNo 到 处方下载方法 进行下载
|
|
|
|
|
CollectOrderRequest collectOrderRequest = new CollectOrderRequest();
|
|
|
|
|
collectOrderRequest.setBusType("YPCF002");
|
|
|
|
|
collectOrderRequest.setBillNo(code);
|
|
|
|
|
BaseResponse baseResponse = collectOriginService.downloadOrder(collectOrderRequest);
|
|
|
|
|
if (ResultEnum.SUCCESS.getCode() == baseResponse.getCode()){
|
|
|
|
|
collectOrder = collectOrderService.getByBillNo(code);
|
|
|
|
|
//=============================================//
|
|
|
|
|
BaseResponse response = ResultVOUtils.error(601, code);
|
|
|
|
|
response.setData(collectOrder);
|
|
|
|
|
return response;
|
|
|
|
|
}else {
|
|
|
|
|
BaseResponse response = ResultVOUtils.error(501, "UDI码格式错误");
|
|
|
|
|
response.setData(originCode);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
BaseResponse response = ResultVOUtils.error(601, code);
|
|
|
|
|
response.setData(collectOrder);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
} else{
|
|
|
|
|
String sptmtodi = systemParamConfigService.selectValueByParamKey(Constant.SPTM_TO_DI);
|
|
|
|
|
if (sptmtodi.equals("1")) {
|
|
|
|
|
if (code.length() == 13) {
|
|
|
|
|
UdiProductEntity udiProductEntity = udiProductService.findBySptm(code);
|
|
|
|
|
if (udiProductEntity != null) {
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(508, "UDI码格式错误");
|
|
|
|
|
baseResponse.setData(udiProductEntity);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "UDI码格式错误");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
BaseResponse baseResponse = ResultVOUtils.error(501, "UDI码格式错误");
|
|
|
|
|
baseResponse.setData(originCode);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(udiEntity.getProductType()) == 2) {
|
|
|
|
|
//药品
|
|
|
|
@ -773,12 +809,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入非集采产品!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getFifoSplit()) == 2 && IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前上货只允许录入整取产品!");
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getFifoSplit()) == 1 && !IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前上货只允许录入拆零产品!");
|
|
|
|
|
}
|
|
|
|
|
// if (IntUtil.value(addOrderRequest.getFifoSplit()) == 2 && IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前上货只允许录入整取产品!");
|
|
|
|
|
// }
|
|
|
|
|
// if (IntUtil.value(addOrderRequest.getFifoSplit()) == 1 && !IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前上货只允许录入拆零产品!");
|
|
|
|
|
// }
|
|
|
|
|
//计算实际数量
|
|
|
|
|
if (bussinessTypeEntity.isUse()) {
|
|
|
|
|
codeEnttity.setReCount(IntUtil.value(codeEnttity.getMyReCount()) + udiCalCountUtil.getUseActCount(udiRelevanceResponse));
|
|
|
|
@ -1061,9 +1097,9 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
exitLocalEntity.setCount(exitLocalEntity.getMyCount() + 1);
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isUse()) {
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getMyCount() * udiCalCountUtil.getUseActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getMyReCount() * udiCalCountUtil.getUseActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
} else {
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getMyCount() * udiCalCountUtil.getCirActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
exitLocalEntity.setReCount(exitLocalEntity.getMyReCount() * udiCalCountUtil.getCirActCount(udiRelevanceResponses.get(0)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isBlank(exitLocalEntity.getSerialNo())) {
|
|
|
|
@ -1185,12 +1221,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (bussinessTypeEntity.getVailGroupBuy() == 2 && udiRelevanceResponse.isGroupBuy()) { //只采集非集采产品
|
|
|
|
|
return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入非集采产品!");
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getFifoSplit()) == 2 && IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前上货只允许录入整取产品!");
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getFifoSplit()) == 1 && !IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前上货只允许录入拆零产品!");
|
|
|
|
|
}
|
|
|
|
|
// if (IntUtil.value(addOrderRequest.getFifoSplit()) == 2 && IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前上货只允许录入整取产品!");
|
|
|
|
|
// }
|
|
|
|
|
// if (IntUtil.value(addOrderRequest.getFifoSplit()) == 1 && !IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前上货只允许录入拆零产品!");
|
|
|
|
|
// }
|
|
|
|
|
//计算实际数量
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isUse()) {
|
|
|
|
@ -2147,12 +2183,12 @@ public class IoCodeTempController extends BaseController {
|
|
|
|
|
if (bussinessTypeEntity.getVailGroupBuy() == 2 && udiRelevanceResponse.isGroupBuy()) { //只采集非集采产品
|
|
|
|
|
return ResultVOUtils.error(500, bussinessTypeEntity.getName() + "单只允许录入非集采产品!");
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getFifoSplit()) == 2 && IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前上货只允许录入整取产品!");
|
|
|
|
|
}
|
|
|
|
|
if (IntUtil.value(addOrderRequest.getFifoSplit()) == 1 && !IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前上货只允许录入拆零产品!");
|
|
|
|
|
}
|
|
|
|
|
// if (IntUtil.value(addOrderRequest.getFifoSplit()) == 2 && IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前上货只允许录入整取产品!");
|
|
|
|
|
// }
|
|
|
|
|
// if (IntUtil.value(addOrderRequest.getFifoSplit()) == 1 && !IntUtil.value(udiRelevanceResponse.getSplitEnable())) {
|
|
|
|
|
// return ResultVOUtils.error(500, "当前上货只允许录入拆零产品!");
|
|
|
|
|
// }
|
|
|
|
|
//计算实际数量
|
|
|
|
|
codeEnttity.setReCount(IntUtil.value(codeEnttity.getMyReCount()) + udiCalCountUtil.getActCount(udiRelevanceResponse));
|
|
|
|
|
} else if (udiRelevanceResponses.size() == 0) {
|
|
|
|
|