#
luxiaotao1123
2021-03-20 b650e00a5e5ecdad78014452c8bfa60b3ffbfca7
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 zy.cloud.wms.common.service.asrs;
 
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import zy.cloud.wms.common.service.asrs.entity.Result;
import zy.cloud.wms.manager.entity.param.StockTransferParam;
import zy.cloud.wms.manager.utils.HttpHandler;
 
import java.io.IOException;
import java.util.List;
 
/**
 * Created by vincent on 2021/3/20
 */
@Service("asrsService")
public class AsrsService {
 
    @Value("${asrs.baseUrl}")
    private String asrsBaseUrl;
 
    public Boolean stockTransfer(List<StockTransferParam> params) {
        try {
            String response = new HttpHandler.Builder()
                    .setUri(asrsBaseUrl)
                    .setPath("/open/api/stockOut")
                    .setJson(JSON.toJSONString(params))
                    .build()
                    .doPost();
            Result result = JSON.parseObject(response, Result.class);
            if (result.getCode() == 200) {
                return true;
            } else {
                return false;
            }
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
    }
 
}