|
|
@@ -19,6 +19,7 @@ package org.springblade.purchase.sales.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.google.protobuf.ServiceException;
|
|
|
+import com.trade.purchase.order.enums.OrderTypeEnum;
|
|
|
import com.trade.purchase.order.vo.OrderDTO;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -101,6 +102,18 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return R.fail(500,"生成系统编号失败");
|
|
|
}
|
|
|
order.setSysNo((String) billNo.getData());
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(order.getCorpId());
|
|
|
+ if (corpMessage.isSuccess()){
|
|
|
+ R clientBillNo = serialClient.getBillNo(corpMessage.getData().getCode());
|
|
|
+ if (!clientBillNo.isSuccess()){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return R.fail(500,"生成订单编号失败");
|
|
|
+ }
|
|
|
+ order.setOrderNo((String) clientBillNo.getData());
|
|
|
+ if (!order.getBillType().equals(OrderTypeEnum.IMPORT.getType())){ //进口的orgOrderNo 存的是采购订单号 出口国内存的是本身的订单号码
|
|
|
+ order.setOrgOrderNo((String) clientBillNo.getData());
|
|
|
+ }
|
|
|
+ }
|
|
|
order.setTenantId(SecureUtil.getTenantId());
|
|
|
order.setCreateTime(date);
|
|
|
order.setCreateUser(SecureUtil.getUserId());
|
|
|
@@ -283,6 +296,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
throw new RuntimeException("生成系统编号失败");
|
|
|
}
|
|
|
+ selectById.setOrgOrderNo(selectById.getOrderNo());
|
|
|
+ R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(selectById.getCorpId());
|
|
|
+ if (corpMessage.isSuccess()){
|
|
|
+ R clientBillNo = serialClient.getBillNo(corpMessage.getData().getCode());
|
|
|
+ if (!clientBillNo.isSuccess()){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return R.fail(500,"生成订单编号失败");
|
|
|
+ }
|
|
|
+ selectById.setOrderNo((String) clientBillNo.getData());
|
|
|
+ }
|
|
|
selectById.setSrcId(order.getId());
|
|
|
selectById.setSrcOrderNo(selectById.getSysNo());
|
|
|
selectById.setId(null);
|