package com.aucma.api.mapper;

import com.aucma.api.domain.dto.RepairSubmitInfoDto;
import com.aucma.common.annotation.DataSource;
import com.aucma.common.enums.DataSourceType;
import com.aucma.report.domain.ReportQualityInspection;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * @author wanghao
 * @date 2023/11/14  10:16
 */
@Repository
public interface PdaBindingMapper {
    String selectBoxNameByCode(String boxCode);
    @DataSource(value = DataSourceType.SLAVE)
    int insertBindingInfo(@Param("boxCode") String boxCode,
                          @Param("boxName") String boxName,
                          @Param("innerCode")String innerCode);

    int countQualityRecordByCode(String code);

    int submitRepair(@Param("info")RepairSubmitInfoDto info);

    List<ReportQualityInspection> findCheckInfoByCode(String code);

    List<ReportQualityInspection> checkSelectRepairInfo(String code);

    /**
     * 查询箱体条码信息
     * @param code
     * @return
     */
    List<HashMap<String, String>> selectPrintBarcode(String code);

    /**
     * PDA解绑条码
     * @param barCode
     * @return
     */
    @DataSource(value = DataSourceType.SLAVE)
    int unbindBarCode(String barCode);

    /**
     * 存入补打条码记录
     * @param hashMap
     * @return
     */
    @DataSource(value = DataSourceType.SLAVE)
    int printSupplementBarcode(HashMap<String, String> hashMap);

    /**
     * 质量返修查询：质检班长获取所有返修信息
     * @param code
     * @return
     */
    List<ReportQualityInspection> findCheckInfoByCodeUserId(String code);

    List<HashMap<String, String>> downgradedProductCardControl(@Param("objId") String objId);

    /**
     * PDA降级消息通知
     * @param userName
     * @return
     */
    List<HashMap<String, String>> messageNotifications(@Param("userName") String userName);


    String selectBoxNameBarCode(String boxCode);

    @DataSource(value = DataSourceType.SLAVE)
    int updateCodeBinding(@Param("boxCode") String boxCode, @Param("innerCode")String innerCode);

    @DataSource(value = DataSourceType.SLAVE)
    int insertCodeBinding(@Param("boxCode") String boxCode);

    List<HashMap<String, String>> checkShellBinding(@Param("boxCode") String boxCode);
}
