package com.sw.mes.fb.checkout.service;

import com.sw.mes.core.base.BaseService;
import com.sw.mes.core.dto.PieceCheckDto;
import com.sw.mes.core.entity.FbCheckOutData;
import com.sw.mes.core.response.Result;
import com.sw.mes.fb.checkout.dto.FbCheckOutRecordDto;
import com.sw.mes.fb.checkout.entity.OperateCheckOutDataLog;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * @Author
 * @Description：
 * @Date:
 * @Modified By:
 */
public interface FbCheckOutDataService extends BaseService<FbCheckOutData> {
    /**
     * 根据单晶编号查询
     *
     * @param fbSectionNo 单晶编号
     * @return 检验数据
     */
    FbCheckOutData findDataByFbSectionNo(String fbSectionNo);
    String findDataByFbSectionNo1(String fbSectionNo);
    void sendFbSectionAndIp(String fbSectionNo, String ip);

    void sendSapWorkHour(String fbSectionNo);
    void sendNewSapWorkHour(FbCheckOutRecordDto fbSectionNo, String returnWorkOrder);

    /**
     * 根据单晶编号查询
     *
     * @param fbSectionNos 单晶编号集合
     * @return 检验数据
     */
    List<FbCheckOutData> findCheckOutDataByFbSectionNoIns(List<String> fbSectionNos);

    Map<String, Object> findBySectionNoMap(String sectionNo);

    void updateOrderTypeByFbSectionNoList(List<String> fbSectionNoList, String orderType, String checkoutName);

    Result readResultsImport(MultipartFile file) throws Exception;

    Result readResultsImportMk(MultipartFile file) throws Exception;

    void download(HttpServletResponse response) throws Exception;



    @Override
    void saveAll(List<FbCheckOutData> fbCheckOutDatas);

    /**
     * 查询是否抽检
     *
     * @param fbSectionNo 方棒编号
     * @return
     */
    Boolean isSpotCheck(String fbSectionNo);

    /**
     * 查询方棒组合
     *
     * @param fbSectionNo 方棒编号
     * @return 方棒组合编号
     */
    String getSectionComposeBySectionNo(String fbSectionNo);

    List<String> getNos();

    void updateOrderNoBySectionNo(String sectionNo, String orderNo);

    void saveAndLog(FbCheckOutData fbCheckOutData, OperateCheckOutDataLog operateCheckOutDataLog);

    void updateWeight(FbCheckOutData updateDto);

    void updatePieceCheckData(PieceCheckDto pieceCheckDto);

    String findSumWeightByOrderNoAndBackCut(String orderNo, int backCut);

    FbCheckOutData findDataByLikeFbSectionNo(String fbSectionNo);

    FbCheckOutData updateBackCutByFbSectionNo(String fbSectionNo,Integer backCut);
}
