cl
5 天以前 926cc0fd4fad17ae02814387ced7e0a88b042a2b
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/WmsErpController.java
@@ -1,4 +1,6 @@
package com.vincent.rsf.openApi.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.params.ErpMatnrParms;
@@ -7,18 +9,21 @@
import com.vincent.rsf.openApi.service.WmsErpService;
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;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@RestController
@RequestMapping({"/erp","/cloudwms"})
@Api("ERP接口对接")
@Slf4j
public class WmsErpController {
    @Autowired
@@ -51,10 +56,24 @@
        if (Objects.isNull(params)) {
            throw new CoolException("参数不能为空!!");
        }
        log.info("新增/修改单据,请求参数: {}", JSONObject.toJSONString(params));
        return wmsErpService.addOrUpdateOrder(params);
    }
    /**
     * 多条入/出库通知单下发;逐条等同 /order/add,失败条见 data.items,有失败时本地事务回滚。
     */
    @ApiOperation("批量新增单据(兼容修改、取消)")
    @PostMapping("/order/addAll")
    public CommonResponse orderAddAll(@RequestBody List<ErpOpParams> paramsList) {
        if (paramsList == null || paramsList.isEmpty()) {
            throw new CoolException("参数不能为空!!");
        }
        log.info("新增/修改单据,请求参数: {}", JSONArray.toJSONString(paramsList));
        return wmsErpService.addOrUpdateOrders(paramsList);
    }
    /**
     * 取消订单/取消单据。与 /order/add 传 operateType=3 的取消逻辑一致,均转发立库 sync/orders/delete。
     * @param params 至少包含 orderNo,可选 orderItems
     */