
using System;
using Common;
using Common.Request;
using Common.Request.Subscribe;
using Utils;
using Newtonsoft.Json;
using Common.Request.Electronic.Image;
using Common.Request.Electronic.Html;
using Common.Request.Electronic;
using Common.Request.Electronic.Print;
using Common.Request.Sms;
using Common.Request.BorderOfficial;
using Common.Request.internationalshipment;
using Common.Request.cloud;
using Common.Request.samecity;
using Common.Request.thirdPlatform;
using System.Collections;
using System.Collections.Generic;
using Common.Request.Electronic.ocr;
using Common.Request.Label;


namespace Demo
{

    public class API
    {

        //快递100的基础账号信息，可以在这里获取 (需要填写完整才能测试)
        //https://poll.kuaidi100.com/manager/page/myinfo/enterprise
        private static KuaiDi100Config config = new KuaiDi100Config()
        {
            key = "HGbBOtsn4694",
            customer = "5917D6C0161AB881B64ADF270F826683",
            secret = "90849cefa2c347f898edc3725dc4d5ed",
            userid = "2e2e51b845004211998e6351924c0b78",
            siid = "",
            tid = "",
        };
        /// <summary>
        /// 轨迹物流查询
        /// </summary>
        static void testQueryTrack()
        {
            var queryTrackParam = new QueryTrackParam()
            {
                com = "zhongtong",
                num = "7537****693697",
                phone = "15****98256"
            };

            QueryTrack.query(new QueryTrackReq()
            {
                customer = config.customer,
                sign = SignUtils.GetMD5(queryTrackParam.ToString() + config.key + config.customer),
                param = queryTrackParam
            });
        }

        /// <summary>
        /// 轨迹订阅
        /// </summary>
        static void testSubscribe()
        {
            var subscribeParameters = new SubscribeParameters()
            {
                phone = "159*****256",
                resultv2 = "1",
                callbackurl = "http://www.xxxx.com"
            };

            var subscribeParam = new SubscribeParam()
            {
                company = "zhongtong",
                number = "7537****693697",
                key = config.key,
                parameters = subscribeParameters
            };

            Subscribe.subscribe(new SubscribeReq()
            {
                schema = ApiInfoConstant.SUBSCRIBE_SCHEMA,
                param = subscribeParam,
            });
        }

        /// <summary>
        /// 地图轨迹物流查询
        /// </summary>
        static void testQueryTrackWithMap()
        {
            var queryTrackParam = new QueryTrackParam()
            {
                com = "zhongtong",
                num = "7537****693697",
                phone = "159****8256",
                from = "北京海淀区",
                to = "深圳南山区"
            };

            QueryTrackWithMap.query(new QueryTrackReq()
            {
                customer = config.customer,
                sign = SignUtils.GetMD5(queryTrackParam.ToString() + config.key + config.customer),
                param = queryTrackParam
            });
        }

        /// <summary>
        /// 地图轨迹订阅
        /// </summary>
        static void testSubscribeWithMap()
        {
            var subscribeParameters = new SubscribeParameters()
            {
                phone = "159****8256",
                resultv2 = "1",
                callbackurl = "http://www.xxxx.com"
            };

            var subscribeParam = new SubscribeParam()
            {
                company = "zhongtong",
                number = "7537****3697",
                key = config.key,
                parameters = subscribeParameters,
                from = "北京海淀区",
                to = "深圳南山区"
            };

            SubscribeWithMap.subscribe(new SubscribeReq()
            {
                schema = ApiInfoConstant.SUBSCRIBE_SCHEMA,
                param = subscribeParam,
            });
        }

