/**
 * @Title: ProcessYieldAndHourTimer.java
 * @Package com.sw.mes.webservice.scheduled
 * @Description: TODO(用一句话描述该文件做什么)
 * @author 中环 keily
 * @date 2022年2月28日 上午11:28:58
 * @version V1.0
 */

package com.sw.mes.webservice.scheduled;

import java.util.Date;

import com.sw.mes.core.utils.SapUtil;
import com.sw.mes.core.utils.WbServiceUtils;
import com.sw.mes.third.service.SapGiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.sw.mes.webservice.service.ProcessYieldAndHourService;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName: ProcessYieldAndHourTimer
 * @Description:
 * @author 中环 keily
 * @date 2022年2月28日 上午11:28:58
 *
 */
@Slf4j
@Component
@Transactional
public class ProcessYieldAndHourRun  {

	@Autowired
    private SapGiService sapGiService;

	@Autowired
	private ProcessYieldAndHourService processYieldAndHourService; // 工序产量工时service

	/**
	 * @throws Exception
	 *
	 * @Title: sendYieldAndHourOfCrystalPulling
	 * @Description: 拉晶工序【产量|工时】数据推送
	 * @param     设定文件
	 * @return void    返回类型
	 * @throws
	 */
//	@Scheduled(cron = "45 59 */1 * * ?")
	public void sendYieldAndHourOfCrystalPulling() throws Exception {
		String sapOderDate = SapUtil.getDateNowForSap(540);
		Date nowTime = new Date();
        String sapDate = WbServiceUtils.getSapDate(nowTime);
        String sapTime = WbServiceUtils.getSapTime(nowTime);
//        if (!execute()) return;
//        Integer isOff = sapGiService.getSapOffType();
//        if (!isOff.equals(1)) {
//            return;
//        }
        processYieldAndHourService.queryAndSendCrystalPullingData(nowTime, sapDate, sapTime, sapOderDate);
	}



}
