package com.sw.mes.sap.controller;


import com.sw.mes.core.dto.erp.ErpAddResultDto;
import com.sw.mes.core.dto.erp.ErpRequestDto;
import com.sw.mes.core.response.Result;
import com.sw.mes.core.response.ResultGenerator;
import com.sw.mes.third.utils.ErpRequestUtil;
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
* @Description：
* @Date: Create in
* @Modified By:
*/
@RestController
@RequestMapping("/erp")
@Slf4j
@Api(description = "ERP接口")
public class ErpReportController {
	@Autowired
	private ErpRequestUtil erpRequestUtil;

	@ApiOperation(value = "上报ERP数据")
	@PostMapping("/postToErp")
	public Result<ErpAddResultDto> postToErp(@RequestBody ErpRequestDto erpRequestDto) {
		ErpAddResultDto erpAddResultDto = erpRequestUtil.postToErp(erpRequestDto);
        return ResultGenerator.success(erpAddResultDto);
	}



}
