private string CreateTestOrderFromNg() { ProcurementOrderFromNg order = new ProcurementOrderFromNg(); order.AppKey = "334362"; order.AppSecret = "w5v9Xu2sK2y5"; order.TokenKey = "9ee0ac93-0aae-45f5-a671-ca7564280a3a"; order.CompanyCode = "1000"; order.OperatorLoginId = "dongyl3333"; order.NgPurId = DateTime.Now.Ticks.ToString(); order.Address = new ProcurementOrderAddress(); order.Address.Address = "浙江省杭州市滨江区网商路699号"; order.Address.ReceiverName = "李四"; order.Address.Post = "315151"; order.Address.MobilePhone = "13786543897"; order.NeedSupplierConfirm = false; order.NeedInvoice = false; order.QuoteId = 1190909900727; order.Details = new List <ProcurementOrderDetail>(); order.Details.Add(new ProcurementOrderDetail() { DeliveryDate = DateTime.Now.AddDays(10), QuoteDetialId = 1575894180727, Qty = 15 }); order.Details.Add(new ProcurementOrderDetail() { DeliveryDate = DateTime.Now.AddDays(10), QuoteDetialId = 1575894190727, Qty = 15 }); JsonSerializerSettings set = new JsonSerializerSettings(); set.DateFormatString = "yyyy-MM-dd hh:mm:ss"; return(JsonConvert.SerializeObject(order, set)); }
private void SetCreateOrderBySourceIdParams(string busdata) { ProcurementOrderFromNg order = JsonConvert.DeserializeObject <ProcurementOrderFromNg>(busdata); Secret = order; UrlParams = new Dictionary <string, string>(); JObject createOrderParam = new JObject(), tmpObj = new JObject(); //createOrderParam.Add("bizScene", "outersystem"); createOrderParam.Add("companyCode", order.CompanyCode); createOrderParam.Add("erpId", order.NgPurId); createOrderParam.Add("needDefaultInvoiceTemplate", order.NeedInvoice); createOrderParam.Add("needSupplierConfirm", order.NeedSupplierConfirm); createOrderParam.Add("operatorLoginId", order.OperatorLoginId); if (string.IsNullOrWhiteSpace(order.OrderType)) { createOrderParam.Add("orderType", "standard"); } else { createOrderParam.Add("orderType", order.OrderType); } createOrderParam.Add("sourceId", order.QuoteId); if (string.IsNullOrWhiteSpace(order.SourceType)) { createOrderParam.Add("sourceType", "quotation"); } else { createOrderParam.Add("sourceType", order.SourceType); } if (order.Address != null) { tmpObj = new JObject(); tmpObj.Add("address", order.Address.Address); tmpObj.Add("mobilePhone", order.Address.MobilePhone); tmpObj.Add("phone", order.Address.Phone); tmpObj.Add("post", order.Address.Post); tmpObj.Add("receiverName", order.Address.ReceiverName); JObject logisticsInfo = new JObject(); logisticsInfo.Add("address", tmpObj); createOrderParam.Add("logisticsInfo", logisticsInfo); } JArray entries = new JArray(); JObject entry = null; foreach (ProcurementOrderDetail d in order.Details) { entry = new JObject(); entry.Add("amount", d.Qty); if (d.DeliveryDate.HasValue) { tmpObj = new JObject(); tmpObj.Add("deliveryDate", d.DeliveryDate.Value.ToString("yyyyMMddHHmmssfffzz00")); entry.Add("deliveryInfo", tmpObj); } entry.Add("sourceRowId", d.QuoteDetialId); entries.Add(entry); } createOrderParam.Add("orderEntryList", entries); UrlParams.Add("access_token", Secret.TokenKey); //JsonSerializerSettings set = new JsonSerializerSettings(); //set.DateFormatString = "yyyy-MM-dd hh:mm:ss"; UrlParams.Add("param", JsonConvert.SerializeObject(createOrderParam)); FunName = "cn.alibaba.open/com.alibaba.procurement.BuyerOrderService.createOrderBySourceId"; }