package com.vincent.rsf.server.api.controller;
|
|
import com.vincent.rsf.framework.common.R;
|
import com.vincent.rsf.server.api.controller.params.OrderParams;
|
import com.vincent.rsf.server.api.service.ReceiveMsgService;
|
import com.vincent.rsf.server.common.utils.ExcelUtil;
|
import com.vincent.rsf.server.manager.entity.AsnOrder;
|
import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate;
|
import com.vincent.rsf.server.system.controller.BaseController;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
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 javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* @author Ryan
|
* @version 1.0
|
* @title ErpApiController
|
* @description
|
* @create 2025/3/4 13:19
|
*/
|
@RestController
|
@RequestMapping("/erp")
|
@Api(tags = "ERP接口对接")
|
public class ReceiveMsgController extends BaseController {
|
|
@Autowired
|
private ReceiveMsgService receiveMsgService;
|
|
/**
|
* @author Ryan
|
* @description 接收ERP推送的PO单据
|
* @throws
|
* @return
|
* @time 2025/3/4 13:57
|
*/
|
@ApiOperation(value = "接收同步ERP采购单")
|
@PostMapping("/sync/purchase")
|
public R syncPurchases(@RequestBody List<OrderParams> orders) {
|
if (orders.isEmpty()) {
|
return R.error("推送订单不能为空,请检查校验后再操作!!");
|
}
|
if (!receiveMsgService.syncPurchasee(orders)) {
|
return R.error("保存失败");
|
} else {
|
return R.ok("保存成功!!");
|
}
|
}
|
|
/**
|
* @author Ryan
|
* @description 同步质检结果信息
|
* @param
|
* @return
|
* @time 2025/3/12 16:56
|
*/
|
@ApiOperation("质检结果同步")
|
@PostMapping("/sync/inspect")
|
public void syncQlyInspect(HttpServletRequest request, HttpServletResponse response) {
|
AsnOrderTemplate template = ExcelUtil.mockData(AsnOrderTemplate.class);
|
List<AsnOrderTemplate> list = new ArrayList<>();
|
list.add(template);
|
ExcelUtil.build(ExcelUtil.create(list, AsnOrderTemplate.class), response);
|
System.out.println(template);
|
// return R.ok();
|
}
|
|
}
|