package org.jeecg.modules.sapScheduledTask;

import org.jeecg.modules.fbsInventory.service.IFbsInventoryService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

/**
 * 功能描述：第三个定时 获取供应商与物料
 *
 * @Author: chenchuang
 * @Date: 2022/4/1 21:06
 */
@Transactional
public class SAPPullThree implements Job {

    @Autowired
    IFbsInventoryService iFbsInventoryService;

    public static boolean  jobIsRuning=false;

    public static boolean  getJobIsRuningFlag(){
        return jobIsRuning;
    }

    public static boolean setJobIsRuningFlag(){
        jobIsRuning =true;
        return jobIsRuning;
    }
    public static void removeJobIsRuningFlag(){
        jobIsRuning =false;
    }
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println("88888888888888");
//        String a="{ \"TIMELIMIT\": { \"ST\": 20220118000000, \"ET\": 20220118240000 }, \"COMMON_INFO_REQ\": { \"API_NO\": \"KANB00001\", \"GUID\": \"1234567890\", \"USERID\": \"USERNAME\" } } ";
        if(getJobIsRuningFlag()){
            return;
        }
        setJobIsRuningFlag();
        try {
            iFbsInventoryService.implementSAPPullThree();
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            removeJobIsRuningFlag();
        }
    }
}
