4/1 优化退货1.0

dev_2.5_inv
wangwei 3 days ago
parent f0dcbf0717
commit 791311fe99

@ -18,9 +18,7 @@ import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.collect.CollectOrderCodeManResponse;
import com.glxp.api.res.inout.VailCodeResultResponse;
import com.glxp.api.res.inout.VailTagResultResponse;
import com.glxp.api.service.collect.IoCollectOrderBizService;
import com.glxp.api.service.collect.IoCollectOrderCodeManService;
import com.glxp.api.service.collect.IoCollectOrderService;
import com.glxp.api.service.collect.*;
import com.glxp.api.util.IntUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
@ -49,6 +47,7 @@ public class IoCollectOrderCodeManController extends BaseController {
@Resource
IoCollectOrderCodeManService collectOrderCodeManService;
/**
*
*

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.CusRedissonAnnotation;
import com.glxp.api.annotation.RepeatSubmit;
@ -332,8 +333,8 @@ public class IoCollectOrderController extends BaseController {
BeanUtils.copyProperties(collectOrderRequest, collectOrder);
collectOrder.setUpdateTime(new Date());
collectOrder.setUpdateUser(getUserId());
collectOrderService.updateById(collectOrder);
boolean update = collectOrderService.update(new LambdaUpdateWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, collectOrder.getBillNo())
.set(IoCollectOrder::getTagStatus, 2).set(IoCollectOrder::getUpdateUser,getUserId()));
if (collectOrder.getTagStatus() == 2) {
collectOrderOriginService.update(new LambdaUpdateWrapper<IoCollectOrderOrigin>().eq(IoCollectOrderOrigin::getBillNo, collectOrder.getBillNo())
.set(IoCollectOrderOrigin::getTagStatus, 2));
@ -621,4 +622,14 @@ public class IoCollectOrderController extends BaseController {
}
@Resource
IoCollectOriginService collectOriginService;
@PostMapping("/udiwms/basic/collect/order/finishReturnOrder")
@Transactional(rollbackFor = Exception.class)
public BaseResponse finishReturnOrder(@RequestBody CollectOrderRequest collectOrderRequest) {
return collectOriginService.submitreturnOrder(collectOrderRequest);
}
}

@ -126,6 +126,7 @@ public class UdiProductEntity {
@TableField(exist = false)
//本地生成信息
private String batchNo;
@TableField(exist = false)
private String produceDate;
@TableField(exist = false)
private String expireDate;

@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.basic.BasicProductsDao;
import com.glxp.api.dao.collect.IoCollectOrderBizMapper;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.collect.IoCollectOrderBiz;
import com.glxp.api.req.collect.CollectOrderBizRequest;
@ -24,7 +26,7 @@ public class IoCollectOrderBizService extends ServiceImpl<IoCollectOrderBizMappe
IoCollectOrderBizMapper collectOrderBizMapper;
@Resource
UdiProductService udiProductService;
private BasicProductsDao basicProductsDao;
public List<CollectOrderBizResponse> filterList(CollectOrderBizRequest collectOrderRequest) {
@ -44,9 +46,25 @@ public class IoCollectOrderBizService extends ServiceImpl<IoCollectOrderBizMappe
//设置 应该扫码数量 shouldCount
if (data.size() > 0){
for (CollectOrderBizResponse collectOrderBizResponse : data){
UdiProductEntity product = udiProductService.selectUdiByName(collectOrderBizResponse.getNameCode());
Integer myBhxjsl = product.getMyBhxjsl();
collectOrderBizResponse.setShouldCount(collectOrderBizResponse.getCount() / myBhxjsl);
List<BasicProductsEntity> productList = basicProductsDao.selectList(
new LambdaQueryWrapper<BasicProductsEntity>()
.eq(BasicProductsEntity::getYbbm, collectOrderBizResponse.getYbbm())
.eq(BasicProductsEntity::getPackLevel, "1"));
BasicProductsEntity product = productList.get(0);
Integer myBhxjsl = product.getBhxjsl();
Integer shouldCount = 0;
double quotient = (double)collectOrderBizResponse.getCount() / myBhxjsl;
int integerPart = (int) quotient;
if (quotient == integerPart) {
if (integerPart == 0){
shouldCount = 1;
}else {
shouldCount = integerPart;
}
} else {
shouldCount = integerPart + 1;
}
collectOrderBizResponse.setShouldCount(shouldCount);
if (collectOrderBizResponse.getScanCount() == null){
collectOrderBizResponse.setScanCount(0);
}

@ -27,9 +27,11 @@ import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.collect.CollectOrderCodeManRequest;
import com.glxp.api.req.collect.IoCollectCodeRequest;
import com.glxp.api.req.inout.AddTagCodeReqeust;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.collect.CollectOrderCodeManResponse;
import com.glxp.api.res.collect.IoCollectCodeResponse;
import com.glxp.api.res.collect.RelCodeDetailResponse;
import com.glxp.api.res.inout.AddEnterCodeResponse;
import com.glxp.api.res.inout.VailCodeResultResponse;
@ -95,7 +97,7 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
IoSplitCodeService splitCodeService;
@Resource
IoCollectCodeBackService ioCollectCodeBackService;
private IoCollectCodeBackService ioCollectCodeBackService;
@Resource
private IBasicBussinessTypeService basicBussinessTypeService;
@ -190,6 +192,22 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
}
}
//如果是处方退药的码 要去校验是 否是 原始单据处方已完成的码
if (addTagCodeReqeust.getBusType().startsWith("YPCFTF")){
collectOrder = collectOrderService.getByBillNo(addTagCodeReqeust.getBillNo());
IoCollectCodeRequest ioCollectCodeRequest = new IoCollectCodeRequest();
ioCollectCodeRequest.setBillNo(collectOrder.getRemark());
ioCollectCodeRequest.setCode(code);
List<IoCollectCodeResponse> ioCollectCodeResponses = ioCollectCodeBackService.filterList(ioCollectCodeRequest);
if (ioCollectCodeResponses.size() == 0){
throw new JsonException(500, "当前追溯码非原始处方追溯码");
}
IoCollectCodeResponse ioCollectCodeResponse = ioCollectCodeResponses.get(0);
if (!ioCollectCodeResponse.getCode().equals(code)){
throw new JsonException(500, "当前追溯码非原始处方追溯码");
}
}
//2-1.校验预验收库存是否已存在
String preInBillNo = addTagCodeReqeust.getPreInBillNo();
String orderId = addTagCodeReqeust.getBillNo();
@ -420,14 +438,17 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
throw new JsonException(500, "当前追溯码已被其他单据关联!");
}
if (splitCodeEntity != null && StrUtil.isNotEmpty(splitCodeEntity.getSerialNo())) {
if (IntUtil.value(splitCodeEntity.getRemainCount()) < 1) {
throw new JsonException(500, "当前追溯码已被拆零!");
} else {
circleCount = splitCodeEntity.getRemainCount();
useCount = splitCodeEntity.getRemainCount();
if (!addTagCodeReqeust.getBusType().startsWith("YPCFTF")){
if (splitCodeEntity != null && StrUtil.isNotEmpty(splitCodeEntity.getSerialNo())) {
if (IntUtil.value(splitCodeEntity.getRemainCount()) < 1) {
throw new JsonException(500, "当前追溯码已被拆零!");
} else {
circleCount = splitCodeEntity.getRemainCount();
useCount = splitCodeEntity.getRemainCount();
}
}
}
if (IntUtil.value(collectOrder.getOrderCirType()) == 1) {
scanCount = circleCount;
} else {
@ -469,25 +490,27 @@ public class IoCollectOrderCodeManService extends ServiceImpl<IoCollectOrderCode
int count1 = IntUtil.value(collectOrderBiz.getScanCount()) + 1;
int actCount1 = 0;
actCount1 = IntUtil.value(collectOrderBiz.getScanActCount()) + scanCount;
if (actCount1 > IntUtil.value(collectOrderBiz.getCount())) {
int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount());
if (needCount > 0) {
if (vailInSplit(collectOrderBiz, putWorkPlaceCode, needCount)) {
throw new JsonException(502, collectOrderBiz.getCpmctymc() + "拆零数量还有剩余,是否继续添加?");
}
int myUseCount = calCountUtil.getUseActCount(udiRelevanceResponse);
if (needCount > myUseCount) {
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
} else {
collectOrderBiz.setSplitUnCheck(true);
if (IntUtil.value(collectSet.getLastCodeSplit())) {
throw new JsonException(503, collectOrderBiz.getId() + ";" + count1 + ";" + collectOrderBiz.getCpmctymc() + ";" + "扫码数量超出!");
if (!addTagCodeReqeust.getBusType().startsWith("YPCFTF")){
if (actCount1 > IntUtil.value(collectOrderBiz.getCount())) {
int needCount = IntUtil.value(collectOrderBiz.getCount()) - IntUtil.value(collectOrderBiz.getScanActCount());
if (needCount > 0) {
if (vailInSplit(collectOrderBiz, putWorkPlaceCode, needCount)) {
throw new JsonException(502, collectOrderBiz.getCpmctymc() + "拆零数量还有剩余,是否继续添加?");
}
int myUseCount = calCountUtil.getUseActCount(udiRelevanceResponse);
if (needCount > myUseCount) {
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
} else {
collectOrderBiz.setSplitUnCheck(true);
if (IntUtil.value(collectSet.getLastCodeSplit())) {
throw new JsonException(503, collectOrderBiz.getId() + ";" + count1 + ";" + collectOrderBiz.getCpmctymc() + ";" + "扫码数量超出!");
}
}
} else {
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
}
} else {
throw new JsonException(500, collectOrderBiz.getCpmctymc() + "扫码数量超出!");
}
}
}
collectOrderBiz.setAddScanCount(1);
collectOrderBiz.setAddScanActCount(scanCount);

@ -78,6 +78,9 @@ public class IoCollectOriginService {
@Resource
private IoSplitFifoInvService splitFifoInvService;
@Resource
IoCollectOrderCodeManService ioCollectOrderCodeManService;
public BaseResponse downloadOrderV2(CollectOrderRequest collectOrderRequest) {
@ -273,7 +276,7 @@ public class IoCollectOriginService {
//码明细
for(IoCollectCodeResponse ioCollectCodeResponse : ioCollectCodeResponses){
//拆零码
if (ioCollectCodeResponse.getIsSplitCode() == 1){
if (ioCollectCodeResponse.getIsSplitCode() == 1 && ioCollectCodeResponse.getReCount() != null && ioCollectCodeResponse.getReCount() != 0 ){
//退回拆零码
IoSplitCodeEntity splitCode = splitCodeService.getOne(new LambdaQueryWrapper<IoSplitCodeEntity>().eq(IoSplitCodeEntity::getCode, ioCollectCodeResponse.getCode()));
//拆零码存在直接加库存
@ -355,6 +358,10 @@ public class IoCollectOriginService {
collectOrderOriginService.updateById(collectOrder);
ioCollectOrderBizBackupService.saveBatch(ioCollectOrderBizBackups);
collectOrderService.removeOrderByBillNo(ioCollectOrder);
List<IoCollectOrderCodeMan> list = ioCollectOrderCodeManService.list(new LambdaQueryWrapper<IoCollectOrderCodeMan>().eq(IoCollectOrderCodeMan::getOrderIdFk, collectOrder.getBillNo()));
if (list.size() > 0){
ioCollectOrderCodeManService.removeByBillNo(collectOrder.getBillNo());
}
return ResultVOUtils.success();
}

Loading…
Cancel
Save