package com.prolog.eis.schedule;

import com.prolog.eis.service.core.InboundService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @program: eis_qnym_java
 * @description: 入库定时器
 * @author: Xiong
 * @create: 2022-11-11 16:30
 **/
@Slf4j
@Component
@RequiredArgsConstructor
public class InboundSchedule {

    private final InboundService inboundService;

    //入库任务完成回告wms 20->30
    @Scheduled(initialDelay = 3000, fixedDelay = 3000)
    public void wmsInCallBack() {
        try {
            inboundService.inboundTaskCbWms();
        } catch (Exception e) {
            log.error("任务完成回告wms处理异常:" + e.getMessage(), e);
        }
    }

    //通用入库任务搬运
    @Scheduled(initialDelay = 3000, fixedDelay = 3000)
    public void inboundTask() {
        try {
            inboundService.wmsInboundAgvCarryTask();
        } catch (Exception e) {
            log.error("入库agv搬运异常:" + e.getMessage(), e);
        }
    }

    /**
     * 补货入库任务搬运
     */
    @Scheduled(initialDelay = 3000, fixedDelay = 3000)
    public void agvlInboundTask() {
        try {
            inboundService.agvlInboundTask();
        } catch (Exception e) {
            log.error("入库agv搬运异常:" + e.getMessage(), e);
        }
    }
}
