moon vor 5 Jahren
Ursprung
Commit
53a7dfe6ef

+ 100 - 0
src/main/java/com/style24/batch/biz/dao/TsbDeliveryDao.java

@@ -94,4 +94,104 @@ public interface TsbDeliveryDao {
 	 */
 	void updateTbOrderDtlStat(Delivery delivery);		
 	
+	/**
+	 * 회수결과등록 -TB_WITHDRAW
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 19
+	 */
+	void insertTbWithdraw(Delivery delivery);
+	
+	/**
+	 * 회수결과상세등록 -TB_WITHDRAW_DETAIL
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 19
+	 */
+	void insertTbWithdrawDetail(Delivery delivery);
+		
+	/**
+	 * 주문정보 조회 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 23
+	 */
+	Delivery getOrderInfoList(Delivery delivery);
+	
+	/**
+	 * 주문변경 회수완료
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 25
+	 */
+	void updateTbOrderChange(Delivery delivery);
+	
+	/**
+	 * 주문변경상세 회수완료 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 25
+	 */
+	void updateTbOrderChangeDetail(Delivery delivery);	
+	
+	/**
+	 * 회수결과  주문상세 상태값 변경 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 25
+	 */
+	void updateWdOrderDtlStat(Delivery delivery);		
+	
+	/**
+	 * 교환대기 상태값변경 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 25
+	 */
+	void updateOrderExch(Delivery delivery);		
+	
+	/**
+	 * 출고 송장번호 등록 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 27
+	 */	
+	void insertTbOrdDtlInvoice(Delivery delivery);	
+	
+	/**
+	 * 출고 상태값변경 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 27
+	 */	
+	void updateOrdDtlStat(Delivery delivery);	
+		
+	
+	/**
+	 * 매장 상품재고 초기화 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 28
+	 */	
+	void deleteShopStock();	
+	
+	/**
+	 * 매장 상품재고 등록 
+	 * @param Delivery
+	 * @return
+	 * @author moon
+	 * @since 2021. 03. 28
+	 */	
+	void insertShopStock(Delivery delivery);		
+	
 }

+ 50 - 0
src/main/java/com/style24/batch/biz/dao/TsbWmsDeliveryDao.java

@@ -140,5 +140,55 @@ public interface TsbWmsDeliveryDao {
 	 */
 	void updateWmsIfDeliveryOrdRsltItem(Delivery delivery);
 		
+	/**
+	 * WMS_IF 회수결과 조회
+	 * @param 
+	 * @return Collection<Delivery>
+	 * @author moon
+	 * @since 2021. 03. 19
+	 */
+	Collection<Delivery> getWmsIfRecallDeliveryList();	
+	
+	
+	/**
+	 * WMS_IF 입고결과수신완료 -H
+	 * @param 
+	 * @return Delivery
+	 * @author moon
+	 * @since 2021. 03. 19
+	 */
+	void updateWmsIfRecallDeliveryRslt(Delivery delivery);
+	
+	/**
+	 * WMS_IF 결과수신완료 -D
+	 * @param 
+	 * @return Delivery
+	 * @author moon
+	 * @since 2021. 03. 19
+	 */
+	void updateWmsIfRecallDeliveryItemRslt(Delivery delivery);
+	
+	
+	/**
+	 * WMS_IF 출고 송장번호 조회
+	 * @param 
+	 * @return Collection<Delivery>
+	 * @author moon
+	 * @since 2021. 03. 26
+	 */
+	Collection<Delivery> getWmsTbIfDeliveryInvoiceRslt();	
+	
+	/**
+	 * WMS_IF 출고 수신완료
+	 * @param 
+	 * @return Delivery
+	 * @author moon
+	 * @since 2021. 03. 27
+	 */
+	void updateWmsTbIfDeliveryInvoiceRslt(Delivery delivery);
+	
+	
+	
+	
 	
 }

+ 90 - 0
src/main/java/com/style24/batch/biz/job/delivery/TsbInvoiceNoRcvJob.java

@@ -0,0 +1,90 @@
+package com.style24.batch.biz.job.delivery;
+
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.style24.batch.biz.job.TsbAbstractJob;
+import com.style24.batch.biz.service.TsbDeliveryService;
+import com.style24.batch.biz.service.TsbWmsDeliveryService;
+import com.style24.persistence.domain.Delivery;
+
+import com.style24.core.support.env.TscConstants.OrderChangeGb;
+import com.style24.core.support.env.TscConstants.OrderDetailStat;
+
+
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 출고 송장번호 수신 (wmsif to mall) 
+ *
+ * @author moon
+ * @since 2021. 03. 26
+ */
+@Component
+@Slf4j
+public class TsbInvoiceNoRcvJob extends TsbAbstractJob<Collection<Delivery>, Collection<Delivery> , Collection<Delivery>> {
+
+	@Autowired
+	private TsbDeliveryService deliveryService;
+
+	@Autowired
+	private TsbWmsDeliveryService wmsDeliveryService
+	
+	;
+	private int succCnt = 0;
+	private int failCnt = 0;
+
+	@Override
+	public Collection<Delivery> read() throws Exception {
+
+		// WMS_IF 출고 송장번호 조회 
+		Collection<Delivery> invoiceList = wmsDeliveryService.getWmsTbIfDeliveryInvoiceRslt();
+		return invoiceList;
+	}
+
+	@Override
+	public Collection<Delivery> process(Collection<Delivery> invoiceList) throws Exception {
+		succCnt = 0;
+		failCnt = 0;
+		/**
+		 * 1. wms 송장번호 조회
+		 * 2. tb_order_detail_invoice 등록 
+		 * 3. tb_order_detail 상태값 변경   -- G013_40	배송준비중
+		 * 4. wms 수신완료 업데이트 
+		 * 
+		 * */
+		
+
+		for(Delivery data: invoiceList) {
+			
+			try {
+				
+				// 송장번호 등록 
+				deliveryService.saveInvoice(data);
+				
+				// wms 수신완료 업데이트 
+				wmsDeliveryService.updateWmsTbIfDeliveryInvoiceRslt(data);
+
+				succCnt++;
+			}catch(Exception e) {
+				failCnt++;
+			}
+		}
+		return invoiceList;
+	}
+
+	@Override
+	public Collection<Delivery> write(Collection<Delivery> invoiceList) throws Exception {
+
+		return invoiceList;
+	}
+
+	@Override
+	public void notify(Collection<Delivery> invoiceList) throws Exception {
+		super.printResult(succCnt, failCnt);
+	}
+
+}

+ 64 - 0
src/main/java/com/style24/batch/biz/job/delivery/TsbShopGoodsStockJob.java

