package com.sw.mes.yb.production.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.sw.mes.core.base.BaseService;
import com.sw.mes.core.response.Result;
import com.sw.mes.yb.production.dto.AgainTaskDetail.TaskDetailExportDto;
import com.sw.mes.yb.production.dto.InputFurnaceBurden.InputFurnaceBurdenExportParam;
import com.sw.mes.yb.production.dto.LoadingTask.IngredientInfoDto;
import com.sw.mes.yb.production.dto.PartReturnMaterialDto;
import com.sw.mes.yb.production.dto.ProductionBucketRecipeRecordDto;
import com.sw.mes.yb.production.dto.ProductionMaterialReturnRecordDto;
import com.sw.mes.yb.production.entity.BlastFurnaceDetail;
import com.sw.mes.yb.production.entity.LoadingTask;

/**
 * @Author 李儒
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface LoadingTaskService extends BaseService<LoadingTask> {

    LoadingTask getFinishTask(String equipmentCode, String lotNo);

    BigDecimal getPeiLiaoTotalWeightByLotNo(String lotNo);

    List<LoadingTask> findByLotNo(String lotNo);

    List<LoadingTask> findByLotNoV2(String source, String lotNo);

    List<LoadingTask> findBySapNo(String sapNo);

    List<LoadingTask> findByEquipmentCode(String equipmentCode);

    LoadingTask getByEquipmentAndStateLastTask(String equipmentCode, String lotNo, Integer rawstatus);

    LoadingTask getByEquipmentAndSuccessLastTask(String equipmentCode, String lotNo);

    String getLastOneHeight(String equipmentCode);

    void backTask(Long id, String cause);

    void repeatOpenTask(Long id);

	void cancelTask(Long id, String cause);

	Map<String,List<ProductionBucketRecipeRecordDto>> getRecipeByLoadingTaskId(Long id, String height);

    Map<String, Object> findCrucibleInfoByLotNo(String lotNo);

    List<LoadingTask> findByLotNoList(List<String> lotNo);

    void materialReturn(PartReturnMaterialDto dto);

    List<ProductionMaterialReturnRecordDto> findMaterialList(Long id);

    /**
     * 根据炉次号查询未确认订单
     * @param lotNo
     * @return
     */
    LoadingTask findUnconfirmedTask(String lotNo);

    /**
     * 确认投料，本次装料任务报线边仓出库
     * @param id
     */
    Result confirmMaterials(Long id);
    /**
     * 根据炉次号查询配料任务
     */
    List<LoadingTask> findRealWeightByLotNo(String lotNo);

    /**
     * 根据炉次号和物料号查询配料详情
     */
    List<BlastFurnaceDetail> findByLotNoAndProductCode(String lotNo, String code);

    /**
     * 根据炉次号查询已完结的数据
     */
    LoadingTask findSuccessByLotNo(String lotNo);

    /**
     * 根据配料任务id查询打印信息
     * @param id 配料任务id
     * @return 打印信息
     */
    IngredientInfoDto findIngredientInfoById(Long id);

    /**
     * 获取需要导出的配料任务及明细
     * @param param
     * @return
     */
    List<Map<String, Object>> findTaskAndDetails(InputFurnaceBurdenExportParam param);

    BigDecimal findLoadingSumWeightBySapNoAndInRawStatus(String orderNo);


    /**
     * 补充导出数据信息
     */
    void addMaterialInfoFromWarehouse(List<TaskDetailExportDto> list);

    List<LoadingTask> findByConfirmTime(String startTime, String endTime);

}
