|  |  |  | 
|---|
|  |  |  | 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.entity.DeliveryItem; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.enums.AsnExceStatus; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.mapper.DeliveryMapper; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.entity.Delivery; | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException("数据错误:单据信息不存在!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | deliveries.forEach(delivery -> { | 
|---|
|  |  |  | if (delivery.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)){ | 
|---|
|  |  |  | if (delivery.getExceStatus().equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val)){ | 
|---|
|  |  |  | if (!this.removeById(delivery.getId())) { | 
|---|
|  |  |  | throw new CoolException("主单删除失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!deliveryItemService.removeById(delivery.getId())) { | 
|---|
|  |  |  | if (!deliveryItemService.remove(new LambdaQueryWrapper<DeliveryItem>().eq(DeliveryItem::getDeliveryId,delivery.getId()))) { | 
|---|
|  |  |  | throw new CoolException("单据明细删除失败!1"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|