|  |  | 
 |  |  | package com.vincent.rsf.server.manager.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.vincent.rsf.framework.exception.CoolException; | 
 |  |  | import com.vincent.rsf.server.common.exception.BusinessException; | 
 |  |  | import com.vincent.rsf.server.manager.enums.AsnExceStatus; | 
 |  |  | import com.vincent.rsf.server.manager.mapper.DeliveryMapper; | 
 |  |  | import com.vincent.rsf.server.manager.entity.Delivery; | 
 |  |  | import com.vincent.rsf.server.manager.service.DeliveryItemService; | 
 |  |  | import com.vincent.rsf.server.manager.service.DeliveryService; | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | @Service("deliveryService") | 
 |  |  | public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> implements DeliveryService { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private DeliveryItemService deliveryItemService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Delivery removeDo(List<Long> list) { | 
 |  |  |         List<Delivery> deliveries = this.list(new LambdaQueryWrapper<Delivery>().eq(Delivery::getId, list)); | 
 |  |  |         if (deliveries.isEmpty()) { | 
 |  |  |             throw new BusinessException("数据错误:单据信息不存在!!"); | 
 |  |  |         } | 
 |  |  |         deliveries.forEach(delivery -> { | 
 |  |  |             if (delivery.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)){ | 
 |  |  |                 if (!this.removeById(delivery.getId())) { | 
 |  |  |                     throw new CoolException("主单删除失败!!"); | 
 |  |  |                 } | 
 |  |  |                 if (!deliveryItemService.removeById(delivery.getId())) { | 
 |  |  |                     throw new CoolException("单据明细删除失败!1"); | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 throw new CoolException("单据已执行,不可执行删除操作!!"); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  | } |