lvzb 2 years ago
parent
commit
cb44a71cda
  1. 2
      be/DataExchange/host/Win_in.Sfs.Wms.DataExchange.HttpApi.Host/appsettings.json
  2. 3
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs
  3. 4
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs
  4. 2
      be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj
  5. 19
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs
  6. 211
      be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/DashboardHttpApiHostModule.cs
  7. 4
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj
  8. 2
      be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql
  9. 80
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs
  10. 6
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs
  11. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs
  12. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs
  13. 6
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs
  14. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs
  15. 2
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs
  16. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs
  17. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs
  18. 6
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs
  19. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs
  20. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs
  21. 4
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs
  22. 1
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Win_in.Sfs.Wms.Pda.Host.csproj
  23. 22
      be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json
  24. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs
  25. 9
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs
  26. 1
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs
  27. 9
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs
  28. 12
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs
  29. 10
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs
  30. 3
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs
  31. 2
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs
  32. 2
      be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs
  33. 1
      be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs
  34. 11
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs
  35. 30
      be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs
  36. 2
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs
  37. 24
      be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs
  38. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Event/SfsCreatedEntityEventData.cs
  39. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs
  40. 1
      be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Win_in.Sfs.Shared.Host.csproj
  41. 28
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs
  42. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs
  43. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs
  44. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs
  45. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs
  46. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs
  47. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs
  48. 274
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
  49. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteMapperProfile.cs
  50. 146
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs
  51. 297
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs
  52. 21
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs
  53. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs
  54. 12
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs
  55. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs
  56. 32
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs
  57. 105
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs
  58. 117
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs
  59. 81
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs
  60. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs
  61. 95
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs
  62. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs
  63. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs
  64. 50
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs
  65. 20
      build/src/docker/publish/conf/settings/appsettings.Development.json
  66. 4
      build/src/docker/publish/conf/settings/appsettings.json
  67. BIN
      build/src/win-x64/publish/TaskKill.exe
  68. 1
      build/src/win-x64/publish/stop.cmd.example

2
be/DataExchange/host/Win_in.Sfs.Wms.DataExchange.HttpApi.Host/appsettings.json

@ -46,6 +46,8 @@
"StringEncryption": { "StringEncryption": {
"DefaultPassPhrase": "8fFOYxuru0qm2ATJ" "DefaultPassPhrase": "8fFOYxuru0qm2ATJ"
}, },
//
"Sites": "T8,T9", "Sites": "T8,T9",
"Company": "T8,T9" "Company": "T8,T9"
} }

3
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs

@ -15,8 +15,9 @@ namespace Win_in.Sfs.Auth.Tokens;
public class TokenService : ApplicationService public class TokenService : ApplicationService
{ {
private readonly IHttpClientFactory _httpClientFactory; private readonly IHttpClientFactory _httpClientFactory;
private readonly IConfiguration _configuration;
private readonly ILogger<TokenService> _logger; private readonly ILogger<TokenService> _logger;
private readonly IConfiguration _configuration;
public TokenService(IHttpClientFactory httpClientFactory, IConfiguration configuration, ILogger<TokenService> logger) public TokenService(IHttpClientFactory httpClientFactory, IConfiguration configuration, ILogger<TokenService> logger)
{ {

4
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs

@ -57,7 +57,7 @@ public class UserMenuAppService :
public virtual async Task<List<MenuDto>> GetPdaMenusOfUserAsync(Guid? userId) public virtual async Task<List<MenuDto>> GetPdaMenusOfUserAsync(Guid? userId)
{ {
var userMenus = await _repository var userMenus = await _repository
.GetListAsync(p => p.UserId == userId && p.Portal == PDA_PORTAL).ConfigureAwait(false); .GetListAsync(p => p.UserId == userId && p.Portal == EnumPortal.Pda).ConfigureAwait(false);
var menuCodes = userMenus.Select(p => p.MenuCode).Distinct().ToList(); var menuCodes = userMenus.Select(p => p.MenuCode).Distinct().ToList();
@ -155,7 +155,7 @@ public class UserMenuAppService :
var entities = await _menuRepository var entities = await _menuRepository
.GetListAsync(p => menuCodes.Contains(p.Code)); .GetListAsync(p => menuCodes.Contains(p.Code));
entities = entities.Where(p => p.Status == MenuStatus.Enable && p.Portal == EnumPortal.Web).ToList(); entities = entities.Where(p => p.Status == MenuStatus.Enable && p.Portal == EnumPortal.Pda).ToList();
return ObjectMapper.Map<List<Menu>, List<MenuDto>>(entities); return ObjectMapper.Map<List<Menu>, List<MenuDto>>(entities);
} }

2
be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj

@ -13,8 +13,6 @@
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish> <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PreserveCompilationReferences>true</PreserveCompilationReferences> <PreserveCompilationReferences>true</PreserveCompilationReferences>
<UserSecretsId>Win_in.Sfs.Auth-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId> <UserSecretsId>Win_in.Sfs.Auth-4681b4fd-151f-4221-84a4-929d86723e4c</UserSecretsId>
<IncrementVersionOnBuild>1.yyyy.Mdd.Hmm</IncrementVersionOnBuild>
<Version>1.2023.407.1105</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile> <GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageOutputPath /> <PackageOutputPath />
</PropertyGroup> </PropertyGroup>

19
be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Serilog;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Wms.Dashboard.Host.Models; using Win_in.Sfs.Wms.Dashboard.Host.Models;
@ -101,9 +102,9 @@ public class PlanAndActualController : AbpController
dto.MinQty = itemSafetyStork.MinStock; dto.MinQty = itemSafetyStork.MinStock;
} }
dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode); dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode, detail.Lot);
dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode); dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode, detail.Lot);
dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode); dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode, detail.Lot);
dtos.Add(dto); dtos.Add(dto);
} }
@ -117,19 +118,19 @@ public class PlanAndActualController : AbpController
return dtos.OrderBy(t => t.SupplierShortName).ToList(); return dtos.OrderBy(t => t.SupplierShortName).ToList();
} }
private static decimal CountPutawayQty(List<PutawayNoteDTO> putawayNotes, string itemCode) private static decimal CountPutawayQty(List<PutawayNoteDTO> putawayNotes, string itemCode, string lot)
{ {
return putawayNotes.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty)); return putawayNotes.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.ToLot == lot).Sum(t => t.Qty));
} }
private static decimal CountReceiptQty(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode) private static decimal CountReceiptQty(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode, string lot)
{ {
return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty)); return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.HandledLot == lot).Sum(t => t.Qty));
} }
private static int CountReceiptNoteCount(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode) private static int CountReceiptNoteCount(List<PurchaseReceiptNoteDTO> purchaseReceipts, string itemCode, string lot)
{ {
return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode)); return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode && t.Lot == lot));
} }
private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync() private async Task<List<SupplierAsnDTO>> GetSupplierAsnsAsync()

211
be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/DashboardHttpApiHostModule.cs

@ -1,17 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using Polly; using Polly;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AspNetCore.Serilog;
@ -22,9 +13,8 @@ using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.Authentication; using Volo.Abp.Http.Client.Authentication;
using Volo.Abp.Http.Client.IdentityModel.Web; using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Swashbuckle; using Volo.Abp.Swashbuckle;
using Volo.Abp.Users; using Volo.Abp.Users;
using Win_in.Sfs.Auth; using Win_in.Sfs.Auth;
@ -42,7 +32,9 @@ namespace Win_in.Sfs.Wms.Dashboard.Host;
typeof(AbpIdentityHttpApiClientModule), typeof(AbpIdentityHttpApiClientModule),
typeof(AbpAspNetCoreMvcClientModule), typeof(AbpAspNetCoreMvcClientModule),
typeof(AbpHttpClientIdentityModelWebModule), typeof(AbpHttpClientIdentityModelWebModule),
typeof(SharedHostModule) typeof(SharedHostModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule)
)] )]
/// <summary> /// <summary>
@ -65,10 +57,8 @@ namespace Win_in.Sfs.Wms.Dashboard.Host;
typeof(MessageApplicationContractsModule), typeof(MessageApplicationContractsModule),
typeof(AuthApplicationContractsModule) typeof(AuthApplicationContractsModule)
)] )]
public class DashboardHttpApiHostModule : AbpModule public class DashboardHttpApiHostModule : ModuleBase<DashboardHttpApiHostModule>
{ {
private bool _isMultiTenancy = true;
/// <summary> /// <summary>
/// 预配置服务 /// 预配置服务
/// </summary> /// </summary>
@ -120,55 +110,9 @@ public class DashboardHttpApiHostModule : AbpModule
context.Services.Replace(ServiceDescriptor.Transient<IRemoteServiceHttpClientAuthenticator, SfsHttpContextIdentityModelRemoteServiceHttpClientAuthenticator>()); context.Services.Replace(ServiceDescriptor.Transient<IRemoteServiceHttpClientAuthenticator, SfsHttpContextIdentityModelRemoteServiceHttpClientAuthenticator>());
} }
/// <summary> protected override void ConfigureHttpClientProxies()
/// 配置服务
/// </summary>
/// <param name="context"></param>
public override void ConfigureServices(ServiceConfigurationContext context)
{
_ = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
context.SetConsoleTitleOfWebApp("Dashboard.Host");
_isMultiTenancy = Convert.ToBoolean(configuration["IsMultiTenancy"]);
context.Services.Configure<AuthenticationOptions>(configuration.GetSection("Authentication"));
ConfigureHttpClientProxies(context);
ConfigureMultiTenancy();
ConfigureSwaggerServices(context, configuration);
ConfigureLocalization();
ConfigureAuthentication(context, configuration);
ConfigureCors(context, configuration);
ConfigureAntiForgery();
var testConfig = configuration["TestConfig"];
Console.WriteLine("----------------------------");
Console.WriteLine(testConfig);
Console.WriteLine("----------------------------");
}
private void ConfigureAntiForgery()
{ {
Configure<AbpAntiForgeryOptions>(options => var context = this.ServiceConfigurationContext;
{
options.TokenCookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax;
options.TokenCookie.Expiration = TimeSpan.FromDays(365);
options.AutoValidateIgnoredHttpMethods.Add("POST");
});
}
private static void ConfigureHttpClientProxies(ServiceConfigurationContext context)
{
_ = context.Services.GetConfiguration();
context.Services.AddHttpClientProxies( context.Services.AddHttpClientProxies(
typeof(AuthApplicationContractsModule).Assembly, typeof(AuthApplicationContractsModule).Assembly,
"Auth" "Auth"
@ -202,145 +146,4 @@ public class DashboardHttpApiHostModule : AbpModule
"FileStorage" "FileStorage"
); );
} }
private void ConfigureMultiTenancy()
{
Configure<AbpMultiTenancyOptions>(options => { options.IsEnabled = _isMultiTenancy; });
}
private static void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
{
var origins = configuration.GetSection("App:CorsOrigins").Get<string[]>();
context.Services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder
.WithOrigins(
origins.Select(o => o.RemovePostFix("/"))
.ToArray()
)
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
private static void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
//var isAlwaysAllowAuthorization = configuration.GetValue<bool>("AuthServer:AlwaysAllowAuthorization");
//if (isAlwaysAllowAuthorization)
//{
// //绕过授权服务,用于测试
// context.Services.AddAlwaysAllowAuthorization();
//}
//else
//{
// context.Services.AddAuthentication()
// .AddJwtBearer(options =>
// {
// options.Authority = configuration["AuthServer:Authority"];
// options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
// options.Audience = "DataExchange";
// options.BackchannelHttpHandler = new HttpClientHandler
// {
// ServerCertificateCustomValidationCallback =
// HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
// };
// });
//}
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = configuration["IdentityClients:Default:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["IdentityClients:Default:RequireHttps"]);
options.Audience = configuration["IdentityClients:Default:Scope"];
});
}
private void ConfigureLocalization()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
});
}
/// <summary>
/// 应用初始化
/// </summary>
/// <param name="context"></param>
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
var configuration = context.GetConfiguration();
app.UseDeveloperExceptionPage();
//if (env.IsDevelopment())
//{
// app.UseDeveloperExceptionPage();
//}
//else
//{
// //app.UseErrorPage();
// app.UseHsts();
//}
app.UseHttpsRedirection();
app.UseCorrelationId();
app.UseStaticFiles();
app.UseRouting();
app.UseCors();
app.UseAuthentication();
if (_isMultiTenancy)
{
app.UseMultiTenancy();
}
app.UseAbpRequestLocalization();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Dashboard API");
//options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
//options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]);
//options.OAuthScopes("Dashboard");
options.OAuthClientId(configuration["IdentityClients:Default:ClientId"]);
options.OAuthClientSecret(configuration["IdentityClients:Default:ClientSecret"]);
options.OAuthScopes(configuration["IdentityClients:Default:Scope"]);
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
}
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
{
//context.Services.AddAbpSwaggerGenWithOAuth(
// configuration["IdentityClients:Default:Authority"],
// new Dictionary<string, string>
// {
// {"Dashboard", "Dashboard API"}
// },
// options =>
// {
// options.SwaggerDoc("v1", new OpenApiInfo { Title = "Dashboard API", Version = "v1" });
// options.DocInclusionPredicate((docName, description) => true);
// options.CustomSchemaIds(type => type.FullName);
// GetXmlFiles().ForEach(file =>
// {
// options.IncludeXmlComments(file);
// });
// });
}
} }

4
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj

@ -33,18 +33,22 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="logs\**" />
<Compile Remove="reporting\**" /> <Compile Remove="reporting\**" />
<Compile Remove="Reports\**" /> <Compile Remove="Reports\**" />
<Compile Remove="StaticDictionaryPrintData\**" /> <Compile Remove="StaticDictionaryPrintData\**" />
<Compile Remove="wwwroot\**" /> <Compile Remove="wwwroot\**" />
<Content Remove="logs\**" />
<Content Remove="reporting\**" /> <Content Remove="reporting\**" />
<Content Remove="Reports\**" /> <Content Remove="Reports\**" />
<Content Remove="StaticDictionaryPrintData\**" /> <Content Remove="StaticDictionaryPrintData\**" />
<Content Remove="wwwroot\**" /> <Content Remove="wwwroot\**" />
<EmbeddedResource Remove="logs\**" />
<EmbeddedResource Remove="reporting\**" /> <EmbeddedResource Remove="reporting\**" />
<EmbeddedResource Remove="Reports\**" /> <EmbeddedResource Remove="Reports\**" />
<EmbeddedResource Remove="StaticDictionaryPrintData\**" /> <EmbeddedResource Remove="StaticDictionaryPrintData\**" />
<EmbeddedResource Remove="wwwroot\**" /> <EmbeddedResource Remove="wwwroot\**" />
<None Remove="logs\**" />
<None Remove="reporting\**" /> <None Remove="reporting\**" />
<None Remove="Reports\**" /> <None Remove="Reports\**" />
<None Remove="StaticDictionaryPrintData\**" /> <None Remove="StaticDictionaryPrintData\**" />

2
be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql

