100 lines
3.5 KiB
C#
100 lines
3.5 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)
|
|
{
|
|
<<<<<<< HEAD
|
|
WebSoceketManager.InitWebSocket();
|
|
=======
|
|
try
|
|
{
|
|
//初始化websocket
|
|
WebSoceketManager.InitWebSocket();
|
|
|
|
//初始化数据库
|
|
DbInit.InitDb();
|
|
>>>>>>> 7f35077c07959e9571515ee1a1f88123f9e20bd5
|
|
|
|
//初始化配置文件
|
|
LocalFile.SaveConfig();
|
|
|
|
//初始化TCP连接
|
|
TCPClientManager.InitTcpClient();
|
|
|
|
//初始化货架缓存信息
|
|
ShelfManager.InitShelves();
|
|
|
|
//报警信息重发线程
|
|
WarningManager.StartWarningMessageThread();
|
|
|
|
//盟讯公司后台线程
|
|
if (LocalFile.Config.IsMx)
|
|
{
|
|
MXBackgroundThread.InitBackgroundThread();
|
|
var str = string.Empty;
|
|
MXBackgroundThread.SendDingDingMsg("后台服务启动成功", new List<string> { "104379" }, ref str);
|
|
}
|
|
|
|
|
|
|
|
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://0.0.0.0:8888");//0.0.0.0表示仅接收ipv4
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|