package shuju;

import com.google.gson.Gson;
import kingdee.bos.webapi.client.ApiClient;
import kingdee.bos.webapi.client.K3CloudApiClient;

import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;

public class TestMain {
    public static void main(String[] args) throws Exception{


        K3CloudApiClientSon client = new K3CloudApiClientSon("https://nskj.ik3cloud.com/k3cloud/");
        boolean result = client.login("20210629185713582","kingdee","Kingdee_898",2052);

        System.out.println(result);
//        String view = client.query("PRD_MOExecuteDetailRpt","{\n" +
//                "    \"FieldKeys\": \"FWORKSHOPID,FMOBILLNO,FMOENTRYSEQ,FSALEORDERENTRYSEQ\",\n" +
//                "    \"SchemeId\": \"\",\n" +
//                "    \"StartRow\": 0,\n" +
//                "    \"Limit\": 2000,\n" +
//                "    \"IsVerifyBaseDataField\": \"true\",\n" +
//                "    \"Model\": {\n" +
//                "        \"FPrdOrgId\": \"180235\",\n" +
//                "        \"FBeginConveyDate\": \"2024-02-01\",\n" +
//                "        \"FEndConveyDate\": \"2024-12-31\",\n" +
//                "        \"FBeginPlanStartDate\": \"2024-02-01\",\n" +
//                "        \"FEndPlanStartDate\": \"2024-12-31\",\n" +
//                "        \"FBeginPlanFinishDate\": \"2024-02-01\",\n" +
//                "        \"FEndPlanFinishDate\": \"2024-12-31\",\n" +
//                "        \"FCtrlItem\": \"1\",\n" +
//                "        \"FIsSuspend\": \"0,1\",\n" +
//                "        \"FStatus\": \"3,4,5,6\",\n" +
//                "        \"FMOBillType\": \"123f39178eb2424c8449f992e1fff1ee,0e74146732c24bec90178b6fe16a2d1c,b7dd912d4ef545578f0f5d1d08cb2602,00232405fc58a68311e33257e9e17076,00505694499eb16411e3cd16dc62e287,005056945fca85e511e42420f363da25,574e87276ff23a\",\n" +
//                "        \"FWorkshopId\": [\n" +
//                "            {\n" +
//                "                \"FNumber\": \"BM000034\"\n" +
//                "            }\n" +
//                "        ],\n" +
//                "        \"FConveyDateInvolve\": true,\n" +
//                "        \"FStartDateInvolve\": true,\n" +
//                "        \"FFinishDateInvolve\": true\n" +
//                "    }\n" +
//                "}" )
//           ;

        String view1 = client.queryXSDDSLTJ();
        String view2 = client.queryCGDDSLTJ();
        String view3 = client.querySCDDTJSL();
//        System.out
//        System.out.println("2222222222222222222222");
//        Gson gson = new Gson();
//        Map<String,Object> mainTableData = gson.fromJson(view2, (Type)Map.class);
//        System.out.println(mainTableData);
//        List<Map<String,Object>> list = (List<Map<String,Object>>)mainTableData.get("Data");
//        System.out.println(list.get(0).get("类别"));
//        System.out.println(list.get(0).get("数量"));
//        Map<String,Object> map = gson.fromJson(view1, (Type)Map.class);
        System.out.println(view1);
        System.out.println(view2);
        System.out.println(view3);
//        String view = client.view("AP_AgingAnalysis","{\n" +
//                "    \"FormId\": \"AP_AgingAnalysis\",\n" +
//                "    \"FieldKeys\": \"FContactUnitNumber\",\n" +
//                "    \"SchemeId\": \"\",\n" +
//                "    \"StartRow\": 0,\n" +
//                "    \"Limit\": 2000,\n" +
//                "    \"IsVerifyBaseDataField\": \"true\",\n" +
//                "    \"Model\": {\n" +
//                "        \"FPrdOrgId\": \"180235\",\n" +
//                "        \"FBeginConveyDate\": \"2024-02-01\",\n" +
//                "        \"FEndConveyDate\": \"2024-12-31\",\n" +
//                "        \"FBeginPlanStartDate\": \"2024-02-01\",\n" +
//                "        \"FEndPlanStartDate\": \"2024-12-31\",\n" +
//                "        \"FBeginPlanFinishDate\": \"2024-02-01\",\n" +
//                "        \"FEndPlanFinishDate\": \"2024-12-31\",\n" +
//                "        \"FCtrlItem\": \"1\",\n" +
//                "        \"FIsSuspend\": \"0,1\",\n" +
//                "        \"FStatus\": \"3,4,5,6\",\n" +
//                "        \"FMOBillType\": \"123f39178eb2424c8449f992e1fff1ee,0e74146732c24bec90178b6fe16a2d1c,b7dd912d4ef545578f0f5d1d08cb2602,00232405fc58a68311e33257e9e17076,00505694499eb16411e3cd16dc62e287,005056945fca85e511e42420f363da25,574e87276ff23a\",\n" +
//                "        \"FWorkshopId\": [\n" +
//                "            {\n" +
//                "                \"FNumber\": \"BM000034\"\n" +
//                "            }\n" +
//                "        ],\n" +
//                "        \"FConveyDateInvolve\": true,\n" +
//                "        \"FStartDateInvolve\": true,\n" +
//                "        \"FFinishDateInvolve\": true\n" +
//                "    }\n" +
//                "}");
    }
}
