package com.cf.imes.module.executor.api.plan;


import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.executor.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.NAME) // TODO 晨丰：fallbackFactory =
@Tag(name = "RPC 服务 - 多组织")
public interface OrderPlanApi {

    String PREFIX = ApiConstants.PREFIX + "/plan";


    @GetMapping(PREFIX +"/apiGetOrderPlan")
    @Operation(summary = "查询当前机台对应的排单是否有使用")
    @Parameter(name = "machineId", description = "机台ID", required = true, example = "1024")
    CommonResult<Boolean> getOrderPlan(@RequestParam("machineId") Long id);


    @GetMapping(PREFIX +"/apiGetOrder")
    @Operation(summary = "查询生产单对应的板材已全部开料")
    @Parameter(name = "orderId", description = "生产单ID", required = true)
    CommonResult<Boolean> getOrder(@RequestParam("orderId") Long orderId);

    @GetMapping(PREFIX +"/apiGetOrderProcessScheme")
    @Operation(summary = "查询加工组方案是否在排单中使用")
    @Parameter(name = "processId", description = "加工方案ID", required = true)
    CommonResult<Boolean> getOrderProcessScheme(@RequestParam("processId") Long processId);


    /*
    * 机台数据源数据查询
    *
    * */

    @GetMapping(PREFIX +"/apiDataGetPlan")
    @Operation(summary = "获取当前排单对应的生产单信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiDataGetPlan(@RequestParam("planId") Long planId,@RequestParam("filed") String filed);




    @GetMapping(PREFIX +"/apiGetGoods")
    @Operation(summary = "查询当前排单对应的大板信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String getGoods(@RequestParam("planId") Long planId,@RequestParam("filed") String filed);




    @GetMapping(PREFIX +"/apiGetOrders")
    @Operation(summary = "查询当前排单对应的业务员和拆单员信息")
//    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    List<String> apiGetOrders(@RequestParam("planId") Long planId ,@RequestParam("isSale")  Boolean isSale);




    @GetMapping(PREFIX +"/apiGetPlan")
    @Operation(summary = "查询当前排单的信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String getPlan(@RequestParam("planId") Long planId,@RequestParam("filed") String filed);




    @GetMapping(PREFIX +"/apiGetESPlan")
    @Operation(summary = "查询ES中的排单优化生产信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetEsPlan(@RequestParam("planId") Long planId,@RequestParam("fields") List<String> fields);




    @GetMapping(PREFIX +"/apiGetPlanRemainPlate")
    @Operation(summary = "查询排单中的余料板信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetPlanRemainPlate(@RequestParam("planId") Long planId,@RequestParam("field") String field);




    @GetMapping(PREFIX +"/apiGetPlanPlate")
    @Operation(summary = "查询排单中的板材信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetPlanPlate(@RequestParam("planId") Long planId,@RequestParam("field") String field);




    @GetMapping(PREFIX +"/apiGetESPlate")
    @Operation(summary = "查询ES中的板材信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetEsPlate(@RequestParam("planId") Long planId,@RequestParam("fields") List<String> fields);




    @GetMapping(PREFIX +"/apiGetPlanBodyOrRoom")
    @Operation(summary = "查询排单中的板材房间信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetPlanBodyOrRoom(@RequestParam("planId") Long planId,@RequestParam("field") String field);




    @GetMapping(PREFIX +"/apiGetPlanGroup")
    @Operation(summary = "查询排单中的板材加工组信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetPlanGroup(@RequestParam("planId") Long planId,@RequestParam("field") String field);



    @GetMapping(PREFIX +"/apiGetPlanParts")
    @Operation(summary = "查询排单中的配件信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetPlanParts(@RequestParam("planId") Long planId,@RequestParam("field") String field);


    @GetMapping(PREFIX +"/apiGetESParts")
    @Operation(summary = "查询ES中的配件备注信息")
    @Parameter(name = "planId", description = "排单ID", required = true, example = "1024")
    String apiGetEsParts(@RequestParam("planId") Long planId,@RequestParam("fields") List<String> fields);

}
