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

import com.sw.mes.core.annotation.ServiceLogs;
import com.sw.mes.core.response.Result;
import com.sw.mes.yb.fls.dto.*;
import com.sw.mes.yb.mcs.dto.CrystalTrayBindInfoDto;
import com.sw.mes.yb.mcs.dto.McsFbInventoryDto;

import java.util.List;

/**
 * @Author: GaoXinJian
 * @Date: 2022-01-18 15:53
 */
public interface FlsToMesService {

    /**
     * 绑定接收信息上传
     * <p>
     * 截断完成，FLS将圆棒抓取至托盘，并将绑定信息发送给MES；MES接收到信息后，将绑定信息及晶段基础信息发送至MCS；
     *
     * @param bindingInfoDto
     * @return
     */
    Result bindingInfo(BindingInfoDto bindingInfoDto);

    /**
     * 绑定接收信息校验
     * <p>
     * 截断完成前MCS校验是否可拼
     *
     * @param bindingInfoDto
     * @return
     */
    Result bindingInfoVerify(BindingInfoDto bindingInfoDto);

    Result getPaintingLineInfo(String code);

    Result getPaintingLineInfoManual(String crystalNo);

    Result sampleInfo(SampleInfoDto sampleInfoDto);

    /**
     * 圆棒进入分选口
     * <p>
     * 圆棒进入分选口后，FLS将托盘编号发给MES，MES返回相关信息；
     *
     * @param trayCode
     * @return
     */
    YbEntersSortingPortDto ybEntersSortingPort(String trayCode);

    /**
     * 分选口圆棒上传接口
     * FLS抓取圆棒至AGV后，FLS上传圆棒SN、托盘号、分选口编号信息；
     * MES记录该圆棒直发方棒，需报工至SAP；
     * MES更新在制品(圆棒检验已出站，开方加工待进站)
     *
     * @param ybSortingPortUploadDto
     */
    Result ybSortingPortUpload(YbSortingPortUploadDto ybSortingPortUploadDto);

    /**
     * 圆棒拼棒完成报告
     * <p>
     * 圆棒拼棒完成后，FLS将圆棒拼棒完成报告发给MES，MES返回相关信息并推送拼棒信息至MCS；
     *
     * @param joinCircleFinishDto
     * @return
     */
    Result joinCircleFinish(JoinCircleFinishDto joinCircleFinishDto);

    @ServiceLogs(description = "分选口圆棒上传-处理过站")
    void enterCutSquare(YbSortingPortUploadDto ybSortingPortUploadDto);

    CrystalTrayBindInfoDto initCrystalTrayBindInfoDto(String trayNo, String sectionNo);

    /**
     * mcs检测到异常绑定托盘，自动触发托盘解绑
     *
     * @param trayAutoUnBinding
     */
    void trayAutoUnBinding(TrayAutoUnBinding trayAutoUnBinding, String source);

    void autoInitiateReceipt(String trim);

    /**
     * 验证是否可以自动拼棒
     *
     * @param spellValidationDto
     * @return
     */
    Result spellValidation(SpellValidationDto spellValidationDto);

    void autoInitiateReceiptData(String trim);

    /**
     * 方棒退料fls绑定托盘
     *
     * @param bindingDto
     * @return
     */
    Result trayBinding(BindingDto bindingDto);

    Result matchMakeTrayRule(BindingDto bindingDto);

    Result matchMakeTrayRuleV2(BindingDto bindingDto);

    Result suspendTrayRule(List<McsFbInventoryDto> fbInventoryDto);

    Result queryMcsSquareLog(BindingDto bindingDto);

    Result<List<SectionRecycledResultDto>> sendSectionForInfo(SectionRequestDto gainSectionRequestDto);

    Result recycledMaterialUpload(RecycledMaterialUploadDto recycledMaterialUploadDto);
}
