master
wufan 2 months ago
parent 42aa1c8eca
commit 29c9d78681

@ -1842,10 +1842,18 @@ namespace APIClients.ShopifyAPI
public partial class Body3 public partial class Body3
{ {
/// <summary> /// <summary>
/// 变体SKU /// 产品ID
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("sku", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonProperty("productId", Required = Newtonsoft.Json.Required.Always)]
public string Sku { get; set; } [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string ProductId { get; set; }
/// <summary>
/// 变体编码
/// </summary>
[Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.Always)]
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
public string Code { get; set; }
private System.Collections.Generic.IDictionary<string, object> _additionalProperties; private System.Collections.Generic.IDictionary<string, object> _additionalProperties;

@ -29057,31 +29057,56 @@ namespace TradeManageNew
db.InsertWithInt32Identity(newDtShopifyUsedSaleOrderItem); db.InsertWithInt32Identity(newDtShopifyUsedSaleOrderItem);
//修改ERP二手商品 //ERP二手商品信息
var orderUsedSalePlatform = db.DT_OrderUsedSalePlatform.FirstOrDefault(x => x.BarCode == item.ProductCode);
if (orderUsedSalePlatform is null)
{
throw new Exception($"未获取到编码[{item.ProductCode}]的二手商品信息");
}
//Shopify商品映射
var shopifyProductGoodsMap = db.DT_ShopifyProductGoodsMap.FirstOrDefault(x => x.SkuId == orderUsedSalePlatform.SkuId);
if (shopifyProductGoodsMap is null)
{
throw new Exception($"未获取到SKU[{orderUsedSalePlatform.SkuCode}]对应的Shopify产品信息");
}
//下单后修改二手商品信息
var statement = db.DT_OrderUsedSalePlatform.Where(x => x.BarCode == item.ProductCode) var statement = db.DT_OrderUsedSalePlatform.Where(x => x.BarCode == item.ProductCode)
.Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.PendingPickup); .Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.PendingPickup);
if (item.ShippingMethod == "SP") if (item.ShippingMethod == "SP")
{ {
statement = statement.Set(x => x.ShippingMethod, TradeUsedSale.Enums.ShippingMethod.SelfPickup); statement = statement.Set(x => x.ShippingMethod,
TradeUsedSale.Enums.ShippingMethod.SelfPickup);
} }
if (item.ShippingMethod == "DL") if (item.ShippingMethod == "DL")
{ {
statement = statement.Set(x => x.ShippingMethod, TradeUsedSale.Enums.ShippingMethod.ExpressDelivery); statement = statement.Set(x => x.ShippingMethod,
TradeUsedSale.Enums.ShippingMethod.ExpressDelivery);
} }
statement.Update(); statement.Update();
// Shopify客户端 // Shopify客户端
// 删除产品变体 // 删除产品变体
// var shopifyApiClient = new ShopifyAPIClient(); var shopifyApiClient = new ShopifyAPIClient();
// var productVariantRes = shopifyApiClient.DeleteProductVariantAsync().ConfigureAwait(false) var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3
// .GetAwaiter() {
// .GetResult(); ProductId = shopifyProductGoodsMap.ShopifyProductId,
Code = item.ProductCode,
}).ConfigureAwait(false)
.GetAwaiter()
.GetResult();
if (productVariantRes.Success != true)
{
throw new Exception(productVariantRes.Message);
}
db.DT_ShopifyUsedSaleOrder.Where(x => x.Id == dtShopifyUsedSaleOrderId) db.DT_ShopifyUsedSaleOrder.Where(x => x.Id == dtShopifyUsedSaleOrderId)
.Set(x => x.IsPlaceOrderSuccess, true) .Set(x => x.IsPlaceOrderSuccess, true)
.Set(x => x.PlaceOrderMessage, "更新二手订单信息成功") .Set(x => x.PlaceOrderMessage, "更新二手订单信息成功")
.Update(); .Update();
} }
db.CommitTransaction(); db.CommitTransaction();

Loading…
Cancel
Save