        /// <summary>
        /// 电子面单图片接口
        /// </summary>
        static void testPrintImg()
        {
            var printImgParam = new PrintImgParam()
            {
                kuaidicom = "zhaijisong",
                sendManName = "张三",
                sendManMobile = "159****8256",
                sendManPrintAddr = "广东省深圳市南山区科技南十二路",
                recManName = "李四",
                recManMobile = "159****8256",
                recManPrintAddr = "北京市海淀区xxx路",
                type = "10",
                tempid = "180c7c8f646742ca871a92c976392b05",
                count = "1",
                width = "76",
                height = "130",
            };

            var timestamp = DateUtils.GetTimestamp();
            PrintImg.query(new PrintImgReq()
            {
                method = ApiInfoConstant.ELECTRONIC_ORDER_PIC_METHOD,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(printImgParam.ToString() + timestamp + config.key + config.secret),
                param = printImgParam,
            });
        }

        /// <summary>
        /// 电子面单html接口
        /// </summary>
        static void testPrintHtml()
        {
            var printHtmlParam = new PrintHtmlParam()
            {
                kuaidicom = "zhaijisong",
                sendMan = new ManInfo()
                {
                    name = "张三",
                    mobile = "159****8256",
                    printAddr = "广东省深圳市南山区科技南十二路",
                },
                recMan = new ManInfo()
                {
                    name = "李四",
                    mobile = "159****8256",
                    printAddr = "北京市海淀区xxx路",
                },
                count = "1",
                needTemplate = "1",   //如果需要返回电子面单，需要设置
            };

            var timestamp = DateUtils.GetTimestamp();
            PrintHtml.query(new PrintHtmlReq()
            {
                method = ApiInfoConstant.ELECTRONIC_ORDER_HTML_METHOD,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(printHtmlParam.ToString() + timestamp + config.key + config.secret),
                param = printHtmlParam,
            });
        }

        /// <summary>
        /// 电子面单打印接口
        /// </summary>
        static void testPrintCloud()
        {
            var printCloudParam = new PrintCloudParam()
            {
                kuaidicom = "zhaijisong",
                sendMan = new ManInfo()
                {
                    name = "集成测试",
                    mobile = "13012312345",
                    printAddr = "系统集成测试，无需揽件",
                },
                recMan = new ManInfo()
                {
                    name = "集成测试",
                    mobile = "13812312345",
                    printAddr = "系统集成测试，无需揽件",
                },
                count = "1",
                siid = config.siid,
                tempid = "180c7c8f646742ca871a92c976392b05",
                width = "76",
                height = "130"
            };

            var timestamp = DateUtils.GetTimestamp();
            PrintCloud.query(new PrintCloudReq()
            {
                method = ApiInfoConstant.ELECTRONIC_ORDER_PRINT_METHOD,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(printCloudParam.ToString() + timestamp + config.key + config.secret),
                param = printCloudParam,
            });
        }

        /// <summary>
        /// 发送短信
        /// </summary>
        static void testSendSms()
        {
            var content = new Hashtable();
            content.Add("username", "测试用户");

            SendSms.query(new SendSmsReq()
            {
                content = JsonConvert.SerializeObject(content),
                phone = "xxx",
                seller = "测试",
                userid = config.userid,
                tid = config.tid,
                sign = SignUtils.GetMD5(config.key + config.userid)
            });
        }

        /// <summary>
        /// 智能识别
        /// </summary>
        static void testAutoNum()
        {
            AutoNum.query("773039762404825", config.key);
        }

        /// <summary>
        /// 商家寄件查询价格
        /// </summary>
        static void testBOrderQuery()
        {
            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new BOrderOfficialQueryPriceParam()
            {
                sendManPrintAddr = "福田区华强北",
                kuaidiCom = "jtexpress",
                recManPrintAddr = "北京海淀区"
            };
            BaseReq<BOrderOfficialQueryPriceParam> baseReq = new BaseReq<BOrderOfficialQueryPriceParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            BOrderOfficial.queryPrice(baseReq);
        }

