Exemplo n.º 1
0
        /// <summary>
        /// 产生PO的PDF文件。
        /// 产生的文件保存在出参的流中
        /// </summary>
        /// <param name="input">输入参数</param>
        /// <returns></returns>
        internal GenPoPdfOutParameter GenPoPdfDAL(GenPoPdfInput input)
        {
            string json    = JsonConvert.SerializeObject(input);
            var    res     = HwApiHelper.HuaweiPostSync(baseUrl, genPoPdfUri, token.Access_token, json, null);
            string resJson = HwApiHelper.GetResponseString(res);
            var    output  = JsonConvert.DeserializeObject <GenPoPdfOutParameter>(resJson);

            ErrorMsg = output.HttpCode;
            ErrorMsg = output.Message;
            return(output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 签返订单
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        internal SignBackPoListOutput SignBackPoList(SignBackPoListInput input)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            };
            string json    = JsonConvert.SerializeObject(input, settings);
            var    res     = HwApiHelper.HuaweiPostSync(baseUrl, signBackUri, token.Access_token, json, null);
            string resJson = HwApiHelper.GetResponseString(res);
            var    output  = JsonConvert.DeserializeObject <SignBackPoListOutput>(resJson);

            ErrorCode = output.Code;
            ErrorMsg  = output.Result;
            return(output);
        }
Exemplo n.º 3
0
        /// <summary>
        /// PO列表查询
        /// </summary>
        /// <param name="inParameter"></param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        internal PoLineListOutput GetPoLineList(PoLineListInput inParameter, int page, int pageSize)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            };
            string json    = JsonConvert.SerializeObject(inParameter, settings);
            string url     = pageSize == 100 ? findPoLineListUri + page: findPoLineListUri + pageSize + "/" + page;
            var    res     = HwApiHelper.HuaweiPostSync(baseUrl, url, token.Access_token, json, null);
            string resJson = HwApiHelper.GetResponseString(res);
            var    output  = JsonConvert.DeserializeObject <PoLineListOutput>(resJson);

            ErrorMsg  = res.StatusDescription;
            ErrorCode = res.StatusCode.ToString();
            return(output);
        }
Exemplo n.º 4
0
        public static Token GetToken()
        {
            string uri = "oauth2/token";

            if (File.Exists(SettingItems.settingFile))
            {
                //读配置文件
                MyConfiguration cfg = new MyConfiguration(false);
                cfg.Load(SettingItems.settingFile);
                string baseUrl   = cfg.ReadString("BaseUrl");
                string appKey    = cfg.ReadString("AppKey");
                string appSecret = cfg.ReadString("AppSecret");
                System.Net.HttpWebResponse response = HwApiHelper.CreateHwTokenHttpResponse(baseUrl, uri, appKey, appSecret, null);
                string result = HwApiHelper.GetResponseString(response);
                Token  token  = JsonConvert.DeserializeObject <Token>(result);
                return(token);
            }
            else
            {
                return(null);
            }
        }