@ -1703,7 +1703,7 @@ CREATE TABLE [Store_TransferNote] (
[Id] uniqueidentifier NOT NULL, [Id] uniqueidentifier NOT NULL,
[RequestNumber] nvarchar(max) NULL, [RequestNumber] nvarchar(max) NULL,
[JobNumber] nvarchar(64) NULL, [JobNumber] nvarchar(64) NULL,
[Type] nvarchar(64) NULL, [Type] nvarchar(64) NOT NULL,
[UseOnTheWayLocation] bit NOT NULL, [UseOnTheWayLocation] bit NOT NULL,
[ConfirmTime] datetime2 NULL, [ConfirmTime] datetime2 NULL,
[Confirmed] bit NOT NULL, [Confirmed] bit NOT NULL,

80
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs

@ -1,8 +1,15 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Drawing.Charts;
using IdentityModel.Client;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Volo.Abp.Account; using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Win_in.Sfs.Auth.Application.Contracts; using Win_in.Sfs.Auth.Application.Contracts;
@ -26,6 +33,9 @@ public class AccountController : AbpController
private readonly ITokenService _tokenService; private readonly ITokenService _tokenService;
private readonly IUserMenuAppService _userMenuAppService; private readonly IUserMenuAppService _userMenuAppService;
private readonly IUserWorkGroupAppService _userWorkGroupAppService; private readonly IUserWorkGroupAppService _userWorkGroupAppService;
private readonly IConfiguration _configuration;
private readonly IHttpClientFactory _httpClientFactory;
private readonly ILogger<TokenService> _logger;
/// <summary> /// <summary>
/// ///
@ -38,12 +48,27 @@ public class AccountController : AbpController
, ITokenService tokenService , ITokenService tokenService
, IUserMenuAppService userMenuAppService , IUserMenuAppService userMenuAppService
, IUserWorkGroupAppService userWorkGroupAppService , IUserWorkGroupAppService userWorkGroupAppService
) , IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger<TokenService> logger)
{ {
_profileAppService = profileAppService; _profileAppService = profileAppService;
_tokenService = tokenService; _tokenService = tokenService;
_userMenuAppService = userMenuAppService; _userMenuAppService = userMenuAppService;
_userWorkGroupAppService = userWorkGroupAppService; _userWorkGroupAppService = userWorkGroupAppService;
_configuration = configuration;
_httpClientFactory = httpClientFactory;
_logger = logger;
}
[Display]
public class LoginModel
{
[Display]
[Required]
public string UserName { get; set; }
[Display]
[Required]
public string Password { get; set; }
} }
/// <summary> /// <summary>
@ -55,8 +80,51 @@ public class AccountController : AbpController
public virtual async Task<BaererToken> LoginAsync(UserLoginInput userLoginInput) public virtual async Task<BaererToken> LoginAsync(UserLoginInput userLoginInput)
{ {
var token = await _tokenService.GetTokenAsync(userLoginInput.Username, userLoginInput.Password).ConfigureAwait(false); var address = _configuration["AuthServer:Authority"];
return token; var request = new DiscoveryDocumentRequest
{
Address = address,
Policy = new DiscoveryPolicy { RequireHttps = false }
};
var discovery = await _httpClientFactory.CreateClient().GetDiscoveryDocumentAsync(request).ConfigureAwait(false);
var clientId = _configuration["AuthServer:ClientId"];
var clientSecret = _configuration["AuthServer:ClientSecret"];
this._logger.LogInformation($"address:{address},TokenEndpoint:{discovery.TokenEndpoint},clientId:{clientId},clientSecret:{clientSecret}");
var result = await _httpClientFactory.CreateClient().RequestPasswordTokenAsync(new PasswordTokenRequest
{
Address = $"{address.TrimEnd('/')}/connect/token",
GrantType = "password",
ClientId = clientId,
ClientSecret = clientSecret,
UserName = userLoginInput.Username,
Password = userLoginInput.Password
}).ConfigureAwait(false);
Console.WriteLine($"Result:${(result.IsError ? result.ErrorDescription : result.AccessToken)}");
return new BaererToken()
{
refresh_token = result.RefreshToken,
access_token = result.AccessToken,
scope = result.Scope,
token_type = result.TokenType,
expires_in = result.ExpiresIn,
};
//return new JsonResult(new
//{
// result.TokenType,
// result.AccessToken,
// result.ExpiresIn,
// result.RefreshToken,
// result.Scope,
// result.HttpStatusCode,
// result.Error,
// result.HttpErrorReason,
// result.ErrorDescription,
// result.ErrorType,
// result.Exception?.Message,
// Exception = result.Exception?.ToString()
//});
} }
/// <summary> /// <summary>
@ -95,10 +163,10 @@ public class AccountController : AbpController
/// 菜单 /// 菜单
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("menus")] [HttpGet("menus/{userId}")]
public virtual async Task<List<PdaMenuGroupDto>> GetMenusAsync() public virtual async Task<List<PdaMenuGroupDto>> GetMenusAsync(Guid userId)
{ {
var userId = CurrentUser.Id; //var userId = CurrentUser.Id;
var pdaMenuGroupDtos = new List<PdaMenuGroupDto>();//返回给pda的菜单 已排序 var pdaMenuGroupDtos = new List<PdaMenuGroupDto>();//返回给pda的菜单 已排序
var menusOfUser = await _userMenuAppService.GetPdaMenusOfUserAsync(userId).ConfigureAwait(false); var menusOfUser = await _userMenuAppService.GetPdaMenusOfUserAsync(userId).ConfigureAwait(false);
var menuGroups = menusOfUser.GroupBy(p => p.GroupName); var menuGroups = menusOfUser.GroupBy(p => p.GroupName);

6
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs

@ -75,7 +75,7 @@ public class CountJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -133,7 +133,7 @@ public class CountJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; var status = new List<string>() {EnumJobStatus.Open.ToString(),EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var requestInput = new SfsJobRequestInputBase var requestInput = new SfsJobRequestInputBase
@ -165,7 +165,7 @@ public class CountJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs

@ -75,7 +75,7 @@ public class DeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
_ = JsonSerializer.Serialize(wlgCodes); _ = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -132,7 +132,7 @@ public class DeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs

@ -64,7 +64,7 @@ public class InspectJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -108,7 +108,7 @@ public class InspectJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

6
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs

@ -65,7 +65,7 @@ public class IssueJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; var status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -143,7 +143,7 @@ public class IssueJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; var status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var requestInput = new SfsJobRequestInputBase var requestInput = new SfsJobRequestInputBase
@ -175,7 +175,7 @@ public class IssueJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs

@ -74,7 +74,7 @@ public class JisDeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -106,7 +106,7 @@ public class JisDeliverJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

2
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs

@ -76,7 +76,7 @@ public class JobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var list = new List<JobCountDto>(); var list = new List<JobCountDto>();

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs

@ -62,7 +62,7 @@ public class ProductReceiveJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -106,7 +106,7 @@ public class ProductReceiveJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs

@ -69,7 +69,7 @@ public class ProductionReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -113,7 +113,7 @@ public class ProductionReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

6
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs

@ -84,7 +84,7 @@ public class PurchaseReceiptJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -186,7 +186,7 @@ public class PurchaseReceiptJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes);
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var requestInput = new SfsJobRequestInputBase var requestInput = new SfsJobRequestInputBase
@ -222,7 +222,7 @@ public class PurchaseReceiptJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs

@ -63,7 +63,7 @@ public class PurchaseReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -132,7 +132,7 @@ public class PurchaseReturnJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs

@ -62,7 +62,7 @@ public class PutawayJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase
@ -106,7 +106,7 @@ public class PutawayJobController : AbpController
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false);
var jsonCodes = JsonSerializer.Serialize(wlgCodes); var jsonCodes = JsonSerializer.Serialize(wlgCodes);
List<int> status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; List<string> status = new List<string>() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() };
var jsonStatus = JsonSerializer.Serialize(status); var jsonStatus = JsonSerializer.Serialize(status);
var request = new SfsJobRequestInputBase var request = new SfsJobRequestInputBase

4
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs

@ -74,7 +74,7 @@ public class TransferRequestController : AbpController
Filters = new List<Filter> Filters = new List<Filter>
{ {
new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="), new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==") new(nameof(TransferRequestDTO.RequestStatus),EnumRequestStatus.New.ToString(),"==")
} }
} }
}; };
@ -98,7 +98,7 @@ public class TransferRequestController : AbpController
Filters = new List<Filter> Filters = new List<Filter>
{ {
new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="), new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==") new(nameof(TransferRequestDTO.RequestStatus),EnumRequestStatus.New.ToString(),"==")
} }
} }
}; };

1
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Win_in.Sfs.Wms.Pda.Host.csproj

@ -28,7 +28,6 @@
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="5.3.5" /> <PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="5.3.5" />
<PackageReference Include="Volo.Abp.Core" Version="5.3.5" /> <PackageReference Include="Volo.Abp.Core" Version="5.3.5" />
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="5.3.5" /> <PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="5.3.5" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="5.3.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

22
be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json

@ -1,13 +1,13 @@
{ {
"RemoteServices": { //"RemoteServices": {
"Default": { "BaseUrl": "http://dev.ccwin-in.com:21293/" }, // "Default": { "BaseUrl": "http://dev.ccwin-in.com:21293/" },
"BaseData": { "BaseUrl": "http://dev.ccwin-in.com:21294/" }, // "BaseData": { "BaseUrl": "http://dev.ccwin-in.com:21294/" },
"Store": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, // "Store": { "BaseUrl": "http://dev.ccwin-in.com:21295/" },
"Job": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, // "Job": { "BaseUrl": "http://dev.ccwin-in.com:21295/" },
"Inventory": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, // "Inventory": { "BaseUrl": "http://dev.ccwin-in.com:21295/" },
"FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, // "FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:21292/" },
"Message": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, // "Message": { "BaseUrl": "http://dev.ccwin-in.com:21292/" },
"Label": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, // "Label": { "BaseUrl": "http://dev.ccwin-in.com:21292/" },
"Auth": { "BaseUrl": "http://dev.ccwin-in.com:21293/" } // "Auth": { "BaseUrl": "http://dev.ccwin-in.com:21293/" }
} //}
} }

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs

@ -19,5 +19,12 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
.Ignore(x => x.ConcurrencyStamp) .Ignore(x => x.ConcurrencyStamp)
; ;
CreateMap<ItemPackEditInput, ItemPack>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.ConcurrencyStamp)
;
} }
} }

9
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs

@ -1,4 +1,5 @@
using AutoMapper; using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Inventory.Domain; using Win_in.Sfs.Wms.Inventory.Domain;
@ -10,5 +11,13 @@ public partial class InventoryApplicationAutoMapperProfile : Profile
{ {
CreateMap<ExpectIn, ExpectInDTO>() CreateMap<ExpectIn, ExpectInDTO>()
.ReverseMap(); .ReverseMap();
CreateMap<ExpectInEditInput, ExpectIn>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id)
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
;
} }
} }

1
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs

@ -66,6 +66,7 @@ public class ExpectOutAppService
LocationArea = first.LocationArea, LocationArea = first.LocationArea,
LocationGroup = first.LocationGroup, LocationGroup = first.LocationGroup,
LocationCode = s.Key.LocationCode, LocationCode = s.Key.LocationCode,
LocationErpCode = first.LocationErpCode,
Lot = s.Key.Lot, Lot = s.Key.Lot,
ContainerCode = s.Key.ContainerCode, ContainerCode = s.Key.ContainerCode,
ItemCode = s.Key.ItemCode, ItemCode = s.Key.ItemCode,

9
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs

@ -19,5 +19,14 @@ public partial class InventoryApplicationAutoMapperProfile : Profile
.Ignore(x => x.JobNumber) .Ignore(x => x.JobNumber)
.Ignore(x => x.ConcurrencyStamp) .Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Remark); .Ignore(x => x.Remark);
CreateMap<ExpectOutEditInput, ExpectOut>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id)
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
;
;
} }
} }

12
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs

@ -1,4 +1,5 @@
using AutoMapper; using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Inventory.Domain; using Win_in.Sfs.Wms.Inventory.Domain;
@ -10,6 +11,17 @@ public partial class InventoryApplicationAutoMapperProfile : Profile
{ {
CreateMap<TransferLog, TransferLogDTO>() CreateMap<TransferLog, TransferLogDTO>()
.ReverseMap(); .ReverseMap();
CreateMap<TransferLogEditInput, TransferLog>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TransferNumber)
.Ignore(x => x.FromTransNumber)
.Ignore(x => x.ToTransNumber)
.Ignore(x => x.TransferTime)
.Ignore(x => x.ActiveDate)
.Ignore(x => x.ConcurrencyStamp)
.Ignore(x => x.Id)
;
} }
} }

10
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs

@ -298,8 +298,6 @@ public class Balance : SfsInventoryAggregateRootBase
LastCountPlanNumber = other.LastCountPlanNumber; LastCountPlanNumber = other.LastCountPlanNumber;
LastCountTime = other.LastCountTime; LastCountTime = other.LastCountTime;
LastModificationTime = other.LastModificationTime; LastModificationTime = other.LastModificationTime;
LocationCode = other.LocationCode;
LocationErpCode = other.LocationErpCode;
Lot = other.Lot; Lot = other.Lot;
Uom = other.Uom; Uom = other.Uom;
Qty = other.Qty; Qty = other.Qty;
@ -317,9 +315,17 @@ public class Balance : SfsInventoryAggregateRootBase
ArriveDate = other.ArriveDate; ArriveDate = other.ArriveDate;
ProduceDate = other.ProduceDate; ProduceDate = other.ProduceDate;
ExpireDate = other.ExpireDate; ExpireDate = other.ExpireDate;
ItemCode = other.ItemCode;
ItemName = other.ItemName; ItemName = other.ItemName;
ItemDesc1 = other.ItemDesc1; ItemDesc1 = other.ItemDesc1;
ItemDesc2 = other.ItemDesc2; ItemDesc2 = other.ItemDesc2;
LocationArea= other.LocationArea;
LocationGroup= other.LocationGroup;
LocationCode = other.LocationCode;
LocationErpCode = other.LocationErpCode;
} }
public override string ToString() public override string ToString()

3
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs

@ -56,6 +56,9 @@ public class Transaction : SfsInventoryAggregateRootBase
JobNumber = other.JobNumber; JobNumber = other.JobNumber;
DocNumber = other.DocNumber; DocNumber = other.DocNumber;
ManageType = other.ManageType; ManageType = other.ManageType;
LocationGroup= other.LocationGroup;
LocationArea= other.LocationArea;
LocationErpCode= other.LocationErpCode;
} }
/// <summary> /// <summary>

2
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs

@ -62,6 +62,7 @@ public static class TransferLogExtensions
transaction.ProduceDate = transferLog.ProduceDate; transaction.ProduceDate = transferLog.ProduceDate;
transaction.ExpireDate = transferLog.ExpireDate; transaction.ExpireDate = transferLog.ExpireDate;
transaction.StdPackQty = transferLog.StdPackQty; transaction.StdPackQty = transferLog.StdPackQty;
transaction.Uom = transferLog.Uom;
//出库库存事务的数量要改成负数 //出库库存事务的数量要改成负数
transaction.Qty = -transferLog.Qty; transaction.Qty = -transferLog.Qty;
@ -92,6 +93,7 @@ public static class TransferLogExtensions
transaction.ProduceDate = transferLog.ProduceDate; transaction.ProduceDate = transferLog.ProduceDate;
transaction.ExpireDate = transferLog.ExpireDate; transaction.ExpireDate = transferLog.ExpireDate;
transaction.StdPackQty = transferLog.StdPackQty; transaction.StdPackQty = transferLog.StdPackQty;
transaction.Uom = transferLog.Uom;
transaction.Qty = transferLog.Qty; transaction.Qty = transferLog.Qty;
return transaction; return transaction;

