package com.sw.common.accessory.api.feignCilent;

import com.sw.common.accessory.api.fallBackFactory.YbFeignClientsFallback;
import com.sw.common.accessory.api.model.AccessoryMaterialDto;
import com.sw.common.accessory.api.model.EquipmentDto;
import com.sw.common.accessory.config.FeignConfig;
import com.sw.common.accessory.server.dto.*;
import com.sw.common.core.response.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


@FeignClient(name = "mes-pc-server", configuration = {FeignConfig.class}, fallbackFactory = YbFeignClientsFallback.class)
public interface YbFeignClients {

    /**
     * 根据物料编号查询辅料相关信息
     */
    @GetMapping(value = "/accessoryMaterial/getByMaterialCode", headers = "token=token_admin")
    Result<AccessoryMaterialDto> getByMaterialCode(@RequestParam("materialCode") String materialCode);
    @GetMapping(value = "/accessoryMaterial/getByMaterialCodes", headers = "token=token_admin")
    Result<AccessoryMaterialDto> getByMaterialCodes(@RequestParam("materialCode") String materialCode);
    /**
     * 根据物料id查询辅料相关信息
     */
    @GetMapping(value = "/accessoryMaterial/getByMaterialId", headers = "token=token_admin")
    Result<AccessoryMaterialDto> getByMaterialId(@RequestParam("materialId") Long materialId);

    /**
     * 根据设备编码查询设备相关信息
     */
    @GetMapping(value = "/init/equipment/getByCode", headers = "token=token_admin")
    Result<EquipmentDto> getEquipmentInfo(@RequestParam("equipmentCode") String equipmentCode);
    @ApiOperation(value = "根据设备编码查询设备信息")
    @GetMapping(value = "/init/equipment/getByCodeDto", headers = "token=token_admin")
     Result<EquipmentDto> getByCodeDto(@RequestParam("equipmentCode") String equipmentCode);
    @ApiOperation(value = "报工接口")
    @PostMapping(value = "/sap/goodsmvt/create", headers = "token=token_admin")
    Result sendSapGoodsmvt(@Valid @RequestBody ReportSapGoodsmvtDto reportSapGoodsmvtDto);

    @ApiOperation(value = "工时报工接口")
    @PostMapping(value = "/sap/workinghours/create", headers = "token=token_admin" )
    Result sendSapWorkinghours(@Valid @RequestBody ReportSapWorkinghoursDto ReportSapWorkinghoursDto);
    @ApiOperation(value = "根据字段主题和词条名称查询字典词条")
    @GetMapping(value = "/dictionaryItem/findByThemeValueAndNameAndValueAndEnable", headers = "token=token_admin")
    Result<DictionaryItemDto> findByThemeValueAndNameAndValueAndEnable(@RequestParam String themeValue,
                                                                              @RequestParam String name,
                                                                              @RequestParam String value,
                                                                              @RequestParam boolean enable);
    @ApiOperation(value = "根据字段主题和词条名称查询字典词条")
    @GetMapping(value = "/dictionaryItem/findByThemeValueAndItemName", headers = "token=token_admin")
    Result<DictionaryItemDto> findByThemeCodeAndItemName(@RequestParam String themeValue, @RequestParam String itemName);

    @ApiOperation(value = "设备类型根据设备类型Id获取")
    @GetMapping(value = "/init/device/getDeviceId")
    Result<DeviceDto> getDeviceId(@RequestParam("id") Long id);

    @ApiOperation(value = "根据类型id获取所有设备")
    @GetMapping(value = "/init/equipment/findByDeviceId", headers = "token=token_admin")
    Result<List<EquipmentDto>> findByDeviceId(@RequestParam("deviceId") Integer deviceId);

    @ApiOperation(value = "根据任务编码查询工单排程")
    @GetMapping(value = "/productionSchedule/findPlanProductionById" ,headers = "token=token_admin")
    Result<ProductionScheduleDto> findPlanProductionById(@RequestParam Long id);
    @ApiOperation(value = "根据计划工单获取计划订单详情")
    @GetMapping(value = "/productionOrder/getListByAufnr", headers = "token=token_admin")
    Result<ProductionOrderDto> getListByWorkType(@RequestParam String aufnr);
    @ApiOperation(value = "工单详细信息")
    @GetMapping(value = "/productionOrder/findProductionOrderById", headers = "token=token_admin")
    public Result<ProductionOrderDto> findProductionOrderById(@RequestParam @ApiParam(value = "sapProductionOrderid") Long id);
}
