package com.jisco.dynamicweight.dynamicworkupdata.mapper;

import com.jisco.dynamicweight.dynamicbasereciever.model.DynamicBaseReciever;
import com.jisco.dynamicweight.dynamicworkauditdata.model.DynamicWorkAuditdata;
import com.jisco.dynamicweight.dynamicworkupdata.dto.CalNewCokeDto;
import com.jisco.dynamicweight.dynamicworkupdata.model.DynamicWorkUpdata;
import com.jisco.dynamicweight.dynamicworkupdata.vo.AuditDataVO;
import com.jisco.dynamicweight.dynamicworkupdata.vo.DailyReportVO;
import com.steerinfo.framework.mapper.IBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface DynamicWorkUpdataMapper extends IBaseMapper<DynamicWorkUpdata, String> {
    /**
     * 重新获取动态秤称重数据
     */
    void recalc();

    /**
     * 数据分批总重量
     *
     * @param stationCode
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal inbatchsTotalWeight(String stationCode, String materialName, Date startTime, Date endTime);

    /**
     * 返粉总重量
     *
     * @param map String meterialCode, Date date1, Date date2, BigDecimal weight
     * @return
     */
    BigDecimal returnedDustWeight(Map<String, Object> map);

    /**
     * 动态秤日报表
     *
     * @return
     */
    List<DailyReportVO> dailyReport(LocalDateTime bl8start,
                                    LocalDateTime bl8end,
                                    LocalDateTime bl16start,
                                    LocalDateTime bl16end,
                                    LocalDateTime bl24start,
                                    LocalDateTime bl24end,
                                    LocalDateTime rzlstart,
                                    LocalDateTime rzlend,
                                    LocalDateTime yzlstart,
                                    LocalDateTime yzlend,
                                    LocalDateTime nzlstart,
                                    LocalDateTime nzlend);

    /**
     * 查询待审核数据
     * @param bl8start
     * @param bl8end
     * @param bl16start
     * @param bl16end
     * @param bl24start
     * @param bl24end
     * @return
     */
    List<AuditDataVO> getAuditData(String bl8start, String bl8end, String bl16start, String bl16end, String bl24start, String bl24end);

    /**
     * 设置审核状态
     * @param auditdata
     */
    int setAudit(DynamicWorkAuditdata auditdata);

    /**
     * 启用
     * @param config
     * @return
     */
    int enable(DynamicWorkUpdata config);

    /**
     * 禁用
     * @param config
     * @return
     */
    int disable(DynamicWorkUpdata config);

    /**
     * 批量作废数据
     * @param stationCode
     * @param materialName
     * @param startTime
     * @param endTime
     * @return
     */
    int batchDisable(String stationCode, String materialName, Date startTime, Date endTime, String updateManNo, String updateManName, Date updateTime);

    /**
     * 作废返粉的原始数据
     * @param map
     */
    void disableForReturnedDust(Map<String, Object> map);

    /**
     * 取消审核状态
     * @param dynamicWorkAuditdata
     */
    int setUnAudit(DynamicWorkAuditdata dynamicWorkAuditdata);

    /**
     * 查询审核或者取消审核的记录条数
     * @param auditDataVO
     */
    BigDecimal getWeightForAuditOrUnaudit(DynamicWorkAuditdata auditDataVO);

    /**
     * 统计“动态秤称重数据维护”内，综1A、综1B、综1C、综1D皮带秤，物料品名包含“焦”，收货库房为“2531”的数据
     * @param calNewCokeDto
     * @return
     */
    BigDecimal getTotalCoke(CalNewCokeDto calNewCokeDto);

    /**
     * 计算36B1和煤焦E皮带焦炭量
     * @param stationCode
     * @param startTime
     * @param endTime
     * @return
     */
    BigDecimal getCokeByStation(String stationCode, Date startTime, Date endTime);

    /**
     * 获取综运1A、综运1B、综运1C、综运1D指定时间段内的焦炭记录
     * @param calNewCokeDto
     * @return
     */
    List<DynamicWorkUpdata> getCokeRecords(CalNewCokeDto calNewCokeDto);

    /**
     * 按id列表批量作废
     * @param ids
     */
    int batchDisableByIds(@Param("ids") List<String> ids);
}