Browse Source

[add]增加XmlHost

master
贾荣国 3 years ago
parent
commit
64be845c9b
  1. 13
      WebApiService/Win_in.Sfs.Scp.WebApi.sln
  2. 39
      WebApiService/src/TestHost/Controllers/WeatherForecastController.cs
  3. 26
      WebApiService/src/TestHost/Program.cs
  4. 31
      WebApiService/src/TestHost/Properties/launchSettings.json
  5. 29
      WebApiService/src/TestHost/Startup.cs
  6. 17
      WebApiService/src/TestHost/TestHost.csproj
  7. 47
      WebApiService/src/TestHost/TestModule.cs
  8. 15
      WebApiService/src/TestHost/WeatherForecast.cs
  9. 9
      WebApiService/src/TestHost/appsettings.Development.json
  10. 10
      WebApiService/src/TestHost/appsettings.json
  11. 20
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDto.cs
  12. 68
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartDTO.cs
  13. 22
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/CreatePurchaseOrderDetailValidator.cs
  14. 21
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs
  15. 24
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDTO.cs
  16. 47
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDetailDTO.cs
  17. 21
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDTO.cs
  18. 25
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptDTO.cs
  19. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/RouteConsts.cs
  20. 18
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs
  21. 23
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierDTO.cs
  22. 16
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptCreateDTO.cs
  23. 21
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptDTO.cs
  24. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  25. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  26. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  27. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  28. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  29. 16
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs
  30. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityDetailDtoBase.cs
  31. 21
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityDtoBase.cs
  32. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs
  33. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  34. 83
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthHttpModule.cs
  35. 41
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs
  36. 33
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs
  37. 33
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs
  38. 33
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs
  39. 32
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs
  40. 36
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs
  41. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs
  42. 5285
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt
  43. 59
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Program.cs
  44. 15
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Properties/launchSettings.json
  45. 75
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs
  46. 27
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in - Backup.Sfs.Scp.WebApi.Xml.Host.csproj
  47. 21
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj
  48. 41
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XDocumentInputFormatter.cs
  49. 9
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/appsettings.Development.json
  50. 20
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/appsettings.json
  51. 3
      WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/WebApiConsoleApiClientModule.cs

13
WebApiService/Win_in.Sfs.Scp.WebApi.sln

@ -35,11 +35,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.DbMig
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.HttpApi.Host", "src\Win_in.Sfs.Scp.WebApi.HttpApi.Host\Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj", "{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.HttpApi.Host", "src\Win_in.Sfs.Scp.WebApi.HttpApi.Host\Win_in.Sfs.Scp.WebApi.HttpApi.Host.csproj", "{748584B1-BA69-4F6A-81AA-F4BDE6BCE29D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win_in.Sfs.Scp.v1.Domain", "src\Win_in.Sfs.Scp.v1.Domain\Win_in.Sfs.Scp.v1.Domain.csproj", "{3EE98133-3E7A-4B14-A515-12CB039A9EED}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.v1.Domain", "src\Win_in.Sfs.Scp.v1.Domain\Win_in.Sfs.Scp.v1.Domain.csproj", "{3EE98133-3E7A-4B14-A515-12CB039A9EED}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win_in.Sfs.Scp.v1.EntityFrameworkCore", "src\Win_in.Sfs.Scp.v1.EntityFrameworkCore\Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj", "{77D1D3F8-A04C-4688-AC67-C8372BD268A2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.v1.EntityFrameworkCore", "src\Win_in.Sfs.Scp.v1.EntityFrameworkCore\Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj", "{77D1D3F8-A04C-4688-AC67-C8372BD268A2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win_in.Sfs.Scp.v1.Event", "src\Win_in.Sfs.Scp.v1.Event\Win_in.Sfs.Scp.v1.Event.csproj", "{45EED43B-B235-4C24-9176-3B7992DA4D6E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.v1.Event", "src\Win_in.Sfs.Scp.v1.Event\Win_in.Sfs.Scp.v1.Event.csproj", "{45EED43B-B235-4C24-9176-3B7992DA4D6E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Win_in.Sfs.Scp.WebApi.Xml.Host", "src\Win_in.Sfs.Scp.WebApi.Xml.Host\Win_in.Sfs.Scp.WebApi.Xml.Host.csproj", "{98CDED94-F046-4010-88F4-700B7481169E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -115,6 +117,10 @@ Global
{45EED43B-B235-4C24-9176-3B7992DA4D6E}.Debug|Any CPU.Build.0 = Debug|Any CPU {45EED43B-B235-4C24-9176-3B7992DA4D6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45EED43B-B235-4C24-9176-3B7992DA4D6E}.Release|Any CPU.ActiveCfg = Release|Any CPU {45EED43B-B235-4C24-9176-3B7992DA4D6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45EED43B-B235-4C24-9176-3B7992DA4D6E}.Release|Any CPU.Build.0 = Release|Any CPU {45EED43B-B235-4C24-9176-3B7992DA4D6E}.Release|Any CPU.Build.0 = Release|Any CPU
{98CDED94-F046-4010-88F4-700B7481169E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98CDED94-F046-4010-88F4-700B7481169E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98CDED94-F046-4010-88F4-700B7481169E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98CDED94-F046-4010-88F4-700B7481169E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -137,6 +143,7 @@ Global
{3EE98133-3E7A-4B14-A515-12CB039A9EED} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {3EE98133-3E7A-4B14-A515-12CB039A9EED} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{77D1D3F8-A04C-4688-AC67-C8372BD268A2} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {77D1D3F8-A04C-4688-AC67-C8372BD268A2} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{45EED43B-B235-4C24-9176-3B7992DA4D6E} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} {45EED43B-B235-4C24-9176-3B7992DA4D6E} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
{98CDED94-F046-4010-88F4-700B7481169E} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F}

39
WebApiService/src/TestHost/Controllers/WeatherForecastController.cs

@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TestHost.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}

26
WebApiService/src/TestHost/Program.cs

@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TestHost
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
}).UseAutofac();
}
}

31
WebApiService/src/TestHost/Properties/launchSettings.json

@ -0,0 +1,31 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:33955",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"TestHost": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

29
WebApiService/src/TestHost/Startup.cs

@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TestHost
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<TestModule>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.InitializeApplication();
}
}
}

17
WebApiService/src/TestHost/TestHost.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" />
<PackageReference Include="Volo.Abp.Core" Version="4.4.2" />
<PackageReference Include="Volo.Abp.Autofac" Version="4.4.2" />
<PackageReference Include="Volo.Abp.Http.Client" Version="4.4.2" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="4.4.2" />
</ItemGroup>
</Project>

47
WebApiService/src/TestHost/TestModule.cs

@ -0,0 +1,47 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.Modularity;
namespace TestHost
{
public class TestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var services = context.Services;
services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "TestHost", Version = "v1" });
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "TestHost v1"));
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

15
WebApiService/src/TestHost/WeatherForecast.cs

@ -0,0 +1,15 @@
using System;
namespace TestHost
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}

9
WebApiService/src/TestHost/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

10
WebApiService/src/TestHost/appsettings.json

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

20
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDto.cs

