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

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

import com.sw.mes.yb.production.dto.*;
import com.sw.mes.yb.production.dto.InputFurnaceBurden.InputFurnaceBurdenExportParam;
import com.sw.mes.yb.production.dto.LoadingTask.IngredientInfoDto;
import io.swagger.annotations.ApiParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.sw.mes.core.base.BaseService;
import com.sw.mes.yb.production.dto.AgainTaskDetail.AgainTaskDetailDto;
import com.sw.mes.yb.production.dto.AgainTaskDetail.AgainTaskDetailUpdate;
import com.sw.mes.yb.production.dto.AgainTaskDetail.AgainTaskInstoreDto;
import com.sw.mes.yb.production.entity.AgainTaskDetail;

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface AgainTaskDetailService extends BaseService<AgainTaskDetail> {

    void instoreOperation(AgainTaskInstoreDto againTaskInstoreDto);

    BigDecimal getTotaGuanLiaoWeightByLotNo(String lotNo);

    void updateInfo(AgainTaskDetailUpdate dto, List<InputFurnaceDetailDto> inputFurnaceDetailDtos);

    List<AgainTaskDetail> findByLotNoAndPailNum(String lotNo, String pailNum);

    List<AgainTaskDetail> findByLotNoAndPailNumAndAgainNum(String lotNo, String pailNum, Integer againNum);

    Page<AgainTaskDetail> findByPdaPage(AgainTaskDetailDto againTaskDetailDto, Pageable page);

    AgainTaskDetail getLastSuccessTask(String equipmentCode, String lotNo);

    List<AgainTaskDetail> findByAgainTaskId(Long againTask);

    void backTask(Long id, String cause, Integer bucket);

	void repeatOpenTask(Long id);

	void cancelTask(Long id,String operationCause);

    List<Map<String, Object>> findInputTask(InputFurnaceBurdenExportParam param);

    RecipeDto findFillingRecipe(Long againTaskDetailId);

    void saveFillingRecipeV1(RecipeSaveDto dtoes);

    List<AgainTaskDetail> findByLotNoAndAgainNumAndStatus(String lotNo, Integer againNum);

    List<AgainTaskDetail> findByLotNoAndAgainNum(String lotNo, Integer againNum);

    List<AgainTaskDetail> findBySapNo(String sapNo);

    List<AgainTaskDetail> findByAgainTaskIdList(List<Long> idList);

    AgainTaskDetail findTopByEquipmentCodeOrderByIdDesc(String equipmentCode);

    void materialReturn(PartReturnMaterialDto dto);

    List<ProductionMaterialReturnRecordDto> findMaterialList(Long id);

    /**
     * 根据炉次号查询未确定投料任务
     * @param lotNo
     * @return
     */
    AgainTaskDetail findUnconfirmedTask(String lotNo);

    /**
     * 根据炉次号查询已完成的投料任务
     * @param lotNo
     * @return
     */
    AgainTaskDetail findSuccessByLotNo(String lotNo);

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


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

    BigDecimal findAgainSumWeightBySapNoAndInRawStatus(String orderNo);

    BigDecimal findTotalSumWeightBySapNoAndInRawStatus(String orderNo);

    AgainTaskDetail findByAgainTaskIdAndFillEndAndAgainNum(Long againTaskId, Integer againNum);

    List<AgainTaskDetail> findByAgainTaskAndPreDetailId(Long againTaskId, Long preDetailId);

    /**
     * 根据载具序号查询
     * @param againTaskId
     * @param againNum
     * @param carrierSort
     * @return
     */
    List<AgainTaskDetail> findByCarrierSort(Long againTaskId, Integer againNum, Integer carrierSort);

    /**
     * 检查投料顺序
     * @param id
     * @return
     */
    String checkTaskOrder(Long id);


}