        /// <summary>
        /// 商家寄件下单
        /// 注意保存一下返回值(taskId和orderId),用于获取验证码或者取消订单
        /// </summary>
        static void testBOrder()
        {
            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new BOrderOfficialOrderParam()
            {
                kuaidicom = "jtexpress",
                recManName = "张三",
                recManMobile = "159953225555",
                recManPrintAddr = "深圳市南山区金蝶软件园",
                sendManName = "李四",
                sendManMobile = "15333333333",
                sendManPrintAddr = "深圳福田区华强北",
                cargo = "文件",
                weight = "1",
                remark = "测试单，待会取消",
                salt = "123",
                callBackUrl = "http://www.xxxx.com",
                serviceType = "标准快递"
            };
            BaseReq<BOrderOfficialOrderParam> baseReq = new BaseReq<BOrderOfficialOrderParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            BOrderOfficial.order(baseReq);
        }

        /// <summary>
        /// 商家寄件取消寄件
        /// 入参为下单接口返回的taskId和orderId
        /// </summary>
        static void testBOrderCancel()
        {
            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new BOrderOfficialCancelParam()
            {
                taskId = "9406BFCD6******1E0E00D23047FFB",
                orderId = "169**740",
                cancelMsg = "测试单"
            };
            BaseReq<BOrderOfficialCancelParam> baseReq = new BaseReq<BOrderOfficialCancelParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            BOrderOfficial.cancel(baseReq);
        }

        /// <summary>
        /// 国际电子面单API
        /// </summary>
        static void testInternationalShipment()
        {
            var timestamp = DateUtils.GetTimestamp();
            List<PackageInfo> packageInfoList = new List<PackageInfo>();
            var packageInfo = new PackageInfo()
            {
                length = 10.00,
                width = 20.00,
                height = 10.00,
                weight = 50.00
            };
            packageInfoList.Add(packageInfo);
            List<ExportInfo> exportInfoList = new List<ExportInfo>();
            var exportInfo = new ExportInfo()
            {
                desc = "test",
                grossWeight = 50.00,
                quantity = 1,
                quantityUnitOfMeasurement = "PCS",
                manufacturingCountryCode = "CN",
                unitPrice = 100
            };
            exportInfoList.Add(exportInfo);
            var baseParam = new ShipmentReq()
            {
                partnerId = "",
                partnerKey = "",
                partnerSecret = "",
                code = "",
                kuaidicom = "fedex",
                cargo = "invoice",
                expType = "FedEx International First®",
                unitOfMeasurement = "SU",
                weight = 50.00,
                customsValue = 1000.00,
                sendMan = new InterManInfo()
                {
                    name = "test",
                    mobile = "1688888888",
                    countryCode = "CN",
                    city = "SHENZHEN",
                    addr = "Hi-tech Park,Nanshang District",
                    zipcode = "518057",
                    email = "TEST@QQ.COM"
                },
                recMan = new InterManInfo()
                {
                    name = "test",
                    mobile = "1688888888",
                    countryCode = "US",
                    city = "NEW YORK",
                    addr = " 70 Washington Square South",
                    zipcode = "10012",
                    stateOrProvinceCode = "NY",
                    email = "TEST@QQ.COM"
                },
                packageInfos = packageInfoList,
                exportInfos = exportInfoList,
                customsClearance = new CustomsClearance()
                {
                    purpose = "GIFT",
                    isDocument = true,
                }
            };
            BaseReq<ShipmentReq> baseReq = new BaseReq<ShipmentReq>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            InternationalShipment.getLabel(baseReq);
        }

        /// <summary>
        /// 自定义打印接口
        /// </summary>
        static void testCloudPrintCustom()
        {
            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new CustomParam()
            {
                tempid = "180c7c8f646742ca871a92c976392b05",
                callBackUrl = "http://www.xxxx.com",
                siid = config.siid,
            };
            BaseReq<CustomParam> baseReq = new BaseReq<CustomParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            CloudPrint.custom(baseReq);
        }

