代码拉取完成,页面将自动刷新
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Owin;
using WasWebServerCore.Infrastructure.Authorization.RolesToPermission;
using WasWebServerCore.Infrastructure.Services;
using WasWebServer.WebApis.ICLElement.Models;
using WasWebServer.WebApis.Inbound.Models;
using WasWebServer.WebApis.Material.Models;
using WasWebServer.WebApis.Outbound.Models;
using WasWebServer.WebApis.PullOff.Models;
using WasWebServer.WebApis.PutAway.Models;
using WasWebServer.WebApis.Shipment.Models;
using WasWebServer.WebApis.WavePicking.Models;
using WasWebServer.WebApis.PalletConveyor.Models;
using WasWebServer.WebApis.CartonConveyor.Models;
using WasWebServer.WebApis.Srm.Models;
using WasWebServer.WebApis.Transport.Models;
using WasWebServer.WebApis.Executor.Models;
using WasWebServer.WebApis.WorkTaskProcess.Models;
using WasWebServer.WebApis.DisplayMessage.Models;
using WasWebServer.WebApis.AlarmEvent.Models;
using WasWebServer.WebApis.Route.Models;
using WasWebServer.WebApis.OperationTracing.Models;
using WasWebServer.WebApis.SystemParameter.Models;
using WasWebServer.WebApis.WcsSimulation.Models;
using WasWebServer.WebApis.Picking.Models;
using WasWebServer.WebApis.GoodReceives.Models;
using WasWebServer.WebApis.Agv.Models;
using WasWebServer.WebApis.ExtendRelation.Models;
using WasWebServer.WebApis.Report.Models;
using WasWebServerCore.DataBaseModels.WmsDataContext;
using WasWebServerCore.DataBaseModels.WcsDataContext;
using WasWebServerCore.DataBaseModels.BasicDataContext;
using WasWebServerCore.DataTransferObjects.WcsDto;
using WasWebServerCore.Filters;
using WasWebServerCore.WebApis.Inbound.Models;
using WasWebServerCore.WebApis.Printer.Models;
using WasWebServerCore.WebApis.SleemonInterface.Models;
using WasWebServerCore.WebApis.Report.Models;
using LocationDto = WasWebServer.WebApis.ICLElement.Models.LocationDto;
namespace WasWebServerCore
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Mapper.Initialize(cfg =>
{
//Outbound
cfg.CreateMap<OutboundOrderHeads, OutboundOrderHeadsDto>();
cfg.CreateMap<OutboundOrderLines, OutboundOrderLinesDto>();
cfg.CreateMap<OutboundExecuteWorkTasks, OutboundExecuteWorkTasksDto>();
cfg.CreateMap<OutboundSubWorkTasks, OutboundSubWorkTasksDto>();
cfg.CreateMap<OutboundOrderBussinessTypes, OutboundOrderBussinessTypeDto>();
cfg.CreateMap<OutboundOrderTypes, OutboundOrderTypesDto>();
cfg.CreateMap<OutboundTaskTypes, OutboundTaskTypesDto>();
cfg.CreateMap<PrepareGoodsExecuteWorkTasks, OutboundPrepareGoodsExecuteWorkTasksDto>();
cfg.CreateMap<OutboundOrderLines, OutboundPrepareOrderDto>();
cfg.CreateMap<Locations, LocationRateReportDto>();
cfg.CreateMap<InventoryItems, InventoriesAgeReportDto>();
cfg.CreateMap<InboundOrderLines, ProductionInboundReportDto>();
cfg.CreateMap<InboundExecuteWorkTasks, InboundFlowReportDto>();
cfg.CreateMap<Inventories, InventoriesBySkuReportDto>();
cfg.CreateMap<PickingSubWorkTasks, OutboundFlowReportDto>();
//Inbound
cfg.CreateMap<InboundOrderHeads, InboundOrderHeadsDto>();
cfg.CreateMap<InboundOrderLines, InboundOrderLinesDto>();
cfg.CreateMap<InboundExecuteWorkTasks, InboundExecuteWorkTasksDto>();
cfg.CreateMap<InboundTaskTypes, InboundTaskTypesDto>();
cfg.CreateMap<InboundOrderTypes, InboundOrderTypesDto>();
cfg.CreateMap<InboundOrderBussinessTypes, InboundOrderBussinessTypesDto>();
cfg.CreateMap<InboundSubWorkTasks, InboundSubWorkTasksDto>();
cfg.CreateMap<InboundOrderConfigurations, InboundOrderConfigurationsDto>();
cfg.CreateMap<PalletizationExecuteWorkTasks, InboundPalletizationExecuteWorkTasksDto>();
//Receiving
cfg.CreateMap<ReceivingOrderHeads, GoodReceivesOrderHeadsDto>();
cfg.CreateMap<ReceivingOrderLines, GoodReceivesOrderLinesDto>();
cfg.CreateMap<ReceivingExecuteWorkTasks, GoodReceivesExecuteWorkTasksDto>();
//WavePicking
cfg.CreateMap<WavePickingOrderHeads, WavePickingOrderHeadsDto>();
cfg.CreateMap<WavePickingOrderLines, WavePickingOrderLinesDto>();
//Shipment
cfg.CreateMap<ShippingOrderHeads, ShipmentOrderHeadsDto>();
cfg.CreateMap<ShippingOrderLines, ShipmentOrderLinesDto>();
cfg.CreateMap<ShippingExecuteWorkTasks, ShipmentExecuteWorkTasksDto>();
//PutAway
cfg.CreateMap<PutAwayExecuteWorkTasks, PutAwayExecuteWorkTasksDto>();
cfg.CreateMap<PutAwaySubWorkTasks, PutAwaySubWorkTasksDto>();
cfg.CreateMap<PutAwayExecuteWorkTasks, PutAwayExecuteDto>();
cfg.CreateMap<PutAwaySubWorkTasks, PutAwaySubDto>();
//ICLElement
cfg.CreateMap<Inventories, InventoriesDto>();
cfg.CreateMap<InventoryHistories, InventoryHistoriesDto>();
cfg.CreateMap<InventoryItems, InventoriesAgeReportDto>();
cfg.CreateMap<InventoryItemHistoriesDto, InventoryItemHistoriesDto>();
cfg.CreateMap<Containers, ContainersDto>();
cfg.CreateMap<ContainerTypes, ContainerTypesDto>();
cfg.CreateMap<Locations, LocationDto>();
cfg.CreateMap<LocationTypes, LocationTypesDto>();
cfg.CreateMap<Locations, WareHouseViewDto>();
cfg.CreateMap<LocationInfoes, LocationInfoDto>();
//PullOff
cfg.CreateMap<PullOffExecuteWorkTasks, PullOffExecuteWorkTasksDto>();
cfg.CreateMap<PullOffSubWorkTasks, PullOffSubWorkTasksDto>();
cfg.CreateMap<PullOffExecuteWorkTasks, PullOffExecuteDto>();
//Picking
cfg.CreateMap<PickingExecuteWorkTasks, PickingExecuteWorkTasksDto>();
cfg.CreateMap<PickingSubWorkTasks, PickingSubWorkTasksDto>();
//Material
cfg.CreateMap<SubSkus, SubSkusDto>();
cfg.CreateMap<SkuTypes, TypeSkusDto>();
cfg.CreateMap<PrimarySkus, PrimarySkusDto>();
//PalletConveyor
cfg.CreateMap<PalletConveyorExecuteWorkTasks, PalletConveyorExecuteWorkTasksDto>();
cfg.CreateMap<PalletConveyorMessageWorkTasks, PalletConveyorMessageWorkTasksDto>();
cfg.CreateMap<PalletConveyorPkMsgWorkTasks, PalletConveyorPkMsgWorkTasksDto>();
cfg.CreateMap<PalletConveyorExecuteWorkTasks, PalletConveyorExecuteDto>();
cfg.CreateMap<PalletConveyorMessageWorkTasks, PalletConveyorMessageDto>();
cfg.CreateMap<PalletConveyorPkMsgWorkTasks, PalletConveyorPkMessageDto>();
//CartonConveyor
cfg.CreateMap<CartonConveyorExecuteWorkTasks, CartonConveyorExecuteWorkTasksDto>();
cfg.CreateMap<CartonConveyorSubWorkTasks, CartonConveyorSubWorkTasksDto>();
cfg.CreateMap<CartonConveyorMessageWorkTasks, CartonConveyorMessageWorkTasksDto>();
//Srm
cfg.CreateMap<SrmExecuteWorkTasks, SrmExecuteWorkTasksDto>();
cfg.CreateMap<SrmMessageWorkTasks, SrmMessageWorkTasksDto>();
cfg.CreateMap<SrmExecuteWorkTasks, SrmExecuteDto>();
cfg.CreateMap<SrmMessageWorkTasks, SrmMessageDto>();
//Transport
cfg.CreateMap<TransportSourceWorkTasks, TransportSourceWorkTasksDto>();
cfg.CreateMap<TransportSubWorkTasks, TransportSubWorkTasksDto>();
cfg.CreateMap<TransportExecuteWorkTasks, TransportExecuteWorkTasksDto>();
cfg.CreateMap<TransportRegulars, TransportRegularsDto>();
cfg.CreateMap<TransportSourceWorkTasks, TransportSourceDto>();
cfg.CreateMap<TransportSubWorkTasks, TransportSubDto>();
cfg.CreateMap<TransportExecuteWorkTasks, TransportExecuteDto>();
//Executors
cfg.CreateMap<Executors, ExecutorsDto>();
//WorkTaskProcesses
cfg.CreateMap<WorkTaskProcesses, WorkTaskProcessesDto>();
//DisplayMessages
cfg.CreateMap<DisplayMessages, DisplayMessagesDto>();
//AlarmEvent
cfg.CreateMap<AlarmEventTypes, AlarmEventTypesDto>();
cfg.CreateMap<AlarmEventRecords, AlarmEventRecordsDto>();
//Route
cfg.CreateMap<RouteMaps, RouteMapDto>();
cfg.CreateMap<RouteNodes, RouteNodeDto>();
cfg.CreateMap<RouteEdges, RouteEdgeDto>();
//OperationTracings
cfg.CreateMap<OperationTracings, OperationTracingsDto>();
//SystemParameter
cfg.CreateMap<SystemParameterTemplates, SystemParameterTemplatesDto>();
cfg.CreateMap<SystemParameters, SystemParametersDto>();
//WcsSimulation
cfg.CreateMap<WcsSimulationExecuteWorkTasks, WcsSimulationExecuteWorkTasksDto>();
//Agv
cfg.CreateMap<AgvMessageWorkTasks, AgvMessageWorkTasksDto>();
cfg.CreateMap<AgvExecuteWorkTasks, AgvExecuteWorkTasksDto>();
//ExtendRelation
cfg.CreateMap<ExtendRelations, ExtendRelationsDto>();
//Report
cfg.CreateMap<ReportButtons, ReportButtonsDto>();
cfg.CreateMap<InboundOrderLines, ProductionInboundReportDto>();
cfg.CreateMap<InventoryItems, InventoryItemReportDto>();
//Printer
cfg.CreateMap<PrinterExecuteWorkTasks, PrinterExecuteWorkTasksDto>();
//SleemonInterfaces
cfg.CreateMap<SleemonCrminterfaces, SleemonCRMInterfacesDto>();
cfg.CreateMap<SleemonU9interface, SleemonU9InterfaceDto>();
Z.EntityFramework.Extensions.LicenseManager.AddLicense("35;100-213", "239C409B406E024F1C5E23341EC1867E");
});
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options => options.AddPolicy(
"CorsPolicy",
builder => builder
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials()));
services.AddControllersWithViews()
.AddNewtonsoftJson(op => op.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver());
ConfigureAuthService(services);
services.AddSwaggerGen(options =>
{
var info = new OpenApiInfo
{
Title = "WAS HTTP API",
Version = "v1",
Description = "The WAS Microservice HTTP API.",
};
options.SwaggerDoc("v1", info);
// Locate the XML file being generated by ASP.NET...
var xmlFile = $"{typeof(Startup).Assembly.GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
// ... and tell Swagger to use those XML comments.
options.IncludeXmlComments(xmlPath, true);
var securityScheme = new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
Implicit = new OpenApiOAuthFlow
{
AuthorizationUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
TokenUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),
Scopes = new Dictionary<string, string>
{
{ "WasWebServer", "WasWebServer API" },
},
},
},
};
options.AddSecurityDefinition("oauth2", securityScheme);
options.OperationFilter<AuthorizeCheckOperationFilter>();
});
//token
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddTransient<IIdentityService, IdentityService>();
// Register the Permission policy handlers
services.AddSingleton<IAuthorizationPolicyProvider, AuthorizationPolicyProvider>();
services.AddSingleton<IAuthorizationHandler, PermissionHandler>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseCors("CorsPolicy");
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "WasWebServerApi V1");
c.OAuthClientId("waswebserverapi_swaggerui");
c.OAuthAppName("WasWebServerApi Swagger UI");
c.DocumentTitle = "WasWebServerApi Swagger UI";
});
}
public void ConfigureAuthService(IServiceCollection services)
{
services.AddAuthorization();
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
options.Authority = Configuration.GetValue<string>("IdentityUrlExternal");
options.RequireHttpsMetadata = false;
options.Audience = "WasWebServer";
});
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。