shopify上传商品

master^2
chenwenkai 21 hours ago
parent afef83eb11
commit b55a77755e

@ -28846,7 +28846,7 @@ namespace TradeManageNew
[WebMethod(EnableSession = true)] [WebMethod(EnableSession = true)]
public APIReturnModel OrderUsedSalePlatformPublish(List<int> Ids) public APIReturnModel OrderUsedSalePlatformPublish(List<int> Ids)
{ {
// PagesNew.Login(base.Session); PagesNew.Login(base.Session);
bool lockTaken = false; bool lockTaken = false;
try try
@ -28887,16 +28887,6 @@ namespace TradeManageNew
continue; 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); var postFee = db.HW_PostFee.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId);
@ -28921,7 +28911,24 @@ namespace TradeManageNew
postFee.Fee8, postFee.Fee8,
}.Where(x => x != null).ToList(); }.Where(x => x != null).ToList();
var feeCost = fees.Any() ? fees.Min() : 0; 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) if (feeCost <= 0)
{ {
db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id)
@ -28959,7 +28966,7 @@ namespace TradeManageNew
ProductType = shopifyProductProfile?.Category, ProductType = shopifyProductProfile?.Category,
Tags = shopifyProductProfile?.Tags, Tags = shopifyProductProfile?.Tags,
Weight = product.Weight.Value, Weight = product.Weight.Value,
JYPrice = product.JYPrice.Value, //product.JYPrice.Value, JYPrice = jyprice, //product.JYPrice.Value,
ShippingFee = feeCost.Value, //feeCost.Value, ShippingFee = feeCost.Value, //feeCost.Value,
} }
}; };
@ -29025,7 +29032,7 @@ namespace TradeManageNew
ProductType = shopifyProductProfile?.Category, ProductType = shopifyProductProfile?.Category,
Tags = shopifyProductProfile?.Tags, Tags = shopifyProductProfile?.Tags,
Weight = product.Weight.Value, Weight = product.Weight.Value,
JYPrice = product.JYPrice.Value,// product.JYPrice.Value, JYPrice = jyprice,// product.JYPrice.Value,
ShippingFee= feeCost.Value,// feeCost.Value ShippingFee= feeCost.Value,// feeCost.Value
}, },
Variants = new Variants Variants = new Variants
@ -29224,10 +29231,10 @@ namespace TradeManageNew
// Shopify客户端 删除产品变体 // Shopify客户端 删除产品变体
var shopifyApiClient = new ShopifyAPIClient(); var shopifyApiClient = new ShopifyAPIClient();
var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3 var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3
{ {
ProductId = shopifyProductGoodsMap.ShopifyProductId, ProductId = shopifyProductGoodsMap.ShopifyProductId,
Code = item.ProductCode, Code = item.ProductCode,
}).ConfigureAwait(false) }).ConfigureAwait(false)
.GetAwaiter() .GetAwaiter()
.GetResult(); .GetResult();
@ -30593,10 +30600,11 @@ namespace TradeManageNew
#region 分页查询 #region 分页查询
[WebMethod(EnableSession = true)] [WebMethod(EnableSession = true)]
public JsonModel<List<TemuShopGoodActive>> GetListTemuShopGoodActive(string cs, int PageIndex, int PageSize) public JsonModel<List<TemuShopGoodActive>> GetListTemuShopGoodActive(string cs, int PageIndex, int PageSize, string sku)
{ {
PagesNew.Login(this.Session); //PagesNew.Login(this.Session);
string where = CustomIO.Base64StringToString(cs); string where = CustomIO.Base64StringToString(cs);
string Sku = CustomIO.Base64StringToString(sku);
if (where != "") where = "where " + where.Substring(4); if (where != "") where = "where " + where.Substring(4);
var resultModel = new JsonModel<List<TemuShopGoodActive>>(); var resultModel = new JsonModel<List<TemuShopGoodActive>>();
int RowCount = 0; int RowCount = 0;
@ -30613,7 +30621,7 @@ namespace TradeManageNew
ids = ids.TrimEnd(','); ids = ids.TrimEnd(',');
if (ids != "") if (ids != "")
{ {
var dlist = DataNew.GetListTemuShopGoodActiveDetail(ids); var dlist = DataNew.GetListTemuShopGoodActiveDetail(ids, Sku);
if (dlist != null) if (dlist != null)
{ {

@ -31391,10 +31391,19 @@ delete from TemuShopGoodActiveDetail where Id=@Id";
} }
#endregion #endregion
#region 返回列表 #region 返回列表
public static List<TemuShopGoodActiveDetail> GetListTemuShopGoodActiveDetail(string ids) public static List<TemuShopGoodActiveDetail> 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 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(); Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand(tsql); DbCommand cmd = db.GetSqlStringCommand(tsql);
DataTable tb = db.ExecuteDataTable(cmd); DataTable tb = db.ExecuteDataTable(cmd);

Loading…
Cancel
Save