| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | |
| | | param.setcAccount(order.getNumber()); |
| | | param.setcMemo(order.getMemo()); |
| | | param.setType(Cools.isEmpty(order.getDocType$()) ? "" : order.getDocType$()); |
| | | param.setdDate(Utils.getDateStr(order.getCreateTime())); |
| | | param.setdDate(Utils.getDateStr(new Date())); |
| | | param.setAllocation(order.getItemName()); |
| | | |
| | | |
| | |
| | | private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip) { |
| | | String response = ""; |
| | | boolean success = false; |
| | | log.error(JSONObject.toJSONString(requestParam)); |
| | | log.info(JSONObject.toJSONString(requestParam)); |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url) |
| | |
| | | .setJson(JSONObject.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | log.info("上报ERP出库单据请求返回报文:{}", response); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | |
| | | if (Cools.isEmpty(jsonObject.get("ErrorCode"))) { |
| | | throw new CoolException(jsonObject.get("ErrorMsg").toString()); |
| | | } |
| | | |
| | | int code = Integer.parseInt(jsonObject.get("ErrorCode").toString()); |
| | | if (code != 0) { |
| | | if (code == 0) { |
| | | throw new CoolException(jsonObject.get("ErrorMsg").toString()); |
| | | } |
| | | success = true; |