财务相关基本表
parent
94cb7e9cb7
commit
91724738c6
@ -0,0 +1,128 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 费用代码设置
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("fee_code", "费用代码设置")]
|
||||
public class FeeCode : BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 费用代码 录入费用是作为检索
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "费用代码", Length = 20)]
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 费用名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "费用名称", Length = 50)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 费用英文名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "费用英文名称", Length = 50)]
|
||||
public string EnName { get; set; }
|
||||
/// <summary>
|
||||
/// 币别Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "币别Id")]
|
||||
public long CurrencyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认计费标准
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认计费标准", DefaultValue = "0")]
|
||||
public int DefaultUnit { get; set; }
|
||||
/// <summary>
|
||||
/// 默认收费客户类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认收费客户类型", DefaultValue = "0")]
|
||||
public int DefaultDebit { get; set; }
|
||||
/// <summary>
|
||||
/// 默认付费客户类型
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认付费客户类型", DefaultValue = "0")]
|
||||
public int DefaultCredit { get; set; }
|
||||
/// <summary>
|
||||
/// 海运 海运相关模块使用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "海运", DefaultValue = "0")]
|
||||
public bool? IsSea { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 空运 空运相关模块使用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "空运", DefaultValue = "0")]
|
||||
public bool? IsAir { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 陆运 陆运相关模块使用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "陆运", DefaultValue = "0")]
|
||||
public bool? IsTrucking { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 是否陆运固定费用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否陆运固定费用", DefaultValue = "0")]
|
||||
public bool? IsTruckingFixed { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 仓储 仓储相关模块使用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "仓储", DefaultValue = "0")]
|
||||
public bool? IsWms { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 是否垫付费用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否垫付费用", DefaultValue = "0")]
|
||||
public bool? IsAdvancedPay { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 默认是否机密
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认是否机密", DefaultValue = "0")]
|
||||
public bool? IsOpen { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 默认是否开票
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认是否开票", DefaultValue = "0")]
|
||||
public bool? IsInvoice { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 费用默认税率
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "费用默认税率", IsNullable = true, Length = 18, DecimalDigits = 4, DefaultValue = "0")]
|
||||
public decimal? TaxRate { get; set; }
|
||||
/// <summary>
|
||||
/// 费用分组 枚举可维护
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "费用分组", IsNullable = true, Length = 30)]
|
||||
public string FeeGroup { get; set; }
|
||||
/// <summary>
|
||||
/// 费用默认FRT 枚举可维护
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "费用默认FRT", IsNullable = true, Length = 20)]
|
||||
public string FeeFrt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认发票费用名称 发票费用名称模块可维护
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认发票费用名称", IsNullable = true, Length = 30)]
|
||||
public string GoodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对帐类型 枚举可维护
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "对帐类型", IsNullable = true, Length = 30)]
|
||||
public string CheckingType { get; set; }
|
||||
/// <summary>
|
||||
/// 默认币别
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认币别", Length = 20)]
|
||||
public string DefaultCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态", DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 币别信息表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("fee_currency","币别信息表")]
|
||||
public class FeeCurrency: BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 币别代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "币别代码", Length = 10)]
|
||||
public string CodeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 币别名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "币别名称", Length = 20)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "描述", Length = 200,IsNullable = true)]
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// 财务软件代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "财务软件代码", Length = 30, IsNullable = true)]
|
||||
public string FinanceSoftCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 默认对人民币汇率
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "默认对人民币汇率", IsNullable = true, Length = 18, DecimalDigits = 5, DefaultValue = "0")]
|
||||
public decimal? DefaultRate { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 汇率设置表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("fee_currency_exchange", "汇率设置表")]
|
||||
public class FeeCurrencyExchange: BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 币别Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "币别Id")]
|
||||
public long CurrencyId { get; set; }
|
||||
/// <summary>
|
||||
/// 币别代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "币别代码", Length = 10)]
|
||||
public string CurrencyCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应收汇率
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "应收汇率", IsNullable = true, Length = 18, DecimalDigits = 5, DefaultValue = "0")]
|
||||
public decimal? DRValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应付汇率
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "应付汇率", IsNullable = true, Length = 18, DecimalDigits = 5, DefaultValue = "0")]
|
||||
public decimal? CRValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 海关汇率
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "海关汇率", IsNullable = true, Length = 18, DecimalDigits = 6, DefaultValue = "0")]
|
||||
public decimal? CustomValue { get; set; }
|
||||
/// <summary>
|
||||
/// 开始日期
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(ColumnDescription = "开始日期", IsNullable = false)]
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 结束日期
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(ColumnDescription = "结束日期", IsNullable = false)]
|
||||
public DateTime EndDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 本位币
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "本位币", Length = 10)]
|
||||
public string LocalCurrency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 费用模板主表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("fee_template", "费用模板主表")]
|
||||
public class FeeTemplate: BaseOrgModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 模板名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 50)]
|
||||
public string TemplateName { get; set; }
|
||||
/// <summary>
|
||||
/// 业务类型(海运出口、海运进口、空运出口、空运进口)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "业务类型 海运出口、海运进口、空运出口、空运进口", IsNullable = false, DefaultValue = "0")]
|
||||
public int OpType { get; set; }
|
||||
/// <summary>
|
||||
/// 收付类型(收、付)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "收付类型(收、付)", IsNullable = false, DefaultValue = "1")]
|
||||
public int FeeType { get; set; }
|
||||
/// <summary>
|
||||
/// 是否公共标识
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否公共标识", IsNullable = false, DefaultValue = "0")]
|
||||
public bool IsPublic { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "描述", Length = 200, IsNullable = true)]
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
2024-04-15 15:20:27.0864 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:20:27.1451 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:20:27.1626 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:20:27.2029 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:20:27.2252 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:20:27.2252 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:20:27.2547 Info Configuration initialized.
|
||||
2024-04-15 15:27:54.5732 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:27:54.6179 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:27:54.6315 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:27:54.6628 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:27:54.6782 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:27:54.6782 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:27:54.7133 Info Configuration initialized.
|
||||
2024-04-15 15:32:22.0445 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:32:22.0812 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:32:22.0981 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:32:22.1278 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:32:22.1484 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:32:22.1484 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:32:22.1833 Info Configuration initialized.
|
||||
2024-04-15 15:33:00.9777 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:33:01.0292 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:33:01.0446 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:33:01.0809 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:33:01.1083 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:33:01.1306 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:33:01.1626 Info Configuration initialized.
|
@ -1,32 +1,85 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using DS.Module.AutofacModule;
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.ServiceExtensions;
|
||||
using DS.Module.ExcelModule;
|
||||
using DS.Module.Jwt;
|
||||
using DS.Module.MultiLanguage;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.Swagger;
|
||||
using DS.Module.UserModule;
|
||||
using NLog.Web;
|
||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var environment = builder.Environment.EnvironmentName;
|
||||
Console.WriteLine("当前开发环境:" + environment);
|
||||
//注册配置
|
||||
builder.Configuration
|
||||
// .SetBasePath(builder.Environment.ContentRootPath)
|
||||
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
|
||||
// .AddJsonFile(path: $"appsettings.{environment}.json", optional: true, reloadOnChange: true)
|
||||
.Build();
|
||||
builder.Configuration.AddEnvironmentVariables();
|
||||
builder.Logging.AddNLog("nlog.config");
|
||||
// Add services to the container.
|
||||
//Autofac注入
|
||||
builder.Host
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
.ConfigureContainer<ContainerBuilder>(builder => { builder.RegisterModule(new AutofacModuleRegister()); });
|
||||
|
||||
builder.Services.AddAppWebInstal();
|
||||
builder.Services.AddCorsInstall();
|
||||
builder.Services.AddUserModuleInstall(); //用户服务
|
||||
builder.Services.AddSqlSugarInstall();
|
||||
builder.Services.AddSwaggerInstall();
|
||||
builder.Services.AddJwtInstall();
|
||||
builder.Services.AddSaasDbInstall();//分库服务
|
||||
builder.Services.AddMultiLanguageInstall();//多语言服务
|
||||
// builder.Services.AddEndpointsApiExplorer();
|
||||
// builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
var summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
app.MapGet("/weatherforecast", () =>
|
||||
// if (app.Environment.IsDevelopment())
|
||||
// {
|
||||
// app.UseSwagger();
|
||||
// app.UseSwaggerUI();
|
||||
// }
|
||||
//swagger
|
||||
// app.UseSwagger();
|
||||
var documentName = AppSetting.app(new string[] { "SwaggerDoc", "ContactName" });
|
||||
app
|
||||
.UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; })
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/" + documentName + "/swagger.json",
|
||||
AppSetting.app(new string[] { "SwaggerDoc", "ContactName" }));
|
||||
c.DocExpansion(DocExpansion.None);//DocExpansion设置为None可折叠所有方法
|
||||
c.DefaultModelExpandDepth(-1);//-1 可不显示Models
|
||||
});
|
||||
//跨域
|
||||
var policyName = AppSetting.app(new string[] { "Cors", "PolicyName" });
|
||||
if (!policyName.IsNullOrEmpty())
|
||||
{
|
||||
var forecast = Enumerable.Range(1, 5).Select(index =>
|
||||
new WeatherForecast
|
||||
(
|
||||
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
Random.Shared.Next(-20, 55),
|
||||
summaries[Random.Shared.Next(summaries.Length)]
|
||||
))
|
||||
.ToArray();
|
||||
return forecast;
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
||||
internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
||||
{
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
app.UseCors(policyName); //添加跨域中间件
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseStaticFiles();
|
||||
//多语言中间件
|
||||
app.UseMiddleware<MultiLanguageMiddleware>();
|
||||
// //操作日志中间件
|
||||
// app.UseMiddleware<OperationLogMiddleware>();
|
||||
|
||||
// 先开启认证
|
||||
app.UseAuthentication();
|
||||
// 然后是授权中间件
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||
|
||||
app.Run();
|
@ -0,0 +1,28 @@
|
||||
2024-04-15 15:00:48.5171 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:00:48.5427 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:00:48.5427 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:00:48.5807 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:00:48.6000 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:00:48.6000 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:00:48.6381 Info Configuration initialized.
|
||||
2024-04-15 15:03:35.2260 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:03:35.3087 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:03:35.3264 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:03:35.3876 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:03:35.4222 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:03:35.4429 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:03:35.4753 Info Configuration initialized.
|
||||
2024-04-15 15:09:02.9155 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:09:03.0128 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:09:03.0305 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:09:03.0709 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:09:03.1008 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Release\net8.0\nlog.config
|
||||
2024-04-15 15:09:03.1008 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:09:03.1384 Info Configuration initialized.
|
||||
2024-04-15 15:09:48.7695 Info Registered target NLog.Targets.FileTarget(Name=allfile)
|
||||
2024-04-15 15:09:48.8119 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
|
||||
2024-04-15 15:09:48.8274 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
|
||||
2024-04-15 15:09:48.8717 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
|
||||
2024-04-15 15:09:48.9040 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.OpApi\bin\Debug\net8.0\nlog.config
|
||||
2024-04-15 15:09:48.9178 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
|
||||
2024-04-15 15:09:48.9450 Info Configuration initialized.
|
@ -1,32 +1,85 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using DS.Module.AutofacModule;
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.ServiceExtensions;
|
||||
using DS.Module.ExcelModule;
|
||||
using DS.Module.Jwt;
|
||||
using DS.Module.MultiLanguage;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.Swagger;
|
||||
using DS.Module.UserModule;
|
||||
using NLog.Web;
|
||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var environment = builder.Environment.EnvironmentName;
|
||||
Console.WriteLine("当前开发环境:" + environment);
|
||||
//注册配置
|
||||
builder.Configuration
|
||||
// .SetBasePath(builder.Environment.ContentRootPath)
|
||||
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
|
||||
// .AddJsonFile(path: $"appsettings.{environment}.json", optional: true, reloadOnChange: true)
|
||||
.Build();
|
||||
builder.Configuration.AddEnvironmentVariables();
|
||||
builder.Logging.AddNLog("nlog.config");
|
||||
// Add services to the container.
|
||||
//Autofac注入
|
||||
builder.Host
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
.ConfigureContainer<ContainerBuilder>(builder => { builder.RegisterModule(new AutofacModuleRegister()); });
|
||||
|
||||
builder.Services.AddAppWebInstal();
|
||||
builder.Services.AddCorsInstall();
|
||||
builder.Services.AddUserModuleInstall(); //用户服务
|
||||
builder.Services.AddSqlSugarInstall();
|
||||
builder.Services.AddSwaggerInstall();
|
||||
builder.Services.AddJwtInstall();
|
||||
builder.Services.AddSaasDbInstall();//分库服务
|
||||
builder.Services.AddMultiLanguageInstall();//多语言服务
|
||||
// builder.Services.AddEndpointsApiExplorer();
|
||||
// builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
var summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
app.MapGet("/weatherforecast", () =>
|
||||
// if (app.Environment.IsDevelopment())
|
||||
// {
|
||||
// app.UseSwagger();
|
||||
// app.UseSwaggerUI();
|
||||
// }
|
||||
//swagger
|
||||
// app.UseSwagger();
|
||||
var documentName = AppSetting.app(new string[] { "SwaggerDoc", "ContactName" });
|
||||
app
|
||||
.UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; })
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/" + documentName + "/swagger.json",
|
||||
AppSetting.app(new string[] { "SwaggerDoc", "ContactName" }));
|
||||
c.DocExpansion(DocExpansion.None);//DocExpansion设置为None可折叠所有方法
|
||||
c.DefaultModelExpandDepth(-1);//-1 可不显示Models
|
||||
});
|
||||
//跨域
|
||||
var policyName = AppSetting.app(new string[] { "Cors", "PolicyName" });
|
||||
if (!policyName.IsNullOrEmpty())
|
||||
{
|
||||
var forecast = Enumerable.Range(1, 5).Select(index =>
|
||||
new WeatherForecast
|
||||
(
|
||||
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
Random.Shared.Next(-20, 55),
|
||||
summaries[Random.Shared.Next(summaries.Length)]
|
||||
))
|
||||
.ToArray();
|
||||
return forecast;
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
||||
internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
||||
{
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
app.UseCors(policyName); //添加跨域中间件
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseStaticFiles();
|
||||
//多语言中间件
|
||||
app.UseMiddleware<MultiLanguageMiddleware>();
|
||||
// //操作日志中间件
|
||||
// app.UseMiddleware<OperationLogMiddleware>();
|
||||
|
||||
// 先开启认证
|
||||
app.UseAuthentication();
|
||||
// 然后是授权中间件
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||
|
||||
app.Run();
|
Loading…
Reference in New Issue