cl
4 小时以前 52e09a6b7b7054fc51b9d4bf5f1fbec0a57e60f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package com.vincent.rsf.server.api.controller;
 
import com.vincent.rsf.server.api.controller.erp.params.DapIlcwmsCompletionRequest;
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.RestController;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 云仓模拟接口。platform.erp.base-url 指向本服务时,Feign 会请求下列 DAP 风格路径。
 */
@Slf4j
@RestController
@Api(value = "云仓模拟接口", tags = "云仓模拟(无真实云仓URL时使用)")
public class CloudWmsMockController {
 
    private static Map<String, Object> dapOkEnvelope() {
        Map<String, Object> profile = new HashMap<>();
        profile.put("tenantSid", 1);
        profile.put("userSid", "SYS");
        Map<String, Object> response = new HashMap<>();
        response.put("code", -1);
        response.put("success", false);
        response.put("message", "");
        Map<String, Object> map = new HashMap<>();
        map.put("duration", 58);
        map.put("statusDescription", "OK");
        map.put("response", response);
        map.put("profile", profile);
        map.put("uuid", "");
        map.put("status", 200);
        return map;
    }
 
    private static Map<String, Object> successResponseLegacy() {
        Map<String, Object> data = new HashMap<>();
        data.put("result", "SUCCESS");
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("msg", "");
        map.put("data", data);
        return map;
    }
 
    @ApiOperation("鼎捷-入库完成反馈(模拟)")
    @PostMapping(value = "/dapilc/restful/service/ilcwmsplus/IKWebService/cusInventoryCompletionReport", consumes = MediaType.APPLICATION_JSON_VALUE)
    public Map<String, Object> mockInventoryCompletion(@RequestBody DapIlcwmsCompletionRequest body) {
        log.info("云仓模拟-入库完成反馈,行数={}", body != null && body.getData() != null ? body.getData().size() : 0);
        return dapOkEnvelope();
    }
 
    @ApiOperation("鼎捷-出库完成反馈(模拟)")
    @PostMapping(value = "/dapilc/restful/service/ilcwmsplus/IKWebService/cusOutboundCompletionReport", consumes = MediaType.APPLICATION_JSON_VALUE)
    public Map<String, Object> mockOutboundCompletion(@RequestBody DapIlcwmsCompletionRequest body) {
        log.info("云仓模拟-出库完成反馈,行数={}", body != null && body.getData() != null ? body.getData().size() : 0);
        return dapOkEnvelope();
    }
 
    /** 9.2 库存调整主动上报 - 模拟(路径不变,body 为 {data:[]}) */
    @ApiOperation("库存调整上报(模拟)")
    @PostMapping(value = "/api/report/inventoryAdjust", consumes = MediaType.APPLICATION_JSON_VALUE)
    public Map<String, Object> mockInventoryAdjust(@RequestBody DapIlcwmsCompletionRequest body) {
        log.info("云仓模拟-库存调整上报,行数={}", body != null && body.getData() != null ? body.getData().size() : 0);
        return successResponseLegacy();
    }
 
    /** 物料基础信息同步 - 模拟 */
    @ApiOperation("物料同步(模拟)")
    @PostMapping(value = "/api/mat/sync", consumes = MediaType.APPLICATION_JSON_VALUE)
    public Map<String, Object> mockMatSync(@RequestBody Object body) {
        log.info("云仓模拟-物料同步,body={}", body != null ? body.toString() : null);
        return successResponseLegacy();
    }
 
//    /** 9.1 入/出库结果上报 - 模拟(旧路径,已改 DAP) */
//    @PostMapping(value = "/api/report/inOutResult", consumes = MediaType.APPLICATION_JSON_VALUE)
//    public Map<String, Object> mockInOutResult(@RequestBody InOutResultReportParam body) {
//        return successResponseLegacy();
//    }
}