package com.vincent.rsf.server.api.controller.erp;
|
|
import com.vincent.rsf.framework.common.R;
|
import com.vincent.rsf.framework.exception.CoolException;
|
import com.vincent.rsf.server.api.controller.erp.params.*;
|
import com.vincent.rsf.server.api.service.ReceiveMsgService;
|
import com.vincent.rsf.server.common.annotation.OperationLog;
|
import com.vincent.rsf.server.common.utils.ExcelUtil;
|
import com.vincent.rsf.server.manager.entity.excel.AsnOrderTemplate;
|
import com.vincent.rsf.server.manager.enums.OrderType;
|
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;
|
import java.util.Objects;
|
|
@RestController
|
@RequestMapping("/order")
|
@Api(tags = "单据")
|
public class SyncOrderController extends BaseController {
|
|
@Autowired
|
private ReceiveMsgService receiveMsgService;
|
|
/**
|
* @author Ryan
|
* @description 接收ERP推送的PO单据
|
* @throws
|
* @return
|
* @time 2025/3/4 13:57
|
*/
|
|
@ApiOperation(value = "接收同步ERP采购单")
|
@OperationLog("采购单同步")
|
@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
|
* @date 2025/8/15
|
* @description: DO单同步
|
* @version 1.0
|
*/
|
@ApiOperation(value = "出库通知单(DO单同步)")
|
@OperationLog("出库通知单(DO单同步)")
|
@PostMapping("/sync/delivery")
|
public R syncDelivery(@RequestBody List<OrderParams> orders) {
|
if (!receiveMsgService.syncPurchasee(orders)) {
|
return R.error("保存失败");
|
} else {
|
return R.ok("保存成功!!");
|
}
|
}
|
|
/**
|
* @author Ryan
|
* @description 同步质检结果信息
|
* @param
|
* @return
|
* @time 2025/3/12 16:56
|
*/
|
@ApiOperation(value = "质检结果同步")
|
@OperationLog("质检结果同步")
|
@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();
|
}
|
|
/**
|
* @author Ryan
|
* @date 2025/8/19
|
* @description: 同步盘点单据
|
* @version 1.0
|
*/
|
@ApiOperation("同步单据")
|
@OperationLog("单据同步")
|
@PostMapping("/sync/checks")
|
public R syncCheckResult(@RequestBody SyncOrderParams syncOrders) {
|
if (Objects.isNull(syncOrders)) {
|
throw new CoolException("参数不能为空!!");
|
}
|
return receiveMsgService.syncCheckOrder(syncOrders, getLoginUserId());
|
}
|
|
/**
|
* @author Ryan
|
* @date 2025/8/19
|
* @description: 调拔单据同步
|
* @version 1.0
|
*/
|
@ApiOperation("调拔单同步")
|
@OperationLog("调拔单同步")
|
@PostMapping("/sync/transfers")
|
public R syncTransfer(@RequestBody SyncTransferParams transferParams) {
|
if (Objects.isNull(transferParams)) {
|
throw new CoolException("参数不能为空!!");
|
}
|
return receiveMsgService.syncTransfer(transferParams);
|
}
|
|
|
/**
|
* @author Ryan
|
* @date 2025/8/19
|
* @description: 库存调整单同步
|
* @version 1.0
|
*/
|
@ApiOperation("库存调整单同步")
|
@OperationLog("库存调整单同步")
|
@PostMapping("/sync/revises")
|
public R syncRevise(@RequestBody SyncLocReviseParams reviseParams) {
|
if (Objects.isNull(reviseParams)) {
|
return R.error("参数不能为空!!");
|
}
|
return receiveMsgService.syncLocRevise(reviseParams);
|
}
|
|
/**
|
* @author Ryan
|
* @date 2025/8/19
|
* @description: 库存调整单同步
|
* @version 1.0
|
*/
|
@ApiOperation("质检单上报")
|
@OperationLog("质检单上报")
|
@PostMapping("/sync/qlyInspect")
|
public R syncQlyReport(@RequestBody List<OrderParams> orders) {
|
|
return R.ok();
|
}
|
|
/**
|
* @author Ryan
|
* @date 2025/8/19
|
* @description: 单据修改
|
* @version 1.0
|
*/
|
@ApiOperation("单据修改")
|
@OperationLog("单据修改")
|
@PostMapping("/sync/orders/update")
|
public R syncOrderUpdate(@RequestBody SyncOrderParams orders) {
|
if (Objects.isNull(orders)) {
|
return R.error("参数不能为空!!");
|
}
|
return receiveMsgService.syncOrderUpdate(orders);
|
}
|
|
|
/**
|
* @author Ryan
|
* @date 2025/8/19
|
* @description: 单据删除
|
* @version 1.0
|
*/
|
@ApiOperation("单据删除")
|
@OperationLog("单据删除")
|
@PostMapping("/sync/orders/delete")
|
public R syncOrderDel(@RequestBody List<SyncOrderParams> orders) {
|
if (Objects.isNull(orders)) {
|
return R.error("参数不能为空!!");
|
}
|
return receiveMsgService.syncOrderDelete(orders);
|
}
|
|
|
/**
|
* @author Ryan
|
* @date 2025/8/22
|
* @description: 盘点差异单同步
|
* @version 1.0
|
*/
|
@PostMapping("/sync/check/result")
|
@ApiOperation("盘点差异单同步")
|
@OperationLog("盘点差异单")
|
public R checkResult(@RequestBody SyncCheckDiffParams syncParams) {
|
if (Objects.isNull(syncParams)) {
|
return R.error("参数不能为空!!");
|
}
|
return receiveMsgService.syncCheckDiffs(syncParams);
|
}
|
|
}
|