| | |
| | | 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.common.service.asrs.entity.ResultLocDetl; |
| | | import zy.cloud.wms.common.service.asrs.entity.ResultSite; |
| | | import zy.cloud.wms.manager.entity.param.StockTransferParam; |
| | | import zy.cloud.wms.manager.utils.HttpHandler; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2021/3/20 |
| | |
| | | @Value("${asrs.baseUrl}") |
| | | private String asrsBaseUrl; |
| | | |
| | | public Boolean stockTransfer(List<StockTransferParam> params) { |
| | | 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) |
| | |
| | | .setJson(JSON.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | | Result result = JSON.parseObject(response, Result.class); |
| | | if (result.getCode() == 200) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | return JSON.parseObject(response, Result1.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | return new Result1(500, "服务器异常", null); |
| | | } |
| | | } |
| | | |
| | | public Result1 stockTransferLocMode(List<StockTransferParam> params) { |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(asrsBaseUrl) |
| | | .setPath("/open/api/stockOut/locMode") |
| | | .setJson(JSON.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | | return JSON.parseObject(response, Result1.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new Result1(500, "服务器异常", null); |
| | | } |
| | | } |
| | | |
| | | /* 获取出库站点 */ |
| | | public ResultSite takeSite() { |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(asrsBaseUrl) |
| | | .setPath("/open/api/available/take/site") |
| | | .setJson(JSON.toJSONString("")) |
| | | .build() |
| | | .doPost(); |
| | | return JSON.parseObject(response, ResultSite.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new ResultSite(500, "服务器异常", null); |
| | | } |
| | | } |
| | | |
| | | /* 根据物料编码获取立库库存信息 */ |
| | | public ResultLocDetl getAsrsLocDetl(String matnr) { |
| | | try { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("matnr", matnr); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(asrsBaseUrl) |
| | | .setPath("/open/api/get/asrsLocDetl") |
| | | .setParams(map) |
| | | // .setJson(JSON.toJSONString(matnr)) |
| | | .build() |
| | | .doPost(); |
| | | return JSON.parseObject(response, ResultLocDetl.class); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return new ResultLocDetl(500, "服务器异常", null); |
| | | } |
| | | } |
| | | } |