From afef83eb11a561e65789cdedca7667b2a8d22bd4 Mon Sep 17 00:00:00 2001 From: chenwenkai <1084072318@qq.com> Date: Thu, 27 Feb 2025 14:57:59 +0800 Subject: [PATCH] =?UTF-8?q?shopify=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TradeManageNew/DD_OrderServiceNew.asmx.cs | 111 ++++++++++++------ .../ShopifyUsedSaleOrderDto.cs | 4 +- 2 files changed, 77 insertions(+), 38 deletions(-) diff --git a/TradeManageNew/DD_OrderServiceNew.asmx.cs b/TradeManageNew/DD_OrderServiceNew.asmx.cs index f242b31..5b7f416 100644 --- a/TradeManageNew/DD_OrderServiceNew.asmx.cs +++ b/TradeManageNew/DD_OrderServiceNew.asmx.cs @@ -28959,8 +28959,8 @@ namespace TradeManageNew ProductType = shopifyProductProfile?.Category, Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, - JYPrice = 5m, //product.JYPrice.Value, - ShippingFee = 5m, //feeCost.Value, + JYPrice = product.JYPrice.Value, //product.JYPrice.Value, + ShippingFee = feeCost.Value, //feeCost.Value, } }; var shopifyProductRes = shopifyApiClient @@ -29025,8 +29025,8 @@ namespace TradeManageNew ProductType = shopifyProductProfile?.Category, Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, - JYPrice =5m,// product.JYPrice.Value, - ShippingFee= 5m,// feeCost.Value + JYPrice = product.JYPrice.Value,// product.JYPrice.Value, + ShippingFee= feeCost.Value,// feeCost.Value }, Variants = new Variants { @@ -29114,44 +29114,83 @@ namespace TradeManageNew }; } var originJsonData = JsonConvert.DeserializeObject(originJson); - + using (var db = new TradeUsedSale.Repositories.ErpDbContext()) { var includeUsedSale = false; var errorMessage = string.Empty; //Shopify二手订单 - var newDtShopifyUsedSaleOrder = new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrder - { - OrderId = originJsonData.Order.OrderId, - OrderNumber = originJsonData.Order.OrderNumber, - OrderName = originJsonData.Order.OrderName, - CreatedAt = originJsonData.Order.CreatedAt.DateTime, - UpdatedAt = originJsonData.Order.UpdatedAt.DateTime, - ProcessedAt = originJsonData.Order.ProcessedAt.DateTime, - Name = originJsonData.Recipient.Name, - Phone = originJsonData.Recipient.Phone, - Full = originJsonData.Recipient.Address.Full, - Detail = originJsonData.Recipient.Address.Detail, - Detail2 = originJsonData.Recipient.Address.Detail2, - City = originJsonData.Recipient.Address.City, - Province = originJsonData.Recipient.Address.Province, - ProvinceCode = originJsonData.Recipient.Address.ProvinceCode, - Zip = originJsonData.Recipient.Address.Zip, - Country = originJsonData.Recipient.Address.Country, - CountryCode = originJsonData.Recipient.Address.CountryCode, - Currency = originJsonData.Financial.Currency, - TotalPrice = originJsonData.Financial.TotalPrice, - SubtotalPrice = originJsonData.Financial.SubtotalPrice, - TotalTax = originJsonData.Financial.TotalTax, - TotalDiscounts = originJsonData.Financial.TotalDiscounts, - ShippingPrice = originJsonData.Financial.ShippingPrice, - PaymentMethod = originJsonData.Financial.PaymentMethod, - FinancialStatus = originJsonData.Financial.FinancialStatus, - RefundedAmount = originJsonData.Financial.RefundedAmount, - OriginJson = originJson, - IsPlaceOrderSuccess = false - }; + var newDtShopifyUsedSaleOrder = new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrder(); + if (originJsonData.Recipient !=null) + { + newDtShopifyUsedSaleOrder = new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrder + { + OrderId = originJsonData.Order.OrderId, + OrderNumber = originJsonData.Order.OrderNumber, + OrderName = originJsonData.Order.OrderName, + CreatedAt = originJsonData.Order.CreatedAt.DateTime, + UpdatedAt = originJsonData.Order.UpdatedAt.DateTime, + ProcessedAt = originJsonData.Order.ProcessedAt.DateTime, + Name = originJsonData.Recipient.Name, + Phone = originJsonData.Recipient.Phone, + Full = originJsonData.Recipient.Address.Full, + Detail = originJsonData.Recipient.Address.Detail, + Detail2 = originJsonData.Recipient.Address.Detail2, + City = originJsonData.Recipient.Address.City, + Province = originJsonData.Recipient.Address.Province, + ProvinceCode = originJsonData.Recipient.Address.ProvinceCode, + Zip = originJsonData.Recipient.Address.Zip, + Country = originJsonData.Recipient.Address.Country, + CountryCode = originJsonData.Recipient.Address.CountryCode, + Currency = originJsonData.Financial.Currency, + TotalPrice = originJsonData.Financial.TotalPrice, + SubtotalPrice = originJsonData.Financial.SubtotalPrice, + TotalTax = originJsonData.Financial.TotalTax, + TotalDiscounts = originJsonData.Financial.TotalDiscounts, + ShippingPrice = originJsonData.Financial.ShippingPrice, + PaymentMethod = originJsonData.Financial.PaymentMethod, + FinancialStatus = originJsonData.Financial.FinancialStatus, + RefundedAmount = originJsonData.Financial.RefundedAmount, + OriginJson = originJson, + IsPlaceOrderSuccess = false + }; + } + else + { + newDtShopifyUsedSaleOrder = new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrder + { + OrderId = originJsonData.Order.OrderId, + OrderNumber = originJsonData.Order.OrderNumber, + OrderName = originJsonData.Order.OrderName, + CreatedAt = originJsonData.Order.CreatedAt.DateTime, + UpdatedAt = originJsonData.Order.UpdatedAt.DateTime, + ProcessedAt = originJsonData.Order.ProcessedAt.DateTime, + Name = originJsonData.Customer.FirstName+" "+ originJsonData.Customer.LastName, + Phone = originJsonData.Customer.Phone, + Full = "", + Detail = "", + Detail2 = "", + City = "", + Province = "", + ProvinceCode = "", + Zip = "", + Country = "", + CountryCode = "", + Currency = originJsonData.Financial.Currency, + TotalPrice = originJsonData.Financial.TotalPrice, + SubtotalPrice = originJsonData.Financial.SubtotalPrice, + TotalTax = originJsonData.Financial.TotalTax, + TotalDiscounts = originJsonData.Financial.TotalDiscounts, + ShippingPrice = originJsonData.Financial.ShippingPrice, + PaymentMethod = originJsonData.Financial.PaymentMethod, + FinancialStatus = originJsonData.Financial.FinancialStatus, + RefundedAmount = originJsonData.Financial.RefundedAmount, + OriginJson = originJson, + IsPlaceOrderSuccess = false + }; + } + //Shopify二手订单明细 var newDtShopifyUsedSaleOrderItems = diff --git a/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs b/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs index 5156378..695177d 100644 --- a/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs +++ b/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs @@ -8,13 +8,13 @@ namespace TradeManageNew.Models.ShopifyUsedSale { [JsonProperty("order")] public Order Order { get; set; } - [JsonProperty("recipient")] public Recipient Recipient { get; set; } + [JsonProperty("recipient", NullValueHandling = NullValueHandling.Ignore)] public Recipient Recipient { get; set; } [JsonProperty("items")] public List Items { get; set; } [JsonProperty("financial")] public Financial Financial { get; set; } - [JsonProperty("customer")] public Customer Customer { get; set; } + [JsonProperty("customer", NullValueHandling = NullValueHandling.Ignore)]public Customer Customer { get; set; } [JsonProperty("remark")] public Remark Remark { get; set; } }