        /// <summary>
        /// 云打印附件
        /// </summary>
        static void testCloudAttachment()
        {
            string filePath = "C:\\Users\\Administrator.-20171106WFEKLN\\Desktop\\2.png";
            string filename = "2.png";
            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new AttachmentParam()
            {
                callBackUrl = "http://www.xxxx.com",
                siid = config.siid,
            };
            BaseReq<AttachmentParam> baseReq = new BaseReq<AttachmentParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            CloudPrint.attachment(baseReq, filePath, filename);
        }

        /// <summary>
        /// 复打
        /// </summary>
        static void testCloudPrintOld()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new PrintOldParam()
            {
                taskId = "0E0D2AC5D******463DAF1DA5F9"
            };
            BaseReq<PrintOldParam> baseReq = new BaseReq<PrintOldParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            CloudPrint.printOld(baseReq);
        }

        /// <summary>
        /// 指令打印接口
        /// </summary>
        static void testCloudPrintCommand()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new CommandParam()
            {
                content = " ",
                siid = config.siid
            };
            BaseReq<CommandParam> baseReq = new BaseReq<CommandParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            CloudPrint.commandPrint(baseReq);
        }

        /// <summary>
        /// 发货单接口
        /// </summary>
        static void testCloudPrintParcelsBill()
        {

            var timestamp = DateUtils.GetTimestamp();
            //OrderGoods 表格对象，可以自行自定义即可，这里仅供参考
            var baseParam = new ParcelsBillsParam<OrderGoods>()
            {
                tempid = "164509714515858026",
                siid = config.siid
            };
            BaseReq<ParcelsBillsParam<OrderGoods>> baseReq = new BaseReq<ParcelsBillsParam<OrderGoods>>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            CloudPrint.billParcels(baseReq);
        }

        /// <summary>
        /// 硬件状态接口
        /// </summary>
        static void testCloudDevStatus()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new DevStatusParam()
            {
                siid = config.siid
            };
            BaseReq<DevStatusParam> baseReq = new BaseReq<DevStatusParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            CloudPrint.devStatus(baseReq);
        }

        /// <summary>
        /// 获取店铺授权超链接接口
        /// </summary>
        static void testThirdPlatformStoreAuth()
        {

            var baseParam = new StoreAuthParam()
            {
                shopType = "TAOBAO",
                callbackUrl = "http://www.xxxx.com",
                salt = "123"
            };
            BaseReq<StoreAuthParam> baseReq = new BaseReq<StoreAuthParam>()
            {
                key = config.key,
                sign = SignUtils.GetMD5(baseParam.ToString() + config.key + config.secret),
                param = baseParam
            };
            ThirdPlatformOrder.auth(baseReq);
        }

        /// <summary>
        /// 提交订单获取任务接口
        /// </summary>
        static void testThirdPlatformCommitTask()
        {

            var baseParam = new CommitTaskParam()
            {
                shopType = "TAOBAO",
                shopId = "41****377",
                orderStatus = "UNSHIP",
                updateAtMin = "2022-02-17 16:00:00",
                updateAtMax = "2022-02-17 16:30:00",
                callbackUrl = "http://www.xxxx.com",
                salt = "123"
            };
            BaseReq<CommitTaskParam> baseReq = new BaseReq<CommitTaskParam>()
            {
                key = config.key,
                sign = SignUtils.GetMD5(baseParam.ToString() + config.key + config.secret),
                param = baseParam
            };
            ThirdPlatformOrder.commitTask(baseReq);
        }

        /// <summary>
        /// 快递单号回传及订单发货接口
        /// </summary>
        static void testThirdPlatformUploadNum()
        {

            var baseParam = new UploadNumParam()
            {
                shopType = "TAOBAO",
                shopId = "41****77",
                orderNum = "240*****8072",
                kuaidiCom = "yunda",
                kuaidiNum = "1ds23456"
            };
            BaseReq<UploadNumParam> baseReq = new BaseReq<UploadNumParam>()
            {
                key = config.key,
                sign = SignUtils.GetMD5(baseParam.ToString() + config.key + config.secret),
                param = baseParam
            };
            ThirdPlatformOrder.uploadNum(baseReq);
        }

        /// <summary>
        /// 同城配送账号授权接口
        /// </summary>
        static void testSameCityStoreAuth()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new SameCityAuthParam()
            {
                com = "shansong",
                storeId = "123456",
                callbackUrl = "http://www.xxxx.com"
            };
            BaseReq<SameCityAuthParam> baseReq = new BaseReq<SameCityAuthParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            SameCity.auth(baseReq);
        }

        /// <summary>
        /// 同城配送下单
        /// </summary>
        static void testSameCityOrder()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new SameCityOrderParam()
            {
                partnerId = "199****601",
                partnerKey = "806cdf87*******dfb000326375d",
                com = "kfw",
                storeId = "123456",
                recManName = "张三",
                recManMobile = "1599*****912",
                recManPrintAddr = "深圳市南山区金蝶软件园",
                sendManName = "李四",
                sendManMobile = "153******3333",
                sendManPrintAddr = "深圳福田区华强北",
                price = 100,
                orderSourceType = "饿了么",
                weight = 1,
                remark = "测试单，待会取消",
                serviceType = "火锅",
                salt = "123",
                callbackUrl = "http://www.xxxx.com",
                orderSourceNo = "1233",
                orderType = 0

            };
            BaseReq<SameCityOrderParam> baseReq = new BaseReq<SameCityOrderParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            SameCity.order(baseReq);
        }

        /// <summary>
        /// 同城配送查询订单
        /// </summary>
        static void testSameCityQuery()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new SameCityQueryParam()
            {
                taskId = "EE815B30*****2FEE0EBFEC3",
                orderId = "10003****SWiZ",
            };
            BaseReq<SameCityQueryParam> baseReq = new BaseReq<SameCityQueryParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            SameCity.query(baseReq);
        }


        /// <summary>
        /// 同城配送取消下单接口
        /// </summary>
        static void testSameCityCancel()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new SameCityCancelParam()
            {
                taskId = "EE815B30B5*****B8D522FEE0EBFEC3",
                orderId = "1000****WiZ",
                cancelMsg = "地址信息填错啦，重新下单"
            };
            BaseReq<SameCityCancelParam> baseReq = new BaseReq<SameCityCancelParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            SameCity.cancel(baseReq);
        }

        /// <summary>
        /// 第三方电商平台账号授权
        /// </summary>
        static void testThirdPlatformAuth()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new PlatformAuthParam()
            {
                net = "taobao",
                callbackUrl = "http://www.xxx.com"
            };
            BaseReq<PlatformAuthParam> baseReq = new BaseReq<PlatformAuthParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            ThirdPlatformOrder.platformAuth(baseReq);
        }

        /// <summary>
        /// 第三方平台面单余额接口
        /// </summary>
        static void testThirdPlatBranchInfo()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new BranchInfoParam()
            {
                partnerId = "343****2875",
                partnerKey = "6201d13dee73*********557aa3431402875",
                net = "taobao"
            };
            BaseReq<BranchInfoParam> baseReq = new BaseReq<BranchInfoParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            ThirdPlatformOrder.branchInfo(baseReq);

        }

        /// <summary>
        /// 电子面单取消接口
        /// </summary>
        static void testLabelCancel()
        {

            var timestamp = DateUtils.GetTimestamp();
            var baseParam = new CancelPrint()
            {
                partnerId = "",
                partnerKey = "",
                net = "",
                kuaidicom = "shunfeng",
                kuaidinum = "SF136*****3507",
                orderId = "016455*****25zosNIq",
                reason = "地址错误"
            };
            BaseReq<CancelPrint> baseReq = new BaseReq<CancelPrint>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            PrintCloud.cancel(baseReq);

        }

        /// <summary>
        /// 快递面单OCR识别接口
        /// </summary>
        static void testOcr()
        {

            var baseParam = new OcrParam()
            {
                image = "132"
            };
            BaseReq<OcrParam> baseReq = new BaseReq<OcrParam>()
            {
                key = config.key,
                param = baseParam
            };
            Ocr.ocr(baseReq);

        }

        /// <summary>
        /// 商家寄件查询订单详情
        /// </summary>
        static void testBOrderOfficialQueryDetail()
        {

            var baseParam = new BOrderOfficialQueryDetailParam()
            {
                taskId = "9FC293CA417E431F33046E64F4C4EC20"
            };
            var timestamp = DateUtils.GetTimestamp();
            BaseReq<BOrderOfficialQueryDetailParam> baseReq = new BaseReq<BOrderOfficialQueryDetailParam>()
            {
                key = config.key,
                param = baseParam,
                method = ApiInfoConstant.ORDER,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret)
            };
            BOrderOfficial.queryDetail(baseReq);

        }

        /// <summary>
        /// 电子面单V2打印接口
        /// </summary>
        public static void testLabelOrder()
        {
            var orderParam = new OrderParam()
            {
                printType = "NON",
                partnerId = "81533",
                kuaidicom = "kuayue",
                sendMan = new ManInfo()
                {
                    name = "集成测试",
                    mobile = "13012312345",
                    printAddr = "系统集成测试，无需揽件",
                },
                recMan = new ManInfo()
                {
                    name = "集成测试",
                    mobile = "13812312345",
                    printAddr = "系统集成测试，无需揽件",
                },
                cargo = "测试邮寄货品",
                count = 1,
                remark = "集成测试",

                siid = config.siid,
                tempId = "2478b0885e764f049ef34bbd13ec1079",
                needOcr = false
            };

            var timestamp = DateUtils.GetTimestamp();
            LabelV2.order(new BaseReq<OrderParam>()
            {
                method = ApiInfoConstant.ORDER,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(orderParam.ToString() + timestamp + config.key + config.secret),
                param = orderParam,
            });
        }

        /// <summary>
        /// 电子面单V2复打接口
        /// </summary>
        static void testLabelRepeatPrint()
        {
            var orderParam = new RepeatPrintParam()
            {

                taskId = "638687EEB4744396A40F693541114E44"
            };

            var timestamp = DateUtils.GetTimestamp();
            LabelV2.repeatPrint(new BaseReq<RepeatPrintParam>()
            {
                method = ApiInfoConstant.CLOUD_PRINT_OLD_METHOD,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(orderParam.ToString() + timestamp + config.key + config.secret),
                param = orderParam,
            });
        }

        /// <summary>
        /// 自定义接口
        /// </summary>
        static void testLabelCustomPrint()
        {

            var customParam = new Dictionary<string, object>();
            customParam.Add("qrcode", "888888888");
            var orderParam = new CustomPrintParam()
            {

                siid = config.siid,
                tempId = "41b9d19ee56b45b5a23d7b6ace4f9029",
                printType = "IMAGE",
                customParam = customParam
            };

            var timestamp = DateUtils.GetTimestamp();
            LabelV2.customPrint(new BaseReq<CustomPrintParam>()
            {
                method = ApiInfoConstant.CUSTOM,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(orderParam.ToString() + timestamp + config.key + config.secret),
                param = orderParam,
            });
        }

        /// <summary>
        /// 电子面单V2打印接口
        /// </summary>
        public static string GeneLabelOrder(OrderParam rOP)
        {
             var timestamp = DateUtils.GetTimestamp();
            return LabelV2.callOrder(new BaseReq<OrderParam>()
            {
                method = ApiInfoConstant.ORDER,
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(rOP.ToString() + timestamp + config.key + config.secret),
                param = rOP,
            });
        }

        /// <summary>
        /// 复打
        /// </summary>
        public static string CloudPrintOld(PrintOldParam baseParam)
        {
            var timestamp = DateUtils.GetTimestamp();
            BaseReq<PrintOldParam> baseReq = new BaseReq<PrintOldParam>()
            {
                key = config.key,
                t = timestamp,
                sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
                param = baseParam
            };
            return CloudPrint.callPrintOld(baseReq);
        }
    }
}