@@ -0,0 +1,64 @@
+package com.style24.batch.biz.job.delivery;
+
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.gagaframework.web.parameter.GagaMap;
+import com.style24.batch.biz.job.TsbAbstractJob;
+import com.style24.batch.biz.service.TsbDeliveryService;
+import com.style24.batch.biz.service.TsbWmsDeliveryService;
+import com.style24.persistence.domain.Delivery;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 매장상품재고 수신 (erp to mall) 
+ *
+ * @author moon
+ * @since 2021. 03. 28
+ */
+@Component
+@Slf4j
+public class TsbShopGoodsStockJob extends TsbAbstractJob<Delivery, Delivery, Delivery> {
+
+	@Autowired
+	private TsbDeliveryService deliveryService;
+
+	private int succCnt = 0;
+	private int failCnt = 0;
+
+	@Override
+	public Delivery read() throws Exception {
+
+		Delivery delivery = new Delivery();
+		return delivery;
+	}
+
+	@Override
+	public Delivery process(Delivery delivery) throws Exception {
+		succCnt = 0;
+		failCnt = 1;
+		
+		// 1.wms  출고결과 조회 
+		deliveryService.saveErpGoodsStock();
+		
+		succCnt = 1;
+		failCnt = 0;
+		
+		return delivery;
+	}
+
+	@Override
+	public Delivery write(Delivery delivery) throws Exception {
+
+		return delivery;
+	}
+
+	@Override
+	public void notify(Delivery delivery) throws Exception {
+		super.printResult(succCnt, failCnt);
+	}
+
+}

+ 124 - 0
src/main/java/com/style24/batch/biz/job/delivery/TsbWithdrawRsltJob.java

@@ -0,0 +1,124 @@
+package com.style24.batch.biz.job.delivery;
+
+import java.util.Collection;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.style24.batch.biz.job.TsbAbstractJob;
+import com.style24.batch.biz.service.TsbDeliveryService;
+import com.style24.batch.biz.service.TsbWmsDeliveryService;
+import com.style24.persistence.domain.Delivery;
+
+import com.style24.core.support.env.TscConstants.OrderChangeGb;
+import com.style24.core.support.env.TscConstants.OrderDetailStat;
+
+
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 회수결과 (wmsif to mall) 
+ *
+ * @author moon
+ * @since 2021. 03. 19
+ */
+@Component
+@Slf4j
+public class TsbWithdrawRsltJob extends TsbAbstractJob<Collection<Delivery>, Collection<Delivery> , Collection<Delivery>> {
+
+	@Autowired
+	private TsbDeliveryService deliveryService;
+
+	@Autowired
+	private TsbWmsDeliveryService wmsDeliveryService
+	
+	;
+	private int succCnt = 0;
+	private int failCnt = 0;
+
+	@Override
+	public Collection<Delivery> read() throws Exception {
+
+		// WMS_IF 회수결과 조회 
+		Collection<Delivery> delvList = wmsDeliveryService.getWmsIfRecallDeliveryList();
+		return delvList;
+	}
+
+	@Override
+	public Collection<Delivery> process(Collection<Delivery> delvList) throws Exception {
+		succCnt = 0;
+		failCnt = 0;
+		/**
+		 * 1. 회수결과 조회 
+		 * 2. tb_order_change, tb_order_change_detail  update     
+		 * 3. tb_withdraw, tb_withdraw_detail insert
+		 * 4. tb_order_detail update 
+		 * 4. 교환일경우 교환상품 출고시키기 
+		 * 5. WMS 수신결과 업데이트 
+		 * G680_30	반품요청
+		 * G680_40	교환요청
+		 * */
+		
+		
+		/**
+		 *   as-is 데이터 구분해서 분기처리  로직 추가 예정 !!!
+		 *   insert update 시   중복 쿼리 제거위한 로직 추가 예정!!! 
+		 *   주문상태값 변경되는지 최종확인 후 반영 예정 !!!
+		 * */
+		
+		for(Delivery data: delvList) {
+			
+			try {
+				
+				// 주문정보 및 주문변경정보 조회  (as-is 회수건 포함) 
+				Delivery ordInfo = deliveryService.getOrderInfoList(data);
+				data.setOrdChgSq(ordInfo.getOrdChgSq());
+				data.setOrderdtlno(ordInfo.getOrdDtlNo());
+				data.setItemCd(ordInfo.getItemCd());
+				data.setOptCd1(ordInfo.getOptCd1());
+				data.setOptCd2(ordInfo.getOptCd2());
+				data.setOrdExchGb(ordInfo.getOrdExchGb());
+				data.setChgGb(ordInfo.getChgGb());
+				data.setChgOrdDtlNo(ordInfo.getChgOrdDtlNo());
+				data.setWdInvoiceSendYn("Y");
+				// 
+				
+				// 주문변경  처리  (주문상세 단위!!) 
+				deliveryService.updateOrderChange(data);
+				
+				
+				// 회수등록 처리  
+				deliveryService.createWithdraw(data);
+				
+				// 교환일 경우  주문상세 상태값 처리  
+				if(OrderChangeGb.EXCHANGE.value().equals(data.getChgGb())) {
+					
+					// 원주문건 상태값 취소로 변경 
+					deliveryService.updateWdOrderDtlStat(data);
+					// 교환주문건 상태값 교환대기에서 결제완료 상태로 변경 
+					deliveryService.updateOrderExch(data);
+				}
+				
+				wmsDeliveryService.updateWmsIfRecallDeliveryRslt(data);
+
+				succCnt++;
+			}catch(Exception e) {
+				failCnt++;
+			}
+		}
+		return delvList;
+	}
+
+	@Override
+	public Collection<Delivery> write(Collection<Delivery> delivery) throws Exception {
+
+		return delivery;
+	}
+
+	@Override
+	public void notify(Collection<Delivery> delivery) throws Exception {
+		super.printResult(succCnt, failCnt);
+	}
+
+}

+ 249 - 5
src/main/java/com/style24/batch/biz/service/TsbDeliveryService.java

@@ -1,23 +1,36 @@
 package com.style24.batch.biz.service;
 
+import java.net.URI;
+import java.util.ArrayList;
 import java.util.Collection;
-
+import java.util.List;
+import java.util.Map;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
 import com.gagaframework.web.parameter.GagaMap;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
 import com.style24.batch.biz.dao.TsbDeliveryDao;
 import com.style24.batch.support.env.TsbConstants;
 import com.style24.persistence.domain.Delivery;
-
+import com.style24.persistence.domain.ErpStock;
 import com.style24.core.support.env.TscConstants.OrderDetailStat;
+import com.style24.core.support.env.TscConstants.OrderChangeStat;
 import com.style24.core.biz.dao.TscOrderDao;
+import com.style24.core.biz.service.TscErpService;
+import com.style24.core.biz.service.TscWmsService;
 import com.style24.persistence.domain.Order;
-
+import com.style24.persistence.domain.WmsDelivery;
 
 import lombok.extern.slf4j.Slf4j;
 
