package com.youchain.modules.quartz.task;

import cn.hutool.core.date.DateUtil;
import com.youchain.annotation.Log;
import com.youchain.businessdata.domain.Task;
import com.youchain.businessdata.inputJson.OrderInfo;
import com.youchain.businessdata.inputJson.OrderParams;
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
import com.youchain.businessdata.inputJson.ReturnIssueInfoParams;
import com.youchain.businessdata.rest.MlsController;
import com.youchain.businessdata.service.MlsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 获取送货单定时任务
 */

@Slf4j
@Service
public class orderTask {

    @Autowired
    public MlsService mlsService;


    public void orderTask() {
        OrderInfo orderInfo = getOrderInfo();
        String orderJson = mlsService.getOrderJson(orderInfo);
        mlsService.getOrderInfo(orderJson);
    }


    public OrderInfo getOrderInfo() {

        OrderParams params = new OrderParams();
        params.setOrgId(808);
        Set invCodes = new HashSet<>();
        invCodes.add("MA2111");
        params.setInvCodes(invCodes);
        params.setIqcResult("");
        //DateUtil.format(DateUtil.beginOfDay(new Date()), "yyyy-MM-dd HH:mm:ss")
        params.setStartTime("2024-04-10 00:00:00");
        params.setEndTime("2024-04-10 23:59:59");
        params.setPageNo(1);
        params.setPageSize(100);
        OrderInfo orderInfo = new OrderInfo();
        orderInfo.setIfaceCode("MLS-WQ-002");
        orderInfo.setSourceSystem("WQ");
        orderInfo.setParams(params);
        return orderInfo;
    }

}
