package com.style24.admin.biz.service;

import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import lombok.extern.slf4j.Slf4j;
import com.style24.admin.biz.dao.TsaWmsWithdrawDao;
import com.style24.persistence.domain.WmsWithdraw;
import com.style24.persistence.domain.Withdraw;
import com.style24.persistence.domain.Delivery;
import com.style24.core.support.message.TscMessageByLocale;

/**
 * 회수관리 Service
 *
 * @author moon
 * @since 2020. 11. 16
 */
@Service
@Slf4j
public class TsaWmsWithdrawService {

	@Autowired
	private TscMessageByLocale message;

	@Autowired
	private TsaWmsWithdrawDao wmsWithdrawDao;


	/**
	 * WMS회수 목록 건수
	 *
	 * @param Delivery
	 * @return
	 * @author moon
	 * @since 2021. 03. 10
	 */
	public int getWmsWithdrawListCount(WmsWithdraw wmsWithdraw) {
		return wmsWithdrawDao.getWmsWithdrawListCount(wmsWithdraw);
	}
	
	/**
	 * WMS회수 목록 
	 *
	 * @param Delivery
	 * @return
	 * @author moon
	 * @since 2021. 03. 10
	 */
	public Collection<WmsWithdraw> getWmsWithdrawList(WmsWithdraw wmsWithdraw) {
		return wmsWithdrawDao.getWmsWithdrawList(wmsWithdraw);
	}
	
	/**
	 * 출고처지정 지연재고 등록
	 *
	 * @param Delivery
	 * @return
	 * @author moon
	 * @since 2021. 04. 20
	 */
	@Transactional("wmsTxnManager")
	public void insertWmsTbIfDelifixQty(Delivery delivery) {
		wmsWithdrawDao.insertWmsTbIfDelifixQty(delivery);
	}
	
	/**
	 * 출고처지정 지연재고 삭제 
	 *
	 * @param Delivery
	 * @return
	 * @author moon
	 * @since 2021. 04. 20
	 */
	@Transactional("wmsTxnManager")
	public void deleteWmsTbIfDelifixQty(Delivery delivery) {
		wmsWithdrawDao.deleteWmsTbIfDelifixQty(delivery);
	}
	
	/**
	 * 재회수지시 
	 *
	 * @param Delivery
	 * @return
	 * @author moon
	 * @since 2021. 06. 24
	 */
	@Transactional("wmsTxnManager")
	public void updateReRecallOrder(Withdraw withdraw) {
		wmsWithdrawDao.updateReRecallOrder(withdraw);
	}
	
	
}