+
 /**
  * 배치 Service
  *
@@ -28,12 +41,25 @@ import lombok.extern.slf4j.Slf4j;
 @Slf4j
 public class TsbDeliveryService {
 
+	
+	@Autowired
+	private Environment env;
+	
 	@Autowired
 	private TsbDeliveryDao deliveryDao;
 	
 	@Autowired
 	private TscOrderDao orderDao;	
 
+	@Autowired
+	private RestTemplate restTemplate;
+	
+	@Autowired
+	private TscWmsService wmsService;
+
+	@Autowired
+	private TscErpService erpService;	
+	
 	/**
 	 * 총알배송 권역정보 갱신 
 	 * @param  Collection<Delivery>
@@ -140,7 +166,7 @@ public class TsbDeliveryService {
         
 		// 출고예외 등록 -H
 		for(Delivery data : list) {
-			data.setOrdDtlStat(OrderDetailStat.SHIP_COMPLETE.value());
+			data.setOrdDtlStat(OrderDetailStat.SHIPPING.value());
 			data.setUpdNo(TsbConstants.REG_NO);
 			deliveryDao.updateTbOrderDtlStat(data);
 			
@@ -154,4 +180,222 @@ public class TsbDeliveryService {
 		}	
 	}	
 	
+	/**
+	 * 회수결과 처리 
+	 * @param  Delivery
+	 * @return 
+	 * @author moon
+	 * @since  2021. 03. 19
+	 */
+	@Transactional("shopTxnManager")
+	public void createWithdraw(Delivery delivery) {
+		
+		delivery.setRegNo(TsbConstants.REG_NO);
+		
+		// TB_WITHDRAW 입력
+		deliveryDao.insertTbWithdraw(delivery);
+		// TB_WITHDRAW_DETAIL 입력
+		deliveryDao.insertTbWithdrawDetail(delivery);
+	}	
+	
+	/**
+	 * 주문정보 조회 
+	 * @param Delivery
+	 * @return Delivery
+	 * @author moon
+	 * @since  2021. 03. 23
+	 */
+	public Delivery getOrderInfoList(Delivery delivery) {
+
+		Delivery orderInfo = deliveryDao.getOrderInfoList(delivery);
+		return orderInfo ;
+	}		
+	
+	/**
+	 * 회수결과 주문변경 처리 
+	 * @param  Delivery
+	 * @return 
+	 * @author moon
+	 * @since  2021. 03. 25
+	 */
+	@Transactional("shopTxnManager")
+	public void updateOrderChange(Delivery delivery) {
+		
+		delivery.setRegNo(TsbConstants.REG_NO);
+		delivery.setChgStat(OrderChangeStat.EXCHANGE_COMPLETE.value()); // 교환완료 
+		// TB_ORDER_CHANGE 
+		deliveryDao.updateTbOrderChange(delivery);
+		// TB_ORDER_CHANGE_DETAIL
+		deliveryDao.updateTbOrderChangeDetail(delivery);
+	}	
+	
+	/**
+	 * 회수결과 - 주문상세 상태값 변경 
+	 * @param  Delivery
+	 * @return 
+	 * @author moon
+	 * @since  2021. 03. 25
+	 */
+	@Transactional("shopTxnManager")
+	public void updateWdOrderDtlStat(Delivery data ) {
+
+			data.setOrdDtlStat(OrderDetailStat.PAYMENT_AFTER_CANCEL.value()); // 
+			data.setUpdNo(TsbConstants.REG_NO);
+			deliveryDao.updateWdOrderDtlStat(data);
+			
+			// 주문상세이력
+			Order order = new Order();
+			order.setOrdDtlNo(data.getOrderdtlno());
+			order.setUpdNo(TsbConstants.REG_NO);
+			order.setRegNo(TsbConstants.REG_NO);
+			orderDao.createOrderDetailHst(order);
+	
+	}	
+	
+	/**
+	 * 교환대기 상태값변경 
+	 * @param  Delivery
+	 * @return 
+	 * @author moon
+	 * @since  2021. 03. 25
+	 */
+	@Transactional("shopTxnManager")
+	public void updateOrderExch(Delivery data) {
+		
+		data.setOrdDtlStat(OrderDetailStat.PAYMENT_COMPLETE.value());
+		data.setUpdNo(TsbConstants.REG_NO);
+		deliveryDao.updateOrderExch(data);
+		
+		// 주문상세이력
+		Order order = new Order();
+		order.setOrdDtlNo(data.getChgOrdDtlNo());
+		order.setUpdNo(TsbConstants.REG_NO);
+		order.setRegNo(TsbConstants.REG_NO);
+		orderDao.createOrderDetailHst(order);
+
+	}	
+	
+	/**	
+	 * 출고 송장번호 등록 
+	 * @param  Delivery
+	 * @return 
+	 * @author moon
+	 * @since  2021. 03. 25
+	 */
+	@Transactional("shopTxnManager")
+	public void saveInvoice(Delivery data) {
+		
+		data.setOrdDtlStat(OrderDetailStat.PAYMENT_COMPLETE.value());
+		data.setUpdNo(TsbConstants.REG_NO);
+		deliveryDao.insertTbOrdDtlInvoice(data);
+		
+		if("N".equals(data.getAddinvoiceyn())){
+			data.setOrdDtlStat(OrderDetailStat.DELIVERY_PREPARE.value());  // DELIVERY_PREPARE("G013_40"),		// 배송준비중
+			// INVOICE_SEND_YN    Y N  대상 확인후 case에 반영 
+			
+			deliveryDao.updateOrdDtlStat(data);
+		}
+	}	
+	
+	/**	
+	 * 실시간 재고조회(WMS&ERP)
+	 * @param  Delivery
+	 * @return Collection<WmsDelivery> stockLoc:WH-wms 외 매장코드   locQty: 수량
+	 * @author moon
+	 * @since  2021. 03. 28
+	 */
+	public Collection<WmsDelivery> getRealStock(Integer productNo, String skuCode, String styleCd, String colorCd, String sizeCd)  {
+		
+		////  임시 
+//		productNo = 14475554;
+//		skuCode   = "13096364-5"; // "13096364-5"
+//		styleCd = "COF0GABL02";
+//		colorCd = "CE"; //"CE"
+//		sizeCd = "150";
+		//////
+		
+		Collection<WmsDelivery> list = new ArrayList();
+		String chk1 = "N";
+		String chk2 = "N";
+		
+		
+		WmsDelivery  wmsRtn = wmsService.getWmsRealStock(productNo, skuCode);
+		
+		Collection<ErpStock> erpRtnList = erpService.getErpRealStock(styleCd, colorCd, sizeCd);
+		
+		if(wmsRtn != null ) {
+			list.add(wmsRtn);
+		} 
+		else {
+			chk1 = "Y";
+		}
+		
+		if(!"".equals(erpRtnList) && erpRtnList != null) {
+			for(ErpStock data : erpRtnList) {
+				WmsDelivery tmp = new WmsDelivery();
+				tmp.setStockLoc(data.getStockLoc());
+				tmp.setLocQty(data.getLocQty());
+				list.add(tmp);
+			}
+		}  else {
+			chk2 = "Y";
+		}
+		
+		if("Y".equals(chk1) && "Y".equals(chk2)) {
+			list = null;
+		}
+		
+		return list;
+	}
+	
+	/**	
+	 * ERP 매장상품재고 조회 및 등록  
+	 * @param  Delivery
+	 * @return 
+	 * @author moon
+	 * @since  2021. 03. 28
+	 */
+	public void saveErpGoodsStock()  {
+
+		String erpurl = env.getProperty("erp.api.stock.url");
+		GagaMap resultMap = new GagaMap();
+		
+		URI url = URI.create(erpurl);
+
+		ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
+		HttpStatus status = responseEntity.getStatusCode();
+		
+		log.info("erpurl 호출결과: "+status.name());
+		
+		if("OK".equals(status.name())) {
+
+			String jsonResult = responseEntity.getBody();
+			
+			
+			Gson gson = new GsonBuilder().create();
+			resultMap = gson.fromJson(jsonResult, GagaMap.class); 
+			
+			String GoodsInfo = resultMap.get("GoodsInfo").toString();
+
+			List<Map<String, Object>> List = null;
+			List = gson.fromJson(GoodsInfo, new TypeToken<List<Map<String, Object>>>() {}.getType()); 
+			
+			deliveryDao.deleteShopStock();
+			
+			for(int i=0; i<List.size(); i++) {
+				Map data = List.get(i);
+				Delivery goods = new Delivery();
+				goods.setRegNo(TsbConstants.REG_NO);
+				goods.setSupplyCompCd(TsbConstants.COMPANY_CD_DR); // 1003 한세드립
+				goods.setCdShop(data.get("CD_SHOP").toString());
+				goods.setCdStyle(data.get("CD_STYLE").toString());
+				goods.setCdColor(data.get("CD_COLOR").toString());
+				goods.setCdSize(data.get("CD_SIZE").toString());
+				goods.setQtStock((int)Double.parseDouble(data.get("QT_STOCK").toString()));
+				deliveryDao.insertShopStock(goods);
+			}
+		}
+
+	}
+	
 }

