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

import com.alibaba.fastjson2.JSON;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder;
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.ArrayList;
import java.util.List;

import static org.junit.Assert.*;

/**
 * 测试采退订单
 *
 * @Author：liuyang
 * @Package：com.hzya.frame.plugin.lets.util
 * @Project：kangarooDataCenterV3
 * @name：OfsStandardUtilTest
 * @Date：2024/8/22 15:01
 * @Filename：OfsStandardUtilTest
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class OfsStandardUtilTest {

    @Autowired
    private OfsStandardUtil ofsStandardUtil;

    @Test
    public void queryPurchaseReturnOrder() {
        try {
            List<PurchaseReturnOrder> headerDetailsDtoList = new ArrayList<>();
            QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
            queryOfsSoSaleOutVo.setCode("LETS-PR2024082000000001");
            queryOfsSoSaleOutVo.setClientCode("LETS");
            queryOfsSoSaleOutVo.setPageNo(1L);
            queryOfsSoSaleOutVo.setPageSize(50L);
            ofsStandardUtil.queryPurchaseReturnOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.purchaseReturnOrder.search");
            if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
                System.out.println(JSON.toJSONString(headerDetailsDtoList));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 测试销售订单
     */
    @Test
    public void getOfsOrder() {
        try {
            List<com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();

            QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
            queryOfsSoSaleOutVo.setCode("LETS-SO2024082300021950,LETS-SO2024082300021944");
            ofsStandardUtil.getOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);

            System.out.println(headerDetailsDtoList.size());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}