diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index 5b960ea..0d39fca 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -7174,7 +7174,7 @@ end } if (!string.IsNullOrEmpty(GoodsCode)) { - where += " and GoodsCode like '%" + GoodsCode + "%' "; + where += " and GoodsCode='" + GoodsCode + "' "; } if (!string.IsNullOrEmpty(Name)) { @@ -28582,19 +28582,6 @@ end"; var dt = db.ExecuteDataTable(cmd); return dt.ToList(); } - - public static List GetTemuShopGoodActive(int shopid, string sku, string SKUID) - { - var sql = @" select * from TemuShopGoodActive where Shopid=@shopid and SKU=@sku and SPUID=@SKUID "; - - var db = DatabaseFactory.CreateDatabase(); - var cmd = db.GetSqlStringCommand(sql); - db.AddInParameter(cmd, "@shopid", DbType.Int32, shopid); - db.AddInParameter(cmd, "@SKU", DbType.String, sku); - db.AddInParameter(cmd, "@SKUID", DbType.String, SKUID); - var dt = db.ExecuteDataTable(cmd); - return dt.ToList(); - } public static TemuShopGoodPrice GetTemuShopGoodPriceOne(int shopid, string spuid) { var sql = @" select top 1 * from TemuShopGoodPrice where Shopid=@shopid and spuid=@spuid "; @@ -31117,7 +31104,7 @@ end #endregion - #region 保存TemuShopGoodActive + #region 保存 public static int Save_TemuShopGoodActive(TemuShopGoodActive Model) { string tsql = @" @@ -31216,7 +31203,6 @@ end"; return a; } - #endregion #region 删除 public static void Delete_TemuShopGoodActive(int ID) @@ -31392,5 +31378,4 @@ where c.SKU1=@SKU"; } #endregion } - } \ No newline at end of file diff --git a/TradeManageNew/OuterService/ShageService.ashx.cs b/TradeManageNew/OuterService/ShageService.ashx.cs index 4522d90..7a3092c 100644 --- a/TradeManageNew/OuterService/ShageService.ashx.cs +++ b/TradeManageNew/OuterService/ShageService.ashx.cs @@ -23,7 +23,6 @@ using System.Windows.Forms; using TradeData; using NetLibrary.Data; using NetLibrary.ReportPrint; -using TradeManageNew.APIClients.ShopifyAPI; namespace TradeManageNew.OuterService { @@ -1749,60 +1748,36 @@ namespace TradeManageNew.OuterService if (orderUsedSalePlatform is null) { - //throw new Exception( - // $"No barcode for {input.BarCode} to be shipped used sale item exists"); - - - orderUsedSalePlatform= db.DT_OrderUsedSalePlatform.FirstOrDefault(x => - x.BarCode == input.BarCode); - var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); - - var result = new GetPickupOrderUsedSalePlatformDto - { - Id = orderUsedSalePlatform.Id, - - ProductDescription = product?.GoodsEnglisgName, - SkuId = orderUsedSalePlatform.SkuId, - SkuCode = orderUsedSalePlatform.SkuCode, - BarCode = orderUsedSalePlatform.BarCode, - - }; - - md.Code = "100"; - md.Result = "Success"; - md.Data = JsonConvert.SerializeObject(result); + throw new Exception( + $"No barcode for {input.BarCode} to be shipped used sale item exists"); } - else - { - var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); - - var result = new GetPickupOrderUsedSalePlatformDto - { - Id = orderUsedSalePlatform.Id, - ProductId = orderUsedSalePlatform.ProductId, - ProductCode = orderUsedSalePlatform.ProductCode, - ProductDescription = product?.GoodsEnglisgName, - SkuId = orderUsedSalePlatform.SkuId, - SkuCode = orderUsedSalePlatform.SkuCode, - BarCode = orderUsedSalePlatform.BarCode, - IsPrinted = orderUsedSalePlatform.IsPrinted, - Status = orderUsedSalePlatform.Status, - WarehouseLocation = orderUsedSalePlatform.WarehouseLocation, - WarehousePositionId = orderUsedSalePlatform.WarehousePositionId, - WarehousePositionCode = orderUsedSalePlatform.WarehousePositionCode, - ImageUrls = JsonConvert.DeserializeObject>(orderUsedSalePlatform.ImageUrls), - ShippingMethod = orderUsedSalePlatform.ShippingMethod, - IsNew = orderUsedSalePlatform.IsNew, - CreationTime = orderUsedSalePlatform.CreationTime, - CreatorId = orderUsedSalePlatform.CreatorId - }; + + var product = db.HW_GoodsInfo.FirstOrDefault(x => x.GoodsId == orderUsedSalePlatform.ProductId); - md.Code = "100"; - md.Result = "Success"; - md.Data = JsonConvert.SerializeObject(result); - } + var result = new GetPickupOrderUsedSalePlatformDto + { + Id = orderUsedSalePlatform.Id, + ProductId = orderUsedSalePlatform.ProductId, + ProductCode = orderUsedSalePlatform.ProductCode, + ProductDescription = product?.GoodsEnglisgName, + SkuId = orderUsedSalePlatform.SkuId, + SkuCode = orderUsedSalePlatform.SkuCode, + BarCode = orderUsedSalePlatform.BarCode, + IsPrinted = orderUsedSalePlatform.IsPrinted, + Status = orderUsedSalePlatform.Status, + WarehouseLocation =orderUsedSalePlatform.WarehouseLocation, + WarehousePositionId = orderUsedSalePlatform.WarehousePositionId, + WarehousePositionCode = orderUsedSalePlatform.WarehousePositionCode, + ImageUrls = JsonConvert.DeserializeObject>(orderUsedSalePlatform.ImageUrls), + ShippingMethod = orderUsedSalePlatform.ShippingMethod, + IsNew = orderUsedSalePlatform.IsNew, + CreationTime = orderUsedSalePlatform.CreationTime, + CreatorId = orderUsedSalePlatform.CreatorId + }; - + md.Code = "100"; + md.Result = "Success"; + md.Data = JsonConvert.SerializeObject(result); } } } @@ -2033,46 +2008,21 @@ namespace TradeManageNew.OuterService if (Method == "SelfPickupOrderUsedSalePlatform") { var input = JsonConvert.DeserializeObject(ResponseContent); - + using (var db = new ErpDbContext()) { - var exPlatformList = db.DT_OrderUsedSalePlatform.Where(x => - input.Ids.Contains(x.Id)) - .ToList(); - //如果传入的状态不是4,并且之前的状态是2则需要删除变体 - foreach (var i in exPlatformList) - { - if (input.Status != 4 && (int)i.Status == 2) - { - var shopifyApiClient = new ShopifyAPIClient(); - var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3 - { - ProductId = i.ProductId.ToString(), - Code = i.ProductCode, - }).ConfigureAwait(false) - .GetAwaiter() - .GetResult(); - - //if (productVariantRes.Success != true) - //{ - // throw new Exception($"删除Shopify条码[{item.ProductCode}]变体失败,{productVariantRes.Message}"); - //} - - } - - } - var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x => - input.Ids.Contains(x.Id)) + input.Ids.Contains(x.Id) + && x.Status == UsedSalePlatformStatus.PendingPickup) .ToList(); - - + if (orderUsedSalePlatformList.Any()) { db.DT_OrderUsedSalePlatform.Where(x => - input.Ids.Contains(x.Id)) + input.Ids.Contains(x.Id) + && x.Status == UsedSalePlatformStatus.PendingPickup) .Set(x => x.ShippingMethod, ShippingMethod.SelfPickup) - .Set(x => x.Status, (UsedSalePlatformStatus)input.Status) + .Set(x => x.Status, UsedSalePlatformStatus.Sold) .Set(x => x.LastModifierId, input.UserId) .Set(x => x.LastModificationTime, DateTime.Now) .Set(x => x.imgList, input.imgList) diff --git a/TradeUsedSale/Enums/UsedSalePlatformStatus.cs b/TradeUsedSale/Enums/UsedSalePlatformStatus.cs index 22eb1f1..717227a 100644 --- a/TradeUsedSale/Enums/UsedSalePlatformStatus.cs +++ b/TradeUsedSale/Enums/UsedSalePlatformStatus.cs @@ -22,15 +22,6 @@ namespace TradeUsedSale.Enums /// /// 售卖完成 /// - [Description("售卖完成")] Sold, - - /// - /// 使用配件 - /// - [Description("使用配件")] PeiJian , - /// - /// 现场出售 - /// - [Description("现场出售")] XcChuShou + [Description("售卖完成")] Sold } } \ No newline at end of file