自动化立体仓库 - WMS系统
#
luxiaotao1123
2021-05-31 76e6628a6a238a1a742d04b30fbba588884a0f62
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
package com.zy.common.service.wms;
 
import com.alibaba.fastjson.JSON;
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;
 
//    // todo:luxiaotao
//    public Result replenish(List<ReplenishDto> dtos) {
//        return new Result(200, "操作成功", null);
//    }
 
    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);
        }
    }
 
}