package com.vincent.rsf.server.api.controller; import com.vincent.rsf.server.api.controller.erp.params.InOutResultReportParam; import com.vincent.rsf.server.api.controller.erp.params.InventoryAdjustReportParam; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; 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.HashMap; import java.util.Map; /** * 云仓WMS 模拟接口(对接协议 9.1、9.2、物料同步)。 * 云仓未提供真实 URL 时,可将 platform.erp.base-url 指向本机该服务(如 http://127.0.0.1:8086/rsf-server), * 立库上报请求会打到本接口并返回模拟成功。 */ @Slf4j @RestController @RequestMapping("/api") @Api(value = "云仓模拟接口", tags = "云仓模拟(无真实云仓URL时使用)") public class CloudWmsMockController { private static Map successResponse() { Map data = new HashMap<>(); data.put("result", "SUCCESS"); Map map = new HashMap<>(); map.put("code", 200); map.put("msg", ""); map.put("data", data); return map; } /** 9.1 入/出库结果上报 - 模拟 */ @ApiOperation("入/出库结果上报(模拟)") @PostMapping(value = "/report/inOutResult", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockInOutResult(@RequestBody InOutResultReportParam body) { log.info("云仓模拟-入/出库结果上报,orderNo={},locId={},matNr={}", body != null ? body.getOrderNo() : null, body != null ? body.getLocId() : null, body != null ? body.getMatNr() : null); return successResponse(); } /** 9.2 库存调整主动上报 - 模拟 */ @ApiOperation("库存调整主动上报(模拟)") @PostMapping(value = "/report/inventoryAdjust", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockInventoryAdjust(@RequestBody InventoryAdjustReportParam body) { log.info("云仓模拟-库存调整上报,changeType={},wareHouseId={},matNr={}", body != null ? body.getChangeType() : null, body != null ? body.getWareHouseId() : null, body != null ? body.getMatNr() : null); return successResponse(); } /** 物料基础信息同步 - 模拟 */ @ApiOperation("物料同步(模拟)") @PostMapping(value = "/mat/sync", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockMatSync(@RequestBody Object body) { log.info("云仓模拟-物料同步,body={}", body != null ? body.toString() : null); return successResponse(); } }