package com.clx.performance.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.param.app.AppGoodsOrderSearchParam;
import com.clx.performance.param.app.OrderGoodsListPageParam;
import com.clx.performance.param.feign.DistributionTruckParam;
import com.clx.performance.param.pc.*;
import com.clx.performance.vo.app.OrderGoodsAPPVO;
import com.clx.performance.vo.feign.FreightEstimateVO;
import com.clx.performance.vo.feign.OrderGoodsFeignVO;
import com.clx.performance.vo.pc.OrderGoodsEditVO;
import com.clx.performance.vo.pc.OrderGoodsVO;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author kavin
 * Date 2023-09-17
 * Time 16:45
 */
public interface OrderGoodsService {
    OrderGoodsVO getOrderGoodsInfoByOrderGoodsNoForPC(String orderGoodsNo);

    OrderGoodsVO getOrderGoodsInfoByOrderGoodsNoForAPP(String orderGoodsNo);

    IPage<OrderGoodsVO> pageOrderGoodsList(PageOrderGoodsListParam param);

    void updateOrderGoodsReduceWeightAndStatusAmountLoad(OrderGoods orderGoods, BigDecimal orderChildWeight, Integer orderGoodsStatus);

    void borrowWeight(OrderGoods orderGoods,String orderChildNo,BigDecimal subOrderGoodsResidue, BigDecimal addAlready,BigDecimal borrowOrderWeight,
            Integer orderGoodsStatus);


    void updateOrderGoodsReduceWeightAndStatus(OrderGoods orderGoods, OrderChild orderChild, Integer orderGoodsStatus);

    IPage<OrderGoodsAPPVO> indexOrderGoodsList(OrderGoodsListPageParam orderGoodsListParam);

    List<OrderGoodsFeignVO> getOrderGoodsListByOrderNo(String orderNo);

    List<OrderGoods> getOrderGoodsList(String orderNo, LocalDateTime lastArriveSendTime);

    /**
     * 获取订单取消的时候订单样式
     * @param orderNo
     * @return
     */
    String orderCancelStyle(String orderNo);

    /**
     * 获取当前订单可取消吨数
     * @param orderNo
     * @param optionType
     * @return
     */
    BigDecimal orderCancelResidueWeight(String orderNo,String optionType);

    void updateEditOrderGoods(UpdateEditOrderGoodsParam param);

    void updateOrderGoodsPrice(UpdateOrderGoodsPriceParam param);

    Boolean updateOrderGoodsStopFlag(String orderNo,Integer stopFlag);

    /**
     * 获取货单取消的时候弹窗样式
     * @param orderGoodsNo
     * @return
     */
    String orderGoodsCancelStyle(String orderGoodsNo);

    /**
     * 取消货单
     * @param orderGoodsNo
     */
    void orderGoodsCancel(OrderGoodsCancelParam orderGoodsNo);

    /**
     * 查看货单可取消吨数
     * @param goodsCancelParam
     * @return
     */
    BigDecimal orderGoodsCancelResidueWeight(OrderGoodsCancelParam goodsCancelParam);

    List<String> getOrderChildTruckList(String orderGoodsNo);

    /**
     * 编辑货单查询
     * @param id
     * @return
     */
    OrderGoodsEditVO findOrderGoodsById(Integer id);

    Boolean updateSystemAddressId( Integer ownerAddressId, Integer systemAddressId);

    FreightEstimateVO listFreightEstimate(OrderChildReportParam param);

    IPage<OrderGoodsAPPVO> indexOrderGoodsListSearch(AppGoodsOrderSearchParam param);

    void batchUpdateResidueWeight(List<OrderGoods> list);

    void saveBindTruck(DistributionTruckParam param);

    void updateFrightPrice(String orderGoodsNo,BigDecimal pendingOrderFreight);
}
