package com.sw.mes.sto.controller;


import java.util.List;

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;

import com.fasterxml.jackson.core.JsonProcessingException;
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.sto.dto.StoDto;
import com.sw.mes.sto.service.StoOutputService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;


/**
* @Author 李儒
* @Description：晶科STO数据请求接口
*/
@RestController
@RequestMapping("/sto/out")
@Slf4j
@Api(description = "晶科STO数据请求接口")
@Jinko(value="晶科STO对接请求接口控制器",author = "liru")
public class StoOutputController
{


	@Autowired
	private StoOutputService stoOutputService;


	@ApiOperation(value = "成品返工车间MES接收状态回传接口")
	@PostMapping("/send")
	public Result remessta(@RequestBody List<StoDto> data) throws JsonProcessingException {
		try {
			stoOutputService.sendData(data);
		} catch (Exception e) {
			e.printStackTrace();
			return ResultGenerator.fail(e.getMessage());
		}
		return ResultGenerator.success();
	}
	
}
