diff --git a/TradeManage/GlobalAshx/AjaxFileUpload.ashx.cs b/TradeManage/GlobalAshx/AjaxFileUpload.ashx.cs index b162bfc..e3751c1 100644 --- a/TradeManage/GlobalAshx/AjaxFileUpload.ashx.cs +++ b/TradeManage/GlobalAshx/AjaxFileUpload.ashx.cs @@ -5,6 +5,9 @@ using System.Web; using System.IO; using System.Web.Script.Serialization; using System.Drawing; +using NetLibrary.Log; +using Newtonsoft.Json; +using TradeManageNew; namespace TradeManage.GlobalAshx { @@ -48,6 +51,7 @@ namespace TradeManage.GlobalAshx md.InUserId = 0; md.CompanyId = 0; int id =0; + if (fize < 500000) { id = obj.SaveResource(md); diff --git a/TradeManageNew/DD_OrderServiceNew.asmx.cs b/TradeManageNew/DD_OrderServiceNew.asmx.cs index b010f23..3044534 100644 --- a/TradeManageNew/DD_OrderServiceNew.asmx.cs +++ b/TradeManageNew/DD_OrderServiceNew.asmx.cs @@ -28846,7 +28846,7 @@ namespace TradeManageNew [WebMethod(EnableSession = true)] public APIReturnModel OrderUsedSalePlatformPublish(List Ids) { - // PagesNew.Login(base.Session); + PagesNew.Login(base.Session); bool lockTaken = false; try @@ -28887,16 +28887,6 @@ namespace TradeManageNew 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); @@ -28921,7 +28911,24 @@ namespace TradeManageNew postFee.Fee8, }.Where(x => x != null).ToList(); var feeCost = fees.Any() ? fees.Min() : 0; + decimal jyprice = 0m; + decimal feerate = 6.5m; + //建议售价 + 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; + decimal? sumJy = (Convert.ToDecimal(product.InPrice) / feerate + (feerate * Convert.ToDecimal(product.InPrice) * Convert.ToDecimal(0.01) / feerate) + product.Solid * 130 + feeCost); + jyprice = Convert.ToDecimal(sumJy) / 0.8m; + } + else + { + jyprice = Convert.ToDecimal(product.JYPrice); + } if (feeCost <= 0) { db.DT_OrderUsedSalePlatform.Where(x => x.Id == orderUsedSalePlatform.Id) @@ -28959,7 +28966,7 @@ namespace TradeManageNew ProductType = shopifyProductProfile?.Category, Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, - JYPrice = product.JYPrice.Value, //product.JYPrice.Value, + JYPrice = jyprice, //product.JYPrice.Value, ShippingFee = feeCost.Value, //feeCost.Value, } }; @@ -29025,7 +29032,7 @@ namespace TradeManageNew ProductType = shopifyProductProfile?.Category, Tags = shopifyProductProfile?.Tags, Weight = product.Weight.Value, - JYPrice = product.JYPrice.Value,// product.JYPrice.Value, + JYPrice = jyprice,// product.JYPrice.Value, ShippingFee= feeCost.Value,// feeCost.Value }, Variants = new Variants @@ -29224,10 +29231,10 @@ namespace TradeManageNew // Shopify客户端 删除产品变体 var shopifyApiClient = new ShopifyAPIClient(); var productVariantRes = shopifyApiClient.DeleteProductVariantAsync(new Body3 - { - ProductId = shopifyProductGoodsMap.ShopifyProductId, - Code = item.ProductCode, - }).ConfigureAwait(false) + { + ProductId = shopifyProductGoodsMap.ShopifyProductId, + Code = item.ProductCode, + }).ConfigureAwait(false) .GetAwaiter() .GetResult(); @@ -29938,7 +29945,8 @@ namespace TradeManageNew TotalNetCharge = rateDetail.TotalNetCharge?? 0m, OriginJson = JsonConvert.SerializeObject(response), CreationTime = DateTime.Now, - IsDeleted = false + IsDeleted = false, + imgList= imagePath }); //记录返回结果 @@ -30004,6 +30012,50 @@ namespace TradeManageNew } } + + /// + /// 保存退货订单渠道 + /// + /// + /// + [WebMethod(EnableSession = true)] + public APIReturnModel SaveOrderUsedSaleService(int UsedSalePlatformId, int UsedSaleApplyId) + { + using (var db = new TradeUsedSale.Repositories.ErpDbContext()) + { + var orderUsedSaleApplyDtos = db.DT_OrderUsedSaleApply.Where(x => x.Id == UsedSaleApplyId && + x.IsDeleted == false) + .Select(o => new OrderUsedSaleApplyDto + { + Id = o.Id, + UsedSaleBarCode = o.UsedSaleBarCode, + ServiceType = o.ServiceType, + TrackingCode = o.TrackingCode, + TotalNetCharge = o.TotalNetCharge, + CreationTime = o.CreationTime, + imgList=o.imgList + + }) + .FirstOrDefault(); + if (orderUsedSaleApplyDtos!=null) + { + db.DT_OrderUsedSalePlatform.Where(x => x.Id == UsedSalePlatformId) + .Set(x => x.ServiceType, orderUsedSaleApplyDtos.ServiceType) + .Set(x => x.imgList, orderUsedSaleApplyDtos.imgList) + .Set(x => x.outboundTrackCode, orderUsedSaleApplyDtos.TrackingCode) + .Update(); + } + + return new APIReturnModel + { + Code = 1, + Message = "Success", + Datas = JsonConvert.SerializeObject(orderUsedSaleApplyDtos) + }; + } + } + + /// /// 自提填写预约时间 /// @@ -30597,27 +30649,36 @@ namespace TradeManageNew #region 分页查询 [WebMethod(EnableSession = true)] - public JsonModel> GetListTemuShopGoodActive(string cs, int PageIndex, int PageSize) + public JsonModel> GetListTemuShopGoodActive(string cs, int PageIndex, int PageSize, string sku, string skuid) { - PagesNew.Login(this.Session); - string where = CustomIO.Base64StringToString(cs); - if (where != "") where = "where " + where.Substring(4); + //PagesNew.Login(this.Session); + string shopid = CustomIO.Base64StringToString(cs); + string Sku = CustomIO.Base64StringToString(sku); + string SkuId = CustomIO.Base64StringToString(skuid); + //if (where != "") where = "where " + where.Substring(4); var resultModel = new JsonModel>(); int RowCount = 0; - resultModel.DataSource = DataNew.GetListTemuShopGoodActive(where, PageIndex, PageSize, "", out RowCount); - resultModel.RowCount = RowCount; + resultModel.DataSource = DataNew.GetListTemuShopGoodActive_Test(shopid, Sku, SkuId); + //resultModel.RowCount = RowCount; string ids = ""; - if (resultModel.DataSource != null) + if (resultModel.DataSource != null) { - foreach (var omd in resultModel.DataSource) + RowCount = resultModel.DataSource.Count(); + resultModel.DataSource = resultModel.DataSource.Take(PageSize).Skip(PageSize * (PageIndex - 1)).ToList(); + var Active= DataNew.GetListTemuShopGoodActive(); + //foreach (var omd in resultModel.DataSource) + //{ + // ids += omd.ID + ","; + //} + foreach (var omd in Active) { ids += omd.ID + ","; } ids = ids.TrimEnd(','); if (ids != "") { - var dlist = DataNew.GetListTemuShopGoodActiveDetail(ids); + var dlist = DataNew.GetListTemuShopGoodActiveDetail(ids, Sku, SkuId); if (dlist != null) { @@ -30655,8 +30716,8 @@ namespace TradeManageNew } } } - - return resultModel; + resultModel.RowCount = RowCount; + return resultModel; } #endregion diff --git a/TradeManageNew/DataNew.cs b/TradeManageNew/DataNew.cs index 9c1887d..4990442 100644 --- a/TradeManageNew/DataNew.cs +++ b/TradeManageNew/DataNew.cs @@ -31391,10 +31391,23 @@ delete from TemuShopGoodActiveDetail where Id=@Id"; } #endregion #region 返回列表 - public static List GetListTemuShopGoodActiveDetail(string ids) + public static List GetListTemuShopGoodActiveDetail(string ids, string Sku, string SkuId) { - //string tsql = "select a.ID,a.Shopid,a.SKU,a.SPUID,a.BasePrice,a.CreateUserId,a.CreateTime,a.PostPrice,a.State from TemuShopGoodActive"; - string tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") order by id"; + string tsql = string.Empty; + string where= string.Empty; + string order = " order by id"; + tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") "; + if (!string.IsNullOrEmpty(Sku)) + { + where = " and sku like '%" + Sku + "%' "; + } + if (!string.IsNullOrEmpty(SkuId)) + { + where = " and SKUId = '" + SkuId + "' "; + } + tsql = tsql + where + order; + //string tsql = "select a.ID,a.Shopid,a.SKU,a.SPUID,a.BasePrice,a.CreateUserId,a.CreateTime,a.PostPrice,a.State from TemuShopGoodActive"; + //string tsql = "select * from TemuShopGoodActiveDetail where ActiveId in (" + ids + ") and sku like '%"+ Sku + "%' order by id"; Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetSqlStringCommand(tsql); DataTable tb = db.ExecuteDataTable(cmd); @@ -31427,7 +31440,42 @@ left join jc_userinfo c on a.CreateUserId=c.UserId return ListModel; } #endregion - + + + #region 分页动态条件查询 + public static List GetListTemuShopGoodActive_Test(string shopid, string Sku, string SkuId) + { + string Where = string.Empty; + string order = " ) a order by a.ID desc"; + string tsql = @"select ID,Shopid,SKU,SPUID,BasePrice,CreateUserId,CreateTime,PostPrice,State,ShopName,CreateUserName from ( +select distinct ID=cast(a.ID as int),a.Shopid,a.SKU,a.SPUID,a.BasePrice,a.CreateUserId,a.CreateTime,a.PostPrice,a.State,b.ShopName,CreateUserName=c.Name +from TemuShopGoodActive a +left Join JC_Shop b on a.Shopid = b.Shopid +left join jc_userinfo c on a.CreateUserId=c.UserId +left join TemuShopGoodActiveDetail d on a.ID=d.ActiveId where 1=1 +"; + if (!string.IsNullOrEmpty(shopid)) + { + Where += shopid; + } + if (!string.IsNullOrEmpty(Sku)) + { + Where += " and d.sku like '%" + Sku + "%'"; + } + if (!string.IsNullOrEmpty(SkuId)) + { + Where += " and d.SKUId = '" + SkuId + "'"; + } + tsql = tsql + Where + order; + Database db = DatabaseFactory.CreateDatabase(); + DbCommand cmd = db.GetSqlStringCommand(tsql); + DataTable tb = db.ExecuteDataTable(cmd); + List ListModel = tb.ToList(); + ListModel = tb.ToList(); + return ListModel; + } + #endregion + #region 根据sku读temu订单 public static List GetTemuOrderFromSKU(string SKU) diff --git a/TradeManageNew/GlobalAshx/AjaxFileUpload.ashx.cs b/TradeManageNew/GlobalAshx/AjaxFileUpload.ashx.cs index ce9fa1f..37dd6e0 100644 --- a/TradeManageNew/GlobalAshx/AjaxFileUpload.ashx.cs +++ b/TradeManageNew/GlobalAshx/AjaxFileUpload.ashx.cs @@ -5,6 +5,10 @@ using System.Web; using System.IO; using System.Web.Script.Serialization; using System.Drawing; +using TradeManage; +using NetLibrary.Log; +using FastJSON; +using Newtonsoft.Json; namespace TradeManageNew.GlobalAshx { @@ -23,6 +27,7 @@ namespace TradeManageNew.GlobalAshx if (string.IsNullOrEmpty(DirectoryName) == true) DirectoryName = "ServerCookies"; string FullDirectoryName = System.AppDomain.CurrentDomain.BaseDirectory + DirectoryName; + if (Directory.Exists(FullDirectoryName) == false) Directory.CreateDirectory(FullDirectoryName); if (files.Count > 0) { @@ -48,12 +53,12 @@ namespace TradeManageNew.GlobalAshx md.InUserId = 0; md.CompanyId = 0; int id =0; - //if (fize < 500000) - //{ - // id = obj.SaveResource(md); - //} - - + PagesNew.SaveLog(1, "上传文件", "JC_Resource:" + new JavaScriptSerializer().Serialize(md), 1); + if (fize < 500000) + { + id = obj.SaveResource(md); + } + var model = new { Id = id, FileName = FName, FileUrl = md.FileUrl, FileSize = files[0].InputStream.Length }; string jsonString = new JavaScriptSerializer().Serialize(model); diff --git a/TradeManageNew/Models/ShopifyUsedSale/OrderUsedSaleApplyDto.cs b/TradeManageNew/Models/ShopifyUsedSale/OrderUsedSaleApplyDto.cs index e2c6054..ee39a91 100644 --- a/TradeManageNew/Models/ShopifyUsedSale/OrderUsedSaleApplyDto.cs +++ b/TradeManageNew/Models/ShopifyUsedSale/OrderUsedSaleApplyDto.cs @@ -30,5 +30,9 @@ namespace TradeManageNew.Models.ShopifyUsedSale /// 创建时间 /// public DateTime CreationTime { get; set; } + /// + /// imgList + /// + public string imgList { get; set; } } } \ No newline at end of file diff --git a/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleApply.cs b/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleApply.cs index 469dd2f..28c08cc 100644 --- a/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleApply.cs +++ b/TradeUsedSale/Repositories/Models/DT_OrderUsedSaleApply.cs @@ -46,5 +46,9 @@ namespace TradeUsedSale.Repositories.Models /// 是否已删除 /// public bool IsDeleted { get; set; } + /// + /// imgList + /// + public string imgList { get; set; } } } \ No newline at end of file