|
@@ -41,7 +41,10 @@ public class HansaeErp {
|
|
|
|
|
|
|
|
// 재고 URL
|
|
// 재고 URL
|
|
|
private String stockUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/StockCheck";
|
|
private String stockUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/StockCheck";
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // RT URL
|
|
|
|
|
+ private String stockRtUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/StockRTConfirm";
|
|
|
|
|
+
|
|
|
// 매출반영 URL
|
|
// 매출반영 URL
|
|
|
private String salesUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/SaleIF";
|
|
private String salesUrl = "http://erp.hansaemk.com:96/api/#{erpGb}/Shop/SaleIF";
|
|
|
|
|
|
|
@@ -284,4 +287,51 @@ public class HansaeErp {
|
|
|
return salesMap;
|
|
return salesMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * ERP RT
|
|
|
|
|
+ * @param erpGb - ERP구분(hsmk:한세MK, hsdr:한세드림)
|
|
|
|
|
+ * @param Collection<Erp> - 재고이동 정보
|
|
|
|
|
+ * @return
|
|
|
|
|
+ * @author moon
|
|
|
|
|
+ * @since 2021. 06. 21
|
|
|
|
|
+ */
|
|
|
|
|
+ public String erpStockRt(String erpGb, Collection<Erp> rtList) {
|
|
|
|
|
+ GagaMap salesMap = new GagaMap();
|
|
|
|
|
+ String rtn = "S";
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // Parameter
|
|
|
|
|
+ String requestData = (new Gson()).toJson(rtList, new TypeToken<Collection<Erp>>() {
|
|
|
|
|
+ }.getType());
|
|
|
|
|
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
|
|
|
|
|
+ params.add("DATA", requestData);
|
|
|
|
|
+ log.info("params: {}", params);
|
|
|
|
|
+
|
|
|
|
|
+ String requestUrl = GagaStringUtil.replace(stockRtUrl, "#{erpGb}", erpGb);
|
|
|
|
|
+ log.info("requestUrl: {}", requestUrl);
|
|
|
|
|
+
|
|
|
|
|
+ HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params);
|
|
|
|
|
+ URI url = URI.create(requestUrl);
|
|
|
|
|
+
|
|
|
|
|
+ // POST방식으로 호출
|
|
|
|
|
+ ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, request, String.class);
|
|
|
|
|
+ log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
|
|
|
+
|
|
|
|
|
+ String jsonResult = responseEntity.getBody();
|
|
|
|
|
+ log.info("responseEntity.getBody(): {}", jsonResult);
|
|
|
|
|
+
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ GagaMap resultMap = gson.fromJson(jsonResult, GagaMap.class);
|
|
|
|
|
+
|
|
|
|
|
+ if (resultMap.containsKey("Message")) { // 실패 메시지
|
|
|
|
|
+ log.error("Message: {}", resultMap.get("Message").toString());
|
|
|
|
|
+ rtn = "F";
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("{}", e.getMessage().toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return rtn;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|