+ 58 - 0
src/main/java/com/style24/batch/biz/service/TsbWmsDeliveryService.java

@@ -232,5 +232,63 @@ public class TsbWmsDeliveryService {
 		}
 	}		
 	
+	/**
+	 * WMS_IF 회수결과 조회 
+	 * @param 
+	 * @return Collection<Delivery>
+	 * @author moon
+	 * @since  2021. 03. 19
+	 */
+	public Collection<Delivery> getWmsIfRecallDeliveryList() {
+
+		Collection<Delivery> list = wmsDeliveryDao.getWmsIfRecallDeliveryList();
+		return list ;
+	}	
+	
+	/**
+	 * WMS_IF 회수결과 처리결과 등록 
+	 * 
+	 * @param Delivery
+	 * @author moon
+	 * @since  2021. 03. 19
+	 */
+	@Transactional("wmsTxnManager")
+	public void updateWmsIfRecallDeliveryRslt(Delivery delivery) {
+
+		delivery.setIfstat("2"); // 수신완료 상태 
+		wmsDeliveryDao.updateWmsIfRecallDeliveryRslt(delivery);
+		wmsDeliveryDao.updateWmsIfRecallDeliveryItemRslt(delivery);
+	}		
+	
+	/**
+	 * WMS_IF 출고 송장번호 조회 
+	 * @param 
+	 * @return Collection<Delivery>
+	 * @author moon
+	 * @since  2021. 03. 26
+	 */
+	public Collection<Delivery> getWmsTbIfDeliveryInvoiceRslt() {
+
+		Collection<Delivery> list = wmsDeliveryDao.getWmsTbIfDeliveryInvoiceRslt();
+		return list ;
+	}	
+	
+	
+	/**
+	 * WMS_IF 출고 수신완료
+	 * 
+	 * @param Delivery
+	 * @author moon
+	 * @since  2021. 03. 27
+	 */
+	@Transactional("wmsTxnManager")
+	public void updateWmsTbIfDeliveryInvoiceRslt(Delivery delivery) {
+
+		delivery.setIfyn("Y"); // 수신완료 상태 
+		wmsDeliveryDao.updateWmsTbIfDeliveryInvoiceRslt(delivery);
+	}	
+	
+	
+	
 	
 }

+ 62 - 7
src/main/java/com/style24/batch/biz/task/TsbDeliveryTask.java

@@ -2,6 +2,7 @@ package com.style24.batch.biz.task;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import com.style24.batch.biz.job.delivery.TsbDailyDeliveryZoneJob;
@@ -10,6 +11,11 @@ import com.style24.batch.biz.job.delivery.TsbDeliveryOrderJob;
 import com.style24.batch.biz.job.delivery.TsbDeliveryOrderRsltJob;
 import com.style24.batch.biz.job.delivery.TsbWithdrawExcRcvJob;
 import com.style24.batch.biz.job.delivery.TsbWithdrawExcRsltJob;
