| | |
| | | package com.zy.common.service.wms; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | 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; |
| | |
| | | private String wmsUrl; |
| | | |
| | | public Result replenish(List<ReplenishDto> dtos) { |
| | | return new Result(200, "操作成功", null); |
| | | try { |
| | | if (Cools.isEmpty(dtos)) { |
| | | return new Result(200, "操作成功", null); |
| | | } |
| | | 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 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); |
| | | } |
| | | } |
| | | |
| | | } |