package com.hzs.scm.trans.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.scm.po.ext.PoOrderExt;
import com.hzs.common.domain.scm.purchase.ext.IcPurchaseInBExt;
import com.hzs.common.domain.scm.trans.IcTransInB;
import com.hzs.common.domain.scm.trans.TransferOrder;
import com.hzs.common.domain.scm.trans.TransferOrderItems;
import com.hzs.common.domain.scm.trans.ext.IcTransInBExt;
import com.hzs.common.domain.scm.trans.ext.TransferOrderExt;
import com.hzs.scm.po.param.PoOrderItemsParam;
import com.hzs.scm.po.param.PoOrderParam;
import com.hzs.scm.trans.param.TransferItemParam;
import com.hzs.scm.trans.param.TransferParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 调拨订单表头 Mapper 接口
 * </p>
 *
 * @author hzs
 * @since 2023-12-04
 */
public interface TransferOrderMapper extends BaseMapper<TransferOrder> {

    /*
     * @description: 根据主键查询调拨订单、调拨订单明细
     * @author: sui q
     * @date: 2023/11/21 10:49
     * @param: null null
     **/
    TransferOrderExt queryTransferOrderById(@Param("pkTransfer") Long pkTransfer, @Param("orderStatus") Integer orderStatus);

    /*
     * @description: 根据查询条件查询调拨订单
     * @author: sui q
     * @date: 2023/11/21 15:01
     * @param: null null
     **/
    List<TransferOrderExt> queryTransferOrderByCondition(TransferParam transferParam);

    /*
     * @description: 参照生成调拨入库单，可能存在多个调拨订单生成一个入库单，支持1对多 多对1
     * @author: sui q
     * @date: 2023/11/21 17:47
     * @param: null null
     **/
    List<TransferOrderExt> queryTransferOrderByOrderItems(@Param("orderItemsParamList") List<TransferItemParam> orderItemsParamList);

    /*
     * @description: 查询待入库的调拨订单
     * @author: sui q
     * @date: 2023/11/23 13:53
     * @param: null null
     **/
    List<TransferOrderExt> queryTransferOrderToStoreByCondition(TransferParam transferParam);

    /*
     * @description: 采购入库时回写采购订单主表状态
     * @author: sui q
     * @date: 2023/11/27 13:39
     * @param: null null
     **/
    void updateTransferOrderStatusByTrans(@Param("transferInbList") List<IcTransInBExt> transferInbList, @Param("pkMember") Long pkMember,
                                          @Param("orderStatus") Integer orderStatus);
}
