diff --git a/TradeManageNew/DD_OrderServiceNew.asmx.cs b/TradeManageNew/DD_OrderServiceNew.asmx.cs index 8c04d27..7c07d97 100644 --- a/TradeManageNew/DD_OrderServiceNew.asmx.cs +++ b/TradeManageNew/DD_OrderServiceNew.asmx.cs @@ -28679,6 +28679,8 @@ namespace TradeManageNew #endregion #region 二手商品上架Shopify + + private static readonly object _lockObject = new object(); [WebMethod(EnableSession = true)] public JsonModel> OrderUsedSalePlatformPage(string Code,string BarCode,bool? IsPrinted,TradeUsedSale.Enums.UsedSalePlatformStatus? Status,string WarehousePositionCode,int PageIndex=1,int PageSize=50) @@ -28752,105 +28754,178 @@ namespace TradeManageNew public APIReturnModel OrderUsedSalePlatformPublish(List Ids) { // PagesNew.Login(base.Session); - using (var db = new TradeUsedSale.Repositories.ErpDbContext()) - { - var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x => Ids.Contains(x.Id)).ToList(); + bool lockTaken = false; - foreach (var orderUsedSalePlatform in orderUsedSalePlatformList) + try + { + Monitor.Enter(_lockObject, ref lockTaken); + + using (var db = new TradeUsedSale.Repositories.ErpDbContext()) { - if (orderUsedSalePlatform.Status != TradeUsedSale.Enums.UsedSalePlatformStatus.NotListed) - { - continue; - } - - //系统产品信息 - var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); - if (product is null) - { - var message = $"系统中不存在编码为[{orderUsedSalePlatform.ProductCode}]的产品信息,无法推送至Shopify"; - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, message) - .Update(); - - continue; - } - - //毛重 - if (product.Weight is null || product.Weight <= 0) - { - var message = $"产品[{product.GoodsCode}]无毛重信息,无法推送至Shopify"; - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, message) - .Update(); - - continue; - } + var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x => Ids.Contains(x.Id)).ToList(); - //建议售价 - if (product.JYPrice is null || product.JYPrice <= 0) + foreach (var orderUsedSalePlatform in orderUsedSalePlatformList) { - 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); - if (postFee is null) - { - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, $"产品[{product.GoodsCode}]无预估运费,无法推送至Shopify") - .Update(); - - continue; - } - var fees = new List() - { - postFee.Fee1, - //postFee.Fee2, - postFee.Fee3, - postFee.Fee4, - postFee.Fee5, - //postFee.Fee6, - postFee.Fee7, - postFee.Fee8, - }.Where(x => x != null).ToList(); - var feeCost = fees.Any() ? fees.Min() : 0; + if (orderUsedSalePlatform.Status != TradeUsedSale.Enums.UsedSalePlatformStatus.NotListed) + { + continue; + } + + //系统产品信息 + var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); + if (product is null) + { + var message = $"系统中不存在编码为[{orderUsedSalePlatform.ProductCode}]的产品信息,无法推送至Shopify"; + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.PublishMessage, message) + .Update(); + + continue; + } + + //毛重 + if (product.Weight is null || product.Weight <= 0) + { + var message = $"产品[{product.GoodsCode}]无毛重信息,无法推送至Shopify"; + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.PublishMessage, message) + .Update(); + + 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); + if (postFee is null) + { + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.PublishMessage, $"产品[{product.GoodsCode}]无预估运费,无法推送至Shopify") + .Update(); + + continue; + } + + var fees = new List() + { + postFee.Fee1, + //postFee.Fee2, + postFee.Fee3, + postFee.Fee4, + postFee.Fee5, + //postFee.Fee6, + postFee.Fee7, + postFee.Fee8, + }.Where(x => x != null).ToList(); + var feeCost = fees.Any() ? fees.Min() : 0; + + if (feeCost <= 0) + { + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.PublishMessage, $"产品[{product.GoodsCode}]预估运费小于0,无法推送至Shopify") + .Update(); + + continue; + } + + string shopifyProductId; + + //判断时候在Shopify已创建过产品 + var shopifyProductGoodsMap = + db.DT_ShopifyProductGoodsMap.FirstOrDefault(x => x.SkuId == orderUsedSalePlatform.SkuId); + + //获取SKU的资料信息 + var shopifyProductProfile = + db.DT_ShopifyUsedSaleProduct.FirstOrDefault(x => x.Sku == orderUsedSalePlatform.SkuCode); + + //Shopify客户端 + var shopifyApiClient = new ShopifyAPIClient(); + + if (shopifyProductGoodsMap is null) + { + try + { + //在Shopify创建产品信息 + var createShopifyProductParameter = new Body2 + { + ProductBaseData = new ProductBaseData + { + SKU = shopifyProductProfile?.Sku ?? orderUsedSalePlatform.SkuCode, + Title = shopifyProductProfile?.Title ?? product.GoodsEnglisgName, + ImagePath = shopifyProductProfile?.ImagePath ?? product.FirstImgUrl, + ProductType = shopifyProductProfile?.Category, + Tags = shopifyProductProfile?.Tags, + Weight = product.Weight.Value, + JYPrice = product.JYPrice.Value, + ShippingFee = feeCost.Value, + } + }; + var shopifyProductRes = shopifyApiClient + .CreateProductAsync(createShopifyProductParameter) + .ConfigureAwait(false) + .GetAwaiter() + .GetResult(); + + if (string.IsNullOrWhiteSpace(shopifyProductRes?.Data?.Id)) + { + var message = + $"产品[{product.GoodsCode}]推送Shopify产品失败,原因:{shopifyProductRes.Message}"; + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.PublishMessage, message) + .Update(); + + continue; + } + + shopifyProductId = shopifyProductRes.Data.Id; + + var newMap = new TradeUsedSale.Repositories.Models.DT_ShopifyProductGoodsMap + { + ShopifyProductId = shopifyProductId, + SkuId = orderUsedSalePlatform.SkuId, + SkuCode = orderUsedSalePlatform.SkuCode, + CreationTime = DateTime.Now + }; + + db.InsertWithInt32Identity(newMap); + } + catch (Exception ex) + { + var message = $"产品[{product.GoodsCode}]推送Shopify产品失败,原因:{ex.Message}"; + + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.PublishMessage, message) + .Update(); + + continue; + } + } + else + { + shopifyProductId = shopifyProductGoodsMap.ShopifyProductId; + } - if (feeCost <= 0) - { - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, $"产品[{product.GoodsCode}]预估运费小于0,无法推送至Shopify") - .Update(); - - continue; - } - string shopifyProductId; - - //判断时候在Shopify已创建过产品 - var shopifyProductGoodsMap = - db.DT_ShopifyProductGoodsMap.FirstOrDefault(x => x.SkuId == orderUsedSalePlatform.SkuId); - - //获取SKU的资料信息 - var shopifyProductProfile = - db.DT_ShopifyUsedSaleProduct.FirstOrDefault(x => x.Sku == orderUsedSalePlatform.SkuCode); - - //Shopify客户端 - var shopifyApiClient = new ShopifyAPIClient(); - - if (shopifyProductGoodsMap is null) - { try { - //在Shopify创建产品信息 - var createShopifyProductParameter = new Body2 + var imageUrls = + JsonConvert.DeserializeObject>(orderUsedSalePlatform.ImageUrls); + //在Shopify创建产品变体信息 + var createShopifyVariantParameter = new AddVariantRequest { - ProductBaseData = new ProductBaseData + ProductBaseData = new ProductBaseData2 { + ShoifyGoodsId = shopifyProductId, SKU = shopifyProductProfile?.Sku ?? orderUsedSalePlatform.SkuCode, Title = shopifyProductProfile?.Title ?? product.GoodsEnglisgName, ImagePath = shopifyProductProfile?.ImagePath ?? product.FirstImgUrl, @@ -28858,17 +28933,32 @@ namespace TradeManageNew Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, JYPrice = product.JYPrice.Value, - ShippingFee = feeCost.Value, - } + ShippingFee = feeCost.Value + }, + Variants = new Variants + { + Return_quantity = 1, + ImgUrl = imageUrls.Count > 0 ? imageUrls[0] : null, + ImgUrl2 = imageUrls.Count > 1 ? imageUrls[1] : null, + ImgUrl3 = imageUrls.Count > 2 ? imageUrls[2] : null, + ImgUrl4 = imageUrls.Count > 3 ? imageUrls[3] : null, + ImgUrl5 = imageUrls.Count > 4 ? imageUrls[4] : null, + StoreName = orderUsedSalePlatform.WarehouseLocation == + TradeUsedSale.Enums.WarehouseLocation.East + ? "E" + : "W", + Code = orderUsedSalePlatform.BarCode, + }, }; - var shopifyProductRes = shopifyApiClient.CreateProductAsync(createShopifyProductParameter) - .ConfigureAwait(false) + + var productVariantRes = shopifyApiClient + .AddProductVariantAsync(createShopifyVariantParameter).ConfigureAwait(false) .GetAwaiter() .GetResult(); - if (string.IsNullOrWhiteSpace(shopifyProductRes?.Data?.Id)) + if (productVariantRes.Success == false) { - var message = $"产品[{product.GoodsCode}]推送Shopify产品失败,原因:{shopifyProductRes.Message}"; + var message = $"产品[{product.GoodsCode}]推送Shopify变体失败,原因:{productVariantRes.Message}"; db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) .Set(x => x.PublishMessage, message) .Update(); @@ -28876,109 +28966,39 @@ namespace TradeManageNew continue; } - shopifyProductId = shopifyProductRes.Data.Id; - - var newMap = new TradeUsedSale.Repositories.Models.DT_ShopifyProductGoodsMap - { - ShopifyProductId = shopifyProductId, - SkuId = orderUsedSalePlatform.SkuId, - SkuCode = orderUsedSalePlatform.SkuCode, - CreationTime = DateTime.Now - }; - - db.InsertWithInt32Identity(newMap); - } - catch (Exception ex) - { - var message = $"产品[{product.GoodsCode}]推送Shopify产品失败,原因:{ex.Message}"; - + //推送Shopify成功 db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, message) + .Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.Listed) + .Set(x => x.PublishMessage, "推送成功") .Update(); - - continue; } - } - else - { - shopifyProductId = shopifyProductGoodsMap.ShopifyProductId; - } - - - try - { - var imageUrls = JsonConvert.DeserializeObject>(orderUsedSalePlatform.ImageUrls); - //在Shopify创建产品变体信息 - var createShopifyVariantParameter = new AddVariantRequest + catch (Exception ex) { - ProductBaseData = new ProductBaseData2 - { - ShoifyGoodsId = shopifyProductId, - SKU = shopifyProductProfile?.Sku ?? orderUsedSalePlatform.SkuCode, - Title = shopifyProductProfile?.Title ?? product.GoodsEnglisgName, - ImagePath = shopifyProductProfile?.ImagePath ?? product.FirstImgUrl, - ProductType = shopifyProductProfile?.Category, - Tags = shopifyProductProfile?.Tags, - Weight = product.Weight.Value, - JYPrice = product.JYPrice.Value, - ShippingFee = feeCost.Value - }, - Variants = new Variants - { - Return_quantity = 1, - ImgUrl = imageUrls.Count > 0 ? imageUrls[0] : null, - ImgUrl2 = imageUrls.Count > 1 ? imageUrls[1] : null, - ImgUrl3 = imageUrls.Count > 2 ? imageUrls[2] : null, - ImgUrl4 = imageUrls.Count > 3 ? imageUrls[3] : null, - ImgUrl5 = imageUrls.Count > 4 ? imageUrls[4] : null, - StoreName = orderUsedSalePlatform.WarehouseLocation == - TradeUsedSale.Enums.WarehouseLocation.East - ? "E" - : "W", - Code = orderUsedSalePlatform.BarCode, - }, - }; - - var productVariantRes = shopifyApiClient.AddProductVariantAsync(createShopifyVariantParameter).ConfigureAwait(false) - .GetAwaiter() - .GetResult(); + var message = $"产品[{product.GoodsCode}]推送Shopify变体失败,原因:{ex.Message}"; - if (productVariantRes.Success == false) - { - var message = $"产品[{product.GoodsCode}]推送Shopify变体失败,原因:{productVariantRes.Message}"; db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) .Set(x => x.PublishMessage, message) .Update(); - + continue; } - - //推送Shopify成功 - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.Listed) - .Set(x => x.PublishMessage, "推送成功") - .Update(); - - } - catch (Exception ex) - { - var message = $"产品[{product.GoodsCode}]推送Shopify变体失败,原因:{ex.Message}"; - - db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) - .Set(x => x.PublishMessage, message) - .Update(); - - continue; } } + + return new APIReturnModel + { + Code = 1, + Message = "Success", + Datas = null + }; } - - return new APIReturnModel + finally { - Code = 1, - Message = "Success", - Datas = null - }; + if (lockTaken) + { + Monitor.Exit(_lockObject); + } + } } [WebMethod(EnableSession = true)] @@ -28994,7 +29014,7 @@ namespace TradeManageNew }; } - var originJsonData = ShopifyUsedSaleOrderDto.FromJson(originJson); + var originJsonData = JsonConvert.DeserializeObject(originJson); using (var db = new TradeUsedSale.Repositories.ErpDbContext()) { @@ -29038,25 +29058,6 @@ namespace TradeManageNew { foreach (var item in originJsonData.Items) { - var newDtShopifyUsedSaleOrderItem = - new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrderItem - { - DtShopifyUsedSaleOrderId = dtShopifyUsedSaleOrderId, - OriginSku = item.OriginSku, - Sku = item.Sku, - ProductCode = item.ProductCode, - Quantity = item.Quantity, - Price = item.Price, - Title = item.Title, - VariantTitle = item.VariantTitle, - ProductId = item.ProductId, - VariantId = item.VariantId, - Image = item.Image, - ShippingMethod = item.ShippingMethod - }; - - db.InsertWithInt32Identity(newDtShopifyUsedSaleOrderItem); - //ERP二手商品信息 var orderUsedSalePlatform = db.DT_OrderUsedSalePlatform.FirstOrDefault(x => x.BarCode == item.ProductCode); if (orderUsedSalePlatform is null) @@ -29107,6 +29108,26 @@ namespace TradeManageNew .Set(x => x.IsPlaceOrderSuccess, true) .Set(x => x.PlaceOrderMessage, "更新二手订单信息成功") .Update(); + + //添加Shopify订单明细 + var newDtShopifyUsedSaleOrderItem = + new TradeUsedSale.Repositories.Models.DT_ShopifyUsedSaleOrderItem + { + DtShopifyUsedSaleOrderId = dtShopifyUsedSaleOrderId, + OriginSku = item.OriginSku, + Sku = item.Sku, + ProductCode = item.ProductCode, + Quantity = item.Quantity, + Price = item.Price, + Title = item.Title, + VariantTitle = item.VariantTitle, + ProductId = item.ProductId, + VariantId = item.VariantId, + Image = item.Image, + ShippingMethod = item.ShippingMethod + }; + + db.InsertWithInt32Identity(newDtShopifyUsedSaleOrderItem); } db.CommitTransaction(); @@ -29129,6 +29150,182 @@ namespace TradeManageNew }; } + [WebMethod(EnableSession = true)] + public APIReturnModel CancelShopifyUsedSaleOrderCallback(string originJson) + { + if (string.IsNullOrWhiteSpace(originJson)) + { + return new APIReturnModel + { + Code = 0, + Message = "下单Json数据为空,请检查", + Datas = null + }; + } + + var originJsonData = JsonConvert.DeserializeObject(originJson); + + using (var db = new TradeUsedSale.Repositories.ErpDbContext()) + { + var shopifyUsedSaleOrder = db.DT_ShopifyUsedSaleOrder.FirstOrDefault(x => x.OrderId == originJsonData.OrderId); + if (shopifyUsedSaleOrder is null) + { + PagesNew.SaveLog(0, "Shopify二手商品取消", $"未找到ShopifyOrderId为{originJsonData.OrderId}Shopify二手订单,原始Json为:{originJson}", 0); + } + + try + { + db.BeginTransaction(); + + db.DT_ShopifyUsedSaleOrder.Where(x => x.OrderId == originJsonData.OrderId) + .Set(x => x.IsCancelled, true) + .Set(x => x.CancelReason, originJsonData.CancelReason) + .Set(x => x.CancelDate, originJsonData.CancelDate.DateTime) + .Update(); + + var shopifyUsedSaleOrderItems = db.DT_ShopifyUsedSaleOrderItem + .Where(x => x.DtShopifyUsedSaleOrderId == shopifyUsedSaleOrder.Id) + .ToList(); + + foreach (var saleOrderItem in shopifyUsedSaleOrderItems) + { + //ERP二手商品 + var orderUsedSalePlatform = db.DT_OrderUsedSalePlatform.FirstOrDefault(x => x.BarCode == saleOrderItem.ProductCode); + if (orderUsedSalePlatform is null) + { + throw new Exception($"不存在打印条码为[{saleOrderItem.ProductCode}]的二手商品"); + } + + #region 重新上传Shopify变体 + + //系统产品信息 + var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); + if (product is null) + { + var message = $"系统中不存在编码为[{orderUsedSalePlatform.ProductCode}]的产品信息,无法推送至Shopify"; + throw new Exception(message); + } + + //毛重 + if (product.Weight is null || product.Weight <= 0) + { + var message = $"产品[{product.GoodsCode}]无毛重信息,无法推送至Shopify"; + throw new Exception(message); + } + + //建议售价 + if (product.JYPrice is null || product.JYPrice <= 0) + { + var message = $"产品[{product.GoodsCode}]无建议售价,无法推送至Shopify"; + throw new Exception(message); + } + + //预估运费 + var postFee = db.HW_PostFee.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); + if (postFee is null) + { + throw new Exception( $"产品[{product.GoodsCode}]无预估运费,无法推送至Shopify"); + } + var fees = new List() + { + postFee.Fee1, + //postFee.Fee2, + postFee.Fee3, + postFee.Fee4, + postFee.Fee5, + //postFee.Fee6, + postFee.Fee7, + postFee.Fee8, + }.Where(x => x != null).ToList(); + var feeCost = fees.Any() ? fees.Min() : 0; + + if (feeCost <= 0) + { + throw new Exception( $"产品[{product.GoodsCode}]预估运费小于0,无法推送至Shopify"); + } + + //Shopify商品映射 + var shopifyProductGoodsMap = db.DT_ShopifyProductGoodsMap.FirstOrDefault(x => x.SkuId == orderUsedSalePlatform.SkuId); + if (shopifyProductGoodsMap is null) + { + throw new Exception($"未获取到SKU[{orderUsedSalePlatform.SkuCode}]对应的Shopify产品信息"); + } + + //获取SKU的资料信息 + var shopifyProductProfile = + db.DT_ShopifyUsedSaleProduct.FirstOrDefault(x => x.Sku == orderUsedSalePlatform.SkuCode); + + //Shopify客户端 + var shopifyApiClient = new ShopifyAPIClient(); + + var imageUrls = JsonConvert.DeserializeObject>(orderUsedSalePlatform.ImageUrls); + //在Shopify创建产品变体信息 + var createShopifyVariantParameter = new AddVariantRequest + { + ProductBaseData = new ProductBaseData2 + { + ShoifyGoodsId = shopifyProductGoodsMap.ShopifyProductId, + SKU = shopifyProductProfile?.Sku ?? orderUsedSalePlatform.SkuCode, + Title = shopifyProductProfile?.Title ?? product.GoodsEnglisgName, + ImagePath = shopifyProductProfile?.ImagePath ?? product.FirstImgUrl, + ProductType = shopifyProductProfile?.Category, + Tags = shopifyProductProfile?.Tags, + Weight = product.Weight.Value, + JYPrice = product.JYPrice.Value, + ShippingFee = feeCost.Value + }, + Variants = new Variants + { + Return_quantity = 1, + ImgUrl = imageUrls.Count > 0 ? imageUrls[0] : null, + ImgUrl2 = imageUrls.Count > 1 ? imageUrls[1] : null, + ImgUrl3 = imageUrls.Count > 2 ? imageUrls[2] : null, + ImgUrl4 = imageUrls.Count > 3 ? imageUrls[3] : null, + ImgUrl5 = imageUrls.Count > 4 ? imageUrls[4] : null, + StoreName = orderUsedSalePlatform.WarehouseLocation == + TradeUsedSale.Enums.WarehouseLocation.East + ? "E" + : "W", + Code = orderUsedSalePlatform.BarCode, + }, + }; + + var productVariantRes = shopifyApiClient.AddProductVariantAsync(createShopifyVariantParameter).ConfigureAwait(false) + .GetAwaiter() + .GetResult(); + + if (productVariantRes.Success != true) + { + var message = $"产品[{product.GoodsCode}]推送Shopify变体失败,原因:{productVariantRes.Message}"; + throw new Exception(message); + } + + db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) + .Set(x => x.Status, TradeUsedSale.Enums.UsedSalePlatformStatus.Listed) + .Set(x => x.ShippingMethod, value: null) + .Update(); + + #endregion + } + + db.CommitTransaction(); + } + catch (Exception ex) + { + db.RollbackTransaction(); + + PagesNew.SaveLog(0, "Shopify二手商品取消", $"执行失败,原始Json为:{originJson},原因:{ex.Message}", 0); + } + } + + return new APIReturnModel + { + Code = 1, + Message = "Success", + Datas = null + }; + } + #endregion diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index 7816203..fc10725 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -18105,7 +18105,6 @@ end else if @platid=23 begin update HW_GoodsInfo set guserid_temu=@userid,groupname_temu=@name where goodsid=@goodsid -end IF EXISTS ( select 1 FROM TemuChengBen where goodsid=@goodsid) BEGIN update TemuChengBen set mUserId=@userid where goodsid=@goodsid @@ -18114,10 +18113,13 @@ else BEGIN insert into TemuChengBen([GoodsId],[JinJia],[YunFei],[TouCheng],[HuoWuShuiFei],[YuGuJiaGe] ,[CreateUserId],[CreateTime],[mUserId]) select goodsid, CONVERT(DECIMAL(10, 2), InPrice/6.3) AS jinjia - ,null, CONVERT(DECIMAL(10, 2), Solid*130) AS shuifei,CONVERT(DECIMAL(10, 2), FeeRate*InPrice*0.01/6.3) AS shuifei,null,1,GETDATE(),@userid + ,null, CONVERT(DECIMAL(10, 2), Solid*130) AS shuifei,CONVERT(DECIMAL(10, 2), FeeRate*InPrice*0.01/6.3) AS shuifei,null,@userid ,GETDATE(),@userid from HW_GoodsInfo where GoodsId=@goodsid END +end + + "; diff --git a/TradeManageNew/Models/ShopifyUsedSale/CancelShopifyUsedSaleOrderDto.cs b/TradeManageNew/Models/ShopifyUsedSale/CancelShopifyUsedSaleOrderDto.cs new file mode 100644 index 0000000..e15c92b --- /dev/null +++ b/TradeManageNew/Models/ShopifyUsedSale/CancelShopifyUsedSaleOrderDto.cs @@ -0,0 +1,16 @@ +using System; +using Newtonsoft.Json; + +namespace TradeManageNew.Models.ShopifyUsedSale +{ + public partial class CancelShopifyUsedSaleOrderDto + { + [JsonProperty("orderId")] public string OrderId { get; set; } + + [JsonProperty("orderNumber")] public string OrderNumber { get; set; } + + [JsonProperty("cancelDate")] public DateTimeOffset CancelDate { get; set; } + + [JsonProperty("cancelReason")] public string CancelReason { get; set; } + } +} \ No newline at end of file diff --git a/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs b/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs index 243f71c..5156378 100644 --- a/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs +++ b/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; namespace TradeManageNew.Models.ShopifyUsedSale { @@ -133,30 +131,4 @@ namespace TradeManageNew.Models.ShopifyUsedSale [JsonProperty("tags")] public string Tags { get; set; } } - - public partial class ShopifyUsedSaleOrderDto - { - public static ShopifyUsedSaleOrderDto FromJson(string json) => - JsonConvert.DeserializeObject(json, - TradeManageNew.Models.ShopifyUsedSale.Converter.Settings); - } - - public static class Serialize - { - public static string ToJson(this ShopifyUsedSaleOrderDto self) => - JsonConvert.SerializeObject(self, TradeManageNew.Models.ShopifyUsedSale.Converter.Settings); - } - - internal static class Converter - { - public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings - { - MetadataPropertyHandling = MetadataPropertyHandling.Ignore, - DateParseHandling = DateParseHandling.None, - Converters = - { - new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } - }, - }; - } } \ No newline at end of file diff --git a/TradeManageNew/TradeManageNew.csproj b/TradeManageNew/TradeManageNew.csproj index 4f94f9d..7d2d5f8 100644 --- a/TradeManageNew/TradeManageNew.csproj +++ b/TradeManageNew/TradeManageNew.csproj @@ -2928,6 +2928,7 @@ + OrderAPI.ashx diff --git a/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs b/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs index ceae844..7e9d09b 100644 --- a/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs +++ b/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs @@ -99,7 +99,7 @@ namespace TradeUsedSale.Repositories.Models /// 原始Json /// public string OriginJson { get; set; } - + /// /// 是否同步下单信息成功 /// @@ -109,5 +109,20 @@ namespace TradeUsedSale.Repositories.Models /// 下单同步信息 /// public string PlaceOrderMessage { get; set; } + + /// + /// 是否已取消 + /// + public bool? IsCancelled { get; set; } + + /// + /// 取消原因 + /// + public string CancelReason { get; set; } + + /// + /// 取消时间 + /// + public DateTime? CancelDate { get; set; } } } \ No newline at end of file