2
be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs

@ -1,3 +1,4 @@
using System;
using AutoMapper; using AutoMapper;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Win_in.Sfs.Message.Application.Contracts; using Win_in.Sfs.Message.Application.Contracts;
@ -11,6 +12,7 @@ public class UserNotifyMessageAutoMapperProfile : Profile
{ {
CreateMap<UserNotifyMessage, UserNotifyMessageDto>() CreateMap<UserNotifyMessage, UserNotifyMessageDto>()
.IgnoreAuditedObjectProperties() .IgnoreAuditedObjectProperties()
.BeforeMap((x, y) => y.UserId = x.CreatorId==null?Guid.Empty: x.CreatorId.Value)
.ReverseMap(); .ReverseMap();
CreateMap<UserNotifyMessage, UserNotifyMessageEditInput>(); CreateMap<UserNotifyMessage, UserNotifyMessageEditInput>();

1
be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs

@ -23,7 +23,6 @@ namespace Win_in.Sfs.Message.Application;
public class UserNotifyMessageService : SfsMessageCrudAppServiceBase<UserNotifyMessage, UserNotifyMessageDto, SfsMessageRequestInputBase, UserNotifyMessageEditInput> public class UserNotifyMessageService : SfsMessageCrudAppServiceBase<UserNotifyMessage, UserNotifyMessageDto, SfsMessageRequestInputBase, UserNotifyMessageEditInput>
, IUserNotifyMessageService , IUserNotifyMessageService
{ {
public UserNotifyMessageService(IUserNotifyMessageRepository repository) : base(repository) public UserNotifyMessageService(IUserNotifyMessageRepository repository) : base(repository)
{ {
} }

11
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs

@ -11,6 +11,7 @@ using ClosedXML;
using ClosedXML.Excel; using ClosedXML.Excel;
using ClosedXML.Graphics; using ClosedXML.Graphics;
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using Irony; using Irony;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -37,6 +38,11 @@ public class ClosedXmlExportImportService : IExportImportService
{ {
using var workbook = new XLWorkbook(); using var workbook = new XLWorkbook();
var name = typeof(TModel).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TModel).Name; var name = typeof(TModel).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TModel).Name;
if (name.Length > 30)
{
name=name.Substring(0, 30);
}
var fileName = $"{name}_导出.xlsx"; var fileName = $"{name}_导出.xlsx";
var ws = workbook.Worksheets.Add(name); var ws = workbook.Worksheets.Add(name);
ws.Style.Font.FontName = "宋体"; ws.Style.Font.FontName = "宋体";
@ -79,6 +85,11 @@ public class ClosedXmlExportImportService : IExportImportService
using var workbook = new XLWorkbook(); using var workbook = new XLWorkbook();
var type = typeof(TImportModel); var type = typeof(TImportModel);
var name = type.GetCustomAttribute<DisplayAttribute>()?.Name ?? type.Name; var name = type.GetCustomAttribute<DisplayAttribute>()?.Name ?? type.Name;
if (name.Length > 30)
{
name=name.Substring(0, 30);
}
var fileName = $"{name}_导入模板.xlsx"; var fileName = $"{name}_导入模板.xlsx";
var ws = workbook.Worksheets.Add(name); var ws = workbook.Worksheets.Add(name);
var properties = GetPropertiesForImportModel(type); var properties = GetPropertiesForImportModel(type);

30
be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs

@ -23,6 +23,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;
using Omu.ValueInjecter.Utils;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
@ -331,13 +332,13 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// </summary> /// </summary>
[HttpPost("import")] [HttpPost("import")]
[Consumes("multipart/form-data")] [Consumes("multipart/form-data")]
[UnitOfWork] //[UnitOfWork]
public virtual async Task<IActionResult> ImportAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file) public virtual async Task<IActionResult> ImportAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file)
{ {
using var ms = new MemoryStream(); using var ms = new MemoryStream();
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false);
var inputFileBytes = ms.GetAllBytes(); var inputFileBytes = ms.GetAllBytes();
var result = await ImportInternalAsync(requestInput, inputFileBytes); var result = await ImportInternalAsync(requestInput, inputFileBytes).ConfigureAwait(false);
var bytes = result.FileContents; var bytes = result.FileContents;
result.FileContents = null; result.FileContents = null;
@ -510,7 +511,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
/// <summary> /// <summary>
/// 导入数据具体实现,可重写 /// 导入数据具体实现,可重写
/// </summary> /// </summary>
[UnitOfWork] //[UnitOfWork]
protected virtual async Task<SfsImportResult> ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes) protected virtual async Task<SfsImportResult> ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes)
{ {
IList<TImportInput> modelList = null; IList<TImportInput> modelList = null;
@ -581,6 +582,10 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("---------------------------------");
Console.WriteLine($"####导入验证错误:");
Console.WriteLine($"{ex.Message}");
Console.WriteLine("---------------------------------");
Logger.LogException(ex); Logger.LogException(ex);
if (modelList != null) if (modelList != null)
{ {
@ -683,12 +688,23 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
}; };
var addList = dict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList(); var addList = dict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList();
try
{
await context.BulkInsertOrUpdateAsync(addList, bulkConfig).ConfigureAwait(false); await context.BulkInsertOrUpdateAsync(addList, bulkConfig).ConfigureAwait(false);
await context.BulkInsertAsync(list).ConfigureAwait(false); await context.BulkInsertAsync(list).ConfigureAwait(false);
//await _repository.InsertManyAsync(addList).ConfigureAwait(true); //await _repository.InsertManyAsync(addList).ConfigureAwait(true);
//await _repository.UpdateManyAsync(dict.Where(p => p.Value == EntityState.Modified).Select(p => p.Key)).ConfigureAwait(false); //await _repository.UpdateManyAsync(dict.Where(p => p.Value == EntityState.Modified).Select(p => p.Key)).ConfigureAwait(false);
await PublishCreatedAsync(addList).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<List<TEntity>>(addList), false).ConfigureAwait(false);
}
catch (Exception ex)
{
await context.Database.RollbackTransactionAsync().ConfigureAwait(false);
Logger.LogDebug($"{typeof(TEntity).Name} Created Event:{ex.Message}", null);
Console.WriteLine(ex.Source);
throw;
}
} }
} }
@ -749,10 +765,12 @@ public abstract class SfsCrudWithDetailsAppServiceBase<TEntity, TEntityDto, TReq
// 不包含错误或运行部分插入时,加入批量操作列表 // 不包含错误或运行部分插入时,加入批量操作列表
if (!modelDict.SelectMany(o => o.Value).Any() || requestInput.IsAllowPartImport) if (!modelDict.SelectMany(o => o.Value).Any() || requestInput.IsAllowPartImport)
{ {
if (entity is IHasWorker worker) if (entity != null)
{ {
worker.Worker = CurrentUser.GetUserName(); var first = entity.GetProps().First(p => p.Name == "Worker");
first.SetValue(first, CurrentUser.GetUserName());
} }
var hasEntity = entity != null; var hasEntity = entity != null;
if (entity == null) if (entity == null)
{ {

2
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs

@ -6,7 +6,7 @@ public static class CurrentUserExtensions
{ {
public static string GetUserName(this ICurrentUser currentUser) public static string GetUserName(this ICurrentUser currentUser)
{ {
return currentUser.FindClaimValue("name"); return currentUser.Name;
} }
public static string GetName(this ICurrentUser currentUser) public static string GetName(this ICurrentUser currentUser)

24
be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection;
using System.Text.Json; using System.Text.Json;
using Volo.Abp; using Volo.Abp;
@ -204,6 +205,29 @@ public static class FilterExtensions
{ {
var parameterExpression = Expression.Parameter(typeof(T), "p"); var parameterExpression = Expression.Parameter(typeof(T), "p");
Type lstType = typeof(List<>).MakeGenericType(propertyType); Type lstType = typeof(List<>).MakeGenericType(propertyType);
if (propertyType.IsEnum)
{
var valueArrayStrings = JsonSerializer.Deserialize<List<string>>(filter.Value);
List<object> newValues = new List<object>();
var enumValues = propertyType.GetEnumValues();
foreach (var valueArray in valueArrayStrings)
{
foreach (var enumValue in enumValues)
{
if (enumValue.ToString() == valueArray)
{
newValues.Add(enumValue);
break;
}
}
}
var newValue = JsonSerializer.Serialize(newValues);
filter.Value = newValue;
}
object propertyValue = JsonSerializer.Deserialize(filter.Value, lstType); object propertyValue = JsonSerializer.Deserialize(filter.Value, lstType);
if (propertyValue != null) if (propertyValue != null)
{ {

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Event/SfsCreatedEntityEventData.cs

@ -6,5 +6,6 @@ public class SfsCreatedEntityEventData<TEntity> : EntityEventData<TEntity>
{ {
public SfsCreatedEntityEventData(TEntity entity) : base(entity) public SfsCreatedEntityEventData(TEntity entity) : base(entity)
{ {
} }
} }

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs

@ -146,6 +146,7 @@ public abstract class ModuleBase<T> : AbpModule where T : AbpModule
using var sw = File.CreateText(Path.Combine(path, $"db.{dbContext.Database.ProviderName}.{contextName}.sql")); using var sw = File.CreateText(Path.Combine(path, $"db.{dbContext.Database.ProviderName}.{contextName}.sql"));
sw.Write(sql); sw.Write(sql);
Console.WriteLine($"{contextName} 初始化开始"); Console.WriteLine($"{contextName} 初始化开始");
Console.WriteLine($"ConnectionString:{dbContext.Database.GetConnectionString()}");
//创建数据库 //创建数据库
if (!dbCreator.Exists()) if (!dbCreator.Exists())
{ {

1
be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Win_in.Sfs.Shared.Host.csproj

@ -30,6 +30,7 @@
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="5.3.5" /> <PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="5.3.5" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="5.3.5" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="5.3.5" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.3.5" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="5.3.5" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="5.3.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

28
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Application.Contracts;
@ -23,4 +24,31 @@ public class TransferNoteEditInput : SfsStoreCreateOrUpdateInputBase
[Display(Name = "确认时间")] [Display(Name = "确认时间")]
public DateTime? ConfirmTime { get; set; } public DateTime? ConfirmTime { get; set; }
#endregion #endregion
/// <summary>
/// 调拨申请单号
/// </summary>
[Display(Name = "调拨申请单号")]
public string RequestNumber { get; set; }
/// <summary>
/// 任务ID
/// </summary>
[Display(Name = "任务ID")]
public string JobNumber { get; set; }
/// <summary>
/// 调拨类型
/// </summary>
[Display(Name = "调拨类型")]
public string Type { get; set; }
/// <summary>
/// 使用中间库
/// </summary>
[Display(Name = "使用中间库")]
public bool UseOnTheWayLocation { get; set; }
[Display(Name = "详情")]
public List<TransferNoteDetailInput> Details { get; set; } = new List<TransferNoteDetailInput>();
} }

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs

@ -1,4 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using DocumentFormat.OpenXml.Drawing;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -11,6 +13,9 @@ public class TransferNoteImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "调拨类型")] [Display(Name = "调拨类型")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "调拨类型")]
[ExporterHeader(DisplayName = "调拨类型")]
[ValueMapping("区域内调拨(储位内移库)", EnumTransSubType.Transfer_Inside)]
public string Type { get; set; } public string Type { get; set; }
/// <summary> /// <summary>

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs

@ -25,7 +25,6 @@ public class MaterialRequestImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "目标库位")] [Display(Name = "目标库位")]
[Required] [Required]
[Key]
public string ToLocationCode { get; set; } public string ToLocationCode { get; set; }
/// <summary> /// <summary>

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs

@ -12,6 +12,9 @@ public class TransferRequestImportInput : SfsStoreImportInputBase
/// </summary> /// </summary>
[Display(Name = "调拨类型")] [Display(Name = "调拨类型")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "调拨类型")]
[ExporterHeader(DisplayName = "调拨类型")]
[ValueMapping("客户库位调拨(客户储位调拨)", EnumTransSubType.Transfer_Customer)]
public string Type { get; set; } public string Type { get; set; }
/// <summary> /// <summary>

17
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs

@ -17,9 +17,22 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<InventoryTransferNoteDetailInput, InventoryTransferNoteDetail>() CreateMap<InventoryTransferNoteDetailInput, InventoryTransferNoteDetail>()
.IgnoreAuditedObjectProperties() .IgnoreAuditedObjectProperties()
.Ignore(x => x.MasterID)
.Ignore(x => x.TenantId) .Ignore(x => x.TenantId)
.Ignore(x => x.Number) .Ignore(x => x.Number)
.Ignore(x => x.Id); .Ignore(x => x.Id)
;
CreateMap<InventoryTransferNoteEditInput, InventoryTransferNote>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.Id)
;
CreateMap<InventoryTransferNoteImportInput, InventoryTransferNote>()
.IgnoreAuditedObjectProperties()
.Ignore(x => x.TenantId)
.Ignore(x => x.Id)
;
} }
} }

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs

@ -19,7 +19,10 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<NoOkConvertOkNoteEditInput, NoOkConvertOkNote>() CreateMap<NoOkConvertOkNoteEditInput, NoOkConvertOkNote>()
.IgnoreAuditedObjectProperties() .IgnoreAuditedObjectProperties()
.Ignore(x => x.Number) .Ignore(x => x.Number)
.Ignore(x => x.Details)
.Ignore(x => x.Id); .Ignore(x => x.Id);
CreateMap<NoOkConvertOkNoteDetailInput, NoOkConvertOkNoteDetail>()
.IgnoreAuditedObjectProperties()
;
} }
} }

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs

@ -23,5 +23,9 @@ public partial class StoreApplicationAutoMapperProfile : Profile
.Ignore(x => x.Number) .Ignore(x => x.Number)
.Ignore(x => x.Id) .Ignore(x => x.Id)
.Ignore(x => x.JobNumber); .Ignore(x => x.JobNumber);
CreateMap<PutawayNoteEditInput, PutawayNote>()
.IgnoreAuditedObjectProperties()
;
} }
} }

274
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs

