| | |
| | | import com.vincent.rsf.openApi.entity.dto.OrderDto; |
| | | import com.vincent.rsf.openApi.entity.params.ErpMatnrParms; |
| | | import com.vincent.rsf.openApi.entity.params.ErpOpParams; |
| | | import com.vincent.rsf.openApi.entity.params.ReportParams; |
| | | import com.vincent.rsf.openApi.service.WmsErpService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public CommonResponse reportOrders(Map<String, Object> params) { |
| | | public CommonResponse reportOrders(ReportParams params) { |
| | | if (Objects.isNull(params)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | /**WMS基础配置链接*/ |
| | | String rcsUrl = erpApi.getHost() + ":" + erpApi.getPort() + WmsConstant.REPORT_ORDER_CALLBACK; |
| | | log.info("物料修改:{}, 请求参数: {}", rcsUrl, JSONObject.toJSONString(params)); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.add("Content-Type", "application/json"); |
| | | headers.add("api-version", "v2.0"); |
| | | |
| | | HttpEntity httpEntity = new HttpEntity(params, headers); |
| | | log.info("已完成订单上传:{}, 请求参数: {}", rcsUrl, httpEntity.getBody()); |
| | | |
| | | ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class); |
| | | log.info("修改结果: {}", exchange); |
| | | log.info("已完成订单上传,请求结果: {}", exchange); |
| | | if (Objects.isNull(exchange.getBody())) { |
| | | throw new CoolException("修改失败!!"); |
| | | throw new CoolException("上传失败!!"); |
| | | } else { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | objectMapper.coercionConfigDefaults().setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty); |
| | |
| | | if (result.getCode() == 200) { |
| | | return result; |
| | | } else { |
| | | throw new CoolException("修改失败!!"); |
| | | throw new CoolException("上传失败!!"); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | throw new CoolException(e.getMessage()); |