package com.prolog.cs.biz.outbound.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.prolog.cs.biz.outbound.model.vo.ReceiveDoBillVO;
import com.prolog.cs.biz.outbound.service.IOmsDoBillHService;
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.Collections;

@RunWith(SpringRunner.class)
@SpringBootTest
public class ErpTest {

    @Autowired
    private IOmsDoBillHService iOmsDoBillHService;


    @Test
    public void testReceiveDoBill() {

        String msg = prepareReceiveDoBill();
        ReceiveDoBillVO vo = JSONObject.parseObject(msg, ReceiveDoBillVO.class);
        iOmsDoBillHService.receiveDoBill(Collections.singletonList(vo));

    }

    private static String prepareReceiveDoBill() {
        String msg = "{\n" +
                "        \"billNo\": \"OUT11006\",\n" +
                "        \"billType\": \"1\",\n" +
                "        \"billDate\": \"2022-09-13 00:00:00\",\n" +
                "        \"billState\": \"1\",\n" +
                "        \"planDeliveryDate\": \"2022-09-13 00:00:00\",\n" +
                "        \"deliveryName\": \"1\",\n" +
                "        \"consignorName\": \"青牛货主001\",\n" +
                "        \"consignorCode\": \"HQN001\",\n" +
                "        \"shipperCode\": \"XT00001166\",\n" +
                "        \"shipperName\": \"师宗县老百姓大药房连锁有限公司\",\n" +
                "        \"branchCode\": \"CQN001\",\n" +
                "        \"shopCode\": \"1\",\n" +
                "        \"shopName\": \"1\",\n" +
                "        \"remark\": \"1\",\n" +
                "        \"custPersonTel\": \"1\",\n" +
                "        \"custPerson\": \"1\",\n" +
                "        \"receiveProvinceName\": \"1\",\n" +
                "        \"receiveCityName\": \"1\",\n" +
                "        \"receiveDistrictName\": \"1\",\n" +
                "        \"receiveTownName\": \"1\",\n" +
                "        \"receiveAddress\": \"1\",\n" +
                "        \"receiveCommunityName\": \"1\",\n" +
                "        \"salesPersonName\": \"1\",\n" +
                "        \"salesPersonTel\": \"1\",\n" +
                "        \"preparedBy\": \"1\",\n" +
                "        \"payTime\": \"2022-09-13 00:00:00\",\n" +
                "        \"payAmount\": \"1\",\n" +
                "        \"paySn\": \"1\",\n" +
                "        \"carrierName\": \"顺丰\",\n" +
                "        \"carrierCode\": \"SF\",\n" +
                "        \"freight\": \"1\",\n" +
                "        \"shipBillNo\": \"1\",\n" +
                "        \"lineCode\": \"1\",\n" +
                "        \"lineName\": \"1\",\n" +
                "        \"priorityLevel\": \"1\",\n" +
                "        \"arrivalMode\": \"1\",\n" +
                "        \"transportMode\": \"1\",\n" +
                "        \"partlyRed\": \"1\",\n" +
                "        \"srcPlate\": \"1\",\n" +
                "        \"srcPlateBillno\": \"1\",\n" +
                "        \"totQty\": \"1\",\n" +
                "        \"totPcs\": \"1\",\n" +
                "        \"totamt\": \"1\",\n" +
                "        \"totVolume\": \"1\",\n" +
                "        \"totWeight\": \"1\",\n" +
                "        \"detailList\": [\n" +
                "            {\n" +
                "                \"seqNo\": \"1\",\n" +
                "                \"billNo\": \"OUT00001\",\n" +
                "                \"itemCode\": \"TCCS1146\",\n" +
                "                \"itemName\": \"TC测试商品\",\n" +
                "                \"packUnits\": \"1\",\n" +
                "                \"itemSpecs\": \"1\",\n" +
                "                \"packTypeNum\": \"1\",\n" +
                "                \"itemWeight\": \"1\",\n" +
                "                \"itemVolume\": \"1\",\n" +
                "                \"itemQty\": \"100\",\n" +
                "                \"redQty\": \"0\",\n" +
                "                \"deliveryQty\": \"100\",\n" +
                "                \"price\": \"1\",\n" +
                "                \"amt\": \"1\",\n" +
                "                \"discountPrice\": \"1\",\n" +
                "                \"discountAmt\": \"1\",\n" +
                "                \"batchNo\": \"\",\n" +
                "                \"lotNo\": \"\",\n" +
                "                \"sterilizationBatchNo\": \"1\",\n" +
                "                \"sterilizationTime\": \"2023-08-24 00:00:00\",\n" +
                "                \"pdateFrom\": \"2023-08-24 00:00:00\",\n" +
                "                \"validUntil\": \"2024-08-24 00:00:00\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"seqNo\": \"2\",\n" +
                "                \"billNo\": \"OUT00001\",\n" +
                "                \"itemCode\": \"TCCS1545\",\n" +
                "                \"itemName\": \"TC测试商品01\",\n" +
                "                \"packUnits\": \"1\",\n" +
                "                \"itemSpecs\": \"1\",\n" +
                "                \"packTypeNum\": \"1\",\n" +
                "                \"itemWeight\": \"1\",\n" +
                "                \"itemVolume\": \"1\",\n" +
                "                \"itemQty\": \"100\",\n" +
                "                \"redQty\": \"0\",\n" +
                "                \"deliveryQty\": \"100\",\n" +
                "                \"price\": \"1\",\n" +
                "                \"amt\": \"1\",\n" +
                "                \"discountPrice\": \"1\",\n" +
                "                \"discountAmt\": \"1\",\n" +
                "                \"batchNo\": \"\",\n" +
                "                \"lotno\": \"\",\n" +
                "                \"sterilizationBatchNo\": \"1\",\n" +
                "                \"sterilizationTime\": \"2023-08-24 00:00:00\",\n" +
                "                \"pdateFrom\": \"2023-08-24 00:00:00\",\n" +
                "                \"validUntil\": \"2024-08-24 00:00:00\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"supervisionList\": []\n" +
                "    }";
        return msg;
    }
}
