自动化立体仓库 - WMS系统
#
zjj
2025-09-02 598c9d63f68a8c92b264328c88c1cb4ef25af044
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package com.zy.kingdee.controller;
 
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.common.constant.ApiInterfaceConstant;
import com.zy.common.utils.HttpHandler;
import com.zy.kingdee.entity.ResDto;
import com.zy.kingdee.utils.K3ApiUtil;
import com.zy.kingdee.utils.KingDeeUtils;
 
import lombok.extern.slf4j.Slf4j;
 
import okhttp3.internal.http.HttpMethod;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
 
@RestController
@RequestMapping("kingdee")
@Slf4j
public class KingdeeContorller {
 
    @RequestMapping("/get/manufacturingorder/list")
    @ManagerAuth()
    public R getManufacturingorderList(@RequestParam(defaultValue = "1")Integer curr,
                                       @RequestParam(defaultValue = "10")Integer limit,
                                       @RequestParam(required = false)String orderByField,
                                       @RequestParam(required = false)String orderByType,
                                       @RequestParam(required = false)String condition,
                                       @RequestParam Map<String, Object> param) {
        if (null == K3ApiUtil.TokenRes){
            K3ApiUtil.init();
        }
        Map<String, String> map = new LinkedHashMap<>();
        map.put("access_token", K3ApiUtil.TokenRes.getAccessToken());
 
 
        Map<String, Object> jsonMap = new HashMap<>();
        jsonMap.put("CurrentPage",curr);
        jsonMap.put("ItemsOfPage",limit);
        jsonMap.put("AccountDB","002");
 
        OffsetDateTime  time = OffsetDateTime.parse(param.get("time").toString());
 
        HashMap<Object, Object> map1 = new HashMap<>();
 
        String s = String.valueOf(time.toLocalDate());
        map1.put("Property","FPlanCommitDate");
        map1.put("Type","Desc");
 
        jsonMap.put("OrderBy",map1);
//        map.put("CurrentPage",1);
//        map.put("ItemsOfPage",10);
        String resStr = HttpRequest.post("api.kingdee.com" + "/koas/app007107/api/manufacturingorder/list" + K3ApiUtil.getMapStr(map))
                .header("KIS-Timestamp", Long.toString(System.currentTimeMillis() / 1000L))
                .header("KIS-State", "TEST" + K3ApiUtil.getNonce(12))
                .header("KIS-TraceID", "TEST")
                .header("KIS-Ver", "1.0")
                .header("KIS-AuthData", K3ApiUtil.gatewayDto.getData().getAuthData())
                .header("X-Api-SignHeaders", "X-Api-TimeStamp,X-Api-Nonce")
                .header("X-GW-Router-Addr", K3ApiUtil.gatewayDto.getData().getGwRouterAddr())
                .contentType("application/json")
                .body(JSON.toJSONString(jsonMap))
                .execute()
                .body();
 
        JSONObject parseObject = JSON.parseObject(resStr);
        if (parseObject.get("errcode").hashCode() != 0) {
            throw new CoolException(parseObject.get("description").toString());
        }
 
//        Map<String, Object> headers = new HashMap<>();
//
//        headers.put("KIS-Timestamp",Long.toString(System.currentTimeMillis() / 1000L));
//        headers.put("KIS-State","TEST" + K3ApiUtil.getNonce(12));
//        headers.put("KIS-TraceID","TEST");
//        headers.put("KIS-Ver","1.0");
//        headers.put("KIS-AuthData",K3ApiUtil.kingDeeRes.getAppToken());
//
//        headers.put("X-GW-Router-Addr",K3ApiUtil.kingDeeRes.getDomain());
//        headers.put("Content-Type", "application/json;charset=utf-8");
//
//
//        try {
//            String response = new HttpHandler.Builder()
//                    .setUri("api.kingdee.com")
//                    .setPath("/koas/app007107/api/manufacturingorder/list")
//                    .setHeaders(headers)
//                    .setParams(map)
//                    .setJson(JSON.toJSONString(jsonMap))
//                    .build()
//                    .doPost();
//        }catch (Exception e){
//
//        }
 
 
 
        return R.ok(parseObject.get("data"));
    }
}