38 changed files with 1149 additions and 55 deletions
@ -0,0 +1,15 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
namespace BBWYB.Server.API.Controllers |
||||
|
{ |
||||
|
[Produces("application/json")] |
||||
|
[Route("Api/[Controller]/[Action]")]
|
||||
|
[ApiController] |
||||
|
public class BaseApiController : ControllerBase |
||||
|
{ |
||||
|
protected IHttpContextAccessor httpContextAccessor; |
||||
|
public BaseApiController(IHttpContextAccessor httpContextAccessor) |
||||
|
{ |
||||
|
this.httpContextAccessor = httpContextAccessor; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
using BBWYB.Server.Business; |
||||
|
using BBWYB.Server.Model.Db; |
||||
|
using BBWYB.Server.Model.Dto; |
||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace BBWYB.Server.API.Controllers |
||||
|
{ |
||||
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] |
||||
|
public class PurchaseSchemeController : BaseApiController |
||||
|
{ |
||||
|
private PurchaseSchemeBusiness purchaseSchemeBusiness; |
||||
|
|
||||
|
public PurchaseSchemeController(PurchaseSchemeBusiness purchaseSchemeBusiness, IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) |
||||
|
{ |
||||
|
this.purchaseSchemeBusiness = purchaseSchemeBusiness; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 添加/编辑采购商
|
||||
|
/// </summary>
|
||||
|
/// <param name="batchCURDSchemeRequest"></param>
|
||||
|
[HttpPost] |
||||
|
public void EditPurchaseScheme([FromBody] BatchCURDSchemeRequest batchCURDSchemeRequest) |
||||
|
{ |
||||
|
purchaseSchemeBusiness.EditPurchaseScheme(batchCURDSchemeRequest); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据产品Id批量查询采购商列表
|
||||
|
/// </summary>
|
||||
|
/// <param name="querySchemeRequest"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
public IList<PurchaseSchemeResponse> GetPurchaseSchemeList([FromBody] QuerySchemeRequest querySchemeRequest) |
||||
|
{ |
||||
|
return purchaseSchemeBusiness.GetPurchaseSchemeList(querySchemeRequest); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除采购商
|
||||
|
/// </summary>
|
||||
|
/// <param name="deletePurchaseSchemeRequest"></param>
|
||||
|
[HttpDelete] |
||||
|
public void DeletePurchaser([FromBody] DeletePurchaseSchemeRequest deletePurchaseSchemeRequest) |
||||
|
{ |
||||
|
purchaseSchemeBusiness.DeletePurchaser(deletePurchaseSchemeRequest); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 删除采购方案
|
||||
|
/// </summary>
|
||||
|
/// <param name="schemeId"></param>
|
||||
|
[HttpDelete("{schemeId}")] |
||||
|
public void DeletePurchaseScheme([FromRoute] long schemeId) |
||||
|
{ |
||||
|
purchaseSchemeBusiness.DeletePurchaseScheme(schemeId); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 查询共有采购商
|
||||
|
/// </summary>
|
||||
|
/// <param name="querySchemeRequest"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
public IList<Purchaser> GetSharePurchaser([FromBody] QuerySchemeRequest querySchemeRequest) |
||||
|
{ |
||||
|
return purchaseSchemeBusiness.GetSharePurchaser(querySchemeRequest); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,33 +0,0 @@ |
|||||
using Microsoft.AspNetCore.Mvc; |
|
||||
|
|
||||
namespace BBWYB.Server.API.Controllers |
|
||||
{ |
|
||||
[ApiController] |
|
||||
[Route("[controller]")]
|
|
||||
public class WeatherForecastController : ControllerBase |
|
||||
{ |
|
||||
private static readonly string[] Summaries = new[] |
|
||||
{ |
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" |
|
||||
}; |
|
||||
|
|
||||
private readonly ILogger<WeatherForecastController> _logger; |
|
||||
|
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger) |
|
||||
{ |
|
||||
_logger = logger; |
|
||||
} |
|
||||
|
|
||||
[HttpGet(Name = "GetWeatherForecast")] |
|
||||
public IEnumerable<WeatherForecast> Get() |
|
||||
{ |
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast |
|
||||
{ |
|
||||
Date = DateTime.Now.AddDays(index), |
|
||||
TemperatureC = Random.Shared.Next(-20, 55), |
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] |
|
||||
}) |
|
||||
.ToArray(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,25 +1,124 @@ |
|||||
|
using BBWYB.Common.Http; |
||||
|
using BBWYB.Common.Log; |
||||
|
using BBWYB.Server.Business; |
||||
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
||||
|
using Microsoft.IdentityModel.Tokens; |
||||
|
using Microsoft.OpenApi.Models; |
||||
|
using System.Reflection; |
||||
|
using System.Text; |
||||
|
using Yitter.IdGenerator; |
||||
|
|
||||
var builder = WebApplication.CreateBuilder(args); |
var builder = WebApplication.CreateBuilder(args); |
||||
|
var services = builder.Services; |
||||
|
var configuration = builder.Configuration; |
||||
|
|
||||
|
services.AddMemoryCache(); |
||||
|
|
||||
|
var idOption = new IdGeneratorOptions(1); |
||||
|
var idGenerator = new DefaultIdGenerator(idOption); |
||||
|
services.AddSingleton(typeof(IIdGenerator), idGenerator); |
||||
|
|
||||
|
//var fsql = new FreeSql.FreeSqlBuilder().UseConnectionString(FreeSql.DataType.MySql, configuration.GetConnectionString("DB")).Build();
|
||||
|
//services.AddSingleton(typeof(IFreeSql), fsql);
|
||||
|
|
||||
|
services.AddSingleton<NLogManager>(); |
||||
|
services.AddSingleton<RestApiService>(); |
||||
|
services.AddSingleton<TaskSchedulerManager>(); |
||||
|
services.AddMemoryCache(); |
||||
|
services.AddControllers(); |
||||
|
services.AddHttpContextAccessor(); |
||||
|
services.AddHttpClient(); |
||||
|
services.AddCors(options => |
||||
|
{ |
||||
|
options.AddPolicy("cors", p => |
||||
|
{ |
||||
|
p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
services.AddControllers(); |
||||
|
services.AddEndpointsApiExplorer(); |
||||
|
services.AddSwaggerGen(c => |
||||
|
{ |
||||
|
c.SwaggerDoc("v1", new OpenApiInfo |
||||
|
{ |
||||
|
Version = "v1.0.0", |
||||
|
Title = "步步为盈B端API", |
||||
|
Description = "注意事项\r\n1.返回参数名称采用大驼峰命名\r\n2.ApiResponse为基础返回对象(Code,Data,Message),接口中所有的返回值均属于Data属性\r\n3.正常返回Code=200" |
||||
|
}); |
||||
|
//JWT认证
|
||||
|
c.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme, new OpenApiSecurityScheme |
||||
|
{ |
||||
|
Scheme = JwtBearerDefaults.AuthenticationScheme, |
||||
|
BearerFormat = "JWT", |
||||
|
Type = SecuritySchemeType.ApiKey, |
||||
|
Name = "Authorization", |
||||
|
In = ParameterLocation.Header, |
||||
|
Description = "Authorization:Bearer {your JWT token}<br/>", |
||||
|
}); |
||||
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement |
||||
|
{ |
||||
|
{ |
||||
|
new OpenApiSecurityScheme{Reference = new OpenApiReference |
||||
|
{ |
||||
|
Type = ReferenceType.SecurityScheme, |
||||
|
Id = JwtBearerDefaults.AuthenticationScheme |
||||
|
} |
||||
|
}, |
||||
|
new string[] { } |
||||
|
} |
||||
|
}); |
||||
|
|
||||
// Add services to the container.
|
var executingAssembly = Assembly.GetExecutingAssembly(); |
||||
|
var assemblyNames = executingAssembly.GetReferencedAssemblies().Union(new AssemblyName[] { executingAssembly.GetName() }).ToArray(); |
||||
|
Array.ForEach(assemblyNames, (assemblyName) => |
||||
|
{ |
||||
|
//var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
|
var xmlFile = $"{assemblyName.Name}.xml"; |
||||
|
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); |
||||
|
if (!File.Exists(xmlPath)) |
||||
|
return; |
||||
|
c.IncludeXmlComments(xmlPath, true); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
builder.Services.AddControllers(); |
var secret = configuration.GetSection("Secret").Value; |
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, x => |
||||
builder.Services.AddEndpointsApiExplorer(); |
{ |
||||
builder.Services.AddSwaggerGen(); |
x.SaveToken = true; |
||||
|
x.RequireHttpsMetadata = false; |
||||
|
x.TokenValidationParameters = new TokenValidationParameters() |
||||
|
{ |
||||
|
ClockSkew = TimeSpan.Zero, |
||||
|
ValidateIssuerSigningKey = true, |
||||
|
ValidateIssuer = false, |
||||
|
ValidateAudience = false, |
||||
|
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secret)), |
||||
|
//ValidIssuer = issuer,
|
||||
|
//ValidAudience = audience,
|
||||
|
//ValidateLifetime = true
|
||||
|
}; |
||||
|
}); |
||||
|
|
||||
var app = builder.Build(); |
var app = builder.Build(); |
||||
|
|
||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment()) |
//yunDingBusiness.RefreshKey();
|
||||
|
var isAllowedSwagger = configuration.GetValue<bool>("AllowedSwagger"); |
||||
|
if (isAllowedSwagger) |
||||
|
{ |
||||
|
app.UseSwagger(c => c.SerializeAsV2 = true) |
||||
|
.UseSwaggerUI(c => |
||||
{ |
{ |
||||
app.UseSwagger(); |
c.SwaggerEndpoint("/swagger/v1/swagger.json", "BBWYB API"); |
||||
app.UseSwaggerUI(); |
c.RoutePrefix = string.Empty; |
||||
|
}); |
||||
} |
} |
||||
|
|
||||
app.UseHttpsRedirection(); |
//app.UseHttpsRedirection();
|
||||
|
app.UseRouting(); |
||||
|
app.UseCors("cors"); |
||||
app.UseAuthorization(); |
app.UseAuthorization(); |
||||
|
|
||||
app.MapControllers(); |
app.MapControllers(); |
||||
|
|
||||
app.Run(); |
app.Run(); |
||||
|
@ -0,0 +1,18 @@ |
|||||
|
using BBWYB.Common.Log; |
||||
|
using Yitter.IdGenerator; |
||||
|
namespace BBWYB.Server.Business |
||||
|
{ |
||||
|
public class BaseBusiness |
||||
|
{ |
||||
|
protected IFreeSql fsql; |
||||
|
protected NLogManager nLogManager; |
||||
|
protected IIdGenerator idGenerator; |
||||
|
|
||||
|
public BaseBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator) |
||||
|
{ |
||||
|
this.fsql = fsql; |
||||
|
this.nLogManager = nLogManager; |
||||
|
this.idGenerator = idGenerator; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,246 @@ |
|||||
|
using BBWYB.Common.Extensions; |
||||
|
using BBWYB.Common.Log; |
||||
|
using BBWYB.Common.Models; |
||||
|
using BBWYB.Server.Model.Db; |
||||
|
using BBWYB.Server.Model.Dto; |
||||
|
using Yitter.IdGenerator; |
||||
|
|
||||
|
namespace BBWYB.Server.Business |
||||
|
{ |
||||
|
public class PurchaseSchemeBusiness : BaseBusiness, IDenpendency |
||||
|
{ |
||||
|
public PurchaseSchemeBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator) : base(fsql, nLogManager, idGenerator) { } |
||||
|
|
||||
|
private void ExtractNewPurchaser<T>(IList<T> purchaserSchemeList, IList<Purchaser> addPurchaserList) where T : InputPurchaseSchemeRequest |
||||
|
{ |
||||
|
var reqeustPurchaserIdList = purchaserSchemeList.Select(s => s.PurchaserId).Distinct().ToList(); |
||||
|
var existPurchaserIdList = fsql.Select<Purchaser>().Where(p => reqeustPurchaserIdList.Contains(p.Id)).ToList(p => p.Id); |
||||
|
var newPurchaserIdList = reqeustPurchaserIdList.Except(existPurchaserIdList); |
||||
|
foreach (var scheme in purchaserSchemeList) |
||||
|
{ |
||||
|
if (newPurchaserIdList.Any(p => p == scheme.PurchaserId) && !addPurchaserList.Any(p => p.Id == scheme.PurchaserId)) |
||||
|
{ |
||||
|
addPurchaserList.Add(new Purchaser() |
||||
|
{ |
||||
|
Id = scheme.PurchaserId, |
||||
|
Name = scheme.PurchaserName, |
||||
|
Location = scheme.PurchaserLocation, |
||||
|
Platform = scheme.PurchasePlatform |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void EditPurchaseScheme(BatchCURDSchemeRequest batchCURDSchemeRequest) |
||||
|
{ |
||||
|
if (batchCURDSchemeRequest.EditPurchaseSchemeList.Count == 0 && batchCURDSchemeRequest.AddPurchaseSchemeList.Count == 0) |
||||
|
throw new BusinessException("非法参数"); |
||||
|
if (batchCURDSchemeRequest.AddPurchaseSchemeList.Any(p => string.IsNullOrEmpty(p.PurchaserId) || |
||||
|
string.IsNullOrEmpty(p.PurchaserName))) |
||||
|
throw new BusinessException("新增方案中有采购商Id/Name/Location为空"); |
||||
|
|
||||
|
if (batchCURDSchemeRequest.AddPurchaseSchemeList.Any(p => string.IsNullOrEmpty(p.PurchaserId) || |
||||
|
string.IsNullOrEmpty(p.PurchaserName))) |
||||
|
throw new BusinessException("编辑方案中有采购商Id/Name/Location为空"); |
||||
|
|
||||
|
List<PurchaseScheme> addPurchaseSchemeList = null; |
||||
|
List<PurchaseSchemeProduct> addPurchaseSchemeProductList = new List<PurchaseSchemeProduct>(); |
||||
|
List<PurchaseSchemeProductSku> addPurchaseSchemeProductSkuList = new List<PurchaseSchemeProductSku>(); |
||||
|
List<Purchaser> newPurchaserList = new List<Purchaser>(); |
||||
|
List<long> deletePurchaseSchemeIdList = new List<long>(); |
||||
|
|
||||
|
#region 新增采购方案
|
||||
|
if (batchCURDSchemeRequest.AddPurchaseSchemeList.Count > 0) |
||||
|
{ |
||||
|
ExtractNewPurchaser(batchCURDSchemeRequest.AddPurchaseSchemeList, newPurchaserList); |
||||
|
|
||||
|
addPurchaseSchemeList = batchCURDSchemeRequest.AddPurchaseSchemeList.Map<List<PurchaseScheme>>(); |
||||
|
|
||||
|
foreach (var scheme in addPurchaseSchemeList) |
||||
|
{ |
||||
|
scheme.Id = idGenerator.NewLong(); |
||||
|
scheme.CreateTime = DateTime.Now; |
||||
|
|
||||
|
foreach (var purchaseProduct in scheme.PurchaseSchemeProductList) |
||||
|
{ |
||||
|
purchaseProduct.Id = idGenerator.NewLong(); |
||||
|
purchaseProduct.CreateTime = DateTime.Now; |
||||
|
purchaseProduct.SkuPurchaseSchemeId = scheme.Id; |
||||
|
foreach (var purchaseProductSku in purchaseProduct.PurchaseSchemeProductSkuList) |
||||
|
{ |
||||
|
purchaseProductSku.Id = idGenerator.NewLong(); |
||||
|
purchaseProductSku.CreateTime = DateTime.Now; |
||||
|
purchaseProductSku.SkuPurchaseSchemeId = scheme.Id; |
||||
|
} |
||||
|
addPurchaseSchemeProductSkuList.AddRange(purchaseProduct.PurchaseSchemeProductSkuList); |
||||
|
} |
||||
|
addPurchaseSchemeProductList.AddRange(scheme.PurchaseSchemeProductList); |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
#region 更新采购方案
|
||||
|
if (batchCURDSchemeRequest.EditPurchaseSchemeList.Count > 0) |
||||
|
{ |
||||
|
//ExtractNewPurchaser(batchCURDSchemeRequest.EditPurchaseSchemeList, newPurchaserList);
|
||||
|
deletePurchaseSchemeIdList.AddRange(batchCURDSchemeRequest.EditPurchaseSchemeList.Select(ps => ps.Id)); |
||||
|
|
||||
|
var editPurchaseSchemeList = batchCURDSchemeRequest.EditPurchaseSchemeList.Map<List<Model.Db.PurchaseScheme>>(); |
||||
|
foreach (var scheme in editPurchaseSchemeList) |
||||
|
{ |
||||
|
foreach (var purchaseProduct in scheme.PurchaseSchemeProductList) |
||||
|
{ |
||||
|
purchaseProduct.Id = idGenerator.NewLong(); |
||||
|
purchaseProduct.CreateTime = DateTime.Now; |
||||
|
purchaseProduct.SkuPurchaseSchemeId = scheme.Id; |
||||
|
foreach (var purchaseProductSku in purchaseProduct.PurchaseSchemeProductSkuList) |
||||
|
{ |
||||
|
purchaseProductSku.Id = idGenerator.NewLong(); |
||||
|
purchaseProductSku.CreateTime = DateTime.Now; |
||||
|
purchaseProductSku.SkuPurchaseSchemeId = scheme.Id; |
||||
|
} |
||||
|
addPurchaseSchemeProductSkuList.AddRange(purchaseProduct.PurchaseSchemeProductSkuList); |
||||
|
} |
||||
|
addPurchaseSchemeProductList.AddRange(scheme.PurchaseSchemeProductList); |
||||
|
} |
||||
|
} |
||||
|
#endregion
|
||||
|
|
||||
|
fsql.Transaction(() => |
||||
|
{ |
||||
|
if (newPurchaserList.Count > 0) |
||||
|
fsql.Insert(newPurchaserList).ExecuteAffrows(); |
||||
|
|
||||
|
//更新,删除已存在的采购方案商品和Sku
|
||||
|
if (deletePurchaseSchemeIdList.Count > 0) |
||||
|
{ |
||||
|
fsql.Delete<PurchaseSchemeProduct>().Where(p => deletePurchaseSchemeIdList.Contains(p.SkuPurchaseSchemeId)).ExecuteAffrows(); |
||||
|
fsql.Delete<PurchaseSchemeProductSku>().Where(p => deletePurchaseSchemeIdList.Contains(p.SkuPurchaseSchemeId)).ExecuteAffrows(); |
||||
|
} |
||||
|
|
||||
|
//新增
|
||||
|
if (addPurchaseSchemeList != null && addPurchaseSchemeList.Count > 0) |
||||
|
fsql.Insert(addPurchaseSchemeList).ExecuteAffrows(); |
||||
|
if (addPurchaseSchemeProductList.Count > 0) |
||||
|
fsql.Insert(addPurchaseSchemeProductList).ExecuteAffrows(); |
||||
|
if (addPurchaseSchemeProductSkuList.Count > 0) |
||||
|
fsql.Insert(addPurchaseSchemeProductSkuList).ExecuteAffrows(); |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取采购方案
|
||||
|
/// </summary>
|
||||
|
/// <param name="querySchemeRequest"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public IList<PurchaseSchemeResponse> GetPurchaseSchemeList(QuerySchemeRequest querySchemeRequest) |
||||
|
{ |
||||
|
var select = fsql.Select<PurchaseScheme, Purchaser>().InnerJoin((ps, p) => ps.PurchaserId == p.Id); |
||||
|
if (querySchemeRequest.SchemeId != null && querySchemeRequest.SchemeId != 0) |
||||
|
select = select.Where((ps, p) => ps.Id == querySchemeRequest.SchemeId); |
||||
|
else |
||||
|
{ |
||||
|
select = select.WhereIf(querySchemeRequest.ShopId != null && querySchemeRequest.ShopId != 0, (ps, p) => ps.ShopId == querySchemeRequest.ShopId) |
||||
|
.WhereIf(querySchemeRequest.SkuIdList != null && querySchemeRequest.SkuIdList.Count() > 0, (ps, p) => querySchemeRequest.SkuIdList.Contains(ps.SkuId)) |
||||
|
.WhereIf(!string.IsNullOrEmpty(querySchemeRequest.PurchaserId), (ps, p) => ps.PurchaserId == querySchemeRequest.PurchaserId) |
||||
|
.WhereIf(querySchemeRequest.PurchasePlatform != null, (ps, p) => ps.PurchasePlatform == querySchemeRequest.PurchasePlatform); |
||||
|
} |
||||
|
|
||||
|
var purchaseSchemeList = select.ToList((ps, p) => new PurchaseSchemeResponse |
||||
|
{ |
||||
|
Id = ps.Id, |
||||
|
ProductId = ps.ProductId, |
||||
|
SkuId = ps.SkuId, |
||||
|
ShopId = ps.ShopId, |
||||
|
PurchaserId = p.Id, |
||||
|
PurchaserName = p.Name, |
||||
|
PurchaserLocation = p.Location, |
||||
|
DefaultCost = ps.DefaultCost, |
||||
|
RealCost = ps.RealCost, |
||||
|
CreateTime = ps.CreateTime, |
||||
|
PurchasePlatform = ps.PurchasePlatform |
||||
|
}); |
||||
|
|
||||
|
if (purchaseSchemeList.Count > 0) |
||||
|
{ |
||||
|
var purchaseSchemeIdList = purchaseSchemeList.Select(p => p.Id).ToList(); |
||||
|
|
||||
|
var purchaseSchemeProductList = fsql.Select<PurchaseSchemeProduct>().Where(p => purchaseSchemeIdList.Contains(p.SkuPurchaseSchemeId)) |
||||
|
.ToList().Map<List<PurchaseSchemeProductResponse>>(); |
||||
|
|
||||
|
var purchaseSchemeProductSkuList = fsql.Select<PurchaseSchemeProductSku>().Where(p => purchaseSchemeIdList.Contains(p.SkuPurchaseSchemeId)) |
||||
|
.ToList().Map<List<PurchaseSchemeProductSkuResponse>>(); |
||||
|
|
||||
|
foreach (var scheme in purchaseSchemeList) |
||||
|
{ |
||||
|
var schemeProductList = purchaseSchemeProductList.Where(ps => ps.SkuPurchaseSchemeId == scheme.Id); |
||||
|
if (schemeProductList.Count() > 0) |
||||
|
{ |
||||
|
scheme.PurchaseSchemeProductList.AddRange(schemeProductList); |
||||
|
foreach (var schemeProduct in schemeProductList) |
||||
|
{ |
||||
|
var schemeProductSkuList = purchaseSchemeProductSkuList.Where(psk => psk.SkuPurchaseSchemeId == scheme.Id && |
||||
|
psk.PurchaseProductId == schemeProduct.PurchaseProductId); |
||||
|
if (schemeProductSkuList.Count() > 0) |
||||
|
schemeProduct.PurchaseSchemeProductSkuList.AddRange(schemeProductSkuList); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return purchaseSchemeList; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取共同拥有的采购商
|
||||
|
/// </summary>
|
||||
|
/// <param name="querySchemeRequest"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public IList<Purchaser> GetSharePurchaser(QuerySchemeRequest querySchemeRequest) |
||||
|
{ |
||||
|
var skuCount = querySchemeRequest.SkuIdList.Count(); |
||||
|
|
||||
|
var purchaseSchemeList = fsql.Select<PurchaseScheme, Purchaser>().InnerJoin((ps, p) => ps.PurchaserId == p.Id) |
||||
|
.Where((ps, p) => ps.ShopId == querySchemeRequest.ShopId) |
||||
|
.Where((ps, p) => querySchemeRequest.SkuIdList.Contains(ps.SkuId)) |
||||
|
.ToList(); |
||||
|
if (purchaseSchemeList.Count() == 0) |
||||
|
return null; |
||||
|
|
||||
|
var group = purchaseSchemeList.GroupBy(p => p.PurchaserId); |
||||
|
var sharePurchaserIdList = new List<string>(); |
||||
|
foreach (var g in group) |
||||
|
{ |
||||
|
if (g.Count() == skuCount) |
||||
|
sharePurchaserIdList.Add(g.Key); |
||||
|
} |
||||
|
if (sharePurchaserIdList.Count == 0) |
||||
|
return null; |
||||
|
|
||||
|
return fsql.Select<Purchaser>().Where(p => sharePurchaserIdList.Contains(p.Id)).ToList(); |
||||
|
} |
||||
|
|
||||
|
public void DeletePurchaser(DeletePurchaseSchemeRequest deletePurchaseSchemeRequest) |
||||
|
{ |
||||
|
var purchaseSchemeIdList = fsql.Select<PurchaseScheme>().Where(ps => ps.ProductId == deletePurchaseSchemeRequest.ProductId && |
||||
|
ps.PurchaserId == deletePurchaseSchemeRequest.PurchaserId).ToList(ps => ps.Id); |
||||
|
|
||||
|
fsql.Transaction(() => |
||||
|
{ |
||||
|
fsql.Delete<PurchaseScheme>(purchaseSchemeIdList).ExecuteAffrows(); |
||||
|
fsql.Delete<PurchaseSchemeProduct>().Where(psp => purchaseSchemeIdList.Contains(psp.SkuPurchaseSchemeId)).ExecuteAffrows(); |
||||
|
fsql.Delete<PurchaseSchemeProductSku>().Where(psps => purchaseSchemeIdList.Contains(psps.SkuPurchaseSchemeId)).ExecuteAffrows(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public void DeletePurchaseScheme(long schemeId) |
||||
|
{ |
||||
|
fsql.Transaction(() => |
||||
|
{ |
||||
|
fsql.Delete<PurchaseScheme>(schemeId).ExecuteAffrows(); |
||||
|
fsql.Delete<PurchaseSchemeProduct>().Where(p => p.SkuPurchaseSchemeId == schemeId).ExecuteAffrows(); |
||||
|
fsql.Delete<PurchaseSchemeProductSku>().Where(p => p.SkuPurchaseSchemeId == schemeId).ExecuteAffrows(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
using System.Threading.Tasks.Schedulers; |
||||
|
|
||||
|
namespace BBWYB.Server.Business |
||||
|
{ |
||||
|
public class TaskSchedulerManager |
||||
|
{ |
||||
|
public LimitedConcurrencyLevelTaskScheduler SyncOrderTaskScheduler { get; private set; } |
||||
|
|
||||
|
public LimitedConcurrencyLevelTaskScheduler PurchaseOrderCallbackTaskScheduler { get; private set; } |
||||
|
|
||||
|
|
||||
|
public TaskSchedulerManager() |
||||
|
{ |
||||
|
SyncOrderTaskScheduler = new LimitedConcurrencyLevelTaskScheduler(10); |
||||
|
PurchaseOrderCallbackTaskScheduler = new LimitedConcurrencyLevelTaskScheduler(10); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
using FreeSql.DataAnnotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
namespace BBWYB.Server.Model.Db |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sku采购方案表
|
||||
|
/// </summary>
|
||||
|
[Table(Name = "purchasescheme", DisableSyncStructure = true)] |
||||
|
public partial class PurchaseScheme |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sku采购方案Id
|
||||
|
/// </summary>
|
||||
|
[Column(IsPrimary = true)] |
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
[Column(DbType = "datetime")] |
||||
|
public DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购默认成本
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public decimal DefaultCost { get; set; } = 0.0M; |
||||
|
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string ProductId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商Id
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 20)] |
||||
|
public string PurchaserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购实际成本
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public decimal RealCost { get; set; } = 0.0M; |
||||
|
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string SkuId { get; set; } |
||||
|
|
||||
|
public long ShopId { get; set; } |
||||
|
|
||||
|
[Column(MapType = typeof(int), DbType = "int(1)")] |
||||
|
public Enums.Platform PurchasePlatform { get; set; } |
||||
|
|
||||
|
[Column(IsIgnore = true)] |
||||
|
public List<PurchaseSchemeProduct> PurchaseSchemeProductList { get; set; } |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
using FreeSql.DataAnnotations; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Db |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商表
|
||||
|
/// </summary>
|
||||
|
[Table(Name = "purchaser", DisableSyncStructure = true)] |
||||
|
public partial class Purchaser |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商Id
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 20, IsPrimary = true, IsNullable = false)] |
||||
|
public string Id { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商名称
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 发货地
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string Location { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购平台
|
||||
|
/// </summary>
|
||||
|
[Column(MapType = typeof(int?))] |
||||
|
public Enums.Platform? Platform { get; set; } |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
using FreeSql.DataAnnotations; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Db |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购方案商品表
|
||||
|
/// </summary>
|
||||
|
[Table(Name = "purchaseschemeproduct", DisableSyncStructure = true)] |
||||
|
public partial class PurchaseSchemeProduct |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品和采购方案的关系Id
|
||||
|
/// </summary>
|
||||
|
[Column(IsPrimary = true)] |
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
[Column(DbType = "datetime")] |
||||
|
public DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string ProductId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品Id
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string PurchaseProductId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品链接
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 100)] |
||||
|
public string PurchaseUrl { get; set; } |
||||
|
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string SkuId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sku采购方案Id
|
||||
|
/// </summary>
|
||||
|
public long SkuPurchaseSchemeId { get; set; } |
||||
|
|
||||
|
|
||||
|
[Column(IsIgnore = true)] |
||||
|
public List<PurchaseSchemeProductSku> PurchaseSchemeProductSkuList { get; set; } |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
using FreeSql.DataAnnotations; |
||||
|
using System; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Db |
||||
|
{ |
||||
|
|
||||
|
[Table(Name = "purchaseschemeproductsku", DisableSyncStructure = true)] |
||||
|
public partial class PurchaseSchemeProductSku |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品的SKU和采购方案的关系Id
|
||||
|
/// </summary>
|
||||
|
[Column(IsPrimary = true)] |
||||
|
public long Id { get; set; } |
||||
|
|
||||
|
[Column(DbType = "datetime")] |
||||
|
public DateTime? CreateTime { get; set; } |
||||
|
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string ProductId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品Id
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string PurchaseProductId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品的SkuId
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string PurchaseSkuId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商品Sku的SpecId
|
||||
|
/// </summary>
|
||||
|
[Column(StringLength = 50)] |
||||
|
public string PurchaseSkuSpecId { get; set; } |
||||
|
|
||||
|
[Column(StringLength = 50, IsNullable = false)] |
||||
|
public string SkuId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Sku采购方案Id
|
||||
|
/// </summary>
|
||||
|
public long SkuPurchaseSchemeId { get; set; } |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class BatchCURDSchemeRequest |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 需要修改的采购方案
|
||||
|
/// </summary>
|
||||
|
public IList<EditPurchaseSchemeRequest> EditPurchaseSchemeList { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 需要新增的采购方案
|
||||
|
/// </summary>
|
||||
|
public IList<InputPurchaseSchemeRequest> AddPurchaseSchemeList { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class DeletePurchaseSchemeRequest |
||||
|
{ |
||||
|
public string ProductId { get; set; } |
||||
|
|
||||
|
public string PurchaserId { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class EditPurchaseSchemeRequest: InputPurchaseSchemeRequest |
||||
|
{ |
||||
|
public long Id { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class InputPurchaseSchemeProductRequest |
||||
|
{ |
||||
|
public string ProductId { get; set; } |
||||
|
public string SkuId { get; set; } |
||||
|
public string PurchaseProductId { get; set; } |
||||
|
public string PurchaseUrl { get; set; } |
||||
|
public IList<InputPurchaseSchemeProductSkuRequest> PurchaseSchemeProductSkuList { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class InputPurchaseSchemeProductSkuRequest |
||||
|
{ |
||||
|
public string ProductId { get; set; } |
||||
|
public string SkuId { get; set; } |
||||
|
public string PurchaseProductId { get; set; } |
||||
|
public string PurchaseSkuId { get; set; } |
||||
|
public string PurchaseSkuSpecId { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class InputPurchaseSchemeRequest |
||||
|
{ |
||||
|
public string ShopId { get; set; } |
||||
|
public string ProductId { get; set; } |
||||
|
public string SkuId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 采购默认成本
|
||||
|
/// </summary>
|
||||
|
public decimal? DefaultCost { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 采购实际成本
|
||||
|
/// </summary>
|
||||
|
public decimal? RealCost { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 采购商Id
|
||||
|
/// </summary>
|
||||
|
public string PurchaserId { get; set; } |
||||
|
public string PurchaserName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 采购商发货地
|
||||
|
/// </summary>
|
||||
|
public string PurchaserLocation { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 采购平台
|
||||
|
/// </summary>
|
||||
|
public Enums.Platform PurchasePlatform { get; set; } = Enums.Platform.阿里巴巴; |
||||
|
|
||||
|
public IList<InputPurchaseSchemeProductRequest> PurchaseSchemeProductList { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class QuerySchemeRequest |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 采购方案Id
|
||||
|
/// </summary>
|
||||
|
public long? SchemeId { get; set; } |
||||
|
|
||||
|
public long? ShopId { get; set; } |
||||
|
|
||||
|
public IList<string> SkuIdList { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购商Id, 可空
|
||||
|
/// </summary>
|
||||
|
public string PurchaserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购平台
|
||||
|
/// </summary>
|
||||
|
public Enums.Platform? PurchasePlatform { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class PurchaseSchemeProductResponse : Model.Db.PurchaseSchemeProduct |
||||
|
{ |
||||
|
public new List<PurchaseSchemeProductSkuResponse> PurchaseSchemeProductSkuList { get; set; } |
||||
|
|
||||
|
public PurchaseSchemeProductResponse() |
||||
|
{ |
||||
|
PurchaseSchemeProductSkuList = new List<PurchaseSchemeProductSkuResponse>(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class PurchaseSchemeProductSkuResponse : Model.Db.PurchaseSchemeProductSku |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace BBWYB.Server.Model.Dto |
||||
|
{ |
||||
|
public class PurchaseSchemeResponse : Model.Db.PurchaseScheme |
||||
|
{ |
||||
|
public string PurchaserName { get; set; } |
||||
|
|
||||
|
public string PurchaserLocation { get; set; } |
||||
|
|
||||
|
public new List<PurchaseSchemeProductResponse> PurchaseSchemeProductList { get; set; } |
||||
|
|
||||
|
public PurchaseSchemeResponse() |
||||
|
{ |
||||
|
PurchaseSchemeProductList = new List<PurchaseSchemeProductResponse>(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,259 @@ |
|||||
|
namespace BBWYB.Server.Model |
||||
|
{ |
||||
|
public class Enums |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 电商平台
|
||||
|
/// </summary>
|
||||
|
public enum Platform |
||||
|
{ |
||||
|
淘宝 = 0, |
||||
|
京东 = 1, |
||||
|
阿里巴巴 = 2, |
||||
|
拼多多 = 3, |
||||
|
微信 = 4, |
||||
|
拳探 = 10 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购方式
|
||||
|
/// </summary>
|
||||
|
public enum PurchaseMethod |
||||
|
{ |
||||
|
线上采购 = 0, |
||||
|
线下采购 = 1 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 采购单模式
|
||||
|
/// </summary>
|
||||
|
public enum PurchaseOrderMode |
||||
|
{ |
||||
|
批发 = 0, |
||||
|
代发 = 1 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仓储类型
|
||||
|
/// </summary>
|
||||
|
public enum StorageType |
||||
|
{ |
||||
|
京仓 = 0, |
||||
|
云仓 = 1, |
||||
|
本地自发 = 2, |
||||
|
代发 = 3, |
||||
|
SD = 4 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 订单类型
|
||||
|
/// </summary>
|
||||
|
public enum OrderType |
||||
|
{ |
||||
|
#region JD订单类型
|
||||
|
SOP = 22, |
||||
|
LOC = 75, |
||||
|
FBP = 21 |
||||
|
#endregion
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 支付方式
|
||||
|
/// </summary>
|
||||
|
public enum PayType |
||||
|
{ |
||||
|
货到付款 = 1, |
||||
|
邮局汇款 = 2, |
||||
|
自提 = 3, |
||||
|
在线支付 = 4, |
||||
|
公司转账 = 5, |
||||
|
银行卡转账 = 6 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 订单状态
|
||||
|
/// </summary>
|
||||
|
public enum OrderState |
||||
|
{ |
||||
|
待付款 = 0, |
||||
|
等待采购 = 1, |
||||
|
待出库 = 2, |
||||
|
待收货 = 3, |
||||
|
已完成 = 4, |
||||
|
锁定 = 5, |
||||
|
已取消 = 6, |
||||
|
暂停 = 7, |
||||
|
已退款 = 8 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 刷单类型
|
||||
|
/// </summary>
|
||||
|
public enum SDType |
||||
|
{ |
||||
|
自刷 = 0, |
||||
|
其他 = 1, |
||||
|
京礼金 = 2, |
||||
|
刷单组 = 3 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 订单同步任务状态
|
||||
|
/// </summary>
|
||||
|
public enum OrderSyncState |
||||
|
{ |
||||
|
Running = 0, |
||||
|
End = 1 |
||||
|
} |
||||
|
|
||||
|
public enum PayChannelType |
||||
|
{ |
||||
|
支付宝 = 0, |
||||
|
微信 = 1, |
||||
|
银行卡 = 2 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 服务单处理结果
|
||||
|
/// </summary>
|
||||
|
public enum ServiceResult |
||||
|
{ |
||||
|
退货 = 0, |
||||
|
换新 = 1, |
||||
|
原返 = 2, |
||||
|
线下换新 = 3, |
||||
|
维修 = 4, |
||||
|
商品补发 = 5, |
||||
|
仅退款 = 6, |
||||
|
SD退货 = 7 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 商品处理方式
|
||||
|
/// </summary>
|
||||
|
public enum ProductResult |
||||
|
{ |
||||
|
一件代发_退回厂家 = 0, |
||||
|
退回齐越仓 = 1, |
||||
|
退回京仓 = 2, |
||||
|
退回云仓 = 3, |
||||
|
客户无退货 = 4 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 商品情况
|
||||
|
/// </summary>
|
||||
|
public enum ProductHealth |
||||
|
{ |
||||
|
可二次销售 = 0, |
||||
|
残次品_无法二次销售 = 1, |
||||
|
厂家退货退款 = 2, |
||||
|
客户无退货 = 3, |
||||
|
破损 = 4 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 排序时间类型
|
||||
|
/// </summary>
|
||||
|
public enum SortTimeType |
||||
|
{ |
||||
|
ModifyTime = 0, StartTime = 1 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 支付账单类型
|
||||
|
/// </summary>
|
||||
|
public enum PayBillType |
||||
|
{ |
||||
|
支付宝 = 0, |
||||
|
微信 = 1, |
||||
|
银行卡 = 2 |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 资金类型
|
||||
|
/// </summary>
|
||||
|
public enum AuditCapitalType |
||||
|
{ |
||||
|
当月商品采购 = 0, |
||||
|
当月商品退款 = 1, |
||||
|
上月商品采购 = 2, |
||||
|
上月商品退款 = 3, |
||||
|
批量采购商品 = 4, |
||||
|
采购运费 = 5, |
||||
|
入仓运费 = 6, |
||||
|
售后成本 = 7, |
||||
|
发票点数 = 8, |
||||
|
快递单号 = 9, |
||||
|
诚e赊还款 = 10, |
||||
|
空单号 = 11, |
||||
|
购买刷单号 = 12, |
||||
|
手机费 = 13, |
||||
|
质检报告 = 14, |
||||
|
备用金转入 = 15, |
||||
|
平台补贴 = 16, |
||||
|
快递赔付 = 17, |
||||
|
自定义 = 18, |
||||
|
备用金充值 = 19 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 京东仓库类型 1商家仓 2京东仓
|
||||
|
/// </summary>
|
||||
|
public enum StockType |
||||
|
{ |
||||
|
商家仓 = 1, 京仓 = 2 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 仓库状态 0暂停,1使用
|
||||
|
/// </summary>
|
||||
|
public enum StockStatus |
||||
|
{ |
||||
|
暂停 = 0, 使用 = 1 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// SKU库存周期 暂无周期=0,增长期=1,稳定期=2,衰退期=3
|
||||
|
/// </summary>
|
||||
|
public enum SkuStockNumCycleType |
||||
|
{ |
||||
|
暂无周期 = 0, |
||||
|
增长期 = 1, |
||||
|
稳定期 = 2, |
||||
|
衰退期 = 3 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 司南周期 暂无周期 = -1,成长加速期 = 0,成熟利润期 = 1,稳定日销期 = 2,策马奔腾期 = 3
|
||||
|
/// </summary>
|
||||
|
public enum SiNanCycleType |
||||
|
{ |
||||
|
暂无周期 = -1, |
||||
|
成长加速期 = 0, |
||||
|
成熟利润期 = 1, |
||||
|
稳定日销期 = 2, |
||||
|
策马奔腾期 = 3 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 促销任务状态 等待 = 0,进行中 = 1,已完成 = 2, 已停止 = 3
|
||||
|
/// </summary>
|
||||
|
public enum PromitionTaskStatus |
||||
|
{ |
||||
|
等待 = 0, |
||||
|
进行中 = 1, |
||||
|
已完成 = 2, |
||||
|
已停止 = 3 |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// AppKey类型 全类型 = 0, 订单管理 = 1, 商品管理 = 2
|
||||
|
/// </summary>
|
||||
|
public enum AppKeyType |
||||
|
{ |
||||
|
全类型 = 0, 订单管理 = 1, 商品管理 = 2 |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
|
||||
|
FreeSql.Generator -Razor 1 -NameOptions 1,0,0,0 -NameSpace BBWYB.Server.Model.Db -DB "MySql,data source=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;port=3306;user id=qyroot;password=kaicn1132+-;initial catalog=mds;charset=utf8;sslmode=none;" -FileName "{name}.cs" |
@ -0,0 +1,2 @@ |
|||||
|
|
||||
|
FreeSql.Generator -Razor 1 -NameOptions 1,0,0,0 -NameSpace BBWYB.Server.Model.Db -DB "MySql,data source=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;port=3306;user id=qyroot;password=kaicn1132+-;initial catalog=bbwyb;charset=utf8;sslmode=none;" -FileName "{name}.cs" |
Loading…
Reference in new issue