Ejemplo n.º 1
0
        /// <summary>
        /// 构造请求的协议数据
        /// </summary>
        /// <param name="reqXmlValue"></param>
        /// <returns></returns>
        private string BuildPostReqData(object requestInfo, string secretKey)
        {
            string        requestValues = SerializationUtility.JsonSerialize(requestInfo);
            StringBuilder postData      = new StringBuilder();

            postData.AppendFormat("EData={0}", requestValues);
            postData.AppendFormat("&SignMsg={0}", SignData(requestValues, secretKey));
            return(postData.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 发送商品信息到数据交换中心
        /// </summary>
        /// <param name="productInfo"></param>
        private bool SendProduct(ProductInfo productInfo)
        {
            var result = RestfulClient.PostJson <string>(ConfigurationManager.AppSettings["ProductRestfulUrl"], "addItem", productInfo, (message) =>
            {
                WriteLog(message, "SendRequest");
            });
            var success = result.Code == RestfulCode.Success;//200成功

            if (success)
            {
                ProductDA.UpdateProductStatus(productInfo.SysNo);
                //记录成功日志
                WriteLog("商品【" + productInfo.ItemCode + "】发送至数据交换中心成功", "Success");
            }
            else
            {
                //记录失败日志
                WriteLog("商品【" + productInfo.ItemCode + "】发送至数据交换中心失败【" + SerializationUtility.JsonSerialize(result) + "】", "Failed");
            }
            return(success);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 发送订单信息到数据交换中心
        /// </summary>
        /// <param name="soInfo"></param>
        private bool SendSO(SOInfo soInfo)
        {
            var result = RestfulClient.PostJson <string>(ConfigurationManager.AppSettings["SORestfulUrl"], "customerOrderOutStore", soInfo, (message) =>
            {
                WriteLog(message, "SendRequest");
            });
            var success = result.Code == RestfulCode.Success;//200成功

            if (success)
            {
                SODA.UpdateSOStatus(soInfo.SysNo);
                //记录成功日志
                WriteLog("订单【" + soInfo.SOID + "】发送至数据交换中心成功", "Success");
            }
            else
            {
                //记录失败日志
                WriteLog("订单【" + soInfo.SOID + "】发送至数据交换中心失败【" + SerializationUtility.JsonSerialize(result) + "】", "Failed");
            }
            return(success);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 发送入库单到数据交换中心
        /// </summary>
        /// <param name="poInfo"></param>
        private bool SendPO(POInfo poInfo)
        {
            //poInfo.BillNo = new Random().Next(100000000).ToString();
            var result = RestfulClient.PostJson <string>(ConfigurationManager.AppSettings["PORestfulUrl"], "customerOrderInStore", poInfo, (message) =>
            {
                WriteLog(message, "SendRequest");
            });
            var success = result.Code == RestfulCode.Success;//200成功

            if (success)
            {
                PODA.UpdatePOStatus(poInfo.SysNo);
                //记录成功日志
                WriteLog("入库单【" + poInfo.BillNo + "】发送至数据交换中心成功", "Success");
            }
            else
            {
                //记录失败日志
                WriteLog("入库单【" + poInfo.BillNo + "】发送至数据交换中心失败【" + SerializationUtility.JsonSerialize(result) + "】", "Failed");
            }
            return(success);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 发送损益单到数据交换中心
        /// </summary>
        /// <param name="adjustInfo"></param>
        private bool SendAdjust(AdjustInfo adjustInfo)
        {
            var result = RestfulClient.PostJson <string>(ConfigurationManager.AppSettings["AdjustRestfulUrl"], "causticExcessive", adjustInfo, (message) =>
            {
                WriteLog(message, "SendRequest");
            });
            var success = result.Code == RestfulCode.Success;//200成功

            if (success)
            {
                AdjustDA.UpdateAdjustStatus(adjustInfo.SysNo);
                //记录成功日志
                WriteLog("损益单【" + adjustInfo.AdjustID + "】[" + adjustInfo.ItemCode + "]发送至数据交换中心成功", "Success");
            }
            else
            {
                //记录失败日志
                WriteLog("损益单【" + adjustInfo.AdjustID + "】[" + adjustInfo.ItemCode + "]发送至数据交换中心失败【" + SerializationUtility.JsonSerialize(result) + "】", "Failed");
            }
            return(success);
        }