master
wufan 2 months ago
parent 6590fb4d84
commit 1620edd261

@ -28680,6 +28680,8 @@ namespace TradeManageNew
#region 二手商品上架Shopify #region 二手商品上架Shopify
private static readonly object _lockObject = new object();
[WebMethod(EnableSession = true)] [WebMethod(EnableSession = true)]
public JsonModel<List<TradeUsedSale.Repositories.Models.DT_OrderUsedSalePlatform>> OrderUsedSalePlatformPage(string Code,string BarCode,bool? IsPrinted,TradeUsedSale.Enums.UsedSalePlatformStatus? Status,string WarehousePositionCode,int PageIndex=1,int PageSize=50) public JsonModel<List<TradeUsedSale.Repositories.Models.DT_OrderUsedSalePlatform>> OrderUsedSalePlatformPage(string Code,string BarCode,bool? IsPrinted,TradeUsedSale.Enums.UsedSalePlatformStatus? Status,string WarehousePositionCode,int PageIndex=1,int PageSize=50)
{ {
@ -28752,6 +28754,12 @@ namespace TradeManageNew
public APIReturnModel OrderUsedSalePlatformPublish(List<int> Ids) public APIReturnModel OrderUsedSalePlatformPublish(List<int> Ids)
{ {
// PagesNew.Login(base.Session); // PagesNew.Login(base.Session);
bool lockTaken = false;
try
{
Monitor.Enter(_lockObject, ref lockTaken);
using (var db = new TradeUsedSale.Repositories.ErpDbContext()) using (var db = new TradeUsedSale.Repositories.ErpDbContext())
{ {
var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x => Ids.Contains(x.Id)).ToList(); var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x => Ids.Contains(x.Id)).ToList();
@ -28807,6 +28815,7 @@ namespace TradeManageNew
continue; continue;
} }
var fees = new List<decimal?>() var fees = new List<decimal?>()
{ {
postFee.Fee1, postFee.Fee1,
@ -28861,14 +28870,16 @@ namespace TradeManageNew
ShippingFee = feeCost.Value, ShippingFee = feeCost.Value,
} }
}; };
var shopifyProductRes = shopifyApiClient.CreateProductAsync(createShopifyProductParameter) var shopifyProductRes = shopifyApiClient
.CreateProductAsync(createShopifyProductParameter)
.ConfigureAwait(false) .ConfigureAwait(false)
.GetAwaiter() .GetAwaiter()
.GetResult(); .GetResult();
if (string.IsNullOrWhiteSpace(shopifyProductRes?.Data?.Id)) if (string.IsNullOrWhiteSpace(shopifyProductRes?.Data?.Id))
{ {
var message = $"产品[{product.GoodsCode}]推送Shopify产品失败原因{shopifyProductRes.Message}"; var message =
$"产品[{product.GoodsCode}]推送Shopify产品失败原因{shopifyProductRes.Message}";
db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id)
.Set(x => x.PublishMessage, message) .Set(x => x.PublishMessage, message)
.Update(); .Update();
@ -28907,7 +28918,8 @@ namespace TradeManageNew
try try
{ {
var imageUrls = JsonConvert.DeserializeObject<List<string>>(orderUsedSalePlatform.ImageUrls); var imageUrls =
JsonConvert.DeserializeObject<List<string>>(orderUsedSalePlatform.ImageUrls);
//在Shopify创建产品变体信息 //在Shopify创建产品变体信息
var createShopifyVariantParameter = new AddVariantRequest var createShopifyVariantParameter = new AddVariantRequest
{ {
@ -28939,7 +28951,8 @@ namespace TradeManageNew
}, },
}; };
var productVariantRes = shopifyApiClient.AddProductVariantAsync(createShopifyVariantParameter).ConfigureAwait(false) var productVariantRes = shopifyApiClient
.AddProductVariantAsync(createShopifyVariantParameter).ConfigureAwait(false)
.GetAwaiter() .GetAwaiter()
.GetResult(); .GetResult();
@ -28958,7 +28971,6 @@ namespace TradeManageNew
.Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.Listed) .Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.Listed)
.Set(x => x.PublishMessage, "推送成功") .Set(x => x.PublishMessage, "推送成功")
.Update(); .Update();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -28980,6 +28992,14 @@ namespace TradeManageNew
Datas = null Datas = null
}; };
} }
finally
{
if (lockTaken)
{
Monitor.Exit(_lockObject);
}
}
}
[WebMethod(EnableSession = true)] [WebMethod(EnableSession = true)]
public APIReturnModel PlaceShopifyUsedSaleOrderCallback(string originJson) public APIReturnModel PlaceShopifyUsedSaleOrderCallback(string originJson)

Loading…
Cancel
Save