package com.emergency.avenue.storage.job;

import com.emergency.avenue.common.core.util.R;
import com.emergency.avenue.storage.api.request.InboundInfoRequest;
import com.emergency.avenue.storage.api.response.InboundInfoResponse;
import com.emergency.avenue.storage.api.response.StockDataVO;
import com.emergency.avenue.storage.service.InboundMaterialService;
import com.emergency.avenue.storage.service.impl.StockDataDockingService;
import com.emergency.avenue.storage.util.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: report-java
 * @author: duhuajie
 * @create: 2024-07-24
 * @description: 库存信息对接
 */
@Component
@Slf4j
public class StockDataDockingJob {

    @Resource
    private InboundMaterialService inboundMaterialService;

    @Resource
    private StockDataDockingService stockDataDockingService;

//    @Scheduled(cron = "0 0 * * * ?")
    public void execute() {
        log.info("库存信息对接任务开始");
        R<List<InboundInfoResponse>> listR = inboundMaterialService.selectListByDept( new InboundInfoRequest());
        List<StockDataVO> list = BeanUtils.toBean(listR.getData(), StockDataVO.class);
        log.info("库存信息对接任务结束");
    }

    /**
     * 对接机构信息
     */
    public void executeDockOrganization() {
        log.info("机构信息对接任务开始");
        stockDataDockingService.dockingOrganization();
        log.info("机构信息对接任务结束");
    }

    /**
     * 对接仓库信息
     */
    public void executeDockWarehouse() {
        log.info("仓库信息对接任务开始");
        stockDataDockingService.dockingWarehouse();
        log.info("仓库信息对接任务结束");
    }

    /**
     * 对接库存信息(整理存库）
     */
    public void executeDockStock1() {
        log.info("仓库信息对接任务(整理存库）开始");
        stockDataDockingService.dockingStock();
        log.info("仓库信息对接任务(整理存库）结束");
    }


    /**
     * 对接库存信息（接口对接）
     */
    public void executeDockStock2() {
        log.info("仓库信息对接任务开始");
        stockDataDockingService.dockingStock2();
        log.info("仓库信息对接任务结束");
    }
}
