|
|
@@ -43,6 +43,8 @@ import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.deliver.goods.entity.Delivery;
|
|
|
+import org.springblade.deliver.goods.feign.IDeliveryClient;
|
|
|
import org.springblade.finance.dto.ApplyDTO;
|
|
|
import org.springblade.finance.feign.IFinanceClient;
|
|
|
import org.springblade.finance.vojo.Acc;
|
|
|
@@ -158,6 +160,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
private final IDictBizClient dictBizClient;
|
|
|
|
|
|
+ //收发货
|
|
|
+ private final IDeliveryClient deliveryClient;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public IPage<OrderVO> selectOrderPage(IPage<OrderVO> page, OrderVO order) {
|
|
|
@@ -1342,6 +1347,47 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
baseMapper.updateById(order);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 审批通过撤销审核
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class)
|
|
|
+ public void checkPassCancel(Long id) {
|
|
|
+ //当销售订单完成采购订单、工厂发货、客户收货、财务收款、付款任意一个,撤销审核不能用
|
|
|
+ //生成的 采购订单、工厂发货、客户收货订单删除后,允许撤销
|
|
|
+ //撤销审核后,该条销售账单明细删除;内贸锁定库存释放;销售订单状态变为【录入】;销售订单允许重新编辑、删除,允许重新生成采购、客户收货
|
|
|
+ //积分 溢付款 返利 还原
|
|
|
+
|
|
|
+ //获得当前销售订单信息
|
|
|
+ Order orderMessage = baseMapper.selectById(id);
|
|
|
+ if (orderMessage == null){//判断销售订单是否为null
|
|
|
+ throw new SecurityException("撤销失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据销售订单id获得采购订单
|
|
|
+ Order orderPurchase = baseMapper.selectOne(new LambdaQueryWrapper<Order>()
|
|
|
+ .eq(Order::getIsDeleted, 0)
|
|
|
+ .eq(Order::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Order::getSrcId, orderMessage.getId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(orderPurchase)){
|
|
|
+ throw new SecurityException("采购订单已存在,禁止撤销");
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据订单号获得工厂发货
|
|
|
+ List<Delivery> deliveryList = deliveryClient.getOrderMessage(orderMessage.getOrderNo(), OrderTypeEnum.DOMESTIC.getType());
|
|
|
+ if (CollectionUtils.isNotEmpty(deliveryList)) {
|
|
|
+ throw new SecurityException("收发货单据已存在,禁止撤销");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得财务收款信息
|
|
|
+ List<Settlement> settlementList = financeClient.selectSrcOrderNo(orderMessage.getOrderNo());
|
|
|
+ if (CollectionUtils.isNotEmpty(settlementList)) {
|
|
|
+ throw new SecurityException("收款单据已存在,禁止撤销");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void passSpecialCheck(Long id) {
|
|
|
Order order = baseMapper.selectById(id);
|