package com.hzs.scm.ic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.scm.ic.IcOnHandNum;
import com.hzs.common.domain.scm.ic.IcOnHandNumB;
import com.hzs.common.domain.scm.ic.ext.IcOnHandNumExt;
import com.hzs.common.domain.scm.pub.ScmItemSpecs;
import com.hzs.scm.ic.param.OnHandNumParam;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 现存量 Mapper 接口
 * </p>
 *
 * @author hzs
 * @since 2023-11-21
 */
public interface IcOnHandNumMapper extends BaseMapper<IcOnHandNum> {

    /**
     * 获取会员主键
     *
     * @return: Integer
     * @Author: sui q
     * @Date: 2022/9/30 17:38
     */
    Long createIcOnHandNumId();

    /*
     * @description: 查询产品是否存在现存量表
     * @author: sui q
     * @date: 2023/11/22 15:04
     * @param: null null
     **/
    List<IcOnHandNum> queryIcOnHandNumByCondition(@Param("icOnHandNum") IcOnHandNum icOnHandNum, @Param("pkSpecs") String pkSpecs);


    /*
     * @description: 查询产品是否存在现存量表
     * @author: sui q
     * @date: 2023/11/22 15:04
     * @param: null null
     **/
    List<IcOnHandNumExt> queryOnHandNumByCondition(@Param("icOnHandNum") IcOnHandNum icOnHandNum);

    /*
     * @description: 出入口的时候更新原来现存量的数量
     * @author: sui q
     * @date: 2023/11/22 17:04
     * @param: null null
     **/
    Integer updateOnHandNumByNum(IcOnHandNum icOnHandNum);

    /*
     * @description: 批量更新库存数量，用于签呈提交
     * @author: sui q
     * @date: 2023/11/29 9:13
     * @param: null null
     **/
    Integer mergeUpdateOnHandNumByNum(@Param("icOnHandNumList") List<IcOnHandNum> icOnHandNumList);

    /*
     * @description: 根据明细表数据，回退批次数量，用于签呈驳回
     * @author: sui q
     * @date: 2023/11/29 9:39
     * @param: null null
     **/
    Integer mergeUpdateBackOnHandNumByNum(@Param("icOnHandNumbList") List<IcOnHandNumB> icOnHandNumbList, @Param("pkMember") Long pkMember);

    /*
     * @description: 查询现存量，用于现存量查询，盘点参照使用
     * @author: sui q
     * @date: 2023/12/20 13:50
     * @param: null null
     **/
    List<IcOnHandNumExt> queryInventoryProductByParam(OnHandNumParam onHandNumParam);

    /*
     * @description: 根据主键批量查询现存量
     * @author: sui q
     * @date: 2023/12/21 10:18
     * @param: null null
     **/
    List<IcOnHandNumExt> queryOnHandNumByList(@Param("idList") List<Long> idList);
}
