diff --git a/TradeManageNew/DD_OrderServiceNew.asmx.cs b/TradeManageNew/DD_OrderServiceNew.asmx.cs index e96e49d..e0d7902 100644 --- a/TradeManageNew/DD_OrderServiceNew.asmx.cs +++ b/TradeManageNew/DD_OrderServiceNew.asmx.cs @@ -38,6 +38,7 @@ using LinqToDB; using Match = System.Text.RegularExpressions.Match; using TradeManageNew.APIClients.FedexApi.Tests; using TradeManageNew.APIClients.FedexAPI.Models.RatesAndTransitTimes; +using TradeManageNew.Models.ShopifyUsedSale; namespace TradeManageNew { @@ -28980,6 +28981,87 @@ namespace TradeManageNew }; } + [WebMethod(EnableSession = true)] + public APIReturnModel PlaceShopifyUsedSaleOrderCallback(string originJson) + { + if (string.IsNullOrWhiteSpace(originJson)) + { + return new APIReturnModel + { + Code = 0, + Message = "下单Json数据为空,请检查", + Datas = null + }; + } + + var originJsonData = ShopifyUsedSaleOrderDto.FromJson(originJson); + + using (var db = new TradeUsedSale.Repositories.ErpDbContext()) + { + 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 + }; + + var dtShopifyUsedSaleOrderId = db.InsertWithInt32Identity(newDtShopifyUsedSaleOrder); + + foreach (var item in originJsonData.Items) + { + var newDtShopifyUsedSaleOrderItem = + new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrderItem + { + DtShopifyUsedSaleOrderId = dtShopifyUsedSaleOrderId, + OriginSku = item.OriginSku, + Sku = item.Sku, + ProductCode = item.ProductCode, + Quantity = item.Quantity, + Price = item.Price, + Title = item.Title, + VariantTitle = item.VariantTitle, + ProductId = item.ProductId, + VariantId = item.VariantId, + Image = item.Image, + ShippingMethod = item.ShippingMethod + }; + + db.InsertWithInt32Identity(newDtShopifyUsedSaleOrderItem); + } + } + + return new APIReturnModel + { + Code = 1, + Message = "Success", + Datas = null + }; + } + #endregion diff --git a/TradeUsedSale/Repositories/ErpDbContext.cs b/TradeUsedSale/Repositories/ErpDbContext.cs index f87e4c6..22f81c1 100644 --- a/TradeUsedSale/Repositories/ErpDbContext.cs +++ b/TradeUsedSale/Repositories/ErpDbContext.cs @@ -30,5 +30,7 @@ namespace TradeUsedSale.Repositories public ITable DT_ShopifyUsedSaleProduct => this.GetTable(); public ITable DT_ShopifyProductGoodsMap => this.GetTable(); public ITable HW_PostFee => this.GetTable(); + public ITable DT_ShopifyUsedSaleOrder => this.GetTable(); + public ITable DT_ShopifyUsedSaleOrderItem => this.GetTable(); } }