package com.sw.mes.sectionMes.controller;

import com.alibaba.fastjson.JSONObject;
import com.sw.mes.core.annotation.Jinko;
import com.sw.mes.core.response.Result;
import com.sw.mes.core.response.ResultGenerator;
import com.sw.mes.sectionMes.dto.FeedBackPassBackDto;
import com.sw.mes.sectionMes.service.MESInputService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author lf
 * @description
 * @date 2024/2/2 9:01
 */
@RestController
@RequestMapping("/mes/jinko")
@Slf4j
@Api(description = "切片MES数据请求接口")
@Jinko(value = "切片MES对接请求接口控制器", author = "liangfeng")
public class MESInputController {

    @Autowired
    private MESInputService mesInputService;

    @ApiOperation(value = "方棒反馈回传接口")
    @PostMapping("/feedBack/pass/back")
    public Result<FeedBackPassBackDto> feedBackPassBack(@RequestBody JSONObject data) {
        FeedBackPassBackDto dto = mesInputService.feedBackPassBack(data);
        return ResultGenerator.success(dto);
    }

    @ApiOperation(value = "方棒退料接口")
    @PostMapping("/returnMaterial")
    public Result returnMaterial(@RequestBody JSONObject data) {
        mesInputService.returnMaterial(data);
        return ResultGenerator.success("方棒退料信息接收成功");
    }
}
