自动化立体仓库 - WMS系统
luxiaotao1123
2021-06-18 41b22601227fa44de14737309e559e0d3909b5d6
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
package com.zy.common.service.wms;
 
import com.alibaba.fastjson.JSON;
import com.zy.common.model.BillDto;
import com.zy.common.model.ErpUpload;
import com.zy.common.utils.HttpHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
import java.io.IOException;
import java.util.List;
 
/**
 * Created by vincent on 2021/5/27
 */
@Component
public class WmsService {
 
    @Value("${wms.url}")
    private String wmsUrl;
 
    public Result replenish(List<ReplenishDto> dtos) {
        try {
            ReplenishParam param = new ReplenishParam();
            param.setList(dtos);
            String response = new HttpHandler.Builder()
                    .setUri(wmsUrl)
                    .setPath("/open/api/replenish")
                    .setJson(JSON.toJSONString(param))
                    .build()
                    .doPost();
            return JSON.parseObject(response, Result.class);
        } catch (IOException e) {
            e.printStackTrace();
            return new Result(500, "服务器异常", null);
        }
    }
 
    public Result erpUpload(List<BillDto> dtos, Integer docId, String docNumber) {
        try {
            ErpUpload param = new ErpUpload();
            param.setDtos(dtos);
            param.setDocId(docId);
            param.setDocNumber(docNumber);
            String response = new HttpHandler.Builder()
                    .setUri(wmsUrl)
                    .setPath("/open/api/erp/upload")
                    .setJson(JSON.toJSONString(param))
                    .build()
                    .doPost();
            return JSON.parseObject(response, Result.class);
        } catch (IOException e) {
            e.printStackTrace();
            return new Result(500, "服务器异常", null);
        }
    }
 
}