
package com.tmerclub.cloud.order.service;

import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.order.bo.EsPurchaseOrderBO;
import com.tmerclub.cloud.order.dto.PurchaseOrderDTO;
import com.tmerclub.cloud.order.vo.PurchaseOrderVO;
import com.tmerclub.cloud.order.vo.PurchaseSpuImportVO;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 采购订单
 *
 * @author lhd
 * @date 2022-06-22 17:12:02
 */
public interface PurchaseOrderService {
    /**
     * 保存
     * @param purchaseOrder
     */
    void savePurchaseOrder(PurchaseOrderDTO purchaseOrder);

    /**
     * 采购订单详情
     * @param purchaseOrderId
     * @param supplierId
     * @return
     */
    PurchaseOrderVO info(Long purchaseOrderId, Long supplierId);

    /**
     * 发货
     * @param deliveryOrderParam
     *
     */
    void delivery(DeliveryOrderDTO deliveryOrderParam);

    /**
     * 更新采购订单付款凭证
     * @param purchaseOrder
     */
    void updatePayVoucher(PurchaseOrderDTO purchaseOrder);

    /**
     * 供应商审核采购订单付款凭证
     * @param purchaseOrder
     */
    void auditVoucher(PurchaseOrderDTO purchaseOrder);

    /**
     * 入库
     * @param purchaseOrder
     * @return
     */
    void inbound(PurchaseOrderDTO purchaseOrder);

    /**
     * 作废
     * @param shopId
     * @param purchaseOrderId
     */
    void nullify(Long shopId, Long purchaseOrderId);

    /**
     * 作废订单（通过仓库id）
     * @param warehouseId 仓库id
     */
    void nullifyByWarehouseId(Long warehouseId);

    /**
     * 完成采购订单
     * @param shopId
     * @param purchaseOrderId
     */
    void complete(Long shopId, Long purchaseOrderId);

    /**
     * 下载模板
     * @param response
     */
    void downloadModel(HttpServletResponse response);

    /**
     * 解析文件
     * @param excelFile excel文件
     * @param shopId 店铺id
     * @param warehouseId 仓库id
     * @return
     */
    PurchaseSpuImportVO parseFile(MultipartFile excelFile, Long shopId, Long warehouseId);

    /**
     * 获取采购订单需要保存到es中的数据
     * @param purchaseOrderId 采购订单id
     * @return
     */
    EsPurchaseOrderBO saveMongoAndGetEsInfo(Long purchaseOrderId);

    /**
     * 更新采购订单的状态
     * @param purchaseOrderIds 采购订单id
     * @param purchaseOrderStatus 采购订单状态
     * @return
     */
    void updatePurchaseOrderStatus(List<Long> purchaseOrderIds, Integer purchaseOrderStatus);

    /**
     * 统计未完成的采购订单数
     * @param warehouseId 仓库id
     * @return 未完成数
     */
    Long countUnFinish(Long warehouseId);
}