@ -1,14 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -23,76 +22,86 @@ namespace Win_in.Sfs.Wms.Store.Application;
/// </summary> /// </summary>
[Authorize] [Authorize]
[Route($"{StoreConsts.RootPath}transfer-note")] [Route($"{StoreConsts.RootPath}transfer-note")]
public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
<TransferNote, TransferNoteDTO, SfsStoreRequestInputBase, TransferNoteEditInput, TransferNoteDetail, TransferNoteDetailDTO, SfsStoreRequestInputBase, TransferNoteImportInput>, <TransferNote, TransferNoteDTO, SfsStoreRequestInputBase, TransferNoteEditInput, TransferNoteDetail,
TransferNoteDetailDTO, SfsStoreRequestInputBase, TransferNoteImportInput>,
ITransferNoteAppService ITransferNoteAppService
{ {
private readonly ITransferNoteManager _transferNoteManager; private readonly ITransferNoteManager _transferNoteManager;
private readonly ILocationCapacityAppService _locationCapacityAppService; private readonly IBalanceAppService _balanceAppService;
private readonly ILocationAppService _locationAppService;
public TransferNoteAppService( public TransferNoteAppService(
ITransferNoteRepository repository ITransferNoteRepository repository,
, ITransferNoteManager transferNoteManager ITransferNoteManager transferNoteManager,
, ILocationCapacityAppService locationCapacityAppService IBalanceAppService balanceAppService,
) : base(repository) ILocationAppService locationAppService) : base(repository)
{ {
_transferNoteManager = transferNoteManager; _transferNoteManager = transferNoteManager;
_locationCapacityAppService = locationCapacityAppService; _balanceAppService = balanceAppService;
_locationAppService = locationAppService;
} }
/// <summary> #region 东阳使用
/// 库存转移
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public override async Task<TransferNoteDTO> CreateAsync(TransferNoteEditInput input)
{
var entity = ObjectMapper.Map<TransferNoteEditInput, TransferNote>(input);
await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity);
return dto;
}
/// <summary> /// <summary>
/// 【批量】 库存转移 /// 用来重写 导入数据时可以加工数据
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="dictionary"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("create-many")] protected override async Task<Dictionary<TransferNote, EntityState>> ImportProcessingEntityAsync(
public async Task<List<TransferNoteDTO>> CreateManyAsync(List<TransferNoteEditInput> input) Dictionary<TransferNote, EntityState> dictionary)
{ {
var entitys = ObjectMapper.Map<List<TransferNoteEditInput>, List<TransferNote>>(input); var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
var resultEntity = new List<TransferNote>(); foreach (var transferNote in addList)
foreach (var entity in entitys)
{ {
resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false)); if (transferNote.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) //储位内调拨
_ = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity); {
transferNote.Type = EnumTransSubType.Transfer_Inside.ToString();//重点 需要转换
foreach (var detail in transferNote.Details)
{
var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode,
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false);
var toLocationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
detail.OnTheWayLocationCode = bool.FalseString;
detail.ItemCode=balanceDto.ItemCode;
detail.ArriveDate=balanceDto.ArriveDate;
detail.ItemDesc1=balanceDto.ItemDesc1;
detail.ItemDesc2=balanceDto.ItemDesc2;
detail.ItemName=balanceDto.ItemName;
detail.ProduceDate=balanceDto.ProduceDate;
detail.Qty=balanceDto.Qty;
detail.Uom=balanceDto.Uom;
detail.ExpireDate=balanceDto.ExpireDate;
detail.StdPackQty=balanceDto.StdPackQty;
detail.SupplierBatch=balanceDto.SupplierBatch;
detail.FromLocationArea = balanceDto.LocationArea;
detail.FromContainerCode = balanceDto.ContainerCode;
detail.FromLocationErpCode = balanceDto.LocationErpCode;
detail.FromLocationGroup = balanceDto.LocationGroup;
detail.FromPackingCode = balanceDto.PackingCode;
detail.FromLocationArea = balanceDto.LocationArea;
detail.FromStatus = balanceDto.Status;
detail.FromWarehouseCode = balanceDto.WarehouseCode;
detail.FromLot = balanceDto.Lot;
detail.ToLocationArea = toLocationDto.AreaCode;
detail.ToLocationErpCode = toLocationDto.LocationGroupCode;
detail.ToLocationGroup = toLocationDto.LocationGroupCode;
detail.ToWarehouseCode = toLocationDto.WarehouseCode;
detail.ToContainerCode = balanceDto.ContainerCode;
detail.ToPackingCode = balanceDto.PackingCode;
detail.ToLocationArea = balanceDto.LocationArea;
detail.ToStatus = balanceDto.Status;
detail.ToLot = balanceDto.Lot;
}
} }
return ObjectMapper.Map<List<TransferNote>, List<TransferNoteDTO>>(resultEntity);
} }
/// <summary> return dictionary;
/// 确认对应的记录单
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("confirm/{id}")]
public virtual async Task<TransferNoteDTO> ConfirmAsync(Guid id)
{
var entity = await _transferNoteManager.ConfirmAsync(id).ConfigureAwait(false);
var dto = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity);
return dto;
} }
/// <summary> /// <summary>
@ -110,10 +119,12 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("get-wip-list")] [HttpPost("get-wip-list")]
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetWipTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, public virtual async Task<PagedResultDto<TransferNoteDTO>> GetWipTransferListAsync(
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_WIP, includeDetails, cancellationToken).ConfigureAwait(false); return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_WIP, includeDetails,
cancellationToken).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -131,14 +142,16 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("get-erp-loc-list")] [HttpPost("get-erp-loc-list")]
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetAreaTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, public virtual async Task<PagedResultDto<TransferNoteDTO>> GetAreaTransferListAsync(
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Area, includeDetails, cancellationToken).ConfigureAwait(false); return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Area, includeDetails,
cancellationToken).ConfigureAwait(false);
} }
/// <summary> /// <summary>
/// 按条件获取储位间调拨的分页列表 /// 按条件获取储位内移库的分页列表
/// request sample /// request sample
/// { /// {
/// "maxResultCount": 1000, /// "maxResultCount": 1000,
@ -152,10 +165,12 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("get-inside-list")] [HttpPost("get-inside-list")]
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetInsideTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, public virtual async Task<PagedResultDto<TransferNoteDTO>> GetInsideTransferListAsync(
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Inside, includeDetails, cancellationToken).ConfigureAwait(false); return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Inside, includeDetails,
cancellationToken).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -173,10 +188,12 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("get-custom-loc-list")] [HttpPost("get-custom-loc-list")]
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetCustomerTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, public virtual async Task<PagedResultDto<TransferNoteDTO>> GetCustomerTransferListAsync(
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Customer, includeDetails, cancellationToken).ConfigureAwait(false); return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Customer, includeDetails,
cancellationToken).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -194,115 +211,86 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("get-diff-erp-loc-list")] [HttpPost("get-diff-erp-loc-list")]
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetListForDiffERPLocAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, public virtual async Task<PagedResultDto<TransferNoteDTO>> GetListForDiffERPLocAsync(
SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Warehouse, includeDetails, cancellationToken).ConfigureAwait(false); return await GetSubTypeListAsync(sfsRequestDTO, EnumTransSubType.Transfer_Warehouse, includeDetails,
cancellationToken).ConfigureAwait(false);
} }
private async Task<PagedResultDto<TransferNoteDTO>> GetSubTypeListAsync(SfsStoreRequestInputBase sfsRequestDTO, EnumTransSubType type, bool includeDetails = false, private async Task<PagedResultDto<TransferNoteDTO>> GetSubTypeListAsync(SfsStoreRequestInputBase sfsRequestDTO,
EnumTransSubType type, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
sfsRequestDTO.Condition.Filters.Add(new Filter
{
Action = "==",
Column = "Type",
Logic = EnumFilterLogic.And.ToString(),
Value = type.ToString()
});
sfsRequestDTO.Condition.Filters.Add(new Sfs.Shared.Domain.Filter() { Action = "==", Column = "Type", Logic = EnumFilterLogic.And.ToString(), Value = ((int)type).ToString(), }); var expression = sfsRequestDTO.Condition.Filters?.Count > 0
Expression<Func<TransferNote, bool>> expression = sfsRequestDTO.Condition.Filters?.Count > 0
? sfsRequestDTO.Condition.Filters.ToLambda<TransferNote>() ? sfsRequestDTO.Condition.Filters.ToLambda<TransferNote>()
: p => true; : p => true;
return await GetPagedListAsync(expression, sfsRequestDTO.SkipCount, sfsRequestDTO.MaxResultCount, sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); return await GetPagedListAsync(expression, sfsRequestDTO.SkipCount, sfsRequestDTO.MaxResultCount,
} sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
protected virtual async Task ImportDataAsync(List<TransferNote> entites, List<TransferNote> deleteEntities)
{
await _transferNoteManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);
} }
protected override Func<TransferNoteImportInput, object> GetEntityExpression() #endregion
{
return p => (1);
}
protected virtual async Task<(List<TransferNote> entites, List<TransferNote> deleteEntities)> BuildImportDataAsync(ImportResult<TransferNoteImportInput> importResult, EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false) /// <summary>
{ /// 库存转移
if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) /// </summary>
{ /// <param name="input"></param>
if (!isAllowPartImport) /// <returns></returns>
[HttpPost("")]
public override async Task<TransferNoteDTO> CreateAsync(TransferNoteEditInput input)
{ {
return (null, null); var entity = ObjectMapper.Map<TransferNoteEditInput, TransferNote>(input);
}
}
var entites = new List<TransferNote>();
var details = new List<TransferNoteDetail>();
var deleteEntites = new List<TransferNote>();
var entityExpression = GetEntityExpression();
var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList();
foreach (var group in groupList) entity=await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false);
{
var input = group.FirstOrDefault();
var inputDetails = group.ToList(); var dto = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity);
if (inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) return dto;
{
continue;
} }
var exist = await GetEntityAsync(input).ConfigureAwait(false); /// <summary>
/// 【批量】 库存转移
var entity = ObjectMapper.Map<TransferNoteImportInput, TransferNote>(input); /// </summary>
/// <param name="input"></param>
await SetEntityPropertiesAsync(entity, input).ConfigureAwait(false); /// <returns></returns>
[HttpPost("create-many")]
switch (importMethod) public async Task<List<TransferNoteDTO>> CreateManyAsync(List<TransferNoteEditInput> input)
{
case EnumImportMethod.Update:
if (exist != null)
{
entity.SetId(exist.Id);
}
break;
case EnumImportMethod.Replace:
if (exist != null)
{ {
deleteEntites.Add(exist); var entitys = ObjectMapper.Map<List<TransferNoteEditInput>, List<TransferNote>>(input);
}
break;
}
foreach (var inputDetail in inputDetails) var resultEntity = new List<TransferNote>();
{
var detail = ObjectMapper.Map<TransferNoteImportInput, TransferNoteDetail>(inputDetail);
await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false);
entity.AddDetail(detail);
}
entites.Add(entity); foreach (var entity in entitys)
{
resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false));
_ = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity);
} }
return (entites, deleteEntites); return ObjectMapper.Map<List<TransferNote>, List<TransferNoteDTO>>(resultEntity);
} }
private static async Task SetDetailPropertiesAsync(TransferNoteDetail detail, TransferNoteImportInput input) /// <summary>
/// 确认对应的记录单
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("confirm/{id}")]
public virtual async Task<TransferNoteDTO> ConfirmAsync(Guid id)
{ {
await Task.CompletedTask.ConfigureAwait(false); var entity = await _transferNoteManager.ConfirmAsync(id).ConfigureAwait(false);
var dto = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity);
return dto;
} }
private static async Task SetEntityPropertiesAsync(TransferNote entity, TransferNoteImportInput input)
{
await Task.CompletedTask.ConfigureAwait(false);
entity.UseOnTheWayLocation = false;//不需要中间库
entity.Confirmed = true;//自动确认
}
} }

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteMapperProfile.cs

@ -12,6 +12,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile
CreateMap<TransferNote, TransferNoteDTO>() CreateMap<TransferNote, TransferNoteDTO>()
.ReverseMap(); .ReverseMap();
CreateMap<TransferNoteEditInput, TransferNote>()
.IgnoreAuditedObjectProperties()
;
CreateMap<TransferNoteDetailInput, TransferNoteDetail>()
.IgnoreAuditedObjectProperties()
;
CreateMap<TransferNoteDetailDTO, TransferNoteDetail>(); CreateMap<TransferNoteDetailDTO, TransferNoteDetail>();
CreateMap<TransferNoteDetail, TransferNoteDetailDTO>(); CreateMap<TransferNoteDetail, TransferNoteDetailDTO>();

146
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs

