From b55a77755e9aff5684f83e9581b58b349ed0a406 Mon Sep 17 00:00:00 2001 From: chenwenkai <1084072318@qq.com> Date: Mon, 3 Mar 2025 08:33:57 +0800 Subject: [PATCH] =?UTF-8?q?shopify=E4=B8=8A=E4=BC=A0=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TradeManageNew/DD_OrderServiceNew.asmx.cs | 48 +++++++++++++---------- TradeManageNew/DataNew.cs | 13 +++++- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/TradeManageNew/DD_OrderServiceNew.asmx.cs b/TradeManageNew/DD_OrderServiceNew.asmx.cs index 5b7f416..6bec804 100644 --- a/TradeManageNew/DD_OrderServiceNew.asmx.cs +++ b/TradeManageNew/DD_OrderServiceNew.asmx.cs @@ -28846,7 +28846,7 @@ namespace TradeManageNew [WebMethod(EnableSession = true)] public APIReturnModel OrderUsedSalePlatformPublish(List Ids) { - // PagesNew.Login(base.Session); + PagesNew.Login(base.Session); bool lockTaken = false; try @@ -28887,16 +28887,6 @@ namespace TradeManageNew continue; } - //建议售价 - if (product.JYPrice is null || product.JYPrice <= 0) - { - var message = $"产品[{product.GoodsCode}]无建议售价,无法推送至Shopify"; - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, message) - .Update(); - - continue; - } //预估运费 var postFee = db.HW_PostFee.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); @@ -28921,7 +28911,24 @@ namespace TradeManageNew postFee.Fee8, }.Where(x => x != null).ToList(); var feeCost = fees.Any() ? fees.Min() : 0; + decimal jyprice = 0m; + decimal feerate = 6.5m; + //建议售价 + if (product.JYPrice is null || product.JYPrice <= 0) + { + //var message = $"产品[{product.GoodsCode}]无建议售价,无法推送至Shopify"; + //db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + // .Set(x => x.PublishMessage, message) + // .Update(); + //continue; + decimal? sumJy = (Convert.ToDecimal(product.InPrice) / feerate + (feerate * Convert.ToDecimal(product.InPrice) * Convert.ToDecimal(0.01) / feerate) + product.Solid * 130 + feeCost); + jyprice = Convert.ToDecimal(sumJy) / 0.8m; + } + else + { + jyprice = Convert.ToDecimal(product.JYPrice); + } if (feeCost <= 0) { db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) @@ -28959,7 +28966,7 @@ namespace TradeManageNew ProductType = shopifyProductProfile?.Category, Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, - JYPrice = product.JYPrice.Value, //product.JYPrice.Value, + JYPrice = jyprice, //product.JYPrice.Value, ShippingFee = feeCost.Value, //feeCost.Value, } }; @@ -29025,7 +29032,7 @@ namespace TradeManageNew ProductType = shopifyProductProfile?.Category, Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, - JYPrice = product.JYPrice.Value,// product.JYPrice.Value, + JYPrice = jyprice,// product.JYPrice.Value, ShippingFee= feeCost.Value,// feeCost.Value }, Variants = new Variants @@ -29224,10 +29231,10 @@ namespace TradeManageNew // Shopify客户端 删除产品变体 var shopifyApiClient = new ShopifyAPIClient(); var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3 - { - ProductId = shopifyProductGoodsMap.ShopifyProductId, - Code = item.ProductCode, - }).ConfigureAwait(false) + { + ProductId = shopifyProductGoodsMap.ShopifyProductId, + Code = item.ProductCode, + }).ConfigureAwait(false) .GetAwaiter() .GetResult(); @@ -30593,10 +30600,11 @@ namespace TradeManageNew #region 分页查询 [WebMethod(EnableSession = true)] - public JsonModel> GetListTemuShopGoodActive(string cs, int PageIndex, int PageSize) + public JsonModel> GetListTemuShopGoodActive(string cs, int PageIndex, int PageSize, string sku) { - PagesNew.Login(this.Session); + //PagesNew.Login(this.Session); string where = CustomIO.Base64StringToString(cs); + string Sku = CustomIO.Base64StringToString(sku); if (where != "") where = "where " + where.Substring(4); var resultModel = new JsonModel>(); int RowCount = 0; @@ -30613,7 +30621,7 @@ namespace TradeManageNew ids = ids.TrimEnd(','); if (ids != "") { - var dlist = DataNew.GetListTemuShopGoodActiveDetail(ids); + var dlist = DataNew.GetListTemuShopGoodActiveDetail(ids, Sku); if (dlist != null) { diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index 6f5e739..a1f11de 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -31391,10 +31391,19 @@ delete from TemuShopGoodActiveDetail where Id=@Id"; } #endregion #region 返回列表 - public static List GetListTemuShopGoodActiveDetail(string ids) + public static List GetListTemuShopGoodActiveDetail(string ids, string Sku) { + string tsql = string.Empty; + if (!string.IsNullOrEmpty(Sku)) + { + tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") and sku like '%" + Sku + "%' order by id"; + } + else + { + tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") order by id"; + } //string tsql = "select a.ID,a.Shopid,a.SKU,a.SPUID,a.BasePrice,a.CreateUserId,a.CreateTime,a.PostPrice,a.State from TemuShopGoodActive"; - string tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") order by id"; + //string tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") and sku like '%"+ Sku + "%' order by id"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); DataTable tb = db.ExecuteDataTable(cmd);