|
|
|
@ -29033,7 +29033,7 @@ namespace TradeManageNew
|
|
|
|
|
var dtShopifyUsedSaleOrderId = db.InsertWithInt32Identity(newDtShopifyUsedSaleOrder);
|
|
|
|
|
|
|
|
|
|
db.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in originJsonData.Items)
|
|
|
|
@ -29056,32 +29056,57 @@ namespace TradeManageNew
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
db.InsertWithInt32Identity(newDtShopifyUsedSaleOrderItem);
|
|
|
|
|
|
|
|
|
|
//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产品信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改ERP二手商品
|
|
|
|
|
//下单后修改二手商品信息
|
|
|
|
|
var statement = db.DT_OrderUsedSalePlatform.Where(x => x.BarCode == item.ProductCode)
|
|
|
|
|
.Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.PendingPickup);
|
|
|
|
|
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")
|
|
|
|
|
{
|
|
|
|
|
statement = statement.Set(x => x.ShippingMethod, TradeUsedSale.Enums.ShippingMethod.ExpressDelivery);
|
|
|
|
|
statement = statement.Set(x => x.ShippingMethod,
|
|
|
|
|
TradeUsedSale.Enums.ShippingMethod.ExpressDelivery);
|
|
|
|
|
}
|
|
|
|
|
statement.Update();
|
|
|
|
|
|
|
|
|
|
//Shopify客户端
|
|
|
|
|
//删除产品变体
|
|
|
|
|
// var shopifyApiClient = new ShopifyAPIClient();
|
|
|
|
|
// var productVariantRes = shopifyApiClient.DeleteProductVariantAsync().ConfigureAwait(false)
|
|
|
|
|
// .GetAwaiter()
|
|
|
|
|
// .GetResult();
|
|
|
|
|
|
|
|
|
|
// Shopify客户端
|
|
|
|
|
// 删除产品变体
|
|
|
|
|
var shopifyApiClient = new ShopifyAPIClient();
|
|
|
|
|
var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
.Set(x => x.IsPlaceOrderSuccess, true)
|
|
|
|
|
.Set(x => x.PlaceOrderMessage, "更新二手订单信息成功")
|
|
|
|
|
.Update();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.CommitTransaction();
|
|
|
|
|