package com.huansi.api;


import com.huansi.client.ParamsConfig;
import com.huansi.client.functions.Login;
import com.huansi.client.functions.Upload;
import com.huansi.client.utils.Result;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class UploadRequestTest {

    @Test
    public void upload() {
        TestClient client = new TestClient();
        client.config();
        LoginRequest loginRequest = new Login();
        loginRequest.login();

        UploadRequest uploadRequest = new Upload();
        Map<String, Object> map = new HashMap<>();
        map.put("Bill_Id", "111111");
        map.put("sBillNo", "G210313009");
        map.put("sOrderNo", "SD21031302");
        map.put("sCustomerOrderNo", "");
        map.put("nQty", "19398.00");
        map.put("sUnit", "M");
        map.put("sCardNo", "G210313009");
        map.put("TrackJobGUID", "6E2A7C37-8272-4FDB-AD4D-ACEA008A5DF9");
        map.put("TrackOutputGUID", "63339B62-FEF3-42D9-B096-ACEA008A5BCF");
        map.put("sMaterialLot", "20210312041");
        map.put("upbCustomerGUID", "13FF9BF1-4961-4CB6-864A-ACE2010DCCE7");
        map.put("sCustomerNo", "K0463");
        map.put("sCustomerName", "mmp");
        map.put("upbSalesGUID", "A5194647-C7EE-47F1-AB68-F540C5CD072D");
        map.put("sSalesNo", "汝文伟");
        map.put("sSalesName", "汝文伟");
        map.put("sOrderType", "R");
        map.put("sMaterialTypeCode", "麻系列");
        map.put("sMaterialTypeName", "麻系列");
        map.put("ummMaterialGUID", "95F60778-BE5A-4192-8D3F-ACE201129DE0");
        map.put("sMaterialNo", "高弹SPH乱麻");
        map.put("sMaterialName", "高弹SPH乱麻");
        map.put("sComponent", "");
        map.put("sCustomerMaterialNo", "167*高弹骑兵斜乱麻");
        map.put("sCustomerMaterialName", null);
        map.put("sRawWidth", "196");
        map.put("sRawGMWT", "308");
        map.put("sColorNo", "JL21030536");
        map.put("sColorName", "19#黑色");
        map.put("sCustomerColorNo", "JL21030536");
        map.put("sCustomerColorName", "19#黑色");
        map.put("nPlanOutputQty", "970.00");
        map.put("nPlanOutputQtyEx", "0.00");
        map.put("sWorkingProcedureNo", "0012");
        map.put("sWorkingProcedureName", "开幅");
        map.put("sFinishingMethod", "");
        map.put("sContractNo", "");
        map.put("tTrackTime", "2021-03-18T16:49:00");
        map.put("tFactStartTime", "2021-03-18T16:49:00");
        map.put("tFactEndTime", "2021-03-18T16:49:00");
        map.put("sWorkerGroupNo", "脱水开幅乙组");
        map.put("sWorkerGroupName", "脱水开幅乙组");
        map.put("sWorkerNoList", "00155");
        map.put("sWorkerNameList", "陈利祥");
        map.put("sUnionCardNoList", "");
        map.put("sEquipmentNo", "6#开幅机");
        map.put("sEquipmentName", "6#开幅机");
        map.put("iJobGroupOrderNo", 9);
        map.put("test", 1);
        List<Map> list = new ArrayList<>();
        list.add(map);
//        Map paramsConfig = new HashMap();
//        paramsConfig.put("bill_type_code",5);
//        paramsConfig.put("bill_standard_code","dyeing");
//        paramsConfig.put("bill_id","YGC0624003");
//        paramsConfig.put("bill_no","YGC0624003");
//        paramsConfig.put("to_tenant_code","");
//        paramsConfig.put("update_status",1);
//        paramsConfig.put("client_id","1");
//        paramsConfig.put("to_client_id","2");
        ParamsConfig paramsConfig = new ParamsConfig();
        paramsConfig.setBillId("YGC0624003");
        paramsConfig.setBillNo("YGC0624003");
        paramsConfig.setBillTypeCode("5");
        paramsConfig.setBillStandardCode("dyeing");
        paramsConfig.setClientId("1");
        paramsConfig.setToClientId("2");
        paramsConfig.setToTenantCode("");
        paramsConfig.setUpdateStatus(1);
        Result result = uploadRequest.upload(list, paramsConfig);
        System.out.println(result);
    }
}