@ -1,111 +1,131 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.WebApi;
public class PartCreateDto : EntityDto,ICanTrace public class PartCreateDto : EntityDto,ICanTrace
{ {
/// <summary> /// <summary>
/// 代码(Code) /// 代码(Code)
/// </summary> /// </summary>
[XmlElement("code")]
[Display(Name = "代码")] [Display(Name = "代码")]
public string Code { get; set; } public string Code { get; set; }
/// <summary> /// <summary>
/// 名称(Name) /// 名称(Name)
/// </summary> /// </summary>
[XmlElement("name")]
[Display(Name = "名称")] [Display(Name = "名称")]
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 描述(Desc1) /// 描述(Desc1)
/// </summary> /// </summary>
[XmlElement("desc1")]
[Display(Name = "描述")] [Display(Name = "描述")]
public string Desc1 { get; set; } public string Desc1 { get; set; }
/// <summary> /// <summary>
/// 描述2(Desc2) /// 描述2(Desc2)
/// </summary> /// </summary>
[XmlElement("desc2")]
[Display(Name = "描述2")] [Display(Name = "描述2")]
public string Desc2 { get; set; } public string Desc2 { get; set; }
/// <summary> /// <summary>
/// 状态(Status) /// 状态(Status)
/// </summary> /// </summary>
[XmlElement("status")]
[Display(Name = "状态")] [Display(Name = "状态")]
public string Status { get; set; } public string Status { get; set; }
/// <summary> /// <summary>
/// 制造件(Can make) /// 制造件(Can make)
/// </summary> /// </summary>
[XmlElement("isMakePart")]
[Display(Name = "制造件")] [Display(Name = "制造件")]
public bool IsMakePart { get; set; } public bool IsMakePart { get; set; }
/// <summary> /// <summary>
/// 采购件(Can buy) /// 采购件(Can buy)
/// </summary> /// </summary>
[XmlElement("isBuyPart")]
[Display(Name = "采购件")] [Display(Name = "采购件")]
public bool IsBuyPart { get; set; } public bool IsBuyPart { get; set; }
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[XmlElement("uom")]
[Display(Name = "计量单位")] [Display(Name = "计量单位")]
public string Uom { get; set; } public string Uom { get; set; }
/// <summary> /// <summary>
/// ABC类(ABC Class) /// ABC类(ABC Class)
/// </summary> /// </summary>
[XmlElement("abcClass")]
[Display(Name = "ABC类")] [Display(Name = "ABC类")]
public string AbcClass { get; set; } public string AbcClass { get; set; }
/// <summary> /// <summary>
/// 产品类(Product Line) /// 产品类(Product Line)
/// </summary> /// </summary>
[XmlElement("productLine")]
[Display(Name = "产品类")] [Display(Name = "产品类")]
public string ProductLine { get; set; } public string ProductLine { get; set; }
/// <summary> /// <summary>
/// 类型(Type) /// 类型(Type)
/// </summary> /// </summary>
[XmlElement("type")]
[Display(Name = "类型")] [Display(Name = "类型")]
public string Type { get; set; } public string Type { get; set; }
/// <summary> /// <summary>
/// 种类(Catalog) /// 种类(Catalog)
/// </summary> /// </summary>
[XmlElement("catalog")]
[Display(Name = "种类")] [Display(Name = "种类")]
public string Catalog { get; set; } public string Catalog { get; set; }
/// <summary> /// <summary>
/// 分组(Group) /// 分组(Group)
/// </summary> /// </summary>
[XmlElement("group")]
[Display(Name = "分组")] [Display(Name = "分组")]
public string Group { get; set; } public string Group { get; set; }
/// <summary> /// <summary>
/// 版本(version) /// 版本(version)
/// </summary> /// </summary>
[XmlElement("version")]
[Display(Name = "版本")] [Display(Name = "版本")]
public string Version { get; set; } public string Version { get; set; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[XmlElement("site")]
[Display(Name = "地点")] [Display(Name = "地点")]
public string Site { get; set; } public string Site { get; set; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[XmlElement("company")]
[Display(Name = "公司")] [Display(Name = "公司")]
public string Company { get; set; } public string Company { get; set; }
/// <summary> /// <summary>
/// 跟踪编号(Trace ID) /// 跟踪编号(Trace ID)
/// </summary> /// </summary>
[XmlElement("traceId")]
[Display(Name = "跟踪编号")] [Display(Name = "跟踪编号")]
public Guid TraceId { get; set; } public Guid TraceId { get; set; }
} }

68
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartDTO.cs

@ -1,5 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Volo.Abp.Data; using Volo.Abp.Data;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -8,154 +10,124 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 零件DTO(Part DTO) /// 零件DTO(Part DTO)
/// </summary> /// </summary>
[Serializable,DataContract]
public class PartDTO : EntityDtoBase<Guid> public class PartDTO : EntityDtoBase<Guid>
{ {
/// <summary> /// <summary>
/// 代码(Code) /// 代码(Code)
/// </summary> /// </summary>
[DataMember,XmlElement("code")]
[Display(Name = "代码")] [Display(Name = "代码")]
public string Code { get; set; } public string Code { get; set; }
/// <summary> /// <summary>
/// 名称(Name) /// 名称(Name)
/// </summary> /// </summary>
[DataMember,XmlElement("name")]
[Display(Name = "名称")] [Display(Name = "名称")]
public string Name { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 描述(Desc1) /// 描述(Desc1)
/// </summary> /// </summary>
[DataMember,XmlElement("desc1")]
[Display(Name = "描述")] [Display(Name = "描述")]
public string Desc1 { get; set; } public string Desc1 { get; set; }
/// <summary> /// <summary>
/// 描述2(Desc2) /// 描述2(Desc2)
/// </summary> /// </summary>
[DataMember,XmlElement("desc2")]
[Display(Name = "描述2")] [Display(Name = "描述2")]
public string Desc2 { get; set; } public string Desc2 { get; set; }
/// <summary> /// <summary>
/// 状态(Status) /// 状态(Status)
/// </summary> /// </summary>
[DataMember,XmlElement("status")]
[Display(Name = "状态")] [Display(Name = "状态")]
public string Status { get; set; } public string Status { get; set; }
/// <summary> /// <summary>
/// 制造件(Can make) /// 制造件(Can make)
/// </summary> /// </summary>
[DataMember,XmlElement("isMakePart")]
[Display(Name = "制造件")] [Display(Name = "制造件")]
public bool IsMakePart { get; set; } public bool IsMakePart { get; set; }
/// <summary> /// <summary>
/// 采购件(Can buy) /// 采购件(Can buy)
/// </summary> /// </summary>
[DataMember,XmlElement("isBuyPart")]
[Display(Name = "采购件")] [Display(Name = "采购件")]
public bool IsBuyPart { get; set; } public bool IsBuyPart { get; set; }
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[DataMember,XmlElement("uom")]
[Display(Name = "计量单位")] [Display(Name = "计量单位")]
public string Uom { get; set; } public string Uom { get; set; }
/// <summary> /// <summary>
/// ABC类(ABC Class) /// ABC类(ABC Class)
/// </summary> /// </summary>
[DataMember,XmlElement("abcClass")]
[Display(Name = "ABC类")] [Display(Name = "ABC类")]
public string AbcClass { get; set; } public string AbcClass { get; set; }
/// <summary> /// <summary>
/// 产品类(Product Line) /// 产品类(Product Line)
/// </summary> /// </summary>
[DataMember,XmlElement("productLine")]
[Display(Name = "产品类")] [Display(Name = "产品类")]
public string ProductLine { get; set; } public string ProductLine { get; set; }
/// <summary> /// <summary>
/// 类型(Type) /// 类型(Type)
/// </summary> /// </summary>
[DataMember,XmlElement("type")]
[Display(Name = "类型")] [Display(Name = "类型")]
public string Type { get; set; } public string Type { get; set; }
/// <summary> /// <summary>
/// 种类(Catalog) /// 种类(Catalog)
/// </summary> /// </summary>
[DataMember,XmlElement("catalog")]
[Display(Name = "种类")] [Display(Name = "种类")]
public string Catalog { get; set; } public string Catalog { get; set; }
/// <summary> /// <summary>
/// 分组(Group) /// 分组(Group)
/// </summary> /// </summary>
[DataMember,XmlElement("group")]
[Display(Name = "分组")] [Display(Name = "分组")]
public string Group { get; set; } public string Group { get; set; }
/// <summary> /// <summary>
/// 版本(version) /// 版本(version)
/// </summary> /// </summary>
[DataMember,XmlElement("version")]
[Display(Name = "版本")] [Display(Name = "版本")]
public string Version { get; set; } public string Version { get; set; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[DataMember,XmlElement("site")]
[Display(Name = "地点")] [Display(Name = "地点")]
public string Site { get; set; } public string Site { get; set; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[DataMember,XmlElement("company")]
[Display(Name = "公司")] [Display(Name = "公司")]
public string Company { get; set; } public string Company { get; set; }
/*
/// <summary>
/// 颜色(Color)
/// </summary>
[Display(Name = "颜色")]
public string Color { get; set; }
/// <summary>
/// 配置(Configuration)
/// </summary>
[Display(Name = "配置")]
public string Configuration { get; set; }
/// <summary>
/// 项目(Project)
/// </summary>
[Display(Name = "项目")]
public string Project { get; set; }
/// <summary>
/// 工程变更通知单(Engineering change order)
/// </summary>
[Display(Name = "工程变更通知单")]
public string Eco { get; set; }
/// <summary>
/// 标包计量单位(Standard Pack Uom)
/// </summary>
[Display(Name = "标包计量单位")]
public string StdPackUom { get; set; }
/// <summary>
/// 标包数量(Standard Pack Qty)
/// </summary>
[Display(Name = "标包数量")]
public decimal StdPackQty { get; set; }
/// <summary>
/// 替代计量单位(Extra Pack UM)
/// </summary>
[Display(Name = "替代计量单位")]
public string ExtPackUom { get; set; }
/// <summary>
/// 替代包装数量(Extra Pack Qty)
/// </summary>
[Display(Name = "替代包装数量")]
public decimal ExtPackQty { get; set; }
*/
} }
} }

22
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/CreatePurchaseOrderDetailValidator.cs

@ -0,0 +1,22 @@
using FluentValidation;
namespace Win_in.Sfs.Scp.WebApi;
public class CreatePurchaseOrderDetailValidator : AbstractValidator<PurchaseOrderDetailDTO>
{
public CreatePurchaseOrderDetailValidator()
{
RuleFor(q => q.PoNumber).NotEmpty().MaximumLength(64);
RuleFor(q => q.PoLine).NotEmpty().MaximumLength(64);
RuleFor(q => q.PartCode).NotEmpty().MaximumLength(64);
RuleFor(q => q.Uom).NotEmpty().MaximumLength(64);
RuleFor(q => q.OrderQty).NotEmpty();
RuleFor(q => q.StdPackQty).NotEmpty();
RuleFor(q => q.SupplierPackConvertRate);
RuleFor(q => q.IsConsignment).NotEmpty();
RuleFor(q => q.LineStatus).NotEmpty();
RuleFor(q => q.Remark).MaximumLength(4096);
}
}

21
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -16,94 +17,110 @@ public class PurchaseOrderCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 订单号(PoNumber) /// 订单号(PoNumber)
/// </summary> /// </summary>
[XmlElement("poNumber")]
[Display(Name = "订单号(PoNumber)")] [Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; } public string PoNumber { set; get; }
/// <summary> /// <summary>
/// 供应商代码(SupplierCode) /// 供应商代码(SupplierCode)
/// </summary> /// </summary>
[XmlElement("supplierCode")]
[Display(Name = "供应商代码(SupplierCode)")] [Display(Name = "供应商代码(SupplierCode)")]
public string SupplierCode { set; get; } public string SupplierCode { set; get; }
/// <summary> /// <summary>
/// 订单类型(PoType) /// 订单类型(PoType)
/// </summary> /// </summary>
[XmlElement("poType")]
[Display(Name = "订单类型(PoType)")] [Display(Name = "订单类型(PoType)")]
public string PoType { set; get; } public string PoType { set; get; }
/// <summary> /// <summary>
/// 订单状态(Status) /// 订单状态(Status)
/// </summary> /// </summary>
[XmlElement("status")]
[Display(Name = "订单状态(Status)")] [Display(Name = "订单状态(Status)")]
public int Status { set; get; } public int Status { set; get; }
/// <summary> /// <summary>
/// 是否寄存订单(IsConsignment) /// 是否寄存订单(IsConsignment)
/// </summary> /// </summary>
[XmlElement("isCosignment")]
[Display(Name = "是否寄存订单(IsConsignment)")] [Display(Name = "是否寄存订单(IsConsignment)")]
public bool IsConsignment { set; get; } public bool IsConsignment { set; get; }
/// <summary> /// <summary>
/// 订单日期(OrderDate) /// 订单日期(OrderDate)
/// </summary> /// </summary>
[XmlElement("orderDate")]
[Display(Name = "订单日期(OrderDate)")] [Display(Name = "订单日期(OrderDate)")]
public DateTime OrderDate { set; get; } public DateTime OrderDate { set; get; }
/// <summary> /// <summary>
/// 截止日期(DueDate) /// 截止日期(DueDate)
/// </summary> /// </summary>
[XmlElement("dueDate")]
[Display(Name = "截止日期(DueDate)")] [Display(Name = "截止日期(DueDate)")]
public DateTime DueDate { set; get; } public DateTime DueDate { set; get; }
/// <summary> /// <summary>
/// 税率(TaxRate) /// 税率(TaxRate)
/// </summary> /// </summary>
[XmlElement("taxRate")]
[Display(Name = "税率(TaxRate)")] [Display(Name = "税率(TaxRate)")]
public decimal TaxRate { set; get; } public decimal TaxRate { set; get; }
/// <summary> /// <summary>
/// 版本(version) /// 版本(version)
/// </summary> /// </summary>
[XmlElement("version")]
[Display(Name = "版本")] [Display(Name = "版本")]
public string Version { get; set; } public string Version { get; set; }
/// <summary> /// <summary>
/// 联系人(ContactName) /// 联系人(ContactName)
/// </summary> /// </summary>
[XmlElement("contactName")]
[Display(Name = "联系人(ContactName)")] [Display(Name = "联系人(ContactName)")]
public string ContactName { set; get; } public string ContactName { set; get; }
/// <summary> /// <summary>
/// 联系电话(ContactPhone) /// 联系电话(ContactPhone)
/// </summary> /// </summary>
[XmlElement("contactPhone")]
[Display(Name = "联系电话(ContactPhone)")] [Display(Name = "联系电话(ContactPhone)")]
public string ContactPhone { set; get; } public string ContactPhone { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[XmlElement("site")]
[Display(Name = "地点(Site)")] [Display(Name = "地点(Site)")]
public string Site { set; get; } public string Site { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
[XmlArray(elementName: "poDetails")]
public virtual ICollection<PurchaseOrderDetailDTO> Details { get; set; } [XmlArrayItem(elementName: "poDetail")]
public virtual List<PurchaseOrderDetailDTO> Details { get; set; }
/// <summary> /// <summary>
/// 跟踪编号(Trace ID) /// 跟踪编号(Trace ID)
/// </summary> /// </summary>
[Display(Name = "跟踪编号")] [Display(Name = "跟踪编号")]
[XmlElement("traceId")]
public Guid TraceId { get; set; } public Guid TraceId { get; set; }
} }

24
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDTO.cs

@ -1,6 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
@ -8,94 +12,112 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 采购订单DTO(Purchase order DTO) /// 采购订单DTO(Purchase order DTO)
/// </summary> /// </summary>
[Serializable, DataContract]
public class PurchaseOrderDTO : EntityDtoBase<Guid> public class PurchaseOrderDTO : EntityDtoBase<Guid>
{ {
/// <summary> /// <summary>
/// 订单号(PoNumber) /// 订单号(PoNumber)
/// </summary> /// </summary>
[DataMember,XmlElement("poNumber")]
[Display(Name = "订单号(PoNumber)")] [Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; } public string PoNumber { set; get; }
/// <summary> /// <summary>
/// 供应商代码(SupplierCode) /// 供应商代码(SupplierCode)
/// </summary> /// </summary>
[DataMember,XmlElement("supplierCode")]
[Display(Name = "供应商代码(SupplierCode)")] [Display(Name = "供应商代码(SupplierCode)")]
public string SupplierCode { set; get; } public string SupplierCode { set; get; }
/// <summary> /// <summary>
/// 订单类型(PoType) /// 订单类型(PoType)
/// </summary> /// </summary>
[DataMember,XmlElement("poType")]
[Display(Name = "订单类型(PoType)")] [Display(Name = "订单类型(PoType)")]
public string PoType { set; get; } public string PoType { set; get; }
/// <summary> /// <summary>
/// 订单状态(Status) /// 订单状态(Status)
/// </summary> /// </summary>
[DataMember,XmlElement("status")]
[Display(Name = "订单状态(Status)")] [Display(Name = "订单状态(Status)")]
public int Status { set; get; } public int Status { set; get; }
/// <summary> /// <summary>
/// 是否寄存订单(IsConsignment) /// 是否寄存订单(IsConsignment)
/// </summary> /// </summary>
[DataMember,XmlElement("isCosignment")]
[Display(Name = "是否寄存订单(IsConsignment)")] [Display(Name = "是否寄存订单(IsConsignment)")]
public bool IsConsignment { set; get; } public bool IsConsignment { set; get; }
/// <summary> /// <summary>
/// 订单日期(OrderDate) /// 订单日期(OrderDate)
/// </summary> /// </summary>
[DataMember,XmlElement("orderDate")]
[Display(Name = "订单日期(OrderDate)")] [Display(Name = "订单日期(OrderDate)")]
public DateTime OrderDate { set; get; } public DateTime OrderDate { set; get; }
/// <summary> /// <summary>
/// 截止日期(DueDate) /// 截止日期(DueDate)
/// </summary> /// </summary>
[DataMember,XmlElement("dueDate")]
[Display(Name = "截止日期(DueDate)")] [Display(Name = "截止日期(DueDate)")]
public DateTime DueDate { set; get; } public DateTime DueDate { set; get; }
/// <summary> /// <summary>
/// 税率(TaxRate) /// 税率(TaxRate)
/// </summary> /// </summary>
[DataMember,XmlElement("taxRate")]
[Display(Name = "税率(TaxRate)")] [Display(Name = "税率(TaxRate)")]
public decimal TaxRate { set; get; } public decimal TaxRate { set; get; }
/// <summary> /// <summary>
/// 版本(version) /// 版本(version)
/// </summary> /// </summary>
[DataMember,XmlElement("version")]
[Display(Name = "版本")] [Display(Name = "版本")]
public string Version { get; set; } public string Version { get; set; }
/// <summary> /// <summary>
/// 联系人(ContactName) /// 联系人(ContactName)
/// </summary> /// </summary>
[DataMember,XmlElement("contactName")]
[Display(Name = "联系人(ContactName)")] [Display(Name = "联系人(ContactName)")]
public string ContactName { set; get; } public string ContactName { set; get; }
/// <summary> /// <summary>
/// 联系电话(ContactPhone) /// 联系电话(ContactPhone)
/// </summary> /// </summary>
[DataMember,XmlElement("contactPhone")]
[Display(Name = "联系电话(ContactPhone)")] [Display(Name = "联系电话(ContactPhone)")]
public string ContactPhone { set; get; } public string ContactPhone { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[DataMember,XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[DataMember,XmlElement("site")]
[Display(Name = "地点(Site)")] [Display(Name = "地点(Site)")]
public string Site { set; get; } public string Site { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[DataMember,XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
[XmlArrayItem("poDetail")]
[DataMember,XmlArray("poDetails")]
public virtual List<PurchaseOrderDetailDTO> Details { get; set; }
public virtual ICollection<PurchaseOrderDetailDTO> Details { get; set; }
} }
} }

47
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDetailDTO.cs

@ -1,6 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using FluentValidation; using System.Runtime.Serialization;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -9,85 +10,89 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 采购订单明细DTO(Purchase order detail DTO) /// 采购订单明细DTO(Purchase order detail DTO)
/// </summary> /// </summary>
public class PurchaseOrderDetailDTO : EntityDetailDtoBase<Guid> [Serializable, DataContract]
[XmlType("poDetail")]
public class PurchaseOrderDetailDTO : EntityDetailDtoBase
{ {
/// <summary> /// <summary>
/// 订单号(PoNumber) /// 订单号(PoNumber)
/// </summary> /// </summary>
[DataMember]
[XmlElement("poNumber")]
[Display(Name = "订单号(PoNumber)")] [Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; } public string PoNumber { set; get; }
/// <summary> /// <summary>
/// 订单行(PoLine) /// 订单行(PoLine)
/// </summary> /// </summary>
[DataMember]
[XmlElement("poLine")]
[Display(Name = "订单行(PoLine)")] [Display(Name = "订单行(PoLine)")]
public string PoLine { set; get; } public string PoLine { set; get; }
/// <summary> /// <summary>
/// 零件号(PartCode) /// 零件号(PartCode)
/// </summary> /// </summary>
[DataMember]
[XmlElement("partCode")]
[Display(Name = "零件号(PartCode)")] [Display(Name = "零件号(PartCode)")]
public string PartCode { set; get; } public string PartCode { set; get; }
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[DataMember]
[XmlElement("uom")]
[Display(Name = "计量单位(Uom)")] [Display(Name = "计量单位(Uom)")]
public string Uom { set; get; } public string Uom { set; get; }
/// <summary> /// <summary>
/// 订单数量(Order Qty) /// 订单数量(Order Qty)
/// </summary> /// </summary>
[DataMember]
[XmlElement("orderQty")]
[Display(Name = "订单数量(OrderQty)")] [Display(Name = "订单数量(OrderQty)")]
public decimal OrderQty { set; get; } public decimal OrderQty { set; get; }
/// <summary> /// <summary>
/// 标包数量(Standard Pack Qty) /// 标包数量(Standard Pack Qty)
/// </summary> /// </summary>
[DataMember]
[XmlElement("stdPackQty")]
[Display(Name = "标包数量(Standard Pack Qty)")] [Display(Name = "标包数量(Standard Pack Qty)")]
public decimal StdPackQty { set; get; } public decimal StdPackQty { set; get; }
/// <summary> /// <summary>
/// 供应商包装转换率(SupplierPackConvertRate) /// 供应商包装转换率(SupplierPackConvertRate)
/// </summary> /// </summary>
[DataMember]
[XmlElement("supplierPackConvertRate")]
[Display(Name = "供应商包装转换率(SupplierPackConvertRate)")] [Display(Name = "供应商包装转换率(SupplierPackConvertRate)")]
public decimal SupplierPackConvertRate { set; get; } public decimal SupplierPackConvertRate { set; get; }
/// <summary> /// <summary>
/// 是否寄存订单(IsConsignment) /// 是否寄存订单(IsConsignment)
/// </summary> /// </summary>
[DataMember]
[XmlElement("isConsignment")]
[Display(Name = "是否寄存订单(IsConsignment)")] [Display(Name = "是否寄存订单(IsConsignment)")]
public bool IsConsignment { set; get; } public bool IsConsignment { set; get; }
/// <summary> /// <summary>
/// 订单行状态(LineStatus) /// 订单行状态(LineStatus)
/// </summary> /// </summary>
[DataMember]
[XmlElement("lineStatus")]
[Display(Name = "订单行状态(LineStatus)")] [Display(Name = "订单行状态(LineStatus)")]
public int LineStatus { set; get; } public int LineStatus { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[DataMember]
[XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
} }
public class CreatePurchaseOrderDetailValidator : AbstractValidator<PurchaseOrderDetailDTO>
{
public CreatePurchaseOrderDetailValidator()
{
RuleFor(q => q.PoNumber).NotEmpty().MaximumLength(64);
RuleFor(q => q.PoLine).NotEmpty().MaximumLength(64);
RuleFor(q => q.PartCode).NotEmpty().MaximumLength(64);
RuleFor(q => q.Uom).NotEmpty().MaximumLength(64);
RuleFor(q => q.OrderQty).NotEmpty();
RuleFor(q => q.StdPackQty).NotEmpty();
RuleFor(q => q.SupplierPackConvertRate);
RuleFor(q => q.IsConsignment).NotEmpty();
RuleFor(q => q.LineStatus).NotEmpty();
RuleFor(q => q.Remark).MaximumLength(4096);
}
}
} }

21
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDTO.cs

@ -1,5 +1,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -13,30 +14,35 @@ public class ReceiptCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 收货单号(RcNumber) /// 收货单号(RcNumber)
/// </summary> /// </summary>
[XmlElement("rcNumber")]
[Display(Name = "收货单号(RcNumber)")] [Display(Name = "收货单号(RcNumber)")]
public string RcNumber { set; get; } public string RcNumber { set; get; }
/// <summary> /// <summary>
/// 发货单号(AsnNumber) /// 发货单号(AsnNumber)
/// </summary> /// </summary>
[XmlElement("asnNumber")]
[Display(Name = "发货单号(AsnNumber)")] [Display(Name = "发货单号(AsnNumber)")]
public string AsnNumber { set; get; } public string AsnNumber { set; get; }
/// <summary> /// <summary>
/// 订单号(PoNumber) /// 订单号(PoNumber)
/// </summary> /// </summary>
[XmlElement("poNumber")]
[Display(Name = "订单号(PoNumber)")] [Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; } public string PoNumber { set; get; }
/// <summary> /// <summary>
/// 供应商代码(PoNumber) /// 供应商代码(PoNumber)
/// </summary> /// </summary>
[XmlElement("supplierCode")]
[Display(Name = "供应商代码(SupplierCode)")] [Display(Name = "供应商代码(SupplierCode)")]
public string SupplierCode { set; get; } public string SupplierCode { set; get; }
/// <summary> /// <summary>
/// 收货单类型(RcType) /// 收货单类型(RcType)
/// </summary> /// </summary>
[XmlElement("rcType")]
[Display(Name = "收货单类型(RcType)")] [Display(Name = "收货单类型(RcType)")]
public string RcType { set; get; } public string RcType { set; get; }
@ -44,90 +50,105 @@ public class ReceiptCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 仓库(Warehouse) /// 仓库(Warehouse)
/// </summary> /// </summary>
[XmlElement("warehouse")]
[Display(Name = "仓库(Warehouse)")] [Display(Name = "仓库(Warehouse)")]
public string Warehouse { set; get; } public string Warehouse { set; get; }
/// <summary> /// <summary>
/// 收货口(Dock) /// 收货口(Dock)
/// </summary> /// </summary>
[XmlElement("dock")]
[Display(Name = "收货口(Dock)")] [Display(Name = "收货口(Dock)")]
public string Dock { set; get; } public string Dock { set; get; }
/// <summary> /// <summary>
/// 收货日期(ReceiveDate) /// 收货日期(ReceiveDate)
/// </summary> /// </summary>
[XmlElement("receiveDate")]
[Display(Name = "收货日期(ReceiveDate)")] [Display(Name = "收货日期(ReceiveDate)")]
public DateTime ReceiveDate { set; get; } public DateTime ReceiveDate { set; get; }
/// <summary> /// <summary>
/// 收货时间(ReceiveTime) /// 收货时间(ReceiveTime)
/// </summary> /// </summary>
[XmlElement("receiveTime")]
[Display(Name = "收货时间(ReceiveTime)")] [Display(Name = "收货时间(ReceiveTime)")]
public DateTime ReceiveTime { set; get; } public DateTime ReceiveTime { set; get; }
/// <summary> /// <summary>
/// 订单行(PoLine) /// 订单行(PoLine)
/// </summary> /// </summary>
[XmlElement("poLine")]
[Display(Name = "订单行(PoLine)")] [Display(Name = "订单行(PoLine)")]
public string PoLine { set; get; } public string PoLine { set; get; }
/// <summary> /// <summary>
/// 零件号(PartCode) /// 零件号(PartCode)
/// </summary> /// </summary>
[XmlElement("partCode")]
[Display(Name = "零件号(PartCode)")] [Display(Name = "零件号(PartCode)")]
public string PartCode { set; get; } public string PartCode { set; get; }
/// <summary> /// <summary>
/// 批次(Lot) /// 批次(Lot)
/// </summary> /// </summary>
[XmlElement("lot")]
[Display(Name = "批次(Lot)")] [Display(Name = "批次(Lot)")]
public string Lot { set; get; } public string Lot { set; get; }
/// <summary> /// <summary>
/// 供应商批次(SupplierLot) /// 供应商批次(SupplierLot)
/// </summary> /// </summary>
[XmlElement("supplierLot")]
[Display(Name = "供应商批次(SupplierLot)")] [Display(Name = "供应商批次(SupplierLot)")]
public string SupplierLot { set; get; } public string SupplierLot { set; get; }
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[XmlElement("uom")]
[Display(Name = "计量单位(Uom)")] [Display(Name = "计量单位(Uom)")]
public string Uom { set; get; } public string Uom { set; get; }
/// <summary> /// <summary>
/// 收货数量(ReceiveQty) /// 收货数量(ReceiveQty)
/// </summary> /// </summary>
[XmlElement("receiveQty")]
[Display(Name = "收货数量(ReceiveQty)")] [Display(Name = "收货数量(ReceiveQty)")]
public decimal ReceiveQty { set; get; } public decimal ReceiveQty { set; get; }
/// <summary> /// <summary>
/// 供应商包装转换率(SupplierPackConvertRate) /// 供应商包装转换率(SupplierPackConvertRate)
/// </summary> /// </summary>
[XmlElement("supplierPackConvertRate")]
[Display(Name = "供应商包装转换率(SupplierPackConvertRate)")] [Display(Name = "供应商包装转换率(SupplierPackConvertRate)")]
public decimal SupplierPackConvertRate { set; get; } public decimal SupplierPackConvertRate { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[XmlElement("site")]
[Display(Name = "地点(Site)")] [Display(Name = "地点(Site)")]
public string Site { set; get; } public string Site { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
/// <summary> /// <summary>
/// 跟踪编号(Trace ID) /// 跟踪编号(Trace ID)
/// </summary> /// </summary>
[XmlElement("traceId")]
[Display(Name = "跟踪编号")] [Display(Name = "跟踪编号")]
public Guid TraceId { get; set; } public Guid TraceId { get; set; }

25
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptDTO.cs

@ -1,5 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
@ -7,35 +9,42 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 收货单DTO(Receipt DTO) /// 收货单DTO(Receipt DTO)
/// </summary> /// </summary>
public class ReceiptDTO : EntityDtoBase<Guid> [Serializable, DataContract]
public class ReceiptDTO : EntityDtoBase<Guid>
{ {
/// <summary> /// <summary>
/// 收货单号(RcNumber) /// 收货单号(RcNumber)
/// </summary> /// </summary>
[DataMember,XmlElement("rcNumber")]
[Display(Name = "收货单号(RcNumber)")] [Display(Name = "收货单号(RcNumber)")]
public string RcNumber { set; get; } public string RcNumber { set; get; }
/// <summary> /// <summary>
/// 发货单号(AsnNumber) /// 发货单号(AsnNumber)
/// </summary> /// </summary>
[DataMember,XmlElement("asnNumber")]
[Display(Name = "发货单号(AsnNumber)")] [Display(Name = "发货单号(AsnNumber)")]
public string AsnNumber { set; get; } public string AsnNumber { set; get; }
/// <summary> /// <summary>
/// 订单号(PoNumber) /// 订单号(PoNumber)
/// </summary> /// </summary>
[DataMember,XmlElement("poNumber")]
[Display(Name = "订单号(PoNumber)")] [Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; } public string PoNumber { set; get; }
/// <summary> /// <summary>
/// 供应商代码(PoNumber) /// 供应商代码(PoNumber)
/// </summary> /// </summary>
[DataMember,XmlElement("supplierCode")]
[Display(Name = "供应商代码(SupplierCode)")] [Display(Name = "供应商代码(SupplierCode)")]
public string SupplierCode { set; get; } public string SupplierCode { set; get; }
/// <summary> /// <summary>
/// 收货单类型(RcType) /// 收货单类型(RcType)
/// </summary> /// </summary>
[DataMember,XmlElement("rcType")]
[Display(Name = "收货单类型(RcType)")] [Display(Name = "收货单类型(RcType)")]
public string RcType { set; get; } public string RcType { set; get; }
@ -43,84 +52,98 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 仓库(Warehouse) /// 仓库(Warehouse)
/// </summary> /// </summary>
[DataMember,XmlElement("warehouse")]
[Display(Name = "仓库(Warehouse)")] [Display(Name = "仓库(Warehouse)")]
public string Warehouse { set; get; } public string Warehouse { set; get; }
/// <summary> /// <summary>
/// 收货口(Dock) /// 收货口(Dock)
/// </summary> /// </summary>
[DataMember,XmlElement("dock")]
[Display(Name = "收货口(Dock)")] [Display(Name = "收货口(Dock)")]
public string Dock { set; get; } public string Dock { set; get; }
/// <summary> /// <summary>
/// 收货日期(ReceiveDate) /// 收货日期(ReceiveDate)
/// </summary> /// </summary>
[DataMember,XmlElement("receiveDate")]
[Display(Name = "收货日期(ReceiveDate)")] [Display(Name = "收货日期(ReceiveDate)")]
public DateTime ReceiveDate { set; get; } public DateTime ReceiveDate { set; get; }
/// <summary> /// <summary>
/// 收货时间(ReceiveTime) /// 收货时间(ReceiveTime)
/// </summary> /// </summary>
[DataMember,XmlElement("receiveTime")]
[Display(Name = "收货时间(ReceiveTime)")] [Display(Name = "收货时间(ReceiveTime)")]
public DateTime ReceiveTime { set; get; } public DateTime ReceiveTime { set; get; }
/// <summary> /// <summary>
/// 订单行(PoLine) /// 订单行(PoLine)
/// </summary> /// </summary>
[DataMember,XmlElement("poLine")]
[Display(Name = "订单行(PoLine)")] [Display(Name = "订单行(PoLine)")]
public string PoLine { set; get; } public string PoLine { set; get; }
/// <summary> /// <summary>
/// 零件号(PartCode) /// 零件号(PartCode)
/// </summary> /// </summary>
[DataMember,XmlElement("partCode")]
[Display(Name = "零件号(PartCode)")] [Display(Name = "零件号(PartCode)")]
public string PartCode { set; get; } public string PartCode { set; get; }
/// <summary> /// <summary>
/// 批次(Lot) /// 批次(Lot)
/// </summary> /// </summary>
[DataMember,XmlElement("lot")]
[Display(Name = "批次(Lot)")] [Display(Name = "批次(Lot)")]
public string Lot { set; get; } public string Lot { set; get; }
/// <summary> /// <summary>
/// 供应商批次(SupplierLot) /// 供应商批次(SupplierLot)
/// </summary> /// </summary>
[DataMember,XmlElement("supplierLot")]
[Display(Name = "供应商批次(SupplierLot)")] [Display(Name = "供应商批次(SupplierLot)")]
public string SupplierLot { set; get; } public string SupplierLot { set; get; }
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[DataMember,XmlElement("uom")]
[Display(Name = "计量单位(Uom)")] [Display(Name = "计量单位(Uom)")]
public string Uom { set; get; } public string Uom { set; get; }
/// <summary> /// <summary>
/// 收货数量(ReceiveQty) /// 收货数量(ReceiveQty)
/// </summary> /// </summary>
[DataMember,XmlElement("receiveQty")]
[Display(Name = "收货数量(ReceiveQty)")] [Display(Name = "收货数量(ReceiveQty)")]
public decimal ReceiveQty { set; get; } public decimal ReceiveQty { set; get; }
/// <summary> /// <summary>
/// 供应商包装转换率(SupplierPackConvertRate) /// 供应商包装转换率(SupplierPackConvertRate)
/// </summary> /// </summary>
[DataMember,XmlElement("supplierPackConvertRate")]
[Display(Name = "供应商包装转换率(SupplierPackConvertRate)")] [Display(Name = "供应商包装转换率(SupplierPackConvertRate)")]
public decimal SupplierPackConvertRate { set; get; } public decimal SupplierPackConvertRate { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[DataMember,XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[DataMember,XmlElement("site")]
[Display(Name = "地点(Site)")] [Display(Name = "地点(Site)")]
public string Site { set; get; } public string Site { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[DataMember,XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
} }

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/RouteConsts.cs

@ -0,0 +1,11 @@
namespace Win_in.Sfs.Scp.WebApi
{
public class RouteConsts
{
public const string Part = "api/scp/part";
public const string PurchaseOrder = "api/scp/po";
public const string Receipt = "api/scp/receipt";
public const string Supplier = "api/scp/supplier";
public const string UnplannedReceipt = "api/scp/unplanned-receipt";
}
}

18
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs

@ -1,5 +1,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -13,102 +14,119 @@ public class SupplierCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 代码(Code) /// 代码(Code)
/// </summary> /// </summary>
[XmlElement("code")]
[Display(Name = "代码(Code)")] [Display(Name = "代码(Code)")]
public string Code { set; get; } public string Code { set; get; }
/// <summary> /// <summary>
/// 简称(Name) /// 简称(Name)
/// </summary> /// </summary>
[XmlElement("name")]
[Display(Name = "简称(Name)")] [Display(Name = "简称(Name)")]
public string Name { set; get; } public string Name { set; get; }
/// <summary> /// <summary>
/// 描述(Description) /// 描述(Description)
/// </summary> /// </summary>
[XmlElement("desc")]
[Display(Name = "描述(Description)")] [Display(Name = "描述(Description)")]
public string Desc { set; get; } public string Desc { set; get; }
/// <summary> /// <summary>
/// 级别(Rank) /// 级别(Rank)
/// </summary> /// </summary>
[XmlElement("rank")]
[Display(Name = "级别(Rank)")] [Display(Name = "级别(Rank)")]
public string Rank { get; set; } public string Rank { get; set; }
/// <summary> /// <summary>
/// 地址 /// 地址
/// </summary> /// </summary>
[XmlElement("address")]
[Display(Name = "地址(Address)")] [Display(Name = "地址(Address)")]
public string Address { get; set; } public string Address { get; set; }
/// <summary> /// <summary>
/// 国家(Country) /// 国家(Country)
/// </summary> /// </summary>
[XmlElement("country")]
[Display(Name = "国家(Country)")] [Display(Name = "国家(Country)")]
public string Country { get; set; } public string Country { get; set; }
/// <summary> /// <summary>
/// 城市(City) /// 城市(City)
/// </summary> /// </summary>
[XmlElement("city")]
[Display(Name = "城市(City)")] [Display(Name = "城市(City)")]
public string City { get; set; } public string City { get; set; }
/// <summary> /// <summary>
/// 电话(Phone) /// 电话(Phone)
/// </summary> /// </summary>
[XmlElement("phone")]
[Display(Name = "电话(Phone)")] [Display(Name = "电话(Phone)")]
public string Phone { set; get; } public string Phone { set; get; }
/// <summary> /// <summary>
/// 传真(Fax) /// 传真(Fax)
/// </summary> /// </summary>
[XmlElement("fax")]
[Display(Name = "传真(Fax)")] [Display(Name = "传真(Fax)")]
public string Fax { set; get; } public string Fax { set; get; }
/// <summary> /// <summary>
/// 邮编(PostId) /// 邮编(PostId)
/// </summary> /// </summary>
[XmlElement("postId")]
[Display(Name = "邮编(PostId)")] [Display(Name = "邮编(PostId)")]
public string PostId { set; get; } public string PostId { set; get; }
/// <summary> /// <summary>
/// 联系人(ContactName) /// 联系人(ContactName)
/// </summary> /// </summary>
[XmlElement("contactName")]
[Display(Name = "联系人(ContactName)")] [Display(Name = "联系人(ContactName)")]
public string ContactName { set; get; } public string ContactName { set; get; }
/// <summary> /// <summary>
/// 银行(Bank) /// 银行(Bank)
/// </summary> /// </summary>
[XmlElement("bank")]
[Display(Name = "银行(Bank)")] [Display(Name = "银行(Bank)")]
public string Bank { set; get; } public string Bank { set; get; }
/// <summary> /// <summary>
/// 货币(Currency) /// 货币(Currency)
/// </summary> /// </summary>
[XmlElement("currency")]
[Display(Name = "货币(Currency)")] [Display(Name = "货币(Currency)")]
public string Currency { set; get; } public string Currency { set; get; }
/// <summary> /// <summary>
/// 是否激活(IsActive) /// 是否激活(IsActive)
/// </summary> /// </summary>
[XmlElement("isActive")]
[Display(Name = "是否激活(IsActive)")] [Display(Name = "是否激活(IsActive)")]
public bool IsActive { set; get; } public bool IsActive { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 跟踪编号(Trace ID) /// 跟踪编号(Trace ID)
/// </summary> /// </summary>
[XmlElement("traceId")]
[Display(Name = "跟踪编号")] [Display(Name = "跟踪编号")]
public Guid TraceId { get; set; } public Guid TraceId { get; set; }

23
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierDTO.cs

@ -1,5 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Volo.Abp.Data; using Volo.Abp.Data;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -8,104 +10,123 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 供应商DTO(Supplier DTO) /// 供应商DTO(Supplier DTO)
/// </summary> /// </summary>
public class SupplierDTO : EntityDtoBase<Guid> [Serializable, DataContract]
public class SupplierDTO : EntityDtoBase<Guid>
{ {
/// <summary> /// <summary>
/// 代码(Code) /// 代码(Code)
/// </summary> /// </summary>
[DataMember,XmlElement("code")]
[Display(Name = "代码(Code)")] [Display(Name = "代码(Code)")]
public string Code { set; get; } public string Code { set; get; }
/// <summary> /// <summary>
/// 简称(Name) /// 简称(Name)
/// </summary> /// </summary>
[DataMember,XmlElement("name")]
[Display(Name = "简称(Name)")] [Display(Name = "简称(Name)")]
public string Name { set; get; } public string Name { set; get; }
/// <summary> /// <summary>
/// 描述(Description) /// 描述(Description)
/// </summary> /// </summary>
[DataMember,XmlElement("desc")]
[Display(Name = "描述(Description)")] [Display(Name = "描述(Description)")]
public string Desc { set; get; } public string Desc { set; get; }
/// <summary> /// <summary>
/// 级别(Rank) /// 级别(Rank)
/// </summary> /// </summary>
[DataMember,XmlElement("rank")]
[Display(Name = "级别(Rank)")] [Display(Name = "级别(Rank)")]
public string Rank { get; set; } public string Rank { get; set; }
/// <summary> /// <summary>
/// 地址 /// 地址
/// </summary> /// </summary>
[DataMember,XmlElement("address")]
[Display(Name = "地址(Address)")] [Display(Name = "地址(Address)")]
public string Address { get; set; } public string Address { get; set; }
/// <summary> /// <summary>
/// 国家(Country) /// 国家(Country)
/// </summary> /// </summary>
[DataMember,XmlElement("country")]
[Display(Name = "国家(Country)")] [Display(Name = "国家(Country)")]
public string Country { get; set; } public string Country { get; set; }
/// <summary> /// <summary>
/// 城市(City) /// 城市(City)
/// </summary> /// </summary>
[DataMember,XmlElement("city")]
[Display(Name = "城市(City)")] [Display(Name = "城市(City)")]
public string City { get; set; } public string City { get; set; }
/// <summary> /// <summary>
/// 电话(Phone) /// 电话(Phone)
/// </summary> /// </summary>
[DataMember,XmlElement("phone")]
[Display(Name = "电话(Phone)")] [Display(Name = "电话(Phone)")]
public string Phone { set; get; } public string Phone { set; get; }
/// <summary> /// <summary>
/// 传真(Fax) /// 传真(Fax)
/// </summary> /// </summary>
[DataMember,XmlElement("fax")]
[Display(Name = "传真(Fax)")] [Display(Name = "传真(Fax)")]
public string Fax { set; get; } public string Fax { set; get; }
/// <summary> /// <summary>
/// 邮编(PostId) /// 邮编(PostId)
/// </summary> /// </summary>
[DataMember,XmlElement("postId")]
[Display(Name = "邮编(PostId)")] [Display(Name = "邮编(PostId)")]
public string PostId { set; get; } public string PostId { set; get; }
/// <summary> /// <summary>
/// 联系人(ContactName) /// 联系人(ContactName)
/// </summary> /// </summary>
[DataMember,XmlElement("contactName")]
[Display(Name = "联系人(ContactName)")] [Display(Name = "联系人(ContactName)")]
public string ContactName { set; get; } public string ContactName { set; get; }
/// <summary> /// <summary>
/// 银行(Bank) /// 银行(Bank)
/// </summary> /// </summary>
[DataMember,XmlElement("bank")]
[Display(Name = "银行(Bank)")] [Display(Name = "银行(Bank)")]
public string Bank { set; get; } public string Bank { set; get; }
/// <summary> /// <summary>
/// 货币(Currency) /// 货币(Currency)
/// </summary> /// </summary>
[DataMember,XmlElement("currency")]
[Display(Name = "货币(Currency)")] [Display(Name = "货币(Currency)")]
public string Currency { set; get; } public string Currency { set; get; }
/// <summary> /// <summary>
/// 是否激活(IsActive) /// 是否激活(IsActive)
/// </summary> /// </summary>
[DataMember,XmlElement("isActive")]
[Display(Name = "是否激活(IsActive)")] [Display(Name = "是否激活(IsActive)")]
public bool IsActive { set; get; } public bool IsActive { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[DataMember,XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[DataMember,XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
} }
} }

16
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptCreateDTO.cs

@ -1,5 +1,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
@ -13,30 +14,35 @@ public class UnplannedReceiptCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 单号(TrNbr) /// 单号(TrNbr)
/// </summary> /// </summary>
[XmlElement("trNbr")]
[Display(Name = "单号(TrNbr)")] [Display(Name = "单号(TrNbr)")]
public long TrNbr { set; get; } public long TrNbr { set; get; }
/// <summary> /// <summary>
/// 事务类型(TrType) /// 事务类型(TrType)
/// </summary> /// </summary>
[XmlElement("trType")]
[Display(Name = "事务类型(TrType)")] [Display(Name = "事务类型(TrType)")]
public string TrType { set; get; } public string TrType { set; get; }
/// <summary> /// <summary>
/// 订单号(Order) /// 订单号(Order)
/// </summary> /// </summary>
[XmlElement("order")]
[Display(Name = "订单号(Order)")] [Display(Name = "订单号(Order)")]
public string Order { set; get; } public string Order { set; get; }
/// <summary> /// <summary>
/// 零件号(PartCode) /// 零件号(PartCode)
/// </summary> /// </summary>
[XmlElement("partCode")]
[Display(Name = "零件号(PartCode)")] [Display(Name = "零件号(PartCode)")]
public string PartCode { set; get; } public string PartCode { set; get; }
/// <summary> /// <summary>
/// 批次(Lot) /// 批次(Lot)
/// </summary> /// </summary>
[XmlElement("lot")]
[Display(Name = "批次(Lot)")] [Display(Name = "批次(Lot)")]
public string Lot { set; get; } public string Lot { set; get; }
@ -44,36 +50,42 @@ public class UnplannedReceiptCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[XmlElement("uom")]
[Display(Name = "计量单位(Uom)")] [Display(Name = "计量单位(Uom)")]
public string Uom { set; get; } public string Uom { set; get; }
/// <summary> /// <summary>
/// 数量(Qty) /// 数量(Qty)
/// </summary> /// </summary>
[XmlElement("qty")]
[Display(Name = "数量(Qty)")] [Display(Name = "数量(Qty)")]
public decimal Qty { set; get; } public decimal Qty { set; get; }
/// <summary> /// <summary>
/// 库位(Location) /// 库位(Location)
/// </summary> /// </summary>
[XmlElement("location")]
[Display(Name = "库位(Location)")] [Display(Name = "库位(Location)")]
public string Location { set; get; } public string Location { set; get; }
/// <summary> /// <summary>
/// 生效日期(EffectiveDate) /// 生效日期(EffectiveDate)
/// </summary> /// </summary>
[XmlElement("effectiveDate")]
[Display(Name = "生效日期(EffectiveDate)")] [Display(Name = "生效日期(EffectiveDate)")]
public DateTime EffectiveDate { set; get; } public DateTime EffectiveDate { set; get; }
/// <summary> /// <summary>
/// 系统日期(SystemDate) /// 系统日期(SystemDate)
/// </summary> /// </summary>
[XmlElement("systemDate")]
[Display(Name = "系统日期(SystemDate)")] [Display(Name = "系统日期(SystemDate)")]
public DateTime SystemDate { set; get; } public DateTime SystemDate { set; get; }
/// <summary> /// <summary>
/// 客户单(so job) /// 客户单(so job)
/// </summary> /// </summary>
[XmlElement("soJob")]
[Display(Name = "客户单(so job)")] [Display(Name = "客户单(so job)")]
public string SoJob { get; set; } public string SoJob { get; set; }
@ -82,24 +94,28 @@ public class UnplannedReceiptCreateDTO : EntityDto,ICanTrace
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[XmlElement("site")]
[Display(Name = "地点(Site)")] [Display(Name = "地点(Site)")]
public string Site { set; get; } public string Site { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
/// <summary> /// <summary>
/// 跟踪编号(Trace ID) /// 跟踪编号(Trace ID)
/// </summary> /// </summary>
[XmlElement("traceId")]
[Display(Name = "跟踪编号")] [Display(Name = "跟踪编号")]
public Guid TraceId { get; set; } public Guid TraceId { get; set; }

21
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/UnplannedReceiptDTO.cs

@ -1,5 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
@ -7,35 +9,42 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 计划外入库单DTO(Unplanned Receipt DTO) /// 计划外入库单DTO(Unplanned Receipt DTO)
/// </summary> /// </summary>
public class UnplannedReceiptDTO : EntityDtoBase<Guid> [Serializable, DataContract]
public class UnplannedReceiptDTO : EntityDtoBase<Guid>
{ {
/// <summary> /// <summary>
/// 单号(TrNbr) /// 单号(TrNbr)
/// </summary> /// </summary>
[DataMember,XmlElement("trNbr")]
[Display(Name = "单号(TrNbr)")] [Display(Name = "单号(TrNbr)")]
public long TrNbr { set; get; } public long TrNbr { set; get; }
/// <summary> /// <summary>
/// 事务类型(TrType) /// 事务类型(TrType)
/// </summary> /// </summary>
[DataMember,XmlElement("trType")]
[Display(Name = "事务类型(TrType)")] [Display(Name = "事务类型(TrType)")]
public string TrType { set; get; } public string TrType { set; get; }
/// <summary> /// <summary>
/// 订单号(Order) /// 订单号(Order)
/// </summary> /// </summary>
[DataMember,XmlElement("order")]
[Display(Name = "订单号(Order)")] [Display(Name = "订单号(Order)")]
public string Order { set; get; } public string Order { set; get; }
/// <summary> /// <summary>
/// 零件号(PartCode) /// 零件号(PartCode)
/// </summary> /// </summary>
[DataMember,XmlElement("partCode")]
[Display(Name = "零件号(PartCode)")] [Display(Name = "零件号(PartCode)")]
public string PartCode { set; get; } public string PartCode { set; get; }
/// <summary> /// <summary>
/// 批次(Lot) /// 批次(Lot)
/// </summary> /// </summary>
[DataMember,XmlElement("lot")]
[Display(Name = "批次(Lot)")] [Display(Name = "批次(Lot)")]
public string Lot { set; get; } public string Lot { set; get; }
@ -43,36 +52,42 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 计量单位(Uom) /// 计量单位(Uom)
/// </summary> /// </summary>
[DataMember,XmlElement("uom")]
[Display(Name = "计量单位(Uom)")] [Display(Name = "计量单位(Uom)")]
public string Uom { set; get; } public string Uom { set; get; }
/// <summary> /// <summary>
/// 数量(Qty) /// 数量(Qty)
/// </summary> /// </summary>
[DataMember,XmlElement("qty")]
[Display(Name = "数量(Qty)")] [Display(Name = "数量(Qty)")]
public decimal Qty { set; get; } public decimal Qty { set; get; }
/// <summary> /// <summary>
/// 库位(Location) /// 库位(Location)
/// </summary> /// </summary>
[DataMember,XmlElement("location")]
[Display(Name = "库位(Location)")] [Display(Name = "库位(Location)")]
public string Location { set; get; } public string Location { set; get; }
/// <summary> /// <summary>
/// 生效日期(EffectiveDate) /// 生效日期(EffectiveDate)
/// </summary> /// </summary>
[DataMember,XmlElement("effectiveDate")]
[Display(Name = "生效日期(EffectiveDate)")] [Display(Name = "生效日期(EffectiveDate)")]
public DateTime EffectiveDate { set; get; } public DateTime EffectiveDate { set; get; }
/// <summary> /// <summary>
/// 系统日期(SystemDate) /// 系统日期(SystemDate)
/// </summary> /// </summary>
[DataMember,XmlElement("systemDate")]
[Display(Name = "系统日期(SystemDate)")] [Display(Name = "系统日期(SystemDate)")]
public DateTime SystemDate { set; get; } public DateTime SystemDate { set; get; }
/// <summary> /// <summary>
/// 客户单(so job) /// 客户单(so job)
/// </summary> /// </summary>
[DataMember,XmlElement("soJob")]
[Display(Name = "客户单(so job)")] [Display(Name = "客户单(so job)")]
public string SoJob { get; set; } public string SoJob { get; set; }
@ -81,19 +96,23 @@ namespace Win_in.Sfs.Scp.WebApi
/// <summary> /// <summary>
/// 备注(Remark) /// 备注(Remark)
/// </summary> /// </summary>
[DataMember,XmlElement("remark")]
[Display(Name = "备注(Remark)")] [Display(Name = "备注(Remark)")]
public string Remark { set; get; } public string Remark { set; get; }
/// <summary> /// <summary>
/// 地点(Site) /// 地点(Site)
/// </summary> /// </summary>
[DataMember,XmlElement("site")]
[Display(Name = "地点(Site)")] [Display(Name = "地点(Site)")]
public string Site { set; get; } public string Site { set; get; }
/// <summary> /// <summary>
/// 公司(Company) /// 公司(Company)
/// </summary> /// </summary>
[DataMember,XmlElement("company")]
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
} }
} }

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs

@ -15,7 +15,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// 零件服务 /// 零件服务
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route("api/scp/part")] [Route(RouteConsts.Part)]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class PartAppService :ReadOnlyAppService<Part,PartDTO,Guid, RequestDTO>, IPartAppService public class PartAppService :ReadOnlyAppService<Part,PartDTO,Guid, RequestDTO>, IPartAppService
@ -70,5 +70,7 @@ namespace Win_in.Sfs.Scp.WebApi
return dto; return dto;
} }
} }
} }

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs

@ -12,7 +12,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// 采购订单服务 /// 采购订单服务
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route("api/scp/po")] [Route(RouteConsts.PurchaseOrder)]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid,RequestDTO>, IPurchaseOrderAppService public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid,RequestDTO>, IPurchaseOrderAppService
{ {

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs

@ -12,7 +12,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// 收货单服务 /// 收货单服务
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route("api/scp/receipt")] [Route(RouteConsts.Receipt)]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class ReceiptAppService : ReadOnlyAppService<Receipt, ReceiptDTO, Guid,RequestDTO>, IReceiptAppService public class ReceiptAppService : ReadOnlyAppService<Receipt, ReceiptDTO, Guid,RequestDTO>, IReceiptAppService
{ {

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs

@ -13,7 +13,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// 供应商服务 /// 供应商服务
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route("api/scp/supplier")] [Route(RouteConsts.Supplier)]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class SuppliersAppService : ReadOnlyAppService<Supplier, SupplierDTO, Guid,RequestDTO>, ISupplierAppService public class SuppliersAppService : ReadOnlyAppService<Supplier, SupplierDTO, Guid,RequestDTO>, ISupplierAppService
{ {

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs

@ -12,7 +12,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// 计划外入库单服务 /// 计划外入库单服务
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route("api/scp/unplanned-receipt")] [Route(RouteConsts.UnplannedReceipt)]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)] [ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class UnplannedReceiptAppService : ReadOnlyAppService<UnplannedReceipt, UnplannedReceiptDTO, Guid,RequestDTO>, IUnplannedReceiptAppService public class UnplannedReceiptAppService : ReadOnlyAppService<UnplannedReceipt, UnplannedReceiptDTO, Guid,RequestDTO>, IUnplannedReceiptAppService
{ {

16
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs

@ -25,7 +25,7 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapPart() private void CreateMapPart()
{ {
CreateMap<Part, PartDTO>().ReverseMap(); CreateMap<Part, PartDTO>();
CreateMap<PartCreateDto, Part>() CreateMap<PartCreateDto, Part>()
.Ignore(p=>p.Id) .Ignore(p=>p.Id)
.Ignore(p=>p.CreatorId) .Ignore(p=>p.CreatorId)
@ -38,7 +38,7 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapSupplier() private void CreateMapSupplier()
{ {
CreateMap<Supplier, SupplierDTO>().ReverseMap(); CreateMap<Supplier, SupplierDTO>();
CreateMap<SupplierCreateDTO,Supplier>() CreateMap<SupplierCreateDTO,Supplier>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.Ignore(p => p.CreatorId) .Ignore(p => p.CreatorId)
@ -52,7 +52,7 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapReceipt() private void CreateMapReceipt()
{ {
CreateMap<Receipt, ReceiptDTO>().ReverseMap(); CreateMap<Receipt, ReceiptDTO>();
CreateMap<ReceiptCreateDTO, Receipt>() CreateMap<ReceiptCreateDTO, Receipt>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.Ignore(p => p.CreatorId) .Ignore(p => p.CreatorId)
@ -66,7 +66,7 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapPurchaseOrder() private void CreateMapPurchaseOrder()
{ {
CreateMap<PurchaseOrder, PurchaseOrderDTO>().ReverseMap(); CreateMap<PurchaseOrder, PurchaseOrderDTO>();
CreateMap<PurchaseOrderCreateDTO, PurchaseOrder>() CreateMap<PurchaseOrderCreateDTO, PurchaseOrder>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.Ignore(p => p.CreatorId) .Ignore(p => p.CreatorId)
@ -79,12 +79,16 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapPurchaseOrderDetail() private void CreateMapPurchaseOrderDetail()
{ {
CreateMap<PurchaseOrderDetail, PurchaseOrderDetailDTO>().ReverseMap(); CreateMap<PurchaseOrderDetail, PurchaseOrderDetailDTO>();
CreateMap<PurchaseOrderDetailDTO,PurchaseOrderDetail>()
.Ignore(p => p.Id)
.Ignore(p => p.CreatorId)
.Ignore(p => p.CreationTime);
} }
private void CreateMapUnplannedReceipt() private void CreateMapUnplannedReceipt()
{ {
CreateMap<UnplannedReceipt, UnplannedReceiptDTO>().ReverseMap(); CreateMap<UnplannedReceipt, UnplannedReceiptDTO>();
CreateMap<UnplannedReceiptCreateDTO, UnplannedReceipt>() CreateMap<UnplannedReceiptCreateDTO, UnplannedReceipt>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.Ignore(p => p.CreatorId) .Ignore(p => p.CreatorId)

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityDetailDtoBase.cs

@ -1,11 +1,13 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
namespace Win_in.Sfs.Scp.WebApi.Domain.Shared namespace Win_in.Sfs.Scp.WebApi.Domain.Shared
{ {
public class EntityDetailDtoBase<TKey> : CreationAuditedEntityDto<TKey> [Serializable, DataContract]
public class EntityDetailDtoBase :IEntityDto
{ {
} }

21
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityDtoBase.cs

@ -1,12 +1,31 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
namespace Win_in.Sfs.Scp.WebApi.Domain.Shared namespace Win_in.Sfs.Scp.WebApi.Domain.Shared
{ {
public class EntityDtoBase<TKey> : CreationAuditedEntityDto<TKey>, ICanTrace [Serializable,DataContract]
public class EntityDtoBase<TKey> :IEntityDto<TKey>, ICanTrace
{ {
[DataMember]
public TKey Id { get; set; }
[DataMember]
public DateTime CreationTime { get; set; }
[DataMember]
public Guid? CreatorId { get; set; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[DataMember]
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; } public Guid TraceId { get; set; }
} }
} }

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs

@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -55,6 +56,8 @@ namespace Win_in.Sfs.Scp.WebApi
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
ConfigureBundles(); ConfigureBundles();
ConfigureUrls(configuration); ConfigureUrls(configuration);
ConfigureConventionalControllers(); ConfigureConventionalControllers();
@ -64,14 +67,18 @@ namespace Win_in.Sfs.Scp.WebApi
ConfigureCors(context, configuration); ConfigureCors(context, configuration);
ConfigureSwaggerServices(context, configuration); ConfigureSwaggerServices(context, configuration);
ConfigureAuthorization(context); ConfigureAuthorization(context,configuration);
} }
private static void ConfigureAuthorization(ServiceConfigurationContext context) private static void ConfigureAuthorization(ServiceConfigurationContext context, IConfiguration configuration)
{
var alwaysAllowAuthorization = Convert.ToBoolean(configuration["AlwaysAllowAuthorization"]);
if (alwaysAllowAuthorization)
{ {
//绕过授权服务 //绕过授权服务
context.Services.AddAlwaysAllowAuthorization(); context.Services.AddAlwaysAllowAuthorization();
} }
}
private void ConfigureBundles() private void ConfigureBundles()
{ {

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -1,7 +1,7 @@
{ {
"App": { "App": {
"SelfUrl": "https://localhost:9988", "SelfUrl": "https://localhost:9988",
"CorsOrigins": "http://*.WebApi.com", "CorsOrigins": "https://scp.iacchina.net:9977,https://localhost:9977,https://localhost:9988,https://scp.iacchina.net:9988",
"RedirectAllowedUrls": "http://localhost:4200,https://localhost:9988" "RedirectAllowedUrls": "http://localhost:4200,https://localhost:9988"
}, },
"ConnectionStrings": { "ConnectionStrings": {
@ -37,5 +37,6 @@
"RootUrl": "https://localhost:9988" "RootUrl": "https://localhost:9988"
} }
} }
} },
"AlwaysAllowAuthorization": true
} }

83
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthHttpModule.cs

@ -0,0 +1,83 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
namespace ApiBasicAuth.Security
{
public class BasicAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{
private readonly BasicAuthenticationOptions _basicOptions;
public BasicAuthenticationHandler(
IOptions<BasicAuthenticationOptions> basicOptions,
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
_basicOptions = basicOptions.Value;
}
protected override async Task<AuthenticateResult> HandleAuthenticateAsync()
{
if (!Request.Headers.ContainsKey("Authorization"))
{
Response.Headers.Add("WWW-Authenticate", @"Basic realm='Secure Area'");
return AuthenticateResult.Fail("Missing Authorization Header");
}
User user = null;
try
{
var authHeader = AuthenticationHeaderValue.Parse(Request.Headers["Authorization"]);
var credentialBytes = Convert.FromBase64String(authHeader.Parameter);
var credentials = Encoding.UTF8.GetString(credentialBytes).Split(new[] { ':' }, 2);
var username = credentials[0];
var password = credentials[1];
if (username.Equals(_basicOptions.Username) && password.Equals(_basicOptions.Password))
{
user = new User { Id = 1, Username = "admin", Birthday = DateTime.Now };
}
}
catch
{
// Base64×Ö·û´®½âÂëʧ°Ü
return AuthenticateResult.Fail("Invalid Authorization Header");
}
if (user == null)
return AuthenticateResult.Fail("Invalid Username or Password");
var claims = new[] {
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
new Claim(ClaimTypes.Name, user.Username),
};
var identity = new ClaimsIdentity(claims, Scheme.Name);
var principal = new ClaimsPrincipal(identity);
var ticket = new AuthenticationTicket(principal, Scheme.Name);
return AuthenticateResult.Success(ticket);
}
}
public class BasicAuthenticationOptions
{
public string Username { get; set; } = "admin";
public string Password { get; set; } = "3edc$RFV";
}
public class User
{
public int Id { get; set; }
public string Username { get; set; }
public DateTime Birthday { get; set; }
}
}

41
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs

@ -0,0 +1,41 @@
using System;
using System.Diagnostics.Eventing.Reader;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Net.Mime;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using RestSharp;
namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers
{
[Authorize]
[Route(RouteConsts.Part)]
public class PartController : ControllerBase
{
private readonly IHttpClientInvoker<PartCreateDto, PartDTO> _httpClientInvoker;
public PartController(IHttpClientInvoker<PartCreateDto,PartDTO> httpClientInvoker)
{
_httpClientInvoker = httpClientInvoker;
}
/// <summary>
/// 新增零件(Add part)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("")]
[Consumes(MediaTypeNames.Application.Xml)]
[Produces(MediaTypeNames.Application.Xml)]
public virtual async Task<ActionResult<PartDTO>> CreateAsync([FromBody]PartCreateDto input)
{
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Part);
return Ok(dto);
}
}
}

33
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs

@ -0,0 +1,33 @@
using System.Net.Mime;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers
{
[Route(RouteConsts.PurchaseOrder)]
public class PurchaseOrderController : ControllerBase
{
private readonly IHttpClientInvoker<PurchaseOrderCreateDTO, PurchaseOrderDTO> _httpClientInvoker;
public PurchaseOrderController(IHttpClientInvoker<PurchaseOrderCreateDTO, PurchaseOrderDTO> httpClientInvoker)
{
_httpClientInvoker = httpClientInvoker;
}
/// <summary>
/// 新增采购订单(Add purchase order)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("")]
[Consumes(MediaTypeNames.Application.Xml)]
[Produces(MediaTypeNames.Application.Xml)]
public virtual async Task<ActionResult<PurchaseOrderDTO>> CreateAsync([FromBody] PurchaseOrderCreateDTO input)
{
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.PurchaseOrder);
return Ok(dto);
}
}
}

33
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs

@ -0,0 +1,33 @@
using System.Net.Mime;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers
{
[Route(RouteConsts.Receipt)]
public class ReceiptController : ControllerBase
{
private readonly IHttpClientInvoker<ReceiptCreateDTO, ReceiptDTO> _httpClientInvoker;
public ReceiptController(IHttpClientInvoker<ReceiptCreateDTO, ReceiptDTO> httpClientInvoker)
{
_httpClientInvoker = httpClientInvoker;
}
/// <summary>
/// 新增收货/退货单(Add receipt/return receipt)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("")]
[Consumes(MediaTypeNames.Application.Xml)]
[Produces(MediaTypeNames.Application.Xml)]
public virtual async Task<ActionResult<ReceiptDTO>> CreateAsync([FromBody] ReceiptCreateDTO input)
{
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Receipt);
return Ok(dto);
}
}
}

33
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs

@ -0,0 +1,33 @@
using System.Net.Mime;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers
{
[Route(RouteConsts.Supplier)]
public class SupplierController : ControllerBase
{
private readonly IHttpClientInvoker<SupplierCreateDTO, SupplierDTO> _httpClientInvoker;
public SupplierController(IHttpClientInvoker<SupplierCreateDTO, SupplierDTO> httpClientInvoker)
{
_httpClientInvoker = httpClientInvoker;
}
/// <summary>
/// 新增供应商(Add supplier)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("")]
[Consumes(MediaTypeNames.Application.Xml)]
[Produces(MediaTypeNames.Application.Xml)]
public virtual async Task<ActionResult<SupplierDTO>> CreateAsync([FromBody] SupplierCreateDTO input)
{
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Supplier);
return Ok(dto);
}
}
}

32
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs

@ -0,0 +1,32 @@
using System.Net.Mime;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers
{
[Route(RouteConsts.UnplannedReceipt)]
public class UnplannedReceiptController : ControllerBase
{
private readonly IHttpClientInvoker<UnplannedReceiptCreateDTO, UnplannedReceiptDTO> _httpClientInvoker;
public UnplannedReceiptController(IHttpClientInvoker<UnplannedReceiptCreateDTO, UnplannedReceiptDTO> httpClientInvoker)
{
_httpClientInvoker = httpClientInvoker;
}
/// <summary>
/// 新增计划外入库单(Add unplanned receipt)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("")]
[Consumes(MediaTypeNames.Application.Xml)]
[Produces(MediaTypeNames.Application.Xml)]
public virtual async Task<ActionResult<UnplannedReceiptDTO>> CreateAsync([FromBody] UnplannedReceiptCreateDTO input)
{
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.UnplannedReceipt);
return Ok(dto);
}
}
}

36
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs

@ -0,0 +1,36 @@
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public class HttpClientInvoker<TInput, TOutput> : IHttpClientInvoker<TInput, TOutput>
{
private readonly IConfiguration _configuration;
public HttpClientInvoker(IConfiguration configuration)
{
_configuration = configuration;
}
public async Task<TOutput> InvokeAsync(TInput input,string routeString)
{
var baseUrl = _configuration["RemoteServices:Default:BaseUrl"];
var client = new HttpClient();
client.BaseAddress = new Uri(baseUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = await client.PostAsJsonAsync(routeString, input);
response.EnsureSuccessStatusCode();
var dto = await response.Content.ReadFromJsonAsync<TOutput>();
return dto;
}
}
}

10
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs

@ -0,0 +1,10 @@
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public interface IHttpClientInvoker<TInput,TOutput>
{
Task<TOutput> InvokeAsync(TInput input,string routeString);
}
}

5285
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt

File diff suppressed because it is too large

59
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Program.cs

@ -0,0 +1,59 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System;
using Serilog;
using Serilog.Events;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public class Program
{
public static int Main(string[] args)
{
InitLogger();
try
{
Log.Information("Starting Win_in.Sfs.Scp.WebApi.Xml.Host.");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
private static void InitLogger()
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif
.CreateLogger();
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseSerilog();
}
}

15
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Properties/launchSettings.json

@ -0,0 +1,15 @@
{
"profiles": {
"Win_in.Sfs.Scp.WebApi.Xml.Host": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:9977",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

75
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs

@ -0,0 +1,75 @@
using ApiBasicAuth.Security;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// services.AddControllers()
// .AddXmlDataContractSerializerFormatters();
var configuration = services.GetConfiguration();
services.AddControllers()
.AddMvcOptions(options =>
{
// options.ModelMetadataDetailsProviders.Add(
// new ExcludeBindingMetadataProvider(typeof(System.Version)));
// options.ModelMetadataDetailsProviders.Add(
// new SuppressChildValidationMetadataProvider(typeof(System.Guid)));
options.InputFormatters.Insert(0, new XDocumentInputFormatter());
// options.OutputFormatters.Insert(0,new XDocumentOutputFormatter());
})
.AddXmlDataContractSerializerFormatters()
.AddXmlSerializerFormatters();
// services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Win_in.Sfs.Scp.WebApi.Xml.Host", Version = "v1" });
});
services.AddAuthentication("BasicAuthentication")
.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
services.Configure<BasicAuthenticationOptions>(configuration.GetSection("BasicAuthentication"));
services.AddSingleton(typeof(IHttpClientInvoker<,>),typeof(HttpClientInvoker<,>));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Win_in.Sfs.Scp.WebApi.Xml.Host v1"));
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

27
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in - Backup.Sfs.Scp.WebApi.Xml.Host.csproj

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Win_in.Sfs.Scp.WebApi.XmlHost</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="4.4.2" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="4.4.2" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="4.4.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Application.Contracts\Win_in.Sfs.Scp.WebApi.Application.Contracts.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.HttpApi.Client\Win_in.Sfs.Scp.WebApi.HttpApi.Client.csproj" />
</ItemGroup>
</Project>

21
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Win_in.Sfs.Scp.WebApi.XmlHost</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.2.0" />
<PackageReference Include="RestSharp" Version="107.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Application.Contracts\Win_in.Sfs.Scp.WebApi.Application.Contracts.csproj" />
</ItemGroup>
</Project>

41
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XDocumentInputFormatter.cs

@ -0,0 +1,41 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Formatters;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public class XDocumentInputFormatter : InputFormatter, IInputFormatter, IApiRequestFormatMetadataProvider
{
private Type currentType { get; set; }
public XDocumentInputFormatter()
{
SupportedMediaTypes.Add("application/xml");
}
protected override bool CanReadType(Type type)
{
currentType = type;
if (type.IsAssignableFrom(typeof(XDocument))) return true;
return base.CanReadType(type);
}
public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
{
// Use StreamReader to convert any encoding to UTF-16 (default C# and sql Server).
using var streamReader = new StreamReader(context.HttpContext.Request.Body);
var xmlDoc = await XDocument.LoadAsync(streamReader, LoadOptions.None, CancellationToken.None);
var model = new XmlSerializer(currentType).Deserialize(xmlDoc.CreateReader());
return await InputFormatterResult.SuccessAsync(model);
}
}
}

9
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

20
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/appsettings.json

@ -0,0 +1,20 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"RemoteServices": {
"Default": {
"BaseUrl": "https://scp.iacchina.net:9988/"
}
},
"BasicAuthentication": {
"Username": "admin",
"Password": "admin"
}
}

3
WebApiService/test/Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp/WebApiConsoleApiClientModule.cs

@ -9,7 +9,8 @@ namespace Win_in.Sfs.Scp.WebApi.HttpApi.Client.ConsoleTestApp
{ {
[DependsOn( [DependsOn(
typeof(WebApiHttpApiClientModule), typeof(WebApiHttpApiClientModule),
typeof(AbpHttpClientIdentityModelModule) typeof(AbpHttpClientIdentityModelModule),
typeof(WebApiApplicationContractsModule)
)] )]
public class WebApiConsoleApiClientModule : AbpModule public class WebApiConsoleApiClientModule : AbpModule
{ {

Loading…
Cancel
Save