+import com.style24.batch.biz.job.delivery.TsbWithdrawRsltJob;
+import com.style24.batch.biz.job.delivery.TsbInvoiceNoRcvJob;
+import com.style24.batch.biz.job.delivery.TsbShopGoodsStockJob;
+
+
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -39,7 +45,16 @@ public class TsbDeliveryTask {
 	
 	@Autowired
 	private TsbDeliveryOrderRsltJob deliveryOrderRsltJob;
+	
+	@Autowired
+	private TsbWithdrawRsltJob withdrawRsltJob;
 
+	@Autowired
+	private TsbInvoiceNoRcvJob tsbInvoiceNoRcvJob;
+	
+	@Autowired
+	private TsbShopGoodsStockJob tsbShopGoodsStockJob;
+	
 	/**
 	 * 초 분 시 일 월 주(년)
 	 * 0 0 12 * * ?"             : 아무 요일, 매월, 매일 12:00:00
@@ -76,11 +91,11 @@ public class TsbDeliveryTask {
 	
 
 	/**
-	 * 출고처지정 및 배송(출고)지시   : 분배치 10분
+	 * 출고처지정 및 배송(출고)지시   : 분배치 10분??
 	 *
 	 * @throws Exception
 	 */
-	//@Scheduled(cron = "${cron.delivery.order}")
+	//@Scheduled(cron = "${cron.delivery.tsbDeliveryOrderJob}")
 	//@Scheduled(fixedDelay = 3500000)
 	@Async
 	public void tsbDeliveryOrderJob() throws Exception {
@@ -92,7 +107,7 @@ public class TsbDeliveryTask {
 	 *
 	 * @throws Exception
 	 */
-	//@Scheduled(cron = "${cron.delivery.order}")
+	//@Scheduled(cron = "${cron.delivery.tsbWithdrawExcRcvJob}")
 	//@Scheduled(fixedDelay = 3500000)
 	@Async 
 	public void tsbWithdrawExcRcvJob() throws Exception {
@@ -104,7 +119,7 @@ public class TsbDeliveryTask {
 	 *
 	 * @throws Exception
 	 */
-	//@Scheduled(cron = "${cron.delivery.order}")
+	//@Scheduled(cron = "${cron.delivery.tsbWithdrawExcRsltJob}")
 	//@Scheduled(fixedDelay = 3500000)
 	@Async 
 	public void tsbWithdrawExcRsltJob() throws Exception {
@@ -116,7 +131,7 @@ public class TsbDeliveryTask {
 	 *
 	 * @throws Exception
 	 */
-	//@Scheduled(cron = "${cron.delivery.order}")
+	//@Scheduled(cron = "${cron.delivery.tsbDeliveryExcRcvJob}")
 	//@Scheduled(fixedDelay = 3500000)
 	@Async 
 	public void tsbDeliveryExcRcvJob() throws Exception {
@@ -128,10 +143,50 @@ public class TsbDeliveryTask {
 	 *
 	 * @throws Exception
 	 */
-	//@Scheduled(cron = "${cron.delivery.order}")
+	//@Scheduled(cron = "${cron.delivery.tsbDeliveryOrderRsltJob}")
 	//@Scheduled(fixedDelay = 3500000)
 	@Async 
 	public void tsbDeliveryOrderRsltJob() throws Exception {
 		deliveryOrderRsltJob.run("cron.delivery.tsbDeliveryOrderRsltJob");
-	}		
+	}
+	
+	/**
+	 * 회수결과 수신
+	 *
+	 * @throws Exception
+	 */
+	//@Scheduled(cron = "${cron.delivery.tsbWithdrawRsltJob}")
+	//@Scheduled(fixedDelay = 3500000)
+	@Async 
+	public void tsbWithdrawRsltJob() throws Exception {
+		withdrawRsltJob.run("cron.delivery.tsbWithdrawRsltJob");
+	}	
+
+	/**
+	 * wms 송장번호 수신  
+	 *
+	 * @throws Exception
+	 */
+	//@Scheduled(cron = "${cron.delivery.tsbInvoiceNoRcvJob}")
+	//@Scheduled(fixedDelay = 3500000)
+	@Async 
+	public void tsbInvoiceNoRcvJob() throws Exception {
+		tsbInvoiceNoRcvJob.run("cron.delivery.tsbInvoiceNoRcvJob");
+	}
+	
+	
+	/**
+	 * 매장상품재고 수신 
+	 *
+	 * @throws Exception
+	 */
+	//@Scheduled(cron = "${cron.delivery.tsbShopGoodsStockJob}")
+	@Scheduled(fixedDelay = 3500000)
+	@Async 
+	public void tsbShopGoodsStockJob() throws Exception {
+		tsbShopGoodsStockJob.run("cron.delivery.tsbShopGoodsStockJob");
+	}
+	
+	
+	
 }

+ 4 - 1
src/main/java/com/style24/batch/support/env/TsbConstants.java

@@ -11,7 +11,10 @@ public class TsbConstants {
 
 	// 등록자번호
 	public static final Integer REG_NO = 0;
-
+	
+    public static final String COMPANY_CD_DR = "1003"; // 한세드림
+    public static final String COMPANY_CD_MK = "4337"; // 한세엠케이(주)
+	   
 	// 모니터링
 	public enum Monitoring {
 		JOIN_CNT("A001"),			// 회원가입건수

+ 52 - 2
src/main/java/com/style24/persistence/domain/Delivery.java

@@ -1,5 +1,8 @@
 package com.style24.persistence.domain;
 
+import java.util.Collection;
+import java.util.List;
+
 import com.style24.persistence.TscBaseDomain;
 
 import lombok.Data;
@@ -14,7 +17,6 @@ import lombok.Data;
 @Data
 public class Delivery extends TscBaseDomain {
 
-	
 	private String zipNo;
 	private String pndBran;
 	private String pndBranNm;
@@ -53,6 +55,37 @@ public class Delivery extends TscBaseDomain {
 	private String ordDtlStat;
 	private String rtnCd;
 	private String rtnMsg;
+	private String recalltypecd;		// 반품 타입
+	private String receiver;			// 받는자
+	private String receivertelnum;		// 받는자 전화번호
+	private String receivercellnum;		// 받는자 핸드폰 번호
+	private String deliverypostalcode;	// 우편 번호
+	private String deliveryaddr1;		// 기본 주소
+	private String deliveryaddr2;		// 상세 주소
+	private String csmemo;				// cs 메모
+	private String datecsmemoupdated;	// cs 메모 변경일
+	private String wmsmemo;				// wms 메모
+	private String datewmsmemoupdated;	// wms 메모 변경일
+	private String deliveryaddrnew;		// 도로명 주소
+	private String recallrequestyn;		// 회수요청여부
+	private String datecompleted;		// 완료일
+	private String recallinvoiceno;		// 반품 명세서(회수운송장번호)
+	private String asisYn;
+	private String itemCd;
+	private String optCd;
+	private String optCd1; 
+	private String optCd2; 	
+	private String ordExchGb; 
+	private String logisticscode;        // 택배사 코드 
+	private String sellStoreCd;          // 판매매장코드  
+	private String rtnLocCd;             // 반품처코드 
+	private String chgGb;                // 변경구분
+	private String wdInvoiceSendYn;
+	private String chgStat;
+	private String logisticsno;	
+	private String dateship;				
+	private String addinvoiceyn;		
+	private String datefirstcreated;		
 	
 	
 	private Integer recallexceptionno;
@@ -67,12 +100,29 @@ public class Delivery extends TscBaseDomain {
 	private Integer deliveryexceptionitemno;
 	private Integer deliveryExceptionSq;
 	private Integer deliveryExceptionItemSq;
+	private Integer recallno;			// 반품 번호
+	private Integer orderexceptionno;	// 주문 예외 번호
+	private Integer ordChgSq;           // 주문변경 번호 
+	private Integer ordNo;
+	private Integer ordDtlNo;
+	private Integer chgOrdDtlNo; 
+	private Integer recallitemno;
+	private Integer invoicenoseq;	
+	
 	
 	private int chargeamount;
 	private int qty;
 	private int exceptionqty;
+	private int recallqty;				// 수량
+	
+	
+	private String supplyCompCd;
+	private String cdStyle;
+	private String cdColor;
+	private String cdSize;
+	private String cdShop;
+	private int qtStock;
 	
-
 }
 
 

+ 254 - 12
src/main/java/com/style24/persistence/mybatis/shop/TsbDelivery.xml

@@ -11,13 +11,9 @@
 				  ZIP_NO
 				, PND_BRAN
 				, PND_BRAN_NM
-				, OPER_ABOVE_BRAN
-				, TR_BRAN_NM
 				, CITY_DO
 				, GU_GUN
 				, DONG_YUP_MEUN
-				, DELIVERY_TIME
-				, DELIVERY_PROBABILITY
 				, DELIVERYCLASSCD
 				, ISUSE
                 , DATELASTUPDATE
@@ -27,13 +23,9 @@
 			 	  #{zipNo}
 				, #{pndBran}
 				, #{pndBranNm}
-				, #{operAboveBran}
-				, #{trBranNm}
 				, #{cityDo}
 				, #{guGun}
 				, #{dongYupMeun}
-				, #{deliveryTime}
-				, #{deliveryProbability}
 				, #{deliveryclasscd}
 				, #{isuse}
                 , NOW()
@@ -43,13 +35,9 @@
 			UPDATE
 			  PND_BRAN	            = #{pndBran}
 			, PND_BRAN_NM	        = #{pndBranNm}
-			, OPER_ABOVE_BRAN	    = #{operAboveBran}
-			, TR_BRAN_NM	        = #{trBranNm}
 			, CITY_DO	            = #{cityDo}
 			, GU_GUN	            = #{guGun}
 			, DONG_YUP_MEUN	        = #{dongYupMeun}
-			, DELIVERY_TIME	        = #{deliveryTime}
-			, DELIVERY_PROBABILITY	= #{deliveryProbability}
 			, DELIVERYCLASSCD	    = #{deliveryclasscd}
 			, ISUSE	                = #{isuse}
             , DATELASTUPDATE        = NOW()
@@ -275,5 +263,259 @@
 		  AND ORD_DTL_STAT IN ('G013_20','G013_30','G013_35','G013_40')
 	</update>
 
+	<!-- 주문정보 조회 -->	
+	<select id="getOrderInfoList" resultType="Delivery">
+		SELECT 
+			  B.ORD_NO
+			, B.ORD_DTL_NO
+			, C.ITEM_CD 
+			, C.OPT_CD 
+			, C.OPT_CD1 
+			, C.OPT_CD2 
+			, D.ORD_CHG_SQ 
+			, D.CHG_ORD_DTL_NO
+			, B.ORD_EXCH_GB  
+			, B.SELL_STORE_CD
+			, E.CHG_GB          -- 변경구분 
+			, E.WD_GB           -- 회수구분 (W:회수요청, D:직접배송)
+		  FROM TB_ORDER A
+		  JOIN TB_ORDER_DETAIL B        ON A.ORD_NO     = B.ORD_NO
+		  JOIN TB_ORDER_DETAIL_ITEM C   ON B.ORD_NO     = C.ORD_NO AND B.ORD_DTL_NO = C.ORD_DTL_NO 
+		  JOIN TB_ORDER_CHANGE_DETAIL D ON B.ORD_DTL_NO = D.ORD_DTL_NO 
+		  JOIN TB_ORDER_CHANGE        E ON D.ORD_CHG_SQ = E.ORD_CHG_SQ 
+		 WHERE A.ORD_NO       = #{orderno}
+		   AND C.OPT_CD       = #{skucode}
+		   AND C.PRODUCT_NO   = #{productno}
+		   AND C.PRODUCT_CODE = #{productcode}
+		   AND D.DEL_YN       = 'N'
+		   AND D.CHG_STAT NOT IN ('G685_31','G685_41')
+	</select>
+
+	<!-- 회수결과 등록  -->
+	<update id="insertTbWithdraw" parameterType="Delivery" >
+		/*TsbDelivery.insertTbWithdraw*/
+		INSERT INTO  TB_WITHDRAW
+		(
+			  WD_INVOICE_NO		
+			, ORD_CHG_SQ		
+			, SENDER_NM			
+			, SENDER_PHNNO		
+			, SENDER_TELNO		
+			, SENDER_POST_NO	
+			, SENDER_BASE_ADDR	
+			, SENDER_DTL_ADDR	
+			, SHIP_COMP_CD		
+			, WD_REQ_REASON				
+			, ENCLOSE_FEE		
+			, WD_MEMO					
+			, ARRIVAL_DT		
+			, CS_MEMO			
+			, CS_OB_YN					
+			, SMS_SEND_YN		
+			, REG_NO			
+			, REG_DT			
+			, UPD_NO			
+			, UPD_DT			
+		)
+		SELECT
+		      OC.WD_INVOICE_NO
+		    , OC.ORD_CHG_SQ 
+		    , OC.CHGER_NM
+		    , OC.CHGER_PHNNO
+			, OC.CHGER_TELNO
+			, OC.CHGER_ZIPCODE 
+			, OC.CHGER_BASE_ADDR
+			, OC.CHGER_DTL_ADDR
+		    , #{logisticscode}  	-- 택배사 코드  
+		    , OC.CHG_REASON			-- 회수요청사유
+		    , IFNULL(#{enclosefee},0)  -- 동봉비 
+		    , #{wmsmemo}            -- 물류메모 
+		    , IFNULL(#{datecompleted}, NOW())  -- 도착일시
+		    , #{csmemo}                        -- C/S메모 
+		    , CASE WHEN #{csmemo} IS NULL THEN 'N' ELSE 'Y' END  -- C/S 아웃바운드여부 
+			, 'N'                   -- SMS 발송여부 
+		    , #{regNo}              -- 등록자NO 
+		    , NOW()                 -- 등록일시
+		    , #{regNo}              -- 수정자NO
+		    , NOW()                 -- 수정일시 
+		FROM TB_ORDER_CHANGE OC
+		WHERE OC.ORD_CHG_SQ = #{ordChgSq}
+		  AND NOT EXISTS (
+				SELECT 1
+				  FROM TB_WITHDRAW A
+				 WHERE A.WD_INVOICE_NO = OC.WD_INVOICE_NO
+				   AND A.ORD_CHG_SQ    = OC.ORD_CHG_SQ 
+			)
+	</update>
+   
+	<!-- 회수상세결과 등록   -->
+	<update id="insertTbWithdrawDetail" parameterType="Delivery" >
+		/*TsbDelivery.insertTbWithdrawDetail*/
+		INSERT INTO TB_WITHDRAW_DETAIL 
+		(
+			  WD_INVOICE_NO	
+			, ORD_CHG_SQ	
+			, GOODS_CD		
+			, OPT_CD1		
+			, OPT_CD2		
+			, ORD_DTL_NO	
+			, WD_QTY		
+			, RTN_LOC_CD	
+			, SELL_STORE_CD	
+			, REG_NO		
+			, REG_DT		
+			, UPD_NO		
+			, UPD_DT		
+		)
+		VALUES
+		(
+			  #{recallinvoiceno} 	
+			, #{ordChgSq}	
+			, #{itemCd}		
+			, #{optCd1} 		
+			, #{optCd2} 		
+			, #{ordDtlNo}	
+			, #{recallqty}		
+			, #{rtnLocCd}	
+			, #{sellStoreCd} 	
+			, #{regNo}		
+			, NOW()	
+			, #{regNo}		
+			, NOW()	
+		)
+	
+	</update>
+	   
+	<!-- 주문변경 회수완료    -->
+	<update id="updateTbOrderChange" parameterType="Delivery" >
+		/*TsbDelivery.updateTbOrderChange*/
+		UPDATE TB_ORDER_CHANGE SET
+			  WD_INVOICE_NO      = #{recallinvoiceno}
+			, WD_INVOICE_SEND_YN = #{wdInvoiceSendYn}
+			, SHIP_COMP_CD       = #{logisticscode}
+			, WD_EDDT            = #{datecompleted}
+			, UPD_NO             = #{regNo}
+			, UPD_DT             = NOW()
+		WHERE ORD_CHG_SQ = #{ordChgSq}
+	</update>	
+	
+	<!-- 주문변경상세 회수완료    -->
+	<update id="updateTbOrderChangeDetail" parameterType="Delivery" >
+		/*TsbDelivery.updateTbOrderChangeDetail*/
+		UPDATE TB_ORDER_CHANGE_DETAIL SET			  
+			  WH_MEMO            = #{wmsmemo}
+			<if test='chgGb == "G680_40"'>
+			, COMPLETE_DT        = NOW()
+			, CHG_STAT           = #{chgStat}  -- 교환일경우만 
+			</if>
+			, UPD_NO             = #{regNo}
+			, UPD_DT             = NOW()
+		WHERE ORD_CHG_SQ  = #{ordChgSq}
+		  AND ORD_DTL_NO  = #{orderdtlno}
+		  AND DEL_YN      = 'N'
+	</update>
+	
+	<!-- 주문상세상태 변경   -->
+	<update id="updateWdOrderDtlStat" parameterType="Delivery" >
+		/*TsbDelivery.updateWdOrderDtlStat*/
+		UPDATE tb_order_detail SET
+			  ORD_DTL_STAT = #{ordDtlStat} 
+			, UPD_NO       = #{regNo}
+			, UPD_DT       = NOW()
+		WHERE ORD_DTL_NO = #{orderdtlno}
+		  AND ORD_NO     = #{orderno}
+	</update>
+		
+	<!-- 교환대기 상태값변경    -->
+	<update id="updateOrderExch" parameterType="Delivery" >
+		/*TsbDelivery.updateOrderExch*/
+		UPDATE TB_ORDER_DETAIL SET
+			  ORD_DTL_STAT = #{ordDtlStat}
+			, UPD_NO       = #{regNo}
+			, UPD_DT       = NOW()		
+		WHERE ORD_DTL_NO = #{chgOrdDtlNo}
+		AND ORD_DTL_STAT IN ('G013_25')
+			
+	</update>
+
+	<!--  주문상세송장 등록   -->
+	<insert id="insertTbOrdDtlInvoice" parameterType="Delivery" >
+		/*TsbDelivery.insertTbOrdDtlInvoice*/
+		INSERT INTO TB_ORDER_DETAIL_INVOICE 
+		(
+			  ORD_NO					 -- 주문번호		
+			, ORD_DTL_NO				 -- 주문상세번호	
+			, INVOICE_NO				 -- 송장번호	
+			, ADD_INVOICE_YN             -- 추가송장여부	
+			, DEL_YN					 -- 삭제여부		
+			, REG_NO					 -- 등록자NO		
+			, REG_DT					 -- 등록일시		
+			, UPD_NO					 -- 수정자NO		
+			, UPD_DT					 -- 수정일시		
+		)
+		VALUES
+		(
+			  #{orderno}
+			, IFNULL(#{orderdtlno},0)
+			, #{invoiceno}
+			, #{addinvoiceyn}
+			, 'N'
+			, #{regNo}
+			, NOW()
+			, #{regNo}
+			, NOW()
+		)
+			
+	</insert>
+	
+	<!-- 주문상세 상태값변경    -->
+	<update id="updateOrdDtlStat" parameterType="Delivery" >
+		/*TsbDelivery.updateOrdDtlStat*/
+		UPDATE TB_ORDER_DETAIL SET
+			  ORD_DTL_STAT    = #{ordDtlStat}  -- G013_40	배송준비중
+			, INVOICE_NO      = #{invoiceno}
+			, INVOICE_SEND_YN = 'N'
+			, UPD_NO          = #{regNo}
+			, UPD_DT          = NOW()
+		WHERE ORD_DTL_NO = #{orderno}
+		  AND ORD_NO     = #{orderdtlno}
+			
+	</update>
+		
+	<!-- 매장상품재고 삭제     -->
+	<delete id="deleteShopStock" parameterType="Delivery" >
+		/*TsbDelivery.deleteShopStock*/
+		DELETE FROM TB_SHOP_GOODS_STOCK 
+	</delete>
+		
+	<!-- 매장상품재고 삭제     -->
+	<insert id="insertShopStock" parameterType="Delivery" >
+		/*TsbDelivery.insertShopStock*/
+		INSERT INTO TB_SHOP_GOODS_STOCK 
+		(
+			  SUPPLY_COMP_CD
+			, CD_SHOP
+			, CD_STYLE
+			, CD_COLOR
+			, CD_SIZE
+			, QT_STOCK
+			, REG_NO
+			, REG_DT
+		)
+		VALUES
+		(
+			  #{supplyCompCd}
+			, #{cdShop}
+			, #{cdStyle}
+			, #{cdColor}
+			, replace(#{cdSize},'.0','')
+			, #{qtStock}
+			, #{regNo}
+			, NOW()
+		)
+	</insert>		
+
+		
+		
 	
 </mapper>

+ 93 - 0
src/main/java/com/style24/persistence/mybatis/wms/TsbWmsDelivery.xml

@@ -225,6 +225,7 @@
 		WHERE DeliveryOrderNo = #{deliveryorderno}
 		  AND IfYn = 'N'
 	</update>	
+	
 	<!-- 출고결과수신완료    -->
 	<update id="updateWmsIfDeliveryOrdRsltItem" parameterType="Delivery" >
 		/*TsbWmsDelivery.updateWmsIfDeliveryOrdRsltItem*/
@@ -234,4 +235,96 @@
 		WHERE DeliveryOrderItemNo = #{deliveryorderitemno}
 		  AND IfYn = 'N'
 	</update>					
+	
+	<!-- WMS_IF 회수결과 목록   -->	
+	<select id="getWmsIfRecallDeliveryList" resultType="Delivery">
+		/*TsbWmsDelivery.getWmsIfRecallDeliveryList*/		
+		SELECT 
+			  A.RecallNo			-- 반품 번호
+			, A.OrderExceptionNo	AS ORD_CHG_SQ -- 주문변경번호 (주문 예외 번호 ASIS) 
+			, A.RecallTypeCd		-- 반품 타입
+			, A.Receiver			-- 받는자
+			, A.ReceiverTelNum		-- 받는자 전화번호
+			, A.ReceiverCellNum		-- 받는자 핸드폰 번호
+			, A.DeliveryPostalCode	-- 우편 번호
+			, A.DeliveryAddr1		-- 기본 주소
+			, A.DeliveryAddr2		-- 상세 주소
+			, A.OrderNo				-- 주문 번호
+			, A.CSMemo				-- CS 메모
+			, A.DateCSMemoUpdated	-- CS 메모 변경일
+			, A.WMSMemo				-- WMS 메모
+			, A.DateWMSMemoUpdated	-- WMS 메모 변경일
+			, A.DeliveryAddrNew		-- 도로명 주소
+			, A.RecallRequestYn		-- 회수요청여부
+			, B.RecallItemNo        -- 반품 항목 번호 
+			, B.ProductNo			-- 상품 번호
+			, B.ProductCode			-- 상품 코드
+			, B.ProductName			-- 상품명
+			, B.SKUCode				-- 옵션 코드
+			, B.SKUValue			-- 옵션 내용
+			, B.RecallQty			-- 수량
+			, B.StatusCd			-- 상태
+			, B.DateCompleted		-- 완료일
+			, B.LogisticsName		-- 택배사 명
+			, B.RecallInvoiceNo		-- 반품 명세서(회수운송장번호)
+			, B.OrderDtlNo AS ORD_DTL_NO	-- 주문상세번호
+			, B.InvoiceNo			-- 원운송장번호
+			, A.encloseFee          -- 동봉비 
+			, CASE WHEN A.DateCreated > '20210615 00:00:00' THEN 'N' ELSE 'Y' END AS ASIS_YN 
+		  FROM istyle24_Wmsif.dbo.TB_IF_RECALLDELIVERY A, istyle24_Wmsif.dbo.TB_IF_RECALLDELIVERYITEM B
+		 WHERE A.RecallNo  = B.RecallNo
+		   AND A.IsDeleted = 0
+		   AND B.StatusCd  = '입고완료'   
+		   AND B.IfStat    = '1' -- 회수완료 
+	</select>
+	
+	<!-- 회수결과수신완료    -->
+	<update id="updateWmsIFRecallDeliveryRslt" parameterType="Delivery" >
+		/*TsbWmsDelivery.updateWmsIFRecallDeliveryRslt*/
+			UPDATE istyle24_Wmsif.dbo.TB_IF_RECALLDELIVERY SET
+			  IfStat = #{ifstat}
+			, IfDate = NOW()
+			WHERE RecallNo = #{recallno}
+			  AND IfStat = '1'
+	</update>	
+	
+	<!-- 회수상세결과수신완료    -->
+	<update id="updateWmsIFRecallDeliveryItemRslt" parameterType="Delivery" >
+		/*TsbWmsDelivery.updateWmsIFRecallDeliveryItemRslt*/
+		UPDATE istyle24_Wmsif.dbo.TB_IF_RECALLDELIVERYITEM SET
+			  IfStat = #{ifstat}
+			, IfDate = NOW()
+		WHERE RecallNo     = #{recallno}
+		  AND RecallItemNo = #{recallitemno}
+		  AND IfStat       = '1'
+	</update>	
+		
+	<!-- 출고 송장번호 조회  -->
+	<select id="getWmsTbIfDeliveryInvoiceRslt" resultType="Delivery" >
+		/*TsbWmsDelivery.getWmsTbIfDeliveryInvoiceRslt*/
+		SELECT 
+			  InvoiceNoSeq
+			, orderNo
+			, orderDtlNo
+			, LogisticsNo
+			, InvoiceNo
+			, DateShip
+			, DateCompleted
+			, Qty
+			, AddInvoiceYn
+			, DateFirstCreated
+			, DateLastModified
+		  FROM istyle24_Wmsif.dbo.TB_IF_DELIVERYINVOICE
+		 WHERE IfYn = 'N'
+	</select>
+	
+	<!-- 출고 송장번호 수신완료    -->
+	<update id="updateWmsTbIfDeliveryInvoiceRslt" parameterType="Delivery" >
+		/*TsbWmsDelivery.updateWmsTbIfDeliveryInvoiceRslt*/
+		UPDATE istyle24_Wmsif.dbo.TB_IF_DELIVERYINVOICE  SET
+			  IfYn   = #{ifyn}
+			, IfDate = NOW()
+		WHERE InvoiceNoSeq = #{invoicenoseq}
+	</update>		
+		
 </mapper>

+ 17 - 2
src/main/resources/config/application-locd.yml

@@ -33,6 +33,12 @@ pg:
         log.path: /WIDE/workspace/logs/wivis
         account.cert.url: https://webapi.nicepay.co.kr/api/checkBankAccountAPI.jsp
 
+# ERP (한세드림)
+erp:
+   api:
+       stock.url: http://erp.hansaemk.com:96/api/hsdr/Shop/GoodsInfo
+       goods.url: http://erp.hansaemk.com:96/api/hsdr/Shop
+
 # Schedule
 cron:
     #모니터링
@@ -84,8 +90,17 @@ cron:
         #tsbDeliveryExcRcvJob: 2 22 2 29 2 ?
         tsbDeliveryExcRcvJob: 2 22 2 29 2 ?
         # WMS 출고결과 수신 ()
-        #deliveryOrderRsltJob: 2 22 2 29 2 ?
-        deliveryOrderRsltJob: 2 22 2 29 2 ?
+        #tsbDeliveryOrderRsltJob: 2 22 2 29 2 ?
+        tsbDeliveryOrderRsltJob: 2 22 2 29 2 ?
+        # WMS 회수입고결과 수신 ()
+        #tsbWithdrawRsltJob: 2 22 2 29 2 ?
+        tsbWithdrawRsltJob: 2 22 2 29 2 ?
+        # WMS 운송장번호 수신 () 
+        #tsbInvoiceNoRcvJob: 2 22 2 29 2 ?
+        tsbInvoiceNoRcvJob: 2 22 2 29 2 ?
+        # ERP 매장재고 수신 ()
+        #tsbShopGoodsStockJob: 2 22 2 29 2 ?
+        tsbShopGoodsStockJob: 2 22 2 29 2 ?
     #회원(고객)
     customer :
         scheduleDormantCustomerJob: 2 22 2 29 2 ?