@ -21,8 +21,9 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Authorize] [Authorize]
[Route($"{StoreConsts.RootPath}material-request")] [Route($"{StoreConsts.RootPath}material-request")]
public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialRequest, MaterialRequestDTO,
public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialRequest, MaterialRequestDTO, SfsStoreRequestInputBase, MaterialRequestEditInput, MaterialRequestDetail, MaterialRequestDetailDTO, SfsStoreRequestInputBase, MaterialRequestImportInput>, SfsStoreRequestInputBase, MaterialRequestEditInput, MaterialRequestDetail, MaterialRequestDetailDTO,
SfsStoreRequestInputBase, MaterialRequestImportInput>,
IMaterialRequestAppService IMaterialRequestAppService
{ {
private readonly IMaterialRequestManager _materialRequestManager; private readonly IMaterialRequestManager _materialRequestManager;
@ -33,20 +34,65 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
private readonly IAreaAppService _areaApp; private readonly IAreaAppService _areaApp;
private readonly ILocationAppService _locationAppService;
private readonly IItemBasicAppService _itemBasicAppService;
public MaterialRequestAppService( public MaterialRequestAppService(
IMaterialRequestRepository repository, IMaterialRequestRepository repository,
IMaterialRequestManager materialRequestManager, IMaterialRequestManager materialRequestManager,
IPreparationPlanManager preparationPlanManager, IPreparationPlanManager preparationPlanManager,
IItemStoreRelationAppService itemStoreRelationApp, IItemStoreRelationAppService itemStoreRelationApp,
IAreaAppService areaApp) IAreaAppService areaApp
, ILocationAppService locationAppService
, IItemBasicAppService itemBasicAppService)
: base(repository, materialRequestManager) : base(repository, materialRequestManager)
{ {
_materialRequestManager = materialRequestManager; _materialRequestManager = materialRequestManager;
_preparationPlanManager = preparationPlanManager; _preparationPlanManager = preparationPlanManager;
_itemStoreRelationApp = itemStoreRelationApp; _itemStoreRelationApp = itemStoreRelationApp;
_areaApp = areaApp; _areaApp = areaApp;
_locationAppService = locationAppService;
_itemBasicAppService = itemBasicAppService;
} }
#region 东阳使用
/// <summary>
/// 用来重写 导入数据时可以加工数据
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
protected override async Task<Dictionary<MaterialRequest, EntityState>> ImportProcessingEntityAsync(
Dictionary<MaterialRequest, EntityState> dictionary)
{
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var materialRequest in addList)
{
materialRequest.Worker = CurrentUser.GetUserName();
materialRequest.CreatorId = CurrentUser.Id;
foreach (var detail in materialRequest.Details)
{
var locationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
detail.ToLocationArea = locationDto.AreaCode;
detail.ToLocationErpCode = locationDto.ErpLocationCode;
detail.ToLocationGroup = locationDto.LocationGroupCode;
detail.ToWarehouseCode = locationDto.WarehouseCode;
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2= itemBasicDto.Desc2;
detail.ItemName= itemBasicDto.Name;
detail.Uom = itemBasicDto.BasicUom;
}
}
return await base.ImportProcessingEntityAsync(dictionary).ConfigureAwait(false);
}
#endregion
[HttpPost("")] [HttpPost("")]
//[Authorize(MaterialRequestPermissions.Create)] //[Authorize(MaterialRequestPermissions.Create)]
public override async Task<MaterialRequestDTO> CreateAsync(MaterialRequestEditInput input) public override async Task<MaterialRequestDTO> CreateAsync(MaterialRequestEditInput input)
@ -193,10 +239,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
{ {
var prodPreparationPlan = await _preparationPlanManager.GetByNumberAsync(number).ConfigureAwait(false); var prodPreparationPlan = await _preparationPlanManager.GetByNumberAsync(number).ConfigureAwait(false);
var materialRequestCreateInput = new MaterialRequestEditInput() var materialRequestCreateInput = new MaterialRequestEditInput { Worker = CurrentUser.GetUserName() };
{
Worker = CurrentUser.GetUserName(),
};
foreach (var preparationPlanDetail in prodPreparationPlan.Details) foreach (var preparationPlanDetail in prodPreparationPlan.Details)
{ {
@ -227,7 +270,8 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
/// <returns></returns> /// <returns></returns>
private async Task<List<MaterialRequest>> CheckExistByPreparationPlanAsync(string preparationPlanNumber) private async Task<List<MaterialRequest>> CheckExistByPreparationPlanAsync(string preparationPlanNumber)
{ {
var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber).ConfigureAwait(false); var entities = await _repository.GetListAsync(c => c.PreparationPlanNumber == preparationPlanNumber)
.ConfigureAwait(false);
return entities; return entities;
} }
@ -250,7 +294,6 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
bool includeDetails = false, bool includeDetails = false,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
Expression<Func<MaterialRequest, bool>> expression = p => p.Type == type; Expression<Func<MaterialRequest, bool>> expression = p => p.Type == type;
if (requestInput.Condition.Filters?.Count > 0) if (requestInput.Condition.Filters?.Count > 0)
{ {
@ -261,8 +304,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
} }
#region 导入
#region import
//protected override async Task CheckImportInputBusinessAsync(MaterialRequestImportInput importInput, EnumImportMethod importMethod) //protected override async Task CheckImportInputBusinessAsync(MaterialRequestImportInput importInput, EnumImportMethod importMethod)
//{ //{
@ -278,7 +320,14 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
// CheckTransactionType(EnumTransInOut.In, EnumInventoryStatus.OK, transactionType, item, location); // CheckTransactionType(EnumTransInOut.In, EnumInventoryStatus.OK, transactionType, item, location);
//} //}
protected override async Task ValidateImportModelAsync(MaterialRequestImportInput model, List<ValidationResult> validationRresult) /// <summary>
/// 导入验证
/// </summary>
/// <param name="model"></param>
/// <param name="validationRresult"></param>
/// <returns></returns>
protected override async Task ValidateImportModelAsync(MaterialRequestImportInput model,
List<ValidationResult> validationRresult)
{ {
_ = new Dictionary<string, string>(); _ = new Dictionary<string, string>();
_ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false); _ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false);
@ -287,11 +336,14 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false); await CheckStoreRelationAsync(model, validationRresult).ConfigureAwait(false);
} }
#region 校验
protected override async Task<bool> ValidateImportEntities(Dictionary<MaterialRequest, EntityState> dict) protected override async Task<bool> ValidateImportEntities(Dictionary<MaterialRequest, EntityState> dict)
{ {
foreach (var entity in dict.Keys) foreach (var entity in dict.Keys)
{ {
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); var tranType = await TransactionTypeAclService
.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
Check.NotNull(tranType, "事务类型", "事务类型不存在"); Check.NotNull(tranType, "事务类型", "事务类型不存在");
@ -301,84 +353,71 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
entity.AutoHandle = tranType.AutoHandleRequest; entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote; entity.DirectCreateNote = tranType.DirectCreateNote;
} }
return await base.ValidateImportEntities(dict).ConfigureAwait(false); return await base.ValidateImportEntities(dict).ConfigureAwait(false);
} }
protected async Task<ItemBasicDTO> CheckItemBasicAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult) protected async Task<ItemBasicDTO> CheckItemBasicAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{ {
var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null) if (item == null)
{ {
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new string[] { "物品代码" })); validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" }));
} }
else if (item.StdPackQty == 0) else if (item.StdPackQty == 0)
{ {
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}的标准包装不存在", new string[] { "标准包装" })); validationRresult.Add(
new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" }));
} }
return item; return item;
} }
protected async Task<LocationDTO> CheckLocationAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult) protected async Task<LocationDTO> CheckLocationAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{ {
var location = await LocationAclService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false); var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false);
if (location == null) if (location == null)
{ {
validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new string[] { "目标库位" })); validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" }));
} }
return location; return location;
} }
protected async Task CheckAreaAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult) protected async Task CheckAreaAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{ {
var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false); var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false);
if (area == null) if (area == null)
{ {
validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new string[] { "调出库区" })); validationRresult.Add(new ValidationResult($"调出库区{importInput.FromLocationArea}不存在", new[] { "调出库区" }));
} }
} }
protected async Task CheckStoreRelationAsync(MaterialRequestImportInput importInput, List<ValidationResult> validationRresult) protected async Task CheckStoreRelationAsync(MaterialRequestImportInput importInput,
List<ValidationResult> validationRresult)
{ {
var itemStoreRelation = await _itemStoreRelationApp.GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false); var itemStoreRelation = await _itemStoreRelationApp
.GetFirstAsync(importInput.ItemCode, importInput.ToLocationCode).ConfigureAwait(false);
if (itemStoreRelation == null) if (itemStoreRelation == null)
{ {
validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new string[] { "物品库位对应关系" })); validationRresult.Add(new ValidationResult(
} $"物品代码{importInput.ItemCode}与目标库位{importInput.ToLocationCode}不存在对应关", new[] { "物品库位对应关系" }));
} }
protected override async Task SaveImportAsync(Dictionary<MaterialRequest, EntityState> dict)
{
var entityList = dict.Keys.ToList();
foreach (var entity in entityList)
{
foreach (var detail in entity.Details)
{
var item = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
if (item != null)
{
detail.ItemName = item.Name;
detail.ItemDesc1 = item.Desc1;
detail.ItemDesc2 = item.Desc2;
detail.StdPackQty = item.StdPackQty;
} }
var location = await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); #endregion
if (location != null)
{
detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode;
}
}
}
await base.SaveImportAsync(dict).ConfigureAwait(false);
}
#endregion #endregion
/// <summary>
/// 根据类型 获取叫料申请
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
[HttpGet("list/by-type/{type}")] [HttpGet("list/by-type/{type}")]
public virtual async Task<List<MaterialRequestDTO>> GetListByTypeAsync(string type) public virtual async Task<List<MaterialRequestDTO>> GetListByTypeAsync(string type)
{ {
var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false); var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false);
@ -386,6 +425,5 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase<MaterialR
var dtos = ObjectMapper.Map<List<MaterialRequest>, List<MaterialRequestDTO>>(entities); var dtos = ObjectMapper.Map<List<MaterialRequest>, List<MaterialRequestDTO>>(entities);
return dtos; return dtos;
} }
} }

297
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs

@ -4,13 +4,15 @@ using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Domain.Shared; using Win_in.Sfs.Wms.Store.Domain.Shared;
@ -23,43 +25,102 @@ namespace Win_in.Sfs.Wms.Store.Application;
[Authorize] [Authorize]
[Route($"{StoreConsts.RootPath}transfer-request")] [Route($"{StoreConsts.RootPath}transfer-request")]
public class TransferRequestAppService : SfsStoreRequestAppServiceBase public class TransferRequestAppService : SfsStoreRequestAppServiceBase
<TransferRequest, TransferRequestDTO, SfsStoreRequestInputBase, TransferRequestEditInput, TransferRequestDetail, TransferRequestDetailDTO, SfsStoreRequestInputBase, TransferRequestImportInput>, <TransferRequest, TransferRequestDTO, SfsStoreRequestInputBase, TransferRequestEditInput, TransferRequestDetail,
TransferRequestDetailDTO, SfsStoreRequestInputBase, TransferRequestImportInput>,
ITransferRequestAppService ITransferRequestAppService
{ {
private readonly ITransferRequestManager _transferRequestManager; private readonly ITransferRequestManager _transferRequestManager;
private readonly IBalanceAppService _balanceAppService;
private readonly ILocationAppService _locationAppService;
public TransferRequestAppService( public TransferRequestAppService(
ITransferRequestRepository repository ITransferRequestRepository repository,
, ITransferRequestManager transferRequestManager ITransferRequestManager transferRequestManager,
) : base(repository, transferRequestManager) IBalanceAppService balanceAppService,
ILocationAppService locationAppService) : base(repository, transferRequestManager)
{ {
_transferRequestManager = transferRequestManager; _transferRequestManager = transferRequestManager;
_balanceAppService = balanceAppService;
_locationAppService = locationAppService;
} }
#region 东阳使用
/// <summary> /// <summary>
/// 【创建】库移请求 /// 用来重写 导入数据时可以加工数据
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="dictionary"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("")] protected override async Task<Dictionary<TransferRequest, EntityState>> ImportProcessingEntityAsync(
public override async Task<TransferRequestDTO> CreateAsync(TransferRequestEditInput input) Dictionary<TransferRequest, EntityState> dictionary)
{ {
var entity = ObjectMapper.Map<TransferRequestEditInput, TransferRequest>(input); var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key);
foreach (var transferRequest in addList)
{
if (transferRequest.Type == EnumTransSubType.Transfer_Customer.GetDisplayName()) //客户储位调拨
{
transferRequest.Type = EnumTransSubType.Transfer_Customer.ToString(); //重点 需要转换
transferRequest.UseOnTheWayLocation = true;
foreach (var detail in transferRequest.Details)
{
var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode,
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false);
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode)
.ConfigureAwait(false);
detail.ItemCode = balanceDto.ItemCode;
detail.ArriveDate = balanceDto.ArriveDate;
detail.ItemDesc1 = balanceDto.ItemDesc1;
detail.ItemDesc2 = balanceDto.ItemDesc2;
detail.ItemName = balanceDto.ItemName;
detail.ProduceDate = balanceDto.ProduceDate;
detail.Qty = balanceDto.Qty;
detail.Uom = balanceDto.Uom;
detail.ExpireDate = balanceDto.ExpireDate;
detail.StdPackQty = balanceDto.StdPackQty;
detail.SupplierBatch = balanceDto.SupplierBatch;
detail.FromLocationArea = balanceDto.LocationArea;
detail.FromContainerCode = balanceDto.ContainerCode;
detail.FromLocationErpCode = balanceDto.LocationErpCode;
detail.FromLocationGroup = balanceDto.LocationGroup;
detail.FromPackingCode = balanceDto.PackingCode;
detail.FromLocationArea = balanceDto.LocationArea;
detail.FromStatus = balanceDto.Status;
detail.FromWarehouseCode = balanceDto.WarehouseCode;
detail.FromLot = balanceDto.Lot;
detail.ToLocationArea = toLocationDto.AreaCode;
detail.ToLocationErpCode = toLocationDto.LocationGroupCode;
detail.ToLocationGroup = toLocationDto.LocationGroupCode;
detail.ToWarehouseCode = toLocationDto.WarehouseCode;
detail.ToContainerCode = balanceDto.ContainerCode;
detail.ToPackingCode = balanceDto.PackingCode;
detail.ToLocationArea = balanceDto.LocationArea;
detail.ToStatus = balanceDto.Status;
detail.ToLot = balanceDto.Lot;
}
await SetEntityPropertiesAsync(transferRequest, EnumTransSubType.Transfer_Customer).ConfigureAwait(false);
}
}
return dictionary;
}
private async Task SetEntityPropertiesAsync(TransferRequest entity, EnumTransSubType subType)
{
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType)
.ConfigureAwait(false);
entity.Worker = CurrentUser.GetUserName();
var subType = Enum.Parse<EnumTransSubType>(input.Type);
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType).ConfigureAwait(false);
entity.Type = ((int)subType).ToString();
entity.AutoCompleteJob = tranType.AutoCompleteJob; entity.AutoCompleteJob = tranType.AutoCompleteJob;
entity.AutoSubmit = tranType.AutoSubmitRequest; entity.AutoSubmit = tranType.AutoSubmitRequest;
entity.AutoAgree = tranType.AutoAgreeRequest; entity.AutoAgree = tranType.AutoAgreeRequest;
entity.AutoHandle = tranType.AutoHandleRequest; entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote; entity.DirectCreateNote = tranType.DirectCreateNote;
await _transferRequestManager.CreateAsync(entity).ConfigureAwait(false);
var dto = ObjectMapper.Map<TransferRequest, TransferRequestDTO>(entity);
return dto;
} }
#region 查询相关 #region 查询相关
@ -155,6 +216,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
return await GetListForOtherBaseAsync(sfsRequestDTO, EnumTransSubType.Transfer_WIP, includeDetails, return await GetListForOtherBaseAsync(sfsRequestDTO, EnumTransSubType.Transfer_WIP, includeDetails,
cancellationToken).ConfigureAwait(false); cancellationToken).ConfigureAwait(false);
} }
/// <summary> /// <summary>
/// 按条件获取分页列表 /// 按条件获取分页列表
/// </summary> /// </summary>
@ -168,7 +230,9 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
sfsRequestDTO.Condition.Filters.Add(new Filter sfsRequestDTO.Condition.Filters.Add(new Filter
{ Action = "==", Column = "Type", Logic = EnumFilterLogic.And.ToString(), Value = ((int)type).ToString() }); {
Action = "==", Column = "Type", Logic = EnumFilterLogic.And.ToString(), Value = type.ToString()
});
var expression = sfsRequestDTO.Condition.Filters?.Count > 0 var expression = sfsRequestDTO.Condition.Filters?.Count > 0
? sfsRequestDTO.Condition.Filters.ToLambda<TransferRequest>() ? sfsRequestDTO.Condition.Filters.ToLambda<TransferRequest>()
@ -178,84 +242,36 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
} }
#endregion 查询相关 #endregion
#endregion
/// <summary> /// <summary>
/// 【创建】库移请求
/// </summary> /// </summary>
/// <param name="importResult"></param> /// <param name="input"></param>
/// <param name="importMethod"></param>
/// <param name="isAllowPartImport"></param>
/// <returns></returns> /// <returns></returns>
protected virtual async Task<(List<TransferRequest> entites, List<TransferRequest> deleteEntities)> [HttpPost("")]
BuildImportDataAsync(ImportResult<TransferRequestImportInput> importResult, public override async Task<TransferRequestDTO> CreateAsync(TransferRequestEditInput input)
EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false)
{
if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed))
{
if (!isAllowPartImport)
{
return (null, null);
}
}
var entites = new List<TransferRequest>();
var details = new List<TransferRequestDetail>();
var deleteEntites = new List<TransferRequest>();
var entityExpression = GetEntityExpression();
var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList();
foreach (var group in groupList)
{
var input = group.FirstOrDefault();
var inputDetails = group.ToList();
if (!inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed))
{
var exist = await GetEntityAsync(input).ConfigureAwait(false);
var entity = ObjectMapper.Map<TransferRequestImportInput, TransferRequest>(input);
await SetEntityPropertiesAsync(entity, input.Type).ConfigureAwait(false);
switch (importMethod)
{
case EnumImportMethod.Update:
if (exist != null)
{
entity.SetId(exist.Id);
}
break;
case EnumImportMethod.Replace:
if (exist != null)
{
deleteEntites.Add(exist);
}
break;
}
foreach (var inputDetail in inputDetails)
{ {
var detail = ObjectMapper.Map<TransferRequestImportInput, TransferRequestDetail>(inputDetail); var entity = ObjectMapper.Map<TransferRequestEditInput, TransferRequest>(input);
//detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); var subType = Enum.Parse<EnumTransSubType>(input.Type);
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType)
.ConfigureAwait(false);
entity.Type = ((int)subType).ToString();
entity.AutoCompleteJob = tranType.AutoCompleteJob;
entity.AutoSubmit = tranType.AutoSubmitRequest;
entity.AutoAgree = tranType.AutoAgreeRequest;
entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote;
await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false); await _transferRequestManager.CreateAsync(entity).ConfigureAwait(false);
entity.AddDetail(detail);
}
entites.Add(entity); var dto = ObjectMapper.Map<TransferRequest, TransferRequestDTO>(entity);
}
}
return (entites, deleteEntites); return dto;
} }
protected async Task CheckFromLocationAsync(string locationCode, List<ValidationResult> validationRresult) protected async Task CheckFromLocationAsync(string locationCode, List<ValidationResult> validationRresult)
@ -277,13 +293,15 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
await CheckToLocationAsync(importInput.ToLocationCode, validationRresult).ConfigureAwait(false); await CheckToLocationAsync(importInput.ToLocationCode, validationRresult).ConfigureAwait(false);
} }
protected async Task CheckItemBasicAsync(TransferRequestImportInput importInput, List<ValidationResult> validationRresult) protected async Task CheckItemBasicAsync(TransferRequestImportInput importInput,
List<ValidationResult> validationRresult)
{ {
var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false);
if (item == null) if (item == null)
{ {
validationRresult.Add("物品代码", $"物品代码{importInput.ItemCode}不存在"); validationRresult.Add("物品代码", $"物品代码{importInput.ItemCode}不存在");
} }
if (importInput.Qty <= 0) if (importInput.Qty <= 0)
{ {
validationRresult.Add("调整数量", $"调整数量{importInput.Qty}必须大于0"); validationRresult.Add("调整数量", $"调整数量{importInput.Qty}必须大于0");
@ -302,103 +320,4 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase
protected void ChecktQty(TransferRequestImportInput importInput, List<ValidationResult> validationRresult) protected void ChecktQty(TransferRequestImportInput importInput, List<ValidationResult> validationRresult)
{ {
} }
/// <summary>
/// 导入汇总
/// </summary>
/// <returns></returns>
protected override Func<TransferRequestImportInput, object> GetEntityExpression()
{
return p => 1;
}
protected virtual async Task ImportDataAsync(List<TransferRequest> entites, List<TransferRequest> deleteEntities)
{
await _transferRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false);
}
private static EnumTransSubType ConvertToTransSubType(string type)
{
switch (type)
{
case "线边仓调拨":
return EnumTransSubType.Transfer_WIP;
case "客户储位调拨":
return EnumTransSubType.Transfer_Customer;
case "区域内调拨":
return EnumTransSubType.Transfer_Inside;
case "区域间调拨":
return EnumTransSubType.Transfer_Area;
case "库间调拨":
return EnumTransSubType.Transfer_Warehouse;
}
return EnumTransSubType.None;
}
private static async Task SetDetailPropertiesAsync(TransferRequestDetail detail, TransferRequestImportInput input)
{
await Task.CompletedTask.ConfigureAwait(false);
//if (!string.IsNullOrEmpty(input.OnceBusiCode))
//{
// var dict = await _dictApp.GetByTypeAsync(nameof(input.OnceBusiCode));
// if (dict.Items != null && dict.Items.Count > 0)
// {
// var item = dict.Items.FirstOrDefault(t => t.Code == input.OnceBusiCode);
// Check.NotNull(item, "次交易码", "次交易码不存在");
// detail.SetProperty("OnceBusiCode", item.Code);
// detail.SetProperty("OnceBusiName", item.Name);
// }
//}
//if (!string.IsNullOrEmpty(input.CaseCode))
//{
// var dict = await _dictApp.GetByTypeAsync(nameof(input.CaseCode));
// if (dict.Items != null && dict.Items.Count > 0)
// {
// var item = dict.Items.FirstOrDefault(t => t.Code == input.CaseCode);
// Check.NotNull(item, "专案代码", "专案代码不存在");
// detail.SetProperty("CaseCode", item.Code);
// detail.SetProperty("CaseName", item.Name);
// }
//}
//if (!string.IsNullOrEmpty(input.ProjCapacityCode))
//{
// var dict = await _dictApp.GetByTypeAsync(nameof(input.ProjCapacityCode));
// if (dict.Items != null && dict.Items.Count > 0)
// {
// var item = dict.Items.FirstOrDefault(t => t.Code == input.ProjCapacityCode);
// Check.NotNull(item, "项目分类代码", "项目分类代码不存在");
// detail.SetProperty("ProjCapacityCode", item.Code);
// detail.SetProperty("ProjCapacityName", item.Name);
// }
//}
}
private async Task SetEntityPropertiesAsync(TransferRequest entity, string inputType)
{
var subType = ConvertToTransSubType(inputType);
var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType).ConfigureAwait(false);
entity.Type = ((int)subType).ToString();
entity.Worker = CurrentUser.GetUserName();
entity.AutoCompleteJob = tranType.AutoCompleteJob;
entity.AutoSubmit = tranType.AutoSubmitRequest;
entity.AutoAgree = tranType.AutoAgreeRequest;
entity.AutoHandle = tranType.AutoHandleRequest;
entity.DirectCreateNote = tranType.DirectCreateNote;
}
} }

