|
@@ -1,10 +1,24 @@
|
|
|
+using IMCS.CCS.Services;
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
+using Quartz.Impl;
|
|
|
+using Quartz;
|
|
|
using StackExchange.Redis;
|
|
|
+using System.ComponentModel.Design;
|
|
|
using WCS.Common;
|
|
|
+using WCS.Common.Redis;
|
|
|
+using WCS.Config;
|
|
|
+using WCS.Repository;
|
|
|
+using WCS.Service;
|
|
|
+using WCS.Service.Impl;
|
|
|
+using WCS.Service.Jobs;
|
|
|
+using WCS.Services;
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// Add services to the container.
|
|
|
-// 配置 Redis 连接
|
|
|
+// 锟斤拷锟斤拷 Redis 锟斤拷锟斤拷
|
|
|
var redisConfiguration = builder.Configuration.GetConnectionString("Redis");
|
|
|
builder.Services.AddSingleton<IConnectionMultiplexer>(ConnectionMultiplexer.Connect(redisConfiguration));
|
|
|
|
|
@@ -19,19 +33,91 @@ builder.Services.AddSwaggerGen();
|
|
|
|
|
|
|
|
|
|
|
|
+// 注锟斤拷 Repository
|
|
|
+builder.Services.AddScoped<IDeviceRepository, DeviceRepository>();
|
|
|
+builder.Services.AddScoped<ITaskCallbackRepository, TaskCallbackRepository>();
|
|
|
+builder.Services.AddScoped<IWcsActionAddressRepository, WcsActionAddressRepository>();
|
|
|
+builder.Services.AddScoped<IWcsActionRepository, WcsActionRepository>();
|
|
|
+
|
|
|
+// 注锟斤拷 Service
|
|
|
+builder.Services.AddScoped<ITTaskService, TTaskService>();
|
|
|
+builder.Services.AddScoped<ITaskCallbackService, TaskCallbackService>();
|
|
|
+builder.Services.AddScoped<IWcsActionAddressService, WcsActionAddressService>();
|
|
|
+builder.Services.AddScoped<IWcsActionService, WcsActionService>();
|
|
|
+
|
|
|
+/*builder.Services.AddAutoMapper(typeof(AutoMapperConfig));
|
|
|
+//锟侥硷拷锟斤拷锟捷凤拷锟斤拷
|
|
|
+builder.Services.AddTransient<IDataService, DataService>();
|
|
|
+//锟斤拷目锟斤拷锟斤拷
|
|
|
+builder.Services.AddTransient<IProjectService, ProjectService>();
|
|
|
+//锟斤拷锟斤拷锟斤拷锟�
|
|
|
+builder.Services.AddTransient<ITaskService, TaskService>();
|
|
|
+//锟斤拷时锟斤拷锟斤拷 锟斤拷锟斤拷
|
|
|
+builder.Services.AddTransient<IQuartzJobService, QuartzJobService>();
|
|
|
+//注锟斤拷ISchedulerFactory锟斤拷实锟斤拷锟斤拷
|
|
|
+builder.Services.AddTransient<ISchedulerFactory, StdSchedulerFactory>();
|
|
|
+//web api 锟斤拷锟斤拷锟斤拷锟�
|
|
|
+builder.Services.AddTransient<IApiRequestService, ApiRequestService>();
|
|
|
+//Job 实锟斤拷锟斤拷锟斤拷锟斤拷
|
|
|
+builder.Services.AddSingleton<ResultfulApiJobFactory>();
|
|
|
+//Reultful 锟斤拷锟� api 锟斤拷锟斤拷 锟斤拷锟斤拷
|
|
|
+builder.Services.AddTransient<ResultfulApiJob>();
|
|
|
+//锟斤拷锟斤拷锟斤拷志
|
|
|
+builder.Services.AddSingleton<IJobLoggerService, JobLoggerService>();
|
|
|
+//锟斤拷目锟斤拷锟斤拷锟斤拷息
|
|
|
+builder.Services.AddSingleton<IDataStorageConfigurationService, DataStorageConfigurationService>();*/
|
|
|
+//redis 注锟斤拷
|
|
|
+//RepositoryRedisModule.RegisterRedisRepository(services, Configuration["RedisConnectionString"]);
|
|
|
+//services.AddScoped<IRedisService, RedisService>();
|
|
|
+
|
|
|
+//builder.Services.AddTransient<IUserService, UserService>();
|
|
|
+//builder.Services.AddTransient<IUserRepository, UserRepository>();
|
|
|
+//builder.Services.AddScoped<IDeviceService, DeviceService>();
|
|
|
+//builder.Services.AddScoped<IHttpRequestService, HttpRequestService>();
|
|
|
+//builder.Services.AddScoped<IEquipmentMonitorService, EquipmentMonitorService>();
|
|
|
+builder.Services.AddScoped<ITaskCallbackService, TaskCallbackService>();
|
|
|
+//builder.Services.AddScoped<IDictionaryService, DictionaryService>();
|
|
|
+builder.Services.AddScoped<IWcsActionService, WcsActionService>();
|
|
|
+//builder.Services.AddScoped<IWcsTagValueService, WcsTagValueService>();
|
|
|
+//builder.Services.AddScoped<ITaskJobService, TaskJobService>();
|
|
|
+builder.Services.AddScoped<IWcsActionAddressService, WcsActionAddressService>();
|
|
|
+
|
|
|
+builder.Services.AddScoped<IDeviceRepository, DeviceRepository>();
|
|
|
+//builder.Services.AddScoped<IEquipmentMonitorRepository, EquipmentMonitorRepository>();
|
|
|
+builder.Services.AddScoped<ITaskCallbackRepository, TaskCallbackRepository>();
|
|
|
+//builder.Services.AddScoped<IDictionaryRepository, DictionaryRepository>();
|
|
|
+builder.Services.AddScoped<IWcsActionRepository, WcsActionRepository>();
|
|
|
+//builder.Services.AddScoped<ICcsTagValueRepository, CcsTagValueRepository>();
|
|
|
+builder.Services.AddScoped<IWcsActionAddressRepository, WcsActionAddressRepository>();
|
|
|
+
|
|
|
var app = builder.Build();
|
|
|
|
|
|
-// Configure the HTTP request pipeline.
|
|
|
+
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
{
|
|
|
+ app.UseDeveloperExceptionPage();
|
|
|
app.UseSwagger();
|
|
|
- app.UseSwaggerUI();
|
|
|
+ app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Your API V1"));
|
|
|
}
|
|
|
|
|
|
-app.UseHttpsRedirection();
|
|
|
+// 锟斤拷锟矫撅拷态锟侥硷拷锟叫硷拷锟�
|
|
|
+app.UseStaticFiles();
|
|
|
|
|
|
-app.UseAuthorization();
|
|
|
+// 锟斤拷锟斤拷默锟斤拷锟侥硷拷锟叫硷拷锟�
|
|
|
+app.UseDefaultFiles();
|
|
|
|
|
|
-app.MapControllers();
|
|
|
+// 锟斤拷锟斤拷路锟斤拷
|
|
|
+app.UseRouting();
|
|
|
+
|
|
|
+// 锟斤拷锟斤拷锟斤拷锟斤拷锟截讹拷锟斤拷 HTML 页锟斤拷
|
|
|
+app.UseEndpoints(endpoints =>
|
|
|
+{
|
|
|
+ endpoints.MapControllers();
|
|
|
+ endpoints.MapGet("/", context =>
|
|
|
+ {
|
|
|
+ context.Response.Redirect("/client/index.html");
|
|
|
+ return Task.CompletedTask;
|
|
|
+ });
|
|
|
+});
|
|
|
|
|
|
-app.Run();
|
|
|
+app.Run();
|