|  |  | 
 |  |  | 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.api.entity.dto.PoItemsDto; | 
 |  |  | import com.vincent.rsf.server.api.service.ErpApiService; | 
 |  |  | import com.vincent.rsf.server.manager.entity.AsnOrderItem; | 
 |  |  | import com.vincent.rsf.server.manager.entity.Purchase; | 
 |  |  | import com.vincent.rsf.server.manager.entity.PurchaseItem; | 
 |  |  | import com.vincent.rsf.server.manager.mapper.AsnOrderItemMapper; | 
 |  |  | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; | 
 |  |  | import com.vincent.rsf.server.manager.entity.AsnOrder; | 
 |  |  | import com.vincent.rsf.server.manager.mapper.PurchaseMapper; | 
 |  |  | import com.vincent.rsf.server.manager.service.AsnOrderService; | 
 |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  |  | 
 |  |  | import javax.annotation.Resource; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Set; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author Ryan | 
 |  |  |  * @description | 
 |  |  |  * @throws | 
 |  |  |  * @return | 
 |  |  |  * @time 2025/3/7 08:02 | 
 |  |  |  */ | 
 |  |  | @Service("asnOrderService") | 
 |  |  | public class AsnOrderServiceImpl extends ServiceImpl<AsnOrderMapper, AsnOrder> implements AsnOrderService { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ErpApiService erpApiService; | 
 |  |  |     @Resource | 
 |  |  |     private PurchaseMapper purchaseMapper; | 
 |  |  |  | 
 |  |  |     @Resource | 
 |  |  |     private AsnOrderItemMapper asnOrderItemMapper; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public boolean notifyInspect(List<AsnOrder> orders) { | 
 |  |  |         if (orders.isEmpty()) { | 
 |  |  |             throw new CoolException("上报参数不能为空!!"); | 
 |  |  |         } | 
 |  |  |         Set<Long> asnIds = orders.stream().map(AsnOrder::getId).collect(Collectors.toSet()); | 
 |  |  |         if (asnIds.isEmpty()) { | 
 |  |  |             throw new CoolException("ASN单据不能为空!!"); | 
 |  |  |         } | 
 |  |  |         List<PoItemsDto> items = purchaseMapper.poList(asnIds); | 
 |  |  |         if (erpApiService.reportInspectNotify(items)) { | 
 |  |  |             return true; | 
 |  |  |         } else { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |