fxc 2 months ago
commit 3b3db2d6ef

@ -4852,6 +4852,19 @@ function selectE(p,c) {
type="button" value="计算" /> type="button" value="计算" />
</td> </td>
</tr> </tr>
<tr>
<td class="f1">
temu成本预估
</td>
<td colspan="3" align="center">
进价:<input id="txt_temu_JinJia" min='0' max='1000000' type="text" style="width: 80px;" class="editTextbox" value="0" />
+运费:<input id="txt_temu_YunFei" min='0' max='1000000' type="text" style="width: 80px;" class="editTextbox" value="0" />
+货物税费:<input id="txt_temu_HuoWuShuiFei" min='0' max='1000000' type="text" style="width: 80px;" class="editTextbox" value="0" />
+头程:<input id="txt_temu_TouCheng" min='0' max='1000000' type="text" style="width: 80px;" class="editTextbox" value="0" />
=预计价格:<a style='color: Red' id="txt_temu_YuGuJiaGe">0$</a>&nbsp;&nbsp;
<input class="btnClass btnClassSave" onclick="SaveTemuFee();" type="button" value="计算并保存" />
</td>
</tr>
</table> </table>
</td> </td>
</tr> </tr>

@ -3005,6 +3005,7 @@
<option value="15">Shopify</option> <option value="15">Shopify</option>
<option value="18">wayfair</option> <option value="18">wayfair</option>
<option value="21">SheIn</option> <option value="21">SheIn</option>
<option value="23">Temu</option>
</select> </select>
</td> </td>
<td class="f1" width="10%"> <td class="f1" width="10%">

@ -447,7 +447,15 @@ namespace TradeManage
public JsonModel<List<HW_GoodsDetailNew2>> GetGoodsDetailListNew22(int platid, int MUserId, int cpzt, int GNum, int TJ1, int IsYC, int IsJQ, int StoreId, int AQNum, int AQNum2, string Name, string Supplier, int TJ2, int SNum, int ENum, int cgjh,int kh, int PageIndex, int PageSize, string Sort) public JsonModel<List<HW_GoodsDetailNew2>> GetGoodsDetailListNew22(int platid, int MUserId, int cpzt, int GNum, int TJ1, int IsYC, int IsJQ, int StoreId, int AQNum, int AQNum2, string Name, string Supplier, int TJ2, int SNum, int ENum, int cgjh,int kh, int PageIndex, int PageSize, string Sort)
{ {
HuoWuData data = new HuoWuData(); HuoWuData data = new HuoWuData();
int num = Convert.ToInt32(base.Session["CompanyId"]); int num = 0;
if (base.Session["CompanyId"] != null)
{
num = Convert.ToInt32(base.Session["CompanyId"]);
}
else
{
num = 1;
}
RefParameterCollection where = new RefParameterCollection(); RefParameterCollection where = new RefParameterCollection();
if (IsYC == 0) if (IsYC == 0)
{ {
@ -475,7 +483,8 @@ namespace TradeManage
where.Add("b.guserid_wayfair", "=", MUserId, DbType.Int32); where.Add("b.guserid_wayfair", "=", MUserId, DbType.Int32);
else if (MUserId != 0 && platid == 21) else if (MUserId != 0 && platid == 21)
where.Add("b.guserid_sheIn", "=", MUserId, DbType.Int32); where.Add("b.guserid_sheIn", "=", MUserId, DbType.Int32);
else if (MUserId != 0 && platid == 23)
where.Add("b.guserid_temu", "=", MUserId, DbType.Int32);
if (AQNum == 1) if (AQNum == 1)
{ {
where.Add("isnull(a.WestNum,0)-isnull(a.GoodsHJNum12,0)", "<", 0, DbType.Int32); where.Add("isnull(a.WestNum,0)-isnull(a.GoodsHJNum12,0)", "<", 0, DbType.Int32);

@ -1338,19 +1338,19 @@ namespace APIClients.ShopifyAPI
/// 产品重量(g) /// 产品重量(g)
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("Weight", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("Weight", Required = Newtonsoft.Json.Required.Always)]
public double Weight { get; set; } public decimal Weight { get; set; }
/// <summary> /// <summary>
/// 产品价格 /// 产品价格
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("JYPrice", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("JYPrice", Required = Newtonsoft.Json.Required.Always)]
public double JYPrice { get; set; } public decimal JYPrice { get; set; }
/// <summary> /// <summary>
/// 运费 /// 运费
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("ShippingFee", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("ShippingFee", Required = Newtonsoft.Json.Required.Always)]
public double ShippingFee { get; set; } public decimal ShippingFee { get; set; }
private System.Collections.Generic.IDictionary<string, object> _additionalProperties; private System.Collections.Generic.IDictionary<string, object> _additionalProperties;
@ -2196,7 +2196,7 @@ namespace APIClients.ShopifyAPI
/// 产品ID /// 产品ID
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public double? Id { get; set; } public string Id { get; set; }
private System.Collections.Generic.IDictionary<string, object> _additionalProperties; private System.Collections.Generic.IDictionary<string, object> _additionalProperties;
@ -2216,7 +2216,7 @@ namespace APIClients.ShopifyAPI
/// Shopify商品ID /// Shopify商品ID
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("shoifyGoodsId", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("shoifyGoodsId", Required = Newtonsoft.Json.Required.Always)]
public double ShoifyGoodsId { get; set; } public string ShoifyGoodsId { get; set; }
/// <summary> /// <summary>
/// 产品SKU /// 产品SKU
@ -2254,19 +2254,19 @@ namespace APIClients.ShopifyAPI
/// 产品重量(g) /// 产品重量(g)
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("Weight", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("Weight", Required = Newtonsoft.Json.Required.Always)]
public double Weight { get; set; } public decimal Weight { get; set; }
/// <summary> /// <summary>
/// 产品价格 /// 产品价格
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("JYPrice", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("JYPrice", Required = Newtonsoft.Json.Required.Always)]
public double JYPrice { get; set; } public decimal JYPrice { get; set; }
/// <summary> /// <summary>
/// 运费 /// 运费
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("ShippingFee", Required = Newtonsoft.Json.Required.Always)] [Newtonsoft.Json.JsonProperty("ShippingFee", Required = Newtonsoft.Json.Required.Always)]
public double ShippingFee { get; set; } public decimal ShippingFee { get; set; }
private System.Collections.Generic.IDictionary<string, object> _additionalProperties; private System.Collections.Generic.IDictionary<string, object> _additionalProperties;

@ -33,6 +33,7 @@ using Newtonsoft.Json.Serialization;
using NPOI.HSSF.Record.Formula.Functions; using NPOI.HSSF.Record.Formula.Functions;
using static NPOI.HSSF.Util.HSSFColor; using static NPOI.HSSF.Util.HSSFColor;
using System.Linq.Expressions; using System.Linq.Expressions;
using APIClients.ShopifyAPI;
using LinqToDB; using LinqToDB;
using Match = System.Text.RegularExpressions.Match; using Match = System.Text.RegularExpressions.Match;
using TradeManageNew.APIClients.FedexApi.Tests; using TradeManageNew.APIClients.FedexApi.Tests;
@ -28727,18 +28728,247 @@ namespace TradeManageNew
} }
[WebMethod(EnableSession = true)] [WebMethod(EnableSession = true)]
public int OrderUsedSalePlatformPrint(int Id) public APIReturnModel OrderUsedSalePlatformPrint(List<int> Ids)
{ {
// PagesNew.Login(base.Session); // PagesNew.Login(base.Session);
using (var db = new TradeUsedSale.Repositories.ErpDbContext()) using (var db = new TradeUsedSale.Repositories.ErpDbContext())
{ {
var orderUsedSalePlatform = db.DT_OrderUsedSalePlatform db.DT_OrderUsedSalePlatform
.Where(x => x.Id == Id) .Where(x => Ids.Contains(x.Id))
.Set(x => x.IsPrinted, true) .Set(x => x.IsPrinted, true)
.Update(); .Update();
return orderUsedSalePlatform; return new APIReturnModel
{
Code = 1,
Message = "Success",
Datas = null
};
}
}
[WebMethod(EnableSession = true)]
public APIReturnModel OrderUsedSalePlatformPublish(List<int> Ids)
{
// PagesNew.Login(base.Session);
using (var db = new TradeUsedSale.Repositories.ErpDbContext())
{
var orderUsedSalePlatformList = db.DT_OrderUsedSalePlatform.Where(x => Ids.Contains(x.Id)).ToList();
foreach (var orderUsedSalePlatform in orderUsedSalePlatformList)
{
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<decimal?>()
{
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;
}
try
{
//在Shopify创建产品变体信息
var createShopifyVariantParameter = new AddVariantRequest
{
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,
StoreName = orderUsedSalePlatform.WarehouseLocation.ToString(),
Code = orderUsedSalePlatform.BarCode,
},
};
var productVariantRes = shopifyApiClient.AddProductVariantAsync(createShopifyVariantParameter).ConfigureAwait(false)
.GetAwaiter()
.GetResult();
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
};
} }
#endregion #endregion

@ -30614,10 +30614,10 @@ select @id";
try try
{ {
string tsql = @" string tsql = @"
SELECT a.[ID],a.[GoodsId],c.GoodsCode,[JinJia],[YunFei],[TouCheng],[HuoWuShuiFei],[YuGuJiaGe],[CreateUserId],[CreateTime] SELECT top 1 a.[ID],a.[GoodsId],c.GoodsCode,[JinJia],[YunFei],[TouCheng],[HuoWuShuiFei],[YuGuJiaGe],[CreateUserId],[CreateTime]
FROM [newerpbak_cwk].[dbo].[TemuChengBen] a FROM [dbo].[TemuChengBen] a
inner join HW_GoodsInfo c on a.GoodsId=c.GoodsId inner join HW_GoodsInfo c on a.GoodsId=c.GoodsId
where a.GoodsId = @GoodsId "; where a.GoodsId = @GoodsId order by a.CreateTime desc";
Database db = DatabaseFactory.CreateDatabase(); Database db = DatabaseFactory.CreateDatabase();
DbCommand cmd = db.GetSqlStringCommand(tsql); DbCommand cmd = db.GetSqlStringCommand(tsql);
db.AddInParameter(cmd, "@GoodsId", DbType.Int32, GoodsId); db.AddInParameter(cmd, "@GoodsId", DbType.Int32, GoodsId);

@ -451,7 +451,18 @@ namespace TradeManageNew
public JsonModel<List<HW_GoodsDetailNew2>> GetGoodsDetailListNew22(int platid,int MUserId,int cpzt,int GNum, int TJ1, int IsYC, int IsJQ, int StoreId, int AQNum, int AQNum2, string Name, string Supplier, int TJ2, int SNum, int ENum, int cgjh, int kh, int PageIndex, int PageSize, string Sort) public JsonModel<List<HW_GoodsDetailNew2>> GetGoodsDetailListNew22(int platid,int MUserId,int cpzt,int GNum, int TJ1, int IsYC, int IsJQ, int StoreId, int AQNum, int AQNum2, string Name, string Supplier, int TJ2, int SNum, int ENum, int cgjh, int kh, int PageIndex, int PageSize, string Sort)
{ {
HuoWuData data = new HuoWuData(); HuoWuData data = new HuoWuData();
int num = Convert.ToInt32(base.Session["CompanyId"]); int num = 0;
if (base.Session["CompanyId"] != null)
{
num = Convert.ToInt32(base.Session["CompanyId"]);
}
else
{
num = 1;
}
RefParameterCollection where = new RefParameterCollection(); RefParameterCollection where = new RefParameterCollection();
if (cpzt > 0) if (cpzt > 0)
{ {
@ -497,6 +508,8 @@ namespace TradeManageNew
where.Add("b.guserid_wayfair", "=", MUserId, DbType.Int32); where.Add("b.guserid_wayfair", "=", MUserId, DbType.Int32);
else if (MUserId != 0 && platid == 21) else if (MUserId != 0 && platid == 21)
where.Add("b.guserid_sheIn", "=", MUserId, DbType.Int32); where.Add("b.guserid_sheIn", "=", MUserId, DbType.Int32);
else if (MUserId != 0 && platid == 23)
where.Add("b.guserid_temu", "=", MUserId, DbType.Int32);
if (AQNum == 1) if (AQNum == 1)
{ {

@ -27,5 +27,8 @@ namespace TradeUsedSale.Repositories
public ITable<JC_Shop> JC_Shop => this.GetTable<JC_Shop>(); public ITable<JC_Shop> JC_Shop => this.GetTable<JC_Shop>();
public ITable<JC_UserInfo> JC_UserInfo => this.GetTable<JC_UserInfo>(); public ITable<JC_UserInfo> JC_UserInfo => this.GetTable<JC_UserInfo>();
public ITable<CK_StorePostion> CK_StorePostion => this.GetTable<CK_StorePostion>(); public ITable<CK_StorePostion> CK_StorePostion => this.GetTable<CK_StorePostion>();
public ITable<DT_ShopifyUsedSaleProduct> DT_ShopifyUsedSaleProduct => this.GetTable<DT_ShopifyUsedSaleProduct>();
public ITable<DT_ShopifyProductGoodsMap> DT_ShopifyProductGoodsMap => this.GetTable<DT_ShopifyProductGoodsMap>();
public ITable<HW_PostFee> HW_PostFee => this.GetTable<HW_PostFee>();
} }
} }

@ -92,5 +92,10 @@ namespace TradeUsedSale.Repositories.Models
/// 修改人 /// 修改人
/// </summary> /// </summary>
public int? LastModifierId { get; set; } public int? LastModifierId { get; set; }
/// <summary>
/// 推送至平台信息
/// </summary>
public string PublishMessage { get; set; }
} }
} }

@ -0,0 +1,30 @@
using System;
using LinqToDB.Mapping;
namespace TradeUsedSale.Repositories.Models
{
/// <summary>
/// Shopify产品与系统SKU映射
/// </summary>
public class DT_ShopifyProductGoodsMap
{
[PrimaryKey, Identity] public int Id { get; set; }
/// <summary>
/// Shopify产品Id
/// </summary>
public string ShopifyProductId { get; set; }
/// <summary>
/// 系统SKU ID
/// </summary>
public int SkuId { get; set; }
public string SkuCode { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreationTime { get; set; }
}
}

@ -0,0 +1,17 @@
using LinqToDB.Mapping;
namespace TradeUsedSale.Repositories.Models
{
/// <summary>
/// Shopify产品资料
/// </summary>
public class DT_ShopifyUsedSaleProduct
{
[PrimaryKey, Identity] public int Id { get; set; }
public string Sku { get; set; }
public string Title { get; set; }
public string ImagePath { get; set; }
public string Category { get; set; }
public string Tags { get; set; }
}
}

@ -0,0 +1,19 @@
using LinqToDB.Mapping;
namespace TradeUsedSale.Repositories.Models
{
public class HW_PostFee
{
[PrimaryKey, Identity]
public int Id { get; set; }
public int? GoodsId { get; set; }
public decimal? Fee1 { get; set; }
public decimal? Fee2 { get; set; }
public decimal? Fee3 { get; set; }
public decimal? Fee4 { get; set; }
public decimal? Fee5 { get; set; }
public decimal? Fee6 { get; set; }
public decimal? Fee7 { get; set; }
public decimal? Fee8 { get; set; }
}
}

@ -56,8 +56,11 @@
<Compile Include="Repositories\Models\DT_OrderReturn.cs" /> <Compile Include="Repositories\Models\DT_OrderReturn.cs" />
<Compile Include="Repositories\Models\DT_OrderUsedSalePlatform.cs" /> <Compile Include="Repositories\Models\DT_OrderUsedSalePlatform.cs" />
<Compile Include="Repositories\Models\DT_OrderXXInfo.cs" /> <Compile Include="Repositories\Models\DT_OrderXXInfo.cs" />
<Compile Include="Repositories\Models\DT_ShopifyProductGoodsMap.cs" />
<Compile Include="Repositories\Models\DT_ShopifyUsedSaleProduct.cs" />
<Compile Include="Repositories\Models\HW_GoodsDetail.cs" /> <Compile Include="Repositories\Models\HW_GoodsDetail.cs" />
<Compile Include="Repositories\Models\HW_GoodsInfo.cs" /> <Compile Include="Repositories\Models\HW_GoodsInfo.cs" />
<Compile Include="Repositories\Models\HW_PostFee.cs" />
<Compile Include="Repositories\Models\JC_Shop.cs" /> <Compile Include="Repositories\Models\JC_Shop.cs" />
<Compile Include="Repositories\Models\JC_UserInfo.cs" /> <Compile Include="Repositories\Models\JC_UserInfo.cs" />
<Compile Include="Repositories\Utils\ExpressionExtensions.cs" /> <Compile Include="Repositories\Utils\ExpressionExtensions.cs" />

Loading…
Cancel
Save