Files
wcs/WCS.WebApi/Program.cs
hehaibing-1996 432a96198f fature
2024-05-15 18:59:24 +08:00

78 lines
2.6 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using System.Configuration;
using System.Net;
using System.Net.Http;
using System.Net.Sockets;
using System.Text;
using WCS.BLL.Config;
using WCS.BLL.DbModels;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.WebApi;
using WCS.WebApi.Controllers;
namespace WebApi
{
public class Program
{
public static void Main(string[] args)
{
WebSoceketManager.InitWebSocket();
DbInit.InitDb();
LocalFile.SaveConfig();
TCPClientManager.InitTcpClient();
ShelfManager.InitShelves();
//Æô¶¯¸´Î»±¨¾¯µÆºÍ°å×Ó
//TCPClientManager.InitStatus();
WarningManager.StartWarningMessageThread();
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddScoped<IInstoreService, InstoreService>();
builder.Services.AddScoped<IOutstoreService, OutstoreService>();
builder.Services.AddScoped<IHomerService, HomerService>();
builder.Services.AddScoped<IUserService, UserService>();
builder.Services.AddScoped<IInterfaceRecordService, InterfaceRecordService>();
builder.Services.AddScoped<IMatBaseInfoService, MatBaseInfoService>();
builder.Services.AddScoped<IMatInventoryDetailService, MatInventoryDetailService>();
builder.Services.AddScoped<IStoreInfoService, StoreInfoService>();
builder.Services.AddScoped<IStockTakingService, StockTakingService>();
builder.Services.AddScoped<ISelfCheckService, SelfCheckService>();
builder.Services.AddScoped<IWarningService, WarningService>();
builder.Services.AddScoped<IInOutRecordService, InOutRecordService>();
//Éú³ÉÎïÁÏÂë¡¢Éú³Éµ¥¾ÝÂë²ÉÓõ¥Àýģʽ
builder.Services.AddSingleton<IGenerateService, GenerateService>();
var app = builder.Build();
app.UseMiddleware<RequestResponseLoggingMiddleware>();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseAuthorization();
app.MapControllers();
app.Run("http://+:8888");
}
}
}