package com.bonus.material.purchase.mapper;

import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
import com.bonus.common.biz.domain.purchase.PurchaseDto;
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
import com.bonus.material.purchase.domain.vo.PurchaseVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author ma_sh
 * @create 2024/10/21 18:43
 */
public interface PurchaseBindMapper {

    /**
     * 查询所有
     * @param dto
     * @return
     */
    List<PurchaseVo> selectAll(PurchaseDto dto);

    /**
     * 查询绑定信息
     * @param dto
     * @return
     */
    List<PurchaseVo> selectPurchaseCheckInfoById(PurchaseDto dto);

    /**
     * 获取绑定信息
     * @param dto
     * @return
     */
    List<PurchaseVo> getDetails(PurchaseDto dto);

    /**
     * 根据编码查询
     * @param purchaseDto
     * @return
     */
    List<PurchaseDto> selectByCode(PurchaseDto purchaseDto);

    /**
     * 判断QrCode二维码是否绑定
     * @return true 已绑定 false 未绑定
     */
    boolean checkQrCodeIsBind(String qrCode);

    /**
     * 新增绑定信息
     * @param purchaseDto
     * @return
     */
    int add(PurchaseDto purchaseDto);

    int bindMaCodeByQrCode(PurchaseDto purchaseDto);

    /**
     * 查询二维码code
     * @param genMonth
     * @return
     */
    List<PurchaseVo> select(String genMonth);

    /**
     * 查询状态
     * @param purchaseDto
     * @return
     */
    Integer selectStatus(PurchaseDto purchaseDto);

    /**
     * 更新状态
     * @param id
     * @param purchaseId
     */
    void updateStatus(@Param("id") String id, @Param("purchaseId") String purchaseId);

    /**
     * 二维码数据保存
     * @param dto
     */
    void insert(PurchaseDto dto);

    /**
     * 更新绑定状态
     * @param updatedStatus
     * @param purchaseId
     */
    int updateStatusById(@Param("updatedStatus") Integer updatedStatus, @Param("id") Long purchaseId);

    /**
     * 更新数量
     * @param dto
     * @param num
     * @return
     */
    int updateNum(@Param("dto") PurchaseDto dto, @Param("num") int num);

    int updateStatusWhereNum(@Param("dto") PurchaseDto dto);

    /**
     * 根据id查询详情
     * @param purchaseDto
     * @return
     */
    List<PurchaseVo> getDetailById(PurchaseDto purchaseDto);

    List<PurchaseCheckDetails> getMachineById(PurchaseDto dto);

    List<PurchaseVo> getTypeByQrcode(PurchaseDto dto);

    /**
     * 查询绑定详情
     * @param purchaseDto
     * @return
     */
    List<PurchaseVo> selectPurchaseCheckDetailsById(PurchaseDto purchaseDto);

    /**
     * 更改状态
     * @param taskId
     * @param typeId
     * @param count
     * @return
     */
    int updatePurchaseBindByTaskIdAndTypeId(@Param("taskId") String taskId,@Param("typeId")  Long typeId,@Param("count")  int count);

    /**
     * 查询待入库编号机具详情
     * @param dto
     * @return
     */
    List<PurchaseCheckDetails> getMachineByCode(PurchaseDto dto);

    /**
     * 根据任务id查询供应商
     * @param taskId
     * @return
     */
    PurchaseCheckInfo selectSupplierByTaskId(String taskId);

    /**
     * 根据二维码查询
     * @param purchaseDto
     * @return
     */
    List<PurchaseDto> selectByQrCode(PurchaseDto purchaseDto);

    PurchaseVo getInventoryInfo(PurchaseDto dto);

    int updateQrCodeInfo(PurchaseVo dto);

    int insertMachineBind(PurchaseDto dto);

    int selectMaCodeCount(PurchaseVo dto);
}
