New file |
| | |
| | | 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.common.service.asrs.entity.Result1; |
| | | 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 Result stockTransferPrew(List<StockTransferParam> params) { |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(asrsBaseUrl) |
| | | .setPath("/open/api/stockOut/prew") |
| | | .setJson(JSON.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | | return JSON.parseObject(response, Result.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new Result(500, "服务器异常", null); |
| | | } |
| | | } |
| | | |
| | | public Result1 stockTransfer(List<StockTransferParam> params) { |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(asrsBaseUrl) |
| | | .setPath("/open/api/stockOut") |
| | | .setJson(JSON.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | | return JSON.parseObject(response, Result1.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new Result1(500, "服务器异常", null); |
| | | } |
| | | } |
| | | |
| | | } |