package com.hzya.frame.plugin.lets.plugin.sales;

import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.util.AfterSalesOrderUtil;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

import static org.junit.Assert.*;

/**
 * @Author：liuyang
 * @Package：com.hzya.frame.plugin.lets.plugin.sales
 * @Project：kangarooDataCenterV3
 * @name：SoSaleOutPluginInitializerToBTest
 * @Date：2024/8/13 15:59
 * @Filename：SoSaleOutPluginInitializerToBTest
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class SoSaleOutPluginInitializerToBTest {

    @Autowired
    private SoSaleOutPluginInitializerToB soSaleOutPluginInitializerToB;

    @Autowired
    private AfterSalesOrderUtil afterSalesOrderUtil;

    @Test
    public void startImplement() {
//        soSaleOutPluginInitializerToB.startImplement(null, null);
//        soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024082800000008");

//        soSaleOutPluginInitializerToB.startImplement("2024-04-28", null);

//        try {
//            SaleOrderMessageDto ofsOrder = afterSalesOrderUtil.getOfsOrder("LETS-SO2024081600000050");
//            System.out.println(ofsOrder);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

//        soSaleOutPluginInitializerToB.startImplementByTranTime("2024-08-28 15:28:06", "2024-08-28 15:28:08");

//        soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024080100006222");

//        try {
//            SaleOrderMessageDto saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder("LETS-SO2022080500002332");
//            List<HeaderDetailsDto> data = saleOrderMessageDto.getData();
//            HeaderDto header = data.get(0).getHeader();
//            System.out.println(header.getSubOrderType());
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

        try{
            soSaleOutPluginInitializerToB.startImplementByTranTime("2024-09-12 14:04:00","2024-09-12 14:12:00");
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}