21
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Uow;
using Volo.Abp.Users; using Volo.Abp.Users;
using Volo.Abp.Validation; using Volo.Abp.Validation;
using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Application.Contracts;
@ -47,6 +48,7 @@ public class InspectJobManager : SfsJobManagerBase<InspectJob, InspectJobDetail>
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="entity"></param> /// <param name="entity"></param>
/// <returns></returns> /// <returns></returns>
[UnitOfWork]
public override async Task<InspectJob> CompleteAsync(InspectJob input, ICurrentUser user) public override async Task<InspectJob> CompleteAsync(InspectJob input, ICurrentUser user)
{ {
//执行任务 //执行任务
@ -134,12 +136,22 @@ public class InspectJobManager : SfsJobManagerBase<InspectJob, InspectJobDetail>
/// <returns></returns> /// <returns></returns>
public async Task<InspectJobSummaryDetail> CompleteSummaryDetailStatusAsync(Guid id, Guid summaryDetailId, InspectJobSummaryDetail input, ICurrentUser currentUser) public async Task<InspectJobSummaryDetail> CompleteSummaryDetailStatusAsync(Guid id, Guid summaryDetailId, InspectJobSummaryDetail input, ICurrentUser currentUser)
{ {
var jobEntity = await Repository.FindAsync(id).ConfigureAwait(false); var jobEntity = await Repository.FindAsync(id);
jobEntity.Details.Where(p => p.DetailInspectStatus == EnumDetailInspectStatus.DefaultOK ||
p.DetailInspectStatus == EnumDetailInspectStatus.OK).ToList().ForEach(p =>
{
p.GoodQty = p.ReceiveQty;
});
var goodqty = jobEntity.Details.Where(p =>
p.DetailInspectStatus == EnumDetailInspectStatus.DefaultOK ||
p.DetailInspectStatus == EnumDetailInspectStatus.OK).Sum(p => p.GoodQty);
//获取 汇总详情 //获取 汇总详情
var summaryDetailEntity = jobEntity.SummaryDetails.Find(p => p.Id == summaryDetailId); var summaryDetailEntity = jobEntity.SummaryDetails.Find(p => p.Id == summaryDetailId);
var itemQuality = await _itemQualityAclService.GetByItemCodeAsync(summaryDetailEntity.ItemCode, jobEntity.SupplierCode).ConfigureAwait(false); var itemQuality = await _itemQualityAclService.GetByItemCodeAsync(summaryDetailEntity.ItemCode, jobEntity.SupplierCode);
if (itemQuality.InspectType != EnumInspectType.Exempt) if (itemQuality.InspectType != EnumInspectType.Exempt)
{ {
//获取质检标准 //获取质检标准
@ -150,6 +162,9 @@ public class InspectJobManager : SfsJobManagerBase<InspectJob, InspectJobDetail>
await CheckCompleteSummaryDetailAsync(summaryDetailEntity, aql, input).ConfigureAwait(false); await CheckCompleteSummaryDetailAsync(summaryDetailEntity, aql, input).ConfigureAwait(false);
} }
input.GoodQty = goodqty;
summaryDetailEntity.GoodQty = goodqty;
//构造 汇总详情 //构造 汇总详情
await BuildInspectJobSummaryDetailAsync(input, summaryDetailEntity).ConfigureAwait(false); await BuildInspectJobSummaryDetailAsync(input, summaryDetailEntity).ConfigureAwait(false);
@ -174,7 +189,7 @@ public class InspectJobManager : SfsJobManagerBase<InspectJob, InspectJobDetail>
#endregion #endregion
await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData<InspectJob>(CopyJob),false).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData<InspectJob>(CopyJob)).ConfigureAwait(false);
return summaryDetailEntity; return summaryDetailEntity;
} }

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs

@ -28,14 +28,13 @@ public class TransferNote : SfsStoreAggregateRootBase<TransferNoteDetail>, IHasJ
/// 调拨类型 /// 调拨类型
/// </summary> /// </summary>
[Display(Name = "调拨类型")] [Display(Name = "调拨类型")]
[IgnoreUpdate] [Required(ErrorMessage = "调拨类型不能为空")]
public string Type { get; set; } public string Type { get; set; }
/// <summary> /// <summary>
/// 使用中间库 /// 使用中间库
/// </summary> /// </summary>
[Display(Name = "使用中间库")] [Display(Name = "使用中间库")]
[IgnoreUpdate]
public bool UseOnTheWayLocation { get; set; } public bool UseOnTheWayLocation { get; set; }
/// <summary> /// <summary>

12
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs

@ -43,15 +43,14 @@ public partial class StoreEventAutoMapperProfile : Profile
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode)) .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(d => d.ToLocationCode)) .ForMember(x => x.ToLocationCode, y => y.MapFrom(d => d.ToLocationCode))
.Ignore(x => x.ToWarehouseCode) .Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ToLocationErpCode) .Ignore(x => x.ToLocationErpCode)
; ;
CreateMap<IssueJobDetail, ExpectInEditInput>() CreateMap<
IssueJobDetail, ExpectInEditInput>()
.MapExpectInOutFrom() .MapExpectInOutFrom()
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.Worker) .Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber) .Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties) .Ignore(x => x.ExtraProperties)
@ -59,9 +58,6 @@ public partial class StoreEventAutoMapperProfile : Profile
CreateMap<IssueJobDetail, ExpectOutEditInput>() CreateMap<IssueJobDetail, ExpectOutEditInput>()
.MapExpectInOutFrom() .MapExpectInOutFrom()
.Ignore(x => x.LocationArea)
.Ignore(x => x.LocationGroup)
.Ignore(x => x.WarehouseCode)
.Ignore(x => x.Worker) .Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber) .Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties); .Ignore(x => x.ExtraProperties);

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs

@ -41,7 +41,6 @@ public partial class StoreEventAutoMapperProfile : Profile
#region PurchaseReceiptRequestDetail, PurchaseReceiptJobDetailInput #region PurchaseReceiptRequestDetail, PurchaseReceiptJobDetailInput
CreateMap<PurchaseReceiptRequestDetail, PurchaseReceiptJobDetailInput>() CreateMap<PurchaseReceiptRequestDetail, PurchaseReceiptJobDetailInput>()
.Ignore(x => x.ArriveDate)
.Ignore(x => x.Status) .Ignore(x => x.Status)
.Ignore(x => x.RecommendToLocationCode) .Ignore(x => x.RecommendToLocationCode)
.Ignore(x => x.RecommendToLocationErpCode) .Ignore(x => x.RecommendToLocationErpCode)

32
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs

@ -54,7 +54,11 @@ public class IssueJobEventHandler :
var expectOuts = new List<ExpectOutEditInput>(); var expectOuts = new List<ExpectOutEditInput>();
foreach (var entity in entities) foreach (var entity in entities)
{ {
var entityExpectOuts = BuildExpectOutInventoryAsync(entity); var entityExpectOuts = BuildExpectOutInventoryAsync(entity.Details, entity.Number);
entityExpectOuts.ForEach(p =>
{
p.JobNumber = entity.Number;
});
expectOuts.AddRange(entityExpectOuts); expectOuts.AddRange(entityExpectOuts);
} }
await ExpectOutAppService.AddManyAsync(expectOuts).ConfigureAwait(false); await ExpectOutAppService.AddManyAsync(expectOuts).ConfigureAwait(false);
@ -65,33 +69,25 @@ public class IssueJobEventHandler :
var expectIns = new List<ExpectInEditInput>(); var expectIns = new List<ExpectInEditInput>();
foreach (var entity in entities) foreach (var entity in entities)
{ {
var entityExpectIns = BuildExpectInInventoryAsync(entity); var entityExpectIns = BuildExpectInInventoryAsync(entity.Details, entity.Number);
entityExpectIns.ForEach(p =>
{
p.JobNumber = entity.Number;
});
expectIns.AddRange(entityExpectIns); expectIns.AddRange(entityExpectIns);
} }
await ExpectInAppService.AddManyAsync(expectIns).ConfigureAwait(false); await ExpectInAppService.AddManyAsync(expectIns).ConfigureAwait(false);
} }
private List<ExpectInEditInput> BuildExpectInInventoryAsync(IssueJob issueJob) private List<ExpectInEditInput> BuildExpectInInventoryAsync(List<IssueJobDetail> balanceDto, string jobNumber)
{
var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectInEditInput>>(issueJob.Details);
foreach (var input in inputs)
{ {
input.WarehouseCode = issueJob.WarehouseCode; var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectInEditInput>>(balanceDto);
input.Worker = issueJob.Worker;
input.JobNumber = issueJob.Number;
}
return inputs; return inputs;
} }
private List<ExpectOutEditInput> BuildExpectOutInventoryAsync(IssueJob issueJob) private List<ExpectOutEditInput> BuildExpectOutInventoryAsync(List<IssueJobDetail> balanceDto, string jobNumber)
{
var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectOutEditInput>>(issueJob.Details);
foreach (var input in inputs)
{ {
input.WarehouseCode = issueJob.WarehouseCode; var inputs = ObjectMapper.Map<List<IssueJobDetail>, List<ExpectOutEditInput>>(balanceDto);
input.Worker = issueJob.Worker;
input.JobNumber = issueJob.Number;
}
return inputs; return inputs;
} }
} }

105
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs

@ -15,7 +15,7 @@ public class InspectJobEventHandler :
, ILocalEventHandler<SfsCreatedEntityEventData<InspectJob>> , ILocalEventHandler<SfsCreatedEntityEventData<InspectJob>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<InspectJob>>> , ILocalEventHandler<SfsCreatedEntityEventData<List<InspectJob>>>
, ILocalEventHandler<SfsCompletedEntityEventData<InspectJob>> , ILocalEventHandler<SfsCompletedEntityEventData<InspectJob>>
, ILocalEventHandler<SfsUpdateEntitySummaryDetailEventData<InspectJob>> , ILocalEventHandler<SfsUpdateEntitySummaryDetailEventData<InspectJob>>
{ {
private readonly IInspectNoteAppService _inspectNoteAppService; private readonly IInspectNoteAppService _inspectNoteAppService;
@ -26,36 +26,59 @@ public class InspectJobEventHandler :
_inspectNoteAppService = inspectNoteAppService; _inspectNoteAppService = inspectNoteAppService;
} }
/// <summary>
/// 质检任务 完成后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork] [UnitOfWork]
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<InspectJob> eventData) public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<InspectJob> eventData)
{ {
var entity = eventData.Entity; //var entity = eventData.Entity;
var inspectNote = BuildInspectNote(entity);
await _inspectNoteAppService.CreateAsync(inspectNote).ConfigureAwait(false); await Task.CompletedTask.ConfigureAwait(false);
} }
/// <summary> /// <summary>
/// 创建 质检任务 /// 质检任务创建
/// </summary> /// </summary>
/// <param name="eventData"></param> /// <param name="eventData"></param>
/// <returns></returns> /// <returns></returns>
[UnitOfWork] [UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<InspectJob> eventData) public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<InspectJob>> eventData)
{ {
var entity = eventData.Entity; var entities = eventData.Entity;
var inspectNote = BuildInspectNote(entity);
await _inspectNoteAppService.CreateAsync(inspectNote).ConfigureAwait(false); foreach (var entity in entities)
//await CompleteExemptInspectJobAsync(new List<InspectJob> { entity }); {
await CreateInspectNoteAsync(entity).ConfigureAwait(false);
}
} }
/// <summary>
/// 创建 质检任务后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork] [UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<InspectJob>> eventData) public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<InspectJob> eventData)
{ {
_ = eventData.Entity; var entity = eventData.Entity;
await CreateInspectNoteAsync(entity).ConfigureAwait(false);
}
//await CompleteExemptInspectJobAsync(entities); #region 私有
await Task.CompletedTask.ConfigureAwait(false);
/// <summary>
/// 创建质检记录
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
private async Task<InspectNoteEditInput> CreateInspectNoteAsync(InspectJob entity)
{
var input = ObjectMapper.Map<InspectJob, InspectNoteEditInput>(entity);
await _inspectNoteAppService.CreateAsync(input).ConfigureAwait(false);
return input;
} }
/// <summary> /// <summary>
@ -75,7 +98,8 @@ public class InspectJobEventHandler :
{ {
var noteCreateInput = new InspectNoteEditInput(); var noteCreateInput = new InspectNoteEditInput();
var noteSummaryDetailInput = ObjectMapper.Map<InspectJobSummaryDetail, InspectNoteSummaryDetailInput>(jobSummaryDetail); var noteSummaryDetailInput =
ObjectMapper.Map<InspectJobSummaryDetail, InspectNoteSummaryDetailInput>(jobSummaryDetail);
noteCreateInput.SummaryDetails.Add(noteSummaryDetailInput); noteCreateInput.SummaryDetails.Add(noteSummaryDetailInput);
@ -92,13 +116,54 @@ public class InspectJobEventHandler :
} }
/// <summary> /// <summary>
/// 构造 质检记录 /// 完成免检任务
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entities"></param>
/// <returns></returns> /// <returns></returns>
private InspectNoteEditInput BuildInspectNote(InspectJob entity) private async Task CompleteExemptInspectJobAsync(List<InspectJob> entities)
{ {
var input = ObjectMapper.Map<InspectJob, InspectNoteEditInput>(entity); foreach (var inspectJob in entities)
return input; {
var summaryDetail = inspectJob.SummaryDetails.FirstOrDefault();
//免检任务自动完成 并调用检验记录生成业务
if (summaryDetail?.InspectType != EnumInspectType.Exempt)
{
await CompleteExemptInspectJobAsync(inspectJob, summaryDetail).ConfigureAwait(false);
} }
}
}
/// <summary>
/// 处理免检 物品
/// </summary>
/// <param name="inspectJob"></param>
/// <param name="summarydDetail"></param>
/// <returns></returns>
private async Task CompleteExemptInspectJobAsync(InspectJob inspectJob, InspectJobSummaryDetail summarydDetail)
{
//任务状态直接完成
await inspectJob.CompleteAsync(inspectJob.CreatorId, "", Clock.Now).ConfigureAwait(false);
foreach (var detail in inspectJob.Details)
{
await inspectJob.SetDetail(
detail.Id,
detail.GoodQty,
detail.FailedReason,
detail.FailedQty,
detail.CrackQty,
detail.NotPassedQty,
inspectJob.Worker,
detail.SupplierBatch,
detail.ArriveDate,
detail.ProduceDate,
detail.ExpireDate,
detail.ContainerCode,
detail.LocationCode,
detail.Lot,
detail.PackingCode,
detail.ReceiveQty).ConfigureAwait(false);
}
}
#endregion
} }

117
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs

@ -1,10 +1,10 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using StackExchange.Redis;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts;
@ -15,116 +15,85 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessJob;
public class IssueJobEventHandler : public class IssueJobEventHandler :
StoreEventHandlerBase StoreEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<IssueJob>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<IssueJob>>>
, ILocalEventHandler<SfsCompletedEntityEventData<IssueJob>> , ILocalEventHandler<SfsCompletedEntityEventData<IssueJob>>
{ {
private const string MaterialRequestPrefix = "MaterialRequest"; private const EnumTransType TransType = EnumTransType.Issue;
private readonly IMaterialRequestManager _materialRequestManager; private readonly IIssueNoteAppService _issueNoteAppService;
private readonly IIssueNoteManager _issueNoteManager; private readonly ILocationAppService _locationAppService;
public IssueJobEventHandler(
IIssueNoteManager issueNoteManager
, IMaterialRequestManager materialRequestManager
, IConfiguration configuration)
public IssueJobEventHandler(IIssueNoteAppService issueNoteAppService, ILocationAppService locationAppService)
{ {
_issueNoteManager = issueNoteManager; _issueNoteAppService = issueNoteAppService;
_materialRequestManager = materialRequestManager; _locationAppService = locationAppService;
var redisConnectionString = configuration["Redis:Configuration"];
var redisConnection = ConnectionMultiplexer.Connect(redisConnectionString);
RedisDB = redisConnection.GetDatabase();
} }
/// <summary>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueJob> eventData) /// 执行后
{ /// </summary>
var entity = eventData.Entity; /// <param name="eventData"></param>
var cacheKey = GetCacheKey(entity.MaterialRequestNumber); /// <returns></returns>
var jobNumber = entity.Number;
await RedisDB.HashSetAsync(cacheKey, jobNumber, true).ConfigureAwait(false);
}
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<IssueJob>> eventData)
{
var entities = eventData.Entity;
foreach (var entity in entities)
{
var cacheKey = GetCacheKey(entity.MaterialRequestNumber);
var jobNumber = entity.Number;
await RedisDB.HashSetAsync(cacheKey, jobNumber, true).ConfigureAwait(false);
}
}
[UnitOfWork] [UnitOfWork]
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<IssueJob> eventData) public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<IssueJob> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
#region 更新叫料请求状态
var cacheKey = GetCacheKey(entity.MaterialRequestNumber);
var jobNumber = entity.Number;
await RedisDB.HashDeleteAsync(cacheKey, jobNumber).ConfigureAwait(false);
var count = await RedisDB.HashLengthAsync(cacheKey).ConfigureAwait(false);
if (count == 0)
{
await _materialRequestManager.CompleteAsync(entity.MaterialRequestNumber).ConfigureAwait(false);
}
#endregion
var issueNote = await BuildIssueNoteAsync(entity).ConfigureAwait(false); var issueNote = await BuildIssueNoteAsync(entity).ConfigureAwait(false);
await _issueNoteManager.CreateAsync(issueNote).ConfigureAwait(false); await _issueNoteAppService.CreateAsync(issueNote).ConfigureAwait(false);
} }
#region 私有
/// <summary> /// <summary>
/// 创建补料记录实体 /// 创建补料记录实体
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
/// <returns></returns> /// <returns></returns>
private async Task<IssueNote> BuildIssueNoteAsync(IssueJob entity) private async Task<IssueNoteEditInput> BuildIssueNoteAsync(IssueJob entity)
{ {
var issueNote = ObjectMapper.Map<IssueJob, IssueNote>(entity); var issueNoteCreateInput = ObjectMapper.Map<IssueJob, IssueNoteEditInput>(entity);
var locationCodes = issueNote.Details.Select(p => p.ToLocationCode).Distinct().ToList(); var locationCodes = issueNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList();
var locations = await LocationAclService.GetByCodesAsync(locationCodes).ConfigureAwait(false); var locations = await _locationAppService.GetByCodesAsync(locationCodes).ConfigureAwait(false);
issueNote.Details.RemoveAll(p => p.Qty == 0); issueNoteCreateInput.Details.RemoveAll(p => p.Qty == 0);
foreach (var detail in issueNote.Details) foreach (var detail in issueNoteCreateInput.Details)
{ {
var location = locations.First(p => p.Code == detail.ToLocationCode); var location = locations.First(p => p.Code == detail.ToLocationCode);
await RemovePackingCodeAndContainerCodeAndLot(detail, location.Type).ConfigureAwait(false);//去箱 去托 去批 await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type); //去箱 去托 去批
detail.ToLocationArea = location.AreaCode;
detail.ToLocationGroup = location.LocationGroupCode;
detail.ToLocationErpCode = location.ErpLocationCode; detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode; detail.ToWarehouseCode = location.WarehouseCode;
detail.FromWarehouseCode = location.WarehouseCode;
} }
return issueNote; return issueNoteCreateInput;
} }
/// <summary> /// <summary>
/// 去除箱码 托码 批次 /// 去除箱码 托码 批次
/// </summary> /// </summary>
private async Task RemovePackingCodeAndContainerCodeAndLot(IssueNoteDetail issueNoteDetail, EnumLocationType locationType) private async Task RemovePackingCodeAndContainerCodeAndLotAsync(IssueNoteDetailInput issueNoteDetail,
EnumLocationType locationType)
{ {
switch (locationType) switch (locationType)
{ {
case EnumLocationType.WIP: case EnumLocationType.WIP:
{ {
//用开关控制 发料到线边后去除箱码和托码 ??? //用开关控制 发料到线边后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode).ConfigureAwait(false)) if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode)
.ConfigureAwait(false))
{ {
issueNoteDetail.ToPackingCode = ""; issueNoteDetail.ToPackingCode = "";
} }
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode).ConfigureAwait(false))
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode)
.ConfigureAwait(false))
{ {
issueNoteDetail.ToContainerCode = ""; issueNoteDetail.ToContainerCode = "";
} }
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false))
{ {
issueNoteDetail.ToLot = ""; issueNoteDetail.ToLot = "";
@ -135,14 +104,18 @@ public class IssueJobEventHandler :
case EnumLocationType.SEMI: case EnumLocationType.SEMI:
{ {
//用开关控制 发料到后去除箱码和托码 ??? //用开关控制 发料到后去除箱码和托码 ???
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode).ConfigureAwait(false)) if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemovePackingCode)
.ConfigureAwait(false))
{ {
issueNoteDetail.ToPackingCode = ""; issueNoteDetail.ToPackingCode = "";
} }
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode).ConfigureAwait(false))
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode)
.ConfigureAwait(false))
{ {
issueNoteDetail.ToContainerCode = ""; issueNoteDetail.ToContainerCode = "";
} }
if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false))
{ {
issueNoteDetail.ToLot = ""; issueNoteDetail.ToLot = "";
@ -153,9 +126,5 @@ public class IssueJobEventHandler :
} }
} }
#endregion
private static string GetCacheKey(string requestNumber)
{
return $"{StoreConsts.CachePrefix}:{MaterialRequestPrefix}:{requestNumber}";
}
} }

81
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using FluentValidation.Validators;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement;
@ -20,19 +21,61 @@ public class MaterialRequestEventHandler
, ILocalEventHandler<SfsHandledEntityEventData<MaterialRequest>> , ILocalEventHandler<SfsHandledEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsAbortedEntityEventData<MaterialRequest>> , ILocalEventHandler<SfsAbortedEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsCompletedEntityEventData<MaterialRequest>> , ILocalEventHandler<SfsCompletedEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<MaterialRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<MaterialRequest>>>
{ {
private readonly IIssueJobAppService _issueJobAppService; private readonly IIssueJobAppService _issueJobAppService;
private readonly IProductionLineAppService _productionLineAppService; private readonly IProductionLineAppService _productionLineAppService;
private readonly IMaterialRequestManager _materialRequestManager;
private readonly ILocationAppService _locationAppService;
public MaterialRequestEventHandler( public MaterialRequestEventHandler(
IIssueJobAppService issueJobAppService IIssueJobAppService issueJobAppService
, IProductionLineAppService productionLineAppService , IProductionLineAppService productionLineAppService
) , IMaterialRequestManager materialRequestManager
, ILocationAppService locationAppService)
{ {
_issueJobAppService = issueJobAppService; _issueJobAppService = issueJobAppService;
_productionLineAppService = productionLineAppService; _productionLineAppService = productionLineAppService;
_materialRequestManager = materialRequestManager;
_locationAppService = locationAppService;
} }
/// <summary>
/// 创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<MaterialRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<MaterialRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
}
/// <summary>
/// 执行后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsHandledEntityEventData<MaterialRequest> eventData) public virtual async Task HandleEventAsync(SfsHandledEntityEventData<MaterialRequest> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
@ -43,12 +86,22 @@ public class MaterialRequestEventHandler
} }
} }
/// <summary>
/// 驳回后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<MaterialRequest> eventData) public virtual async Task HandleEventAsync(SfsAbortedEntityEventData<MaterialRequest> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false); await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false);
} }
/// <summary>
/// 完成后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<MaterialRequest> eventData) public virtual async Task HandleEventAsync(SfsCompletedEntityEventData<MaterialRequest> eventData)
{ {
_ = eventData.Entity; _ = eventData.Entity;
@ -63,7 +116,7 @@ public class MaterialRequestEventHandler
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false);
var toLocationCodes = materialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); var toLocationCodes = materialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList();
var toLocations = await LocationAclService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false);
foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0)) foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0))
{ {
@ -76,7 +129,7 @@ public class MaterialRequestEventHandler
} }
var fromLocationCode = jobDetails[0].RecommendFromLocationCode; var fromLocationCode = jobDetails[0].RecommendFromLocationCode;
var fromLocation = await LocationAclService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false); var fromLocation = await _locationAppService.GetByCodeAsync(fromLocationCode).ConfigureAwait(false);
var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode); var job = jobs.FirstOrDefault(p => p.WorkGroupCode == fromLocation?.WorkGroupCode);
if (job == null || job.Details.Any(p => p.ToLocationCode != materialRequestDetail.ToLocationCode)) if (job == null || job.Details.Any(p => p.ToLocationCode != materialRequestDetail.ToLocationCode))
{ {
@ -170,10 +223,27 @@ public class MaterialRequestEventHandler
var detail = ObjectMapper.Map<BalanceDTO, IssueJobDetailInput>(balance); var detail = ObjectMapper.Map<BalanceDTO, IssueJobDetailInput>(balance);
detail.RequestLocationCode = materialRequestDetail.ToLocationCode; detail.RequestLocationCode = materialRequestDetail.ToLocationCode;
detail.ToLocationCode = materialRequestDetail.ToLocationCode;
detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode;
detail.WorkStation = materialRequestDetail.WorkStation; detail.WorkStation = materialRequestDetail.WorkStation;
detail.ExpiredTime = materialRequestDetail.ExpiredTime; detail.ExpiredTime = materialRequestDetail.ExpiredTime;
detail.RecommendPackingCode = balance.PackingCode;
detail.RecommendContainerCode = balance.ContainerCode;
detail.RecommendSupplierBatch = balance.SupplierBatch;
detail.RecommendProduceDate= balance.ProduceDate;
detail.RecommendExpireDate= balance.ExpireDate;
detail.RecommendLot= balance.Lot;
detail.RecommendProduceDate=balance.ProduceDate;
detail.RecommendArriveDate= balance.ArriveDate;
detail.RecommendFromLocationArea = balance.LocationArea;
detail.RecommendFromLocationCode= balance.LocationCode;
detail.RecommendFromLocationErpCode= balance.LocationErpCode;
detail.RecommendFromLocationGroup= balance.LocationGroup;
detail.RecommendFromWarehouseCode= balance.WarehouseCode;
detail.ToLocationCode = materialRequestDetail.ToLocationCode;
detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode;
detail.ToWarehouseCode = materialRequestDetail.ToWarehouseCode;
detail.ToLocationGroup = materialRequestDetail.ToLocationGroup;
//detail.Operation = //TODO //detail.Operation = //TODO
//detail.DistributionType =//TODO //detail.DistributionType =//TODO
//detail.TruncType = //TODO //detail.TruncType = //TODO
@ -206,4 +276,5 @@ public class MaterialRequestEventHandler
} }
} }

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs

@ -70,7 +70,6 @@ public class PutawayRequestEventHandler
/// <returns></returns> /// <returns></returns>
private async Task<PutawayJobEditInput> BulidPutawayJobCreateInputAsync(PutawayRequest putawayRequest) private async Task<PutawayJobEditInput> BulidPutawayJobCreateInputAsync(PutawayRequest putawayRequest)
{ {
await Task.CompletedTask.ConfigureAwait(false);
var createInput = ObjectMapper.Map<PutawayRequest, PutawayJobEditInput>(putawayRequest); var createInput = ObjectMapper.Map<PutawayRequest, PutawayJobEditInput>(putawayRequest);
createInput.JobType = EnumJobType.PutawayJob; createInput.JobType = EnumJobType.PutawayJob;
createInput.JobStatus = EnumJobStatus.Open; createInput.JobStatus = EnumJobStatus.Open;

95
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs

@ -1,8 +1,12 @@
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Local;
using Volo.Abp.SettingManagement; using Volo.Abp.SettingManagement;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
@ -12,16 +16,27 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest;
public class TransferRequestEventHandler public class TransferRequestEventHandler
: StoreEventHandlerBase : StoreEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<TransferRequest>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<TransferRequest>>>
, ILocalEventHandler<SfsHandledEntityEventData<TransferRequest>> , ILocalEventHandler<SfsHandledEntityEventData<TransferRequest>>
//, ILocalEventHandler<SfsSubmittedEntityEventData<TransferRequest>>
//, ILocalEventHandler<SfsAgreedEntityEventData<TransferRequest>>
{ {
private readonly ITransferNoteManager _transferNoteManager; private readonly ITransferNoteManager _transferNoteManager;
private readonly ILocationAppService _locationAppService;
private readonly ITransferRequestManager _transferRequestManager;
protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService<ILocalEventBus>();
public TransferRequestEventHandler( public TransferRequestEventHandler(
ITransferNoteManager transferNoteManager) ITransferNoteManager transferNoteManager, ILocationAppService locationAppService, ITransferRequestManager transferRequestManager)
{ {
_transferNoteManager = transferNoteManager; _transferNoteManager = transferNoteManager;
_locationAppService = locationAppService;
_transferRequestManager = transferRequestManager;
} }
/// <summary> /// <summary>
/// 库存转移 审批通过 后 /// 库存转移 审批通过 后
/// </summary> /// </summary>
@ -32,28 +47,29 @@ public class TransferRequestEventHandler
public async Task HandleEventAsync(SfsHandledEntityEventData<TransferRequest> eventData) public async Task HandleEventAsync(SfsHandledEntityEventData<TransferRequest> eventData)
{ {
var entity = eventData.Entity; var entity = eventData.Entity;
EnumTransSubType enumTransSubType = Enum.Parse<EnumTransSubType>(entity.Type); var enumTransSubType = Enum.Parse<EnumTransSubType>(entity.Type);
if (entity.DirectCreateNote) if (entity.DirectCreateNote)
{ {
var input = ObjectMapper.Map<TransferRequest, TransferNote>(entity); var input = ObjectMapper.Map<TransferRequest, TransferNote>(entity);
var transferOnTheWayLocation = //获取在途库
await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation).ConfigureAwait(false); var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT)
.ConfigureAwait(false);
input.Details.ForEach(p => p.OnTheWayLocationCode = transferOnTheWayLocation); var transferOnTheWayLocation =
await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation)
.ConfigureAwait(false);
// input. input.Details.ForEach(p => { p.OnTheWayLocationCode = locationDto.Code; });
await _transferNoteManager.CreateAsync(input).ConfigureAwait(false); await _transferNoteManager.CreateAsync(input).ConfigureAwait(false);
} }
switch (enumTransSubType) switch (enumTransSubType)
{ {
case EnumTransSubType.Transfer_Inside: case EnumTransSubType.Transfer_Inside:
case EnumTransSubType.Transfer_Area: case EnumTransSubType.Transfer_Area:
break; break;
case EnumTransSubType.Transfer_Warehouse: case EnumTransSubType.Transfer_Warehouse:
case EnumTransSubType.Transfer_Customer: case EnumTransSubType.Transfer_Customer:
@ -63,4 +79,67 @@ public class TransferRequestEventHandler
break; break;
} }
} }
/// <summary>
/// 库移创建后
/// </summary>
/// <param name="eventData">Event data</param>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<TransferRequest> eventData)
{
var entity = eventData.Entity;
if (entity.AutoSubmit)
{
await _transferRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
/// <summary>
/// 库移批量创建后
/// </summary>
/// <param name="eventData">Event data</param>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<TransferRequest>> eventData)
{
var entitys = eventData.Entity;
foreach (var entity in entitys)
{
if (entity.AutoSubmit)
{
await _transferRequestManager.SubmitAsync(entity).ConfigureAwait(false);
}
}
}
///// <summary>
///// 提交后
///// </summary>
///// <param name="eventData">Event data</param>
//[UnitOfWork]
//public virtual async Task HandleEventAsync(SfsSubmittedEntityEventData<TransferRequest> eventData)
//{
// var entity = eventData.Entity;
// if (entity.AutoAgree)
// {
// entity.Agree();
// await LocalEventBus.PublishAsync(new SfsAgreedEntityEventData<TransferRequest>(entity), false)
// .ConfigureAwait(false);
// }
//}
///// <summary>
///// 审批后
///// </summary>
///// <param name="eventData">Event data</param>
//[UnitOfWork]
//public virtual async Task HandleEventAsync(SfsAgreedEntityEventData<TransferRequest> eventData)
//{
// var entity = eventData.Entity;
// if (entity.AutoHandle)
// {
// entity.Handle();
// await LocalEventBus.PublishAsync(new SfsHandledEntityEventData<TransferRequest>(entity), false)
// .ConfigureAwait(false);
// }
//}
} }

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs

@ -57,6 +57,8 @@ public class InspectNoteEventHandler
FromContainerCode = detail.ContainerCode, FromContainerCode = detail.ContainerCode,
FromLocationCode = detail.LocationCode, FromLocationCode = detail.LocationCode,
FromLocationErpCode = detail.LocationErpCode, FromLocationErpCode = detail.LocationErpCode,
FromLocationArea = detail.LocationArea,
FromLocationGroup = detail.LocationGroup,
FromLot = detail.Lot, FromLot = detail.Lot,
FromPackingCode = detail.PackingCode, FromPackingCode = detail.PackingCode,
FromStatus = EnumInventoryStatus.INSP, FromStatus = EnumInventoryStatus.INSP,

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs

@ -303,6 +303,8 @@ public class PurchaseReceiptNoteEventHandler
createInput.Details.ForEach(p => createInput.Details.ForEach(p =>
{ {
p.LocationGroup = inspectLocation.LocationGroupCode;
p.LocationArea = inspectLocation.AreaCode;
p.LocationCode = inspectLocation.Code; p.LocationCode = inspectLocation.Code;
p.LocationErpCode = inspectLocation.ErpLocationCode; p.LocationErpCode = inspectLocation.ErpLocationCode;
p.WarehouseCode = inspectLocation.WarehouseCode; p.WarehouseCode = inspectLocation.WarehouseCode;

50
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -16,13 +17,16 @@ public class TransferNoteEventHandler
: StoreInventoryEventHandlerBase : StoreInventoryEventHandlerBase
, ILocalEventHandler<SfsCreatedEntityEventData<TransferNote>> , ILocalEventHandler<SfsCreatedEntityEventData<TransferNote>>
, ILocalEventHandler<SfsConfirmedEntityEventData<TransferNote>> , ILocalEventHandler<SfsConfirmedEntityEventData<TransferNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<TransferNote>>>
{ {
private const EnumTransType TransType = EnumTransType.Transfer; private const EnumTransType TransType = EnumTransType.Transfer;
private readonly ITransferRequestAppService _transferRequestApp; private readonly ILocationAppService _locationAppService;
private readonly ITransferLogAppService _transferLogAppService;
public TransferNoteEventHandler(ITransferRequestAppService transferRequestApp) public TransferNoteEventHandler(ITransferRequestAppService transferRequestApp, ILocationAppService locationAppService, ITransferLogAppService transferLogAppService)
{ {
_transferRequestApp = transferRequestApp; _locationAppService = locationAppService;
_transferLogAppService = transferLogAppService;
} }
/// <summary> /// <summary>
@ -43,6 +47,25 @@ public class TransferNoteEventHandler
await AddTransferLogsAsync(inputList).ConfigureAwait(false); await AddTransferLogsAsync(inputList).ConfigureAwait(false);
} }
/// <summary>
/// 批量创建 后
/// </summary>
/// <param name="eventData"></param>
/// <returns></returns>
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<TransferNote>> eventData)
{
foreach (var entity in eventData.Entity)
{
var route = entity.UseOnTheWayLocation
? EnumTransferRoute.SourceToOnTheWay
: EnumTransferRoute.SourceToDestination;
var inputList = await BuildTransferLogsAsync(entity, route).ConfigureAwait(false);
await AddTransferLogsAsync(inputList).ConfigureAwait(false);
}
}
/// <summary> /// <summary>
/// 确认 后 /// 确认 后
/// </summary> /// </summary>
@ -63,7 +86,7 @@ public class TransferNoteEventHandler
transferLogs.AddRange(inputList); transferLogs.AddRange(inputList);
await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
} }
@ -81,11 +104,9 @@ public class TransferNoteEventHandler
{ {
var transferLog = ObjectMapper.Map<TransferNoteDetail, TransferLogEditInput>(detail); var transferLog = ObjectMapper.Map<TransferNoteDetail, TransferLogEditInput>(detail);
if (note.UseOnTheWayLocation) var fromLocation = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
{ var toLocation = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
var fromLocation = await LocationAclService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); var transferOnTheWay = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false);
var toLocation = await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
var transferOnTheWay = await LocationAclService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
switch (route) switch (route)
{ {
@ -112,10 +133,19 @@ public class TransferNoteEventHandler
transferLog.ToLocationGroup = toLocation.LocationGroupCode; transferLog.ToLocationGroup = toLocation.LocationGroupCode;
break; break;
case EnumTransferRoute.SourceToDestination: case EnumTransferRoute.SourceToDestination:
transferLog.FromLocationCode = fromLocation.Code;
transferLog.FromLocationArea = fromLocation.AreaCode;
transferLog.FromLocationErpCode = fromLocation.ErpLocationCode;
transferLog.FromLocationGroup = fromLocation.LocationGroupCode;
transferLog.ToLocationCode = toLocation.Code;
transferLog.ToLocationArea = toLocation.AreaCode;
transferLog.ToLocationErpCode = toLocation.ErpLocationCode;
transferLog.ToLocationGroup = toLocation.LocationGroupCode;
break;;
default: default:
throw new ArgumentOutOfRangeException(nameof(route), route, null); throw new ArgumentOutOfRangeException(nameof(route), route, null);
} }
}
transferLog.TransType = TransType; transferLog.TransType = TransType;
transferLog.TransSubType = Enum.Parse<EnumTransSubType>(note.Type); transferLog.TransSubType = Enum.Parse<EnumTransSubType>(note.Type);

20
build/src/docker/publish/conf/settings/appsettings.Development.json

@ -1,5 +1,5 @@
{ {
"AlwaysAllowAuthorization": "False", "AlwaysAllowAuthorization": "True",
"App": { "App": {
"CorsOrigins": [ "CorsOrigins": [
"http://localhost:59080", "http://localhost:59080",
@ -110,31 +110,31 @@
}, },
"RemoteServices": { "RemoteServices": {
"Auth": { "Auth": {
"BaseUrl": "http://localhost:21293/" "BaseUrl": "http://dev.ccwin-in.com:21293/"
}, },
"BaseData": { "BaseData": {
"BaseUrl": "http://localhost:21294/" "BaseUrl": "http://dev.ccwin-in.com:21294/"
}, },
"Default": { "Default": {
"BaseUrl": "http://localhost:21293/" "BaseUrl": "http://dev.ccwin-in.com:21293/"
}, },
"FileStorage": { "FileStorage": {
"BaseUrl": "http://localhost:21292/" "BaseUrl": "http://dev.ccwin-in.com:21292/"
}, },
"Inventory": { "Inventory": {
"BaseUrl": "http://localhost:59095/" "BaseUrl": "http://dev.ccwin-in.com:21295/"
}, },
"Job": { "Job": {
"BaseUrl": "http://localhost:59095/" "BaseUrl": "http://dev.ccwin-in.com:21295/"
}, },
"Label": { "Label": {
"BaseUrl": "http://localhost:21292/" "BaseUrl": "http://dev.ccwin-in.com:21292/"
}, },
"Message": { "Message": {
"BaseUrl": "http://localhost:21292/" "BaseUrl": "http://dev.ccwin-in.com:21292/"
}, },
"Store": { "Store": {
"BaseUrl": "http://localhost:59095/" "BaseUrl": "http://dev.ccwin-in.com:21295/"
} }
}, },
"Serilog": { "Serilog": {

4
build/src/docker/publish/conf/settings/appsettings.json

@ -48,7 +48,7 @@
//ids4 //ids4
"AuthServer": { "AuthServer": {
"Audience": "Auth", "Audience": "Auth",
"Authority": "http://dev.ccwin-in.com:21293/", "Authority": "http://localhost:59093",
"ClientId": "Auth_App", "ClientId": "Auth_App",
"ClientSecret": "1q2w3E*", "ClientSecret": "1q2w3E*",
"RequireHttpsMetadata": "false", "RequireHttpsMetadata": "false",
@ -106,7 +106,7 @@
"BaseUrl": "http://dev.ccwin-in.com:59094/" "BaseUrl": "http://dev.ccwin-in.com:59094/"
}, },
"Default": { "Default": {
"BaseUrl": "http://dev.ccwin-in.com:59093" "BaseUrl": "http://dev.ccwin-in.com:59093/"
}, },
"FileStorage": { "FileStorage": {
"BaseUrl": "http://dev.ccwin-in.com:59092/" "BaseUrl": "http://dev.ccwin-in.com:59092/"

BIN
build/src/win-x64/publish/TaskKill.exe

Binary file not shown.

1
build/src/win-x64/publish/stop.cmd.example

@ -1,3 +1,4 @@
@ECHO OFF @ECHO OFF
taskkill /im supervisord.exe /f /t taskkill /im supervisord.exe /f /t
TaskKill.exe
Loading…
Cancel
Save