package vip.xiaonuo.erp.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import vip.xiaonuo.erp.entity.center.CaiGouJinE;
import vip.xiaonuo.erp.entity.center.DangQianYvQi;
import vip.xiaonuo.erp.entity.center.XiaoShouE;
import vip.xiaonuo.erp.entity.center.YangMaoZhiCaiGouJinE;
import vip.xiaonuo.erp.entity.kucun.*;
import vip.xiaonuo.erp.entity.voucher.ErpVoucher;
import vip.xiaonuo.erp.service.IErpKuCunService;
import vip.xiaonuo.warehouse.entity.WarehouseIncomStock;
import vip.xiaonuo.warehouse.entity.WarehouseStockDetail;
import vip.xiaonuo.warehouse.mapper.WarehouseIncomStockMapper;
import vip.xiaonuo.warehouse.mapper.WarehouseOutStockMapper;
import vip.xiaonuo.warehouse.mapper.WarehouseStockDetailMapper;
import vip.xiaonuo.warehouse.mapper.WarehouseStockMapper;

import java.util.Date;
import java.util.List;


@Service
public class ErpKuCunServiceImpl implements IErpKuCunService {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private WarehouseIncomStockMapper incomStockMapper;
    @Autowired
    private WarehouseOutStockMapper outStockMapper;
    @Autowired
    private WarehouseStockMapper stockMapper;
    @Autowired
    private WarehouseStockDetailMapper stockDetailMapper;

    @Override
    public void getYuanCaiLiaoKuCun() {
        ResponseEntity<List<YuanCaiLiaoKuCun>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYuanCaiLiaoCunLiang?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YuanCaiLiaoKuCun>>() {}
        );
        List<YuanCaiLiaoKuCun> forObjects = response.getBody();
        System.out.println(forObjects);


    }

    @Override
    public void getYangMaoZhiKuCun() {
        ResponseEntity<List<YangMaoZhiChuKu>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYangMaoZhiKuCun?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YangMaoZhiChuKu>>() {}
        );
        List<YangMaoZhiChuKu> forObjects = response.getBody();
        System.out.println(forObjects);

    }

    @Override
    public void getYangMaoZhiGongYingShang() {
        ResponseEntity<List<YangMaoZhiGongYingShang>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYangMaoZhiGongYingShang?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YangMaoZhiGongYingShang>>() {}
        );
        List<YangMaoZhiGongYingShang> forObjects = response.getBody();
        System.out.println(forObjects);

    }

    @Override
    public void getYuanCaiLiaoDangRi() {
        //成片半成品
        ResponseEntity<List<YuanCaiLiaoDangRiRuKu>> response1 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYuanCaiLiaoDangRi?date=&type=1",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YuanCaiLiaoDangRiRuKu>>() {}
        );
        List<YuanCaiLiaoDangRiRuKu> forObjects1= response1.getBody();
        System.out.println(forObjects1);

    }

    @Override
    public void getChengPinDangRi() {
        //成品
        ResponseEntity<List<ChengPinRuKu>> response1 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChengPinDangRi?date=&type=1",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChengPinRuKu>>() {}
        );
        List<ChengPinRuKu> forObjects1 = response1.getBody();
        System.out.println(forObjects1);
        //五金
        ResponseEntity<List<ChengPinRuKu>> response2 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChengPinDangRi?date=&type=2",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChengPinRuKu>>() {}
        );
        List<ChengPinRuKu> forObjects2 = response2.getBody();
        System.out.println(forObjects2);
        //包材
        ResponseEntity<List<ChengPinRuKu>> response3 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChengPinDangRi?date=&type=3",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChengPinRuKu>>() {}
        );
        List<ChengPinRuKu> forObjects3 = response3.getBody();
        System.out.println(forObjects3);
    }

    @Override
    public void getYangMaoZhiDangRi() {
        ResponseEntity<List<ChengPinRuKu>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYangMaoZhiDangRi?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChengPinRuKu>>() {}
        );
        List<ChengPinRuKu> forObjects = response.getBody();
        System.out.println(forObjects);

    }

    @Override
    public void getYuanCaiLiaoChuKu() {
        ResponseEntity<List<YuanCaiLiaoChuKu>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYuanCaiLiaoChuKu?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YuanCaiLiaoChuKu>>() {}
        );
        List<YuanCaiLiaoChuKu> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getChengPinChuKu() {
        Date date = new Date();
        ResponseEntity<List<ChenPinChuKu>> response1 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChengPinChuKu?date=&type=1",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChenPinChuKu>>() {}
        );
        List<ChenPinChuKu> forObjects1 = response1.getBody();
        System.out.println(forObjects1);

        //五金
        ResponseEntity<List<ChenPinChuKu>> response2 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChengPinChuKu?date=&type=2",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChenPinChuKu>>() {}
        );
        List<ChenPinChuKu> forObjects2 = response2.getBody();
        System.out.println(forObjects2);

        //包材
        ResponseEntity<List<ChenPinChuKu>> response3 = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChengPinChuKu?date=&type=3",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<ChenPinChuKu>>() {}
        );
        List<ChenPinChuKu> forObjects3 = response3.getBody();
        System.out.println(forObjects3);
    }

    @Override
    public void getYangMaoZhiChuKu() {
        ResponseEntity<List<YangMaoZhiChuKu>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYangMaoZhiChuKu?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YangMaoZhiChuKu>>() {}
        );
        List<YangMaoZhiChuKu> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getKuCunFenXi() {
        ResponseEntity<List<KunCunQuShi>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getKunCunQuShi?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<KunCunQuShi>>() {}
        );
        List<KunCunQuShi> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getChuKuShuLiang() {
        ResponseEntity<List<YangMaoZhiChuKu>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getChuKuShuLiang?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YangMaoZhiChuKu>>() {}
        );
        List<YangMaoZhiChuKu> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getWuLiaoMingXi() {
        ResponseEntity<List<WuLiaoKuMingXi>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getWuLiaoMingXi?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<WuLiaoKuMingXi>>() {}
        );
        List<WuLiaoKuMingXi> forObjects = response.getBody();
        System.out.println(forObjects);
    }

    @Override
    public void getAnQuanKuCun() {
        //取不到
//        ResponseEntity<List<ErpVoucher>> response = restTemplate.exchange(
//                "http://127.0.0.1:9200/erp-kucun/getShouRuJinE?date=",
//                HttpMethod.GET,
//                null,
//                new ParameterizedTypeReference<List<ErpVoucher>>() {}
//        );
//        List<ErpVoucher> forObjects = response.getBody();
//        System.out.println(forObjects);
    }

    @Override
    public void getYangMaoZhiGongYingShangYueLeiJi() {
        ResponseEntity<List<YangMaoZhiGongYingShang>> response = restTemplate.exchange(
                "http://127.0.0.1:9200/erp-kucun/getYangMaoZhiGongYingShangLeiJi?date=",
                HttpMethod.GET,
                null,
                new ParameterizedTypeReference<List<YangMaoZhiGongYingShang>>() {}
        );
        List<YangMaoZhiGongYingShang> forObjects = response.getBody();
        System.out.println(forObjects);
    }
}
