diff --git a/be/DataExchange/host/Win_in.Sfs.Wms.DataExchange.HttpApi.Host/appsettings.json b/be/DataExchange/host/Win_in.Sfs.Wms.DataExchange.HttpApi.Host/appsettings.json index afc0f3f0e..bfabf4e68 100644 --- a/be/DataExchange/host/Win_in.Sfs.Wms.DataExchange.HttpApi.Host/appsettings.json +++ b/be/DataExchange/host/Win_in.Sfs.Wms.DataExchange.HttpApi.Host/appsettings.json @@ -46,6 +46,8 @@ "StringEncryption": { "DefaultPassPhrase": "8fFOYxuru0qm2ATJ" }, + + //业务 "Sites": "T8,T9", "Company": "T8,T9" } diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs index b2a84587a..c22fde641 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/TokenService.cs +++ b/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 { private readonly IHttpClientFactory _httpClientFactory; - private readonly IConfiguration _configuration; private readonly ILogger _logger; + private readonly IConfiguration _configuration; + public TokenService(IHttpClientFactory httpClientFactory, IConfiguration configuration, ILogger logger) { diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs index 7f955d101..b4ca5d730 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/UserMenus/UserMenuAppService.cs @@ -57,7 +57,7 @@ public class UserMenuAppService : public virtual async Task> GetPdaMenusOfUserAsync(Guid? userId) { 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(); @@ -155,7 +155,7 @@ public class UserMenuAppService : var entities = await _menuRepository .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>(entities); } diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj index e34e27aae..cd991573e 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Web/Win_in.Sfs.Auth.Web.csproj @@ -13,8 +13,6 @@ false true Win_in.Sfs.Auth-4681b4fd-151f-4221-84a4-929d86723e4c - 1.yyyy.Mdd.Hmm - 1.2023.407.1105 True diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs index c62b042bf..0dc46b18f 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Serilog; using Volo.Abp.AspNetCore.Mvc; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.Dashboard.Host.Models; @@ -101,9 +102,9 @@ public class PlanAndActualController : AbpController dto.MinQty = itemSafetyStork.MinStock; } - dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode); - dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode); - dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode); + dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode, detail.Lot); + dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode, detail.Lot); + dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode, detail.Lot); dtos.Add(dto); } @@ -117,19 +118,19 @@ public class PlanAndActualController : AbpController return dtos.OrderBy(t => t.SupplierShortName).ToList(); } - private static decimal CountPutawayQty(List putawayNotes, string itemCode) + private static decimal CountPutawayQty(List 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 purchaseReceipts, string itemCode) + private static decimal CountReceiptQty(List 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 purchaseReceipts, string itemCode) + private static int CountReceiptNoteCount(List 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> GetSupplierAsnsAsync() diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/DashboardHttpApiHostModule.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/DashboardHttpApiHostModule.cs index bcd7b88cc..720e00dcf 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/DashboardHttpApiHostModule.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/DashboardHttpApiHostModule.cs @@ -1,17 +1,8 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; 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.Extensions; using Polly; -using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.AspNetCore.Mvc.Client; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; 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.IdentityModel.Web; using Volo.Abp.Identity; -using Volo.Abp.Localization; using Volo.Abp.Modularity; -using Volo.Abp.MultiTenancy; +using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Swashbuckle; using Volo.Abp.Users; using Win_in.Sfs.Auth; @@ -42,7 +32,9 @@ namespace Win_in.Sfs.Wms.Dashboard.Host; typeof(AbpIdentityHttpApiClientModule), typeof(AbpAspNetCoreMvcClientModule), typeof(AbpHttpClientIdentityModelWebModule), - typeof(SharedHostModule) + typeof(SharedHostModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule) + )] /// @@ -65,10 +57,8 @@ namespace Win_in.Sfs.Wms.Dashboard.Host; typeof(MessageApplicationContractsModule), typeof(AuthApplicationContractsModule) )] -public class DashboardHttpApiHostModule : AbpModule +public class DashboardHttpApiHostModule : ModuleBase { - private bool _isMultiTenancy = true; - /// /// 预配置服务 /// @@ -120,55 +110,9 @@ public class DashboardHttpApiHostModule : AbpModule context.Services.Replace(ServiceDescriptor.Transient()); } - /// - /// 配置服务 - /// - /// - 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(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(options => - { - options.TokenCookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax; - options.TokenCookie.Expiration = TimeSpan.FromDays(365); - options.AutoValidateIgnoredHttpMethods.Add("POST"); - }); - } - - private static void ConfigureHttpClientProxies(ServiceConfigurationContext context) + protected override void ConfigureHttpClientProxies() { - _ = context.Services.GetConfiguration(); - + var context = this.ServiceConfigurationContext; context.Services.AddHttpClientProxies( typeof(AuthApplicationContractsModule).Assembly, "Auth" @@ -202,145 +146,4 @@ public class DashboardHttpApiHostModule : AbpModule "FileStorage" ); } - - private void ConfigureMultiTenancy() - { - Configure(options => { options.IsEnabled = _isMultiTenancy; }); - } - - private static void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) - { - var origins = configuration.GetSection("App:CorsOrigins").Get(); - - 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("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(options => - { - options.Languages.Add(new LanguageInfo("en", "en", "English")); - options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); - }); - } - - /// - /// 应用初始化 - /// - /// - 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 - // { - // {"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); - // }); - // }); - } } diff --git a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj index 922ab1a43..b9b8b2ea8 100644 --- a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj +++ b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Win_in.Sfs.Wms.Store.HttpApi.Host.csproj @@ -33,18 +33,22 @@ + + + + diff --git a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql index 20f15edef..97de80e01 100644 --- a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql +++ b/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, [RequestNumber] nvarchar(max) NULL, [JobNumber] nvarchar(64) NULL, - [Type] nvarchar(64) NULL, + [Type] nvarchar(64) NOT NULL, [UseOnTheWayLocation] bit NOT NULL, [ConfirmTime] datetime2 NULL, [Confirmed] bit NOT NULL, diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs index 57f3f8604..dbaf0e54a 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs +++ b/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.ComponentModel.DataAnnotations; using System.Linq; +using System.Net.Http; using System.Threading.Tasks; +using DocumentFormat.OpenXml.Drawing.Charts; +using IdentityModel.Client; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using Volo.Abp.Account; using Volo.Abp.AspNetCore.Mvc; using Win_in.Sfs.Auth.Application.Contracts; @@ -26,6 +33,9 @@ public class AccountController : AbpController private readonly ITokenService _tokenService; private readonly IUserMenuAppService _userMenuAppService; private readonly IUserWorkGroupAppService _userWorkGroupAppService; + private readonly IConfiguration _configuration; + private readonly IHttpClientFactory _httpClientFactory; + private readonly ILogger _logger; /// /// @@ -38,12 +48,27 @@ public class AccountController : AbpController , ITokenService tokenService , IUserMenuAppService userMenuAppService , IUserWorkGroupAppService userWorkGroupAppService - ) + , IConfiguration configuration, IHttpClientFactory httpClientFactory, ILogger logger) { _profileAppService = profileAppService; _tokenService = tokenService; _userMenuAppService = userMenuAppService; _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; } } /// @@ -55,8 +80,51 @@ public class AccountController : AbpController public virtual async Task LoginAsync(UserLoginInput userLoginInput) { - var token = await _tokenService.GetTokenAsync(userLoginInput.Username, userLoginInput.Password).ConfigureAwait(false); - return token; + var address = _configuration["AuthServer:Authority"]; + 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() + //}); } /// @@ -95,10 +163,10 @@ public class AccountController : AbpController /// 菜单 /// /// - [HttpGet("menus")] - public virtual async Task> GetMenusAsync() + [HttpGet("menus/{userId}")] + public virtual async Task> GetMenusAsync(Guid userId) { - var userId = CurrentUser.Id; + //var userId = CurrentUser.Id; var pdaMenuGroupDtos = new List();//返回给pda的菜单 已排序 var menusOfUser = await _userMenuAppService.GetPdaMenusOfUserAsync(userId).ConfigureAwait(false); var menuGroups = menusOfUser.GroupBy(p => p.GroupName); diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs index fc116e2aa..7ed1b4d54 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/CountJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -133,7 +133,7 @@ public class CountJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); - var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + var status = new List() {EnumJobStatus.Open.ToString(),EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var requestInput = new SfsJobRequestInputBase @@ -165,7 +165,7 @@ public class CountJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs index a25d23869..0b93cc8db 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/DeliverJobController.cs +++ b/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); _ = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -132,7 +132,7 @@ public class DeliverJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs index 205fd3dd8..aabb49b1c 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/InspectJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -108,7 +108,7 @@ public class InspectJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs index d998499a7..c6763da04 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobController.cs +++ b/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 jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); - var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + var status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -143,7 +143,7 @@ public class IssueJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); - var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + var status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var requestInput = new SfsJobRequestInputBase @@ -175,7 +175,7 @@ public class IssueJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs index 2901b2130..420840bed 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JisDeliverJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -106,7 +106,7 @@ public class JisDeliverJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs index aee711c16..4c88f25d3 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var list = new List(); diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs index e075dac29..cbbab2341 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductReceiveJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -106,7 +106,7 @@ public class ProductReceiveJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs index 3bf10c4c1..ca0f1946e 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/ProductionReturnJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -113,7 +113,7 @@ public class ProductionReturnJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs index 3cf9da965..e24f784c4 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -186,7 +186,7 @@ public class PurchaseReceiptJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonWlgCodes = JsonSerializer.Serialize(wlgCodes); - var status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var requestInput = new SfsJobRequestInputBase @@ -222,7 +222,7 @@ public class PurchaseReceiptJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs index e3f7a8fc3..c6a071cce 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReturnJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -132,7 +132,7 @@ public class PurchaseReturnJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs index adc29f621..88cb5d770 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PutawayJobController.cs +++ b/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 jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase @@ -106,7 +106,7 @@ public class PutawayJobController : AbpController var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); - List status = new List() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; + List status = new List() { EnumJobStatus.Open.ToString(), EnumJobStatus.Doing.ToString() }; var jsonStatus = JsonSerializer.Serialize(status); var request = new SfsJobRequestInputBase diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs index c8bdffb8f..e1b686f6f 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/TransferRequestController.cs +++ b/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 { 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 { new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="), - new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==") + new(nameof(TransferRequestDTO.RequestStatus),EnumRequestStatus.New.ToString(),"==") } } }; diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Win_in.Sfs.Wms.Pda.Host.csproj b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Win_in.Sfs.Wms.Pda.Host.csproj index a771e7bc7..3e550397b 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Win_in.Sfs.Wms.Pda.Host.csproj +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Win_in.Sfs.Wms.Pda.Host.csproj @@ -28,7 +28,6 @@ - diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json index aa423658a..10fb7993c 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/appsettings.Development.json @@ -1,13 +1,13 @@ { - "RemoteServices": { - "Default": { "BaseUrl": "http://dev.ccwin-in.com:21293/" }, - "BaseData": { "BaseUrl": "http://dev.ccwin-in.com:21294/" }, - "Store": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, - "Job": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, - "Inventory": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, - "FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, - "Message": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, - "Label": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, - "Auth": { "BaseUrl": "http://dev.ccwin-in.com:21293/" } - } + //"RemoteServices": { + // "Default": { "BaseUrl": "http://dev.ccwin-in.com:21293/" }, + // "BaseData": { "BaseUrl": "http://dev.ccwin-in.com:21294/" }, + // "Store": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, + // "Job": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, + // "Inventory": { "BaseUrl": "http://dev.ccwin-in.com:21295/" }, + // "FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, + // "Message": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, + // "Label": { "BaseUrl": "http://dev.ccwin-in.com:21292/" }, + // "Auth": { "BaseUrl": "http://dev.ccwin-in.com:21293/" } + //} } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs index 76a8f48e9..3b5b405af 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAutoMapperProfile.cs +++ b/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) ; + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.ConcurrencyStamp) + ; + } } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs index 28508901f..0fd6ac6d7 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectIns/ExpectInAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Volo.Abp.AutoMapper; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Domain; @@ -10,5 +11,13 @@ public partial class InventoryApplicationAutoMapperProfile : Profile { CreateMap() .ReverseMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.Id) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + ; } } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs index 340b1860f..fddb1bbff 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs @@ -66,6 +66,7 @@ public class ExpectOutAppService LocationArea = first.LocationArea, LocationGroup = first.LocationGroup, LocationCode = s.Key.LocationCode, + LocationErpCode = first.LocationErpCode, Lot = s.Key.Lot, ContainerCode = s.Key.ContainerCode, ItemCode = s.Key.ItemCode, diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs index b78019d93..d83dcbff0 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAutoMapperProfile.cs +++ b/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.ConcurrencyStamp) .Ignore(x => x.Remark); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.Id) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + ; +; } } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs index 853045acb..5111d1731 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Volo.Abp.AutoMapper; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Domain; @@ -10,6 +11,17 @@ public partial class InventoryApplicationAutoMapperProfile : Profile { CreateMap() .ReverseMap(); + + CreateMap() + .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) + ; } } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs index d3502cf10..f8d05b5f5 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/Balance.cs @@ -298,8 +298,6 @@ public class Balance : SfsInventoryAggregateRootBase LastCountPlanNumber = other.LastCountPlanNumber; LastCountTime = other.LastCountTime; LastModificationTime = other.LastModificationTime; - LocationCode = other.LocationCode; - LocationErpCode = other.LocationErpCode; Lot = other.Lot; Uom = other.Uom; Qty = other.Qty; @@ -317,9 +315,17 @@ public class Balance : SfsInventoryAggregateRootBase ArriveDate = other.ArriveDate; ProduceDate = other.ProduceDate; ExpireDate = other.ExpireDate; + + ItemCode = other.ItemCode; ItemName = other.ItemName; ItemDesc1 = other.ItemDesc1; ItemDesc2 = other.ItemDesc2; + + LocationArea= other.LocationArea; + LocationGroup= other.LocationGroup; + LocationCode = other.LocationCode; + LocationErpCode = other.LocationErpCode; + } public override string ToString() diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs index 335ebcdd3..3414f7104 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs @@ -56,6 +56,9 @@ public class Transaction : SfsInventoryAggregateRootBase JobNumber = other.JobNumber; DocNumber = other.DocNumber; ManageType = other.ManageType; + LocationGroup= other.LocationGroup; + LocationArea= other.LocationArea; + LocationErpCode= other.LocationErpCode; } /// diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs index 42a056d2d..804b35ee7 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs +++ b/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.ExpireDate = transferLog.ExpireDate; transaction.StdPackQty = transferLog.StdPackQty; + transaction.Uom = transferLog.Uom; //出库库存事务的数量要改成负数 transaction.Qty = -transferLog.Qty; @@ -92,6 +93,7 @@ public static class TransferLogExtensions transaction.ProduceDate = transferLog.ProduceDate; transaction.ExpireDate = transferLog.ExpireDate; transaction.StdPackQty = transferLog.StdPackQty; + transaction.Uom = transferLog.Uom; transaction.Qty = transferLog.Qty; return transaction; diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs index 48275639c..6695cb221 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs @@ -1,3 +1,4 @@ +using System; using AutoMapper; using Volo.Abp.AutoMapper; using Win_in.Sfs.Message.Application.Contracts; @@ -11,6 +12,7 @@ public class UserNotifyMessageAutoMapperProfile : Profile { CreateMap() .IgnoreAuditedObjectProperties() + .BeforeMap((x, y) => y.UserId = x.CreatorId==null?Guid.Empty: x.CreatorId.Value) .ReverseMap(); CreateMap(); diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs index 7a9a9f491..5d38f1352 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs +++ b/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 , IUserNotifyMessageService { - public UserNotifyMessageService(IUserNotifyMessageRepository repository) : base(repository) { } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs index 26fd511e7..91d1cb82c 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs @@ -11,6 +11,7 @@ using ClosedXML; using ClosedXML.Excel; using ClosedXML.Graphics; using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Wordprocessing; using Irony; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -37,6 +38,11 @@ public class ClosedXmlExportImportService : IExportImportService { using var workbook = new XLWorkbook(); var name = typeof(TModel).GetCustomAttribute()?.Name ?? typeof(TModel).Name; + if (name.Length > 30) + { + name=name.Substring(0, 30); + } + var fileName = $"{name}_导出.xlsx"; var ws = workbook.Worksheets.Add(name); ws.Style.Font.FontName = "宋体"; @@ -79,6 +85,11 @@ public class ClosedXmlExportImportService : IExportImportService using var workbook = new XLWorkbook(); var type = typeof(TImportModel); var name = type.GetCustomAttribute()?.Name ?? type.Name; + if (name.Length > 30) + { + name=name.Substring(0, 30); + } + var fileName = $"{name}_导入模板.xlsx"; var ws = workbook.Worksheets.Add(name); var properties = GetPropertiesForImportModel(type); diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs index 91119054b..e7643873e 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs @@ -23,6 +23,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Microsoft.Net.Http.Headers; +using Omu.ValueInjecter.Utils; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -331,13 +332,13 @@ public abstract class SfsCrudWithDetailsAppServiceBase [HttpPost("import")] [Consumes("multipart/form-data")] - [UnitOfWork] + //[UnitOfWork] public virtual async Task ImportAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file) { using var ms = new MemoryStream(); await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); var inputFileBytes = ms.GetAllBytes(); - var result = await ImportInternalAsync(requestInput, inputFileBytes); + var result = await ImportInternalAsync(requestInput, inputFileBytes).ConfigureAwait(false); var bytes = result.FileContents; result.FileContents = null; @@ -510,7 +511,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase /// 导入数据具体实现,可重写 /// - [UnitOfWork] + //[UnitOfWork] protected virtual async Task ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes) { IList modelList = null; @@ -581,6 +582,10 @@ public abstract class SfsCrudWithDetailsAppServiceBase p.Value == EntityState.Added).Select(p => p.Key).ToList(); - await context.BulkInsertOrUpdateAsync(addList, bulkConfig).ConfigureAwait(false); - await context.BulkInsertAsync(list).ConfigureAwait(false); + try + { + await context.BulkInsertOrUpdateAsync(addList, bulkConfig).ConfigureAwait(false); + await context.BulkInsertAsync(list).ConfigureAwait(false); + + //await _repository.InsertManyAsync(addList).ConfigureAwait(true); + //await _repository.UpdateManyAsync(dict.Where(p => p.Value == EntityState.Modified).Select(p => p.Key)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData>(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; + } - //await _repository.InsertManyAsync(addList).ConfigureAwait(true); - //await _repository.UpdateManyAsync(dict.Where(p => p.Value == EntityState.Modified).Select(p => p.Key)).ConfigureAwait(false); - await PublishCreatedAsync(addList).ConfigureAwait(false); } } @@ -749,10 +765,12 @@ public abstract class SfsCrudWithDetailsAppServiceBase 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; if (entity == null) { diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs index ea9f3afa0..4623096c0 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs +++ b/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) { - return currentUser.FindClaimValue("name"); + return currentUser.Name; } public static string GetName(this ICurrentUser currentUser) diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs index 384b27d04..3fc0120be 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/Filters/FilterExtensions.cs +++ b/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.Linq; using System.Linq.Expressions; +using System.Reflection; using System.Text.Json; using Volo.Abp; @@ -204,6 +205,29 @@ public static class FilterExtensions { var parameterExpression = Expression.Parameter(typeof(T), "p"); Type lstType = typeof(List<>).MakeGenericType(propertyType); + + if (propertyType.IsEnum) + { + var valueArrayStrings = JsonSerializer.Deserialize>(filter.Value); + List newValues = new List(); + + 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); if (propertyValue != null) { diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Event/SfsCreatedEntityEventData.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Event/SfsCreatedEntityEventData.cs index 25d322ea1..ef4518f07 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Event/SfsCreatedEntityEventData.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Event/SfsCreatedEntityEventData.cs @@ -6,5 +6,6 @@ public class SfsCreatedEntityEventData : EntityEventData { public SfsCreatedEntityEventData(TEntity entity) : base(entity) { + } } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs index 0b7689bb8..34c89f1ab 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/ModuleBase.cs @@ -146,6 +146,7 @@ public abstract class ModuleBase : AbpModule where T : AbpModule using var sw = File.CreateText(Path.Combine(path, $"db.{dbContext.Database.ProviderName}.{contextName}.sql")); sw.Write(sql); Console.WriteLine($"{contextName} 初始化开始"); + Console.WriteLine($"ConnectionString:{dbContext.Database.GetConnectionString()}"); //创建数据库 if (!dbCreator.Exists()) { diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Win_in.Sfs.Shared.Host.csproj b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Win_in.Sfs.Shared.Host.csproj index e07d9d878..f2cc7176c 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Win_in.Sfs.Shared.Host.csproj +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/Win_in.Sfs.Shared.Host.csproj @@ -30,6 +30,7 @@ + diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs index 398f1d2ba..b1b084185 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteEditInput.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -23,4 +24,31 @@ public class TransferNoteEditInput : SfsStoreCreateOrUpdateInputBase [Display(Name = "确认时间")] public DateTime? ConfirmTime { get; set; } #endregion + + /// + /// 调拨申请单号 + /// + [Display(Name = "调拨申请单号")] + public string RequestNumber { get; set; } + + /// + /// 任务ID + /// + [Display(Name = "任务ID")] + public string JobNumber { get; set; } + + /// + /// 调拨类型 + /// + [Display(Name = "调拨类型")] + public string Type { get; set; } + + /// + /// 使用中间库 + /// + [Display(Name = "使用中间库")] + public bool UseOnTheWayLocation { get; set; } + + [Display(Name = "详情")] + public List Details { get; set; } = new List(); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs index 928fcb9ea..de6b8186e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs +++ b/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 DocumentFormat.OpenXml.Drawing; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -11,6 +13,9 @@ public class TransferNoteImportInput : SfsStoreImportInputBase /// [Display(Name = "调拨类型")] [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "调拨类型")] + [ExporterHeader(DisplayName = "调拨类型")] + [ValueMapping("区域内调拨(储位内移库)", EnumTransSubType.Transfer_Inside)] public string Type { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs index b9f6528a1..82b194b03 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/MaterialRequests/Inputs/MaterialRequestImportInput.cs @@ -25,7 +25,6 @@ public class MaterialRequestImportInput : SfsStoreImportInputBase /// [Display(Name = "目标库位")] [Required] - [Key] public string ToLocationCode { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs index b93a1b923..4c096c02d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs @@ -12,6 +12,9 @@ public class TransferRequestImportInput : SfsStoreImportInputBase /// [Display(Name = "调拨类型")] [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "调拨类型")] + [ExporterHeader(DisplayName = "调拨类型")] + [ValueMapping("客户库位调拨(客户储位调拨)", EnumTransSubType.Transfer_Customer)] public string Type { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs index b17634241..0f5f18085 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs @@ -17,9 +17,22 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() - .Ignore(x => x.MasterID) .Ignore(x => x.TenantId) .Ignore(x => x.Number) - .Ignore(x => x.Id); + .Ignore(x => x.Id) + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Id) + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Id) + ; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs index 8e4ceba11..11421503a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs @@ -19,7 +19,10 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.Number) - .Ignore(x => x.Details) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs index bc9465bde..43030955a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs +++ b/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.Id) .Ignore(x => x.JobNumber); + + CreateMap() + .IgnoreAuditedObjectProperties() + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index 63187fec3..43b0d71ae 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; - using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; 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.Shared; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -19,290 +18,279 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application; /// -/// 调拨转移记录 +/// 调拨转移记录 /// [Authorize] [Route($"{StoreConsts.RootPath}transfer-note")] - public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase - , + , ITransferNoteAppService { private readonly ITransferNoteManager _transferNoteManager; - private readonly ILocationCapacityAppService _locationCapacityAppService; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; public TransferNoteAppService( - ITransferNoteRepository repository - , ITransferNoteManager transferNoteManager - , ILocationCapacityAppService locationCapacityAppService - ) : base(repository) + ITransferNoteRepository repository, + ITransferNoteManager transferNoteManager, + IBalanceAppService balanceAppService, + ILocationAppService locationAppService) : base(repository) { _transferNoteManager = transferNoteManager; - _locationCapacityAppService = locationCapacityAppService; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; } - /// - /// 库存转移 - /// - /// - /// - [HttpPost("")] - public override async Task CreateAsync(TransferNoteEditInput input) - { - var entity = ObjectMapper.Map(input); - - await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(entity); - - return dto; - } + #region 东阳使用 /// - /// 【批量】 库存转移 + /// 用来重写 导入数据时可以加工数据 /// - /// + /// /// - [HttpPost("create-many")] - public async Task> CreateManyAsync(List input) + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) { - var entitys = ObjectMapper.Map, List>(input); + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); - var resultEntity = new List(); - - foreach (var entity in entitys) + foreach (var transferNote in addList) { - resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false)); - _ = ObjectMapper.Map(entity); + if (transferNote.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) //储位内调拨 + { + 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>(resultEntity); + return dictionary; } /// - /// 确认对应的记录单 - /// - /// - /// - - [HttpPost("confirm/{id}")] - - public virtual async Task ConfirmAsync(Guid id) - { - var entity = await _transferNoteManager.ConfirmAsync(id).ConfigureAwait(false); - var dto = ObjectMapper.Map(entity); - return dto; - - } - - /// - /// 按条件获取线边调拨的分页列表 - /// request sample - /// { - /// "maxResultCount": 1000, - /// "skipCount": 0, - /// "sorting": "", - /// "condition": { "filters": []} - /// } + /// 按条件获取线边调拨的分页列表 + /// request sample + /// { + /// "maxResultCount": 1000, + /// "skipCount": 0, + /// "sorting": "", + /// "condition": { "filters": []} + /// } /// /// /// /// /// [HttpPost("get-wip-list")] - public virtual async Task> GetWipTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, + public virtual async Task> GetWipTransferListAsync( + SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, 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); } /// - /// 按条件获取储位间调拨的分页列表 - /// request sample - /// { - /// "maxResultCount": 1000, - /// "skipCount": 0, - /// "sorting": "", - /// "condition": { "filters": []} - /// } + /// 按条件获取储位间调拨的分页列表 + /// request sample + /// { + /// "maxResultCount": 1000, + /// "skipCount": 0, + /// "sorting": "", + /// "condition": { "filters": []} + /// } /// /// /// /// /// [HttpPost("get-erp-loc-list")] - public virtual async Task> GetAreaTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, + public virtual async Task> GetAreaTransferListAsync( + SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, 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); } /// - /// 按条件获取储位间调拨的分页列表 - /// request sample - /// { - /// "maxResultCount": 1000, - /// "skipCount": 0, - /// "sorting": "", - /// "condition": { "filters": []} - /// } + /// 按条件获取储位内移库的分页列表 + /// request sample + /// { + /// "maxResultCount": 1000, + /// "skipCount": 0, + /// "sorting": "", + /// "condition": { "filters": []} + /// } /// /// /// /// /// [HttpPost("get-inside-list")] - public virtual async Task> GetInsideTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, + public virtual async Task> GetInsideTransferListAsync( + SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, 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); } /// - /// 按条件获取客户储位间调拨的分页列表 - /// request sample - /// { - /// "maxResultCount": 1000, - /// "skipCount": 0, - /// "sorting": "", - /// "condition": { "filters": []} - /// } + /// 按条件获取客户储位间调拨的分页列表 + /// request sample + /// { + /// "maxResultCount": 1000, + /// "skipCount": 0, + /// "sorting": "", + /// "condition": { "filters": []} + /// } /// /// /// /// /// [HttpPost("get-custom-loc-list")] - public virtual async Task> GetCustomerTransferListAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, + public virtual async Task> GetCustomerTransferListAsync( + SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, 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); } /// - /// 按条件获取储位间调拨的分页列表 - /// request sample - /// { - /// "maxResultCount": 1000, - /// "skipCount": 0, - /// "sorting": "", - /// "condition": { "filters": []} - /// } + /// 按条件获取储位间调拨的分页列表 + /// request sample + /// { + /// "maxResultCount": 1000, + /// "skipCount": 0, + /// "sorting": "", + /// "condition": { "filters": []} + /// } /// /// /// /// /// [HttpPost("get-diff-erp-loc-list")] - public virtual async Task> GetListForDiffERPLocAsync(SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, + public virtual async Task> GetListForDiffERPLocAsync( + SfsStoreRequestInputBase sfsRequestDTO, bool includeDetails = false, 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> GetSubTypeListAsync(SfsStoreRequestInputBase sfsRequestDTO, EnumTransSubType type, bool includeDetails = false, - CancellationToken cancellationToken = default) + private async Task> GetSubTypeListAsync(SfsStoreRequestInputBase sfsRequestDTO, + EnumTransSubType type, bool includeDetails = false, + 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(), }); - - Expression> expression = sfsRequestDTO.Condition.Filters?.Count > 0 + var expression = sfsRequestDTO.Condition.Filters?.Count > 0 ? sfsRequestDTO.Condition.Filters.ToLambda() : 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 entites, List deleteEntities) - { - await _transferNoteManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } + #endregion - protected override Func GetEntityExpression() - { - return p => (1); - } - - protected virtual async Task<(List entites, List deleteEntities)> BuildImportDataAsync(ImportResult importResult, EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false) + /// + /// 库存转移 + /// + /// + /// + [HttpPost("")] + public override async Task CreateAsync(TransferNoteEditInput input) { - if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - if (!isAllowPartImport) - { - return (null, null); - } - } + var entity = ObjectMapper.Map(input); - var entites = new List(); + entity=await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); - var details = new List(); + var dto = ObjectMapper.Map(entity); - var deleteEntites = new List(); + return dto; + } - var entityExpression = GetEntityExpression(); + /// + /// 【批量】 库存转移 + /// + /// + /// + [HttpPost("create-many")] + public async Task> CreateManyAsync(List input) + { + var entitys = ObjectMapper.Map, List>(input); - var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList(); + var resultEntity = new List(); - foreach (var group in groupList) + foreach (var entity in entitys) { - var input = group.FirstOrDefault(); - - var inputDetails = group.ToList(); - - if (inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - continue; - } - - var exist = await GetEntityAsync(input).ConfigureAwait(false); - - var entity = ObjectMapper.Map(input); - - await SetEntityPropertiesAsync(entity, input).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(inputDetail); - await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false); - entity.AddDetail(detail); - } - - entites.Add(entity); + resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false)); + _ = ObjectMapper.Map(entity); } - return (entites, deleteEntites); - } - - private static async Task SetDetailPropertiesAsync(TransferNoteDetail detail, TransferNoteImportInput input) - { - await Task.CompletedTask.ConfigureAwait(false); - + return ObjectMapper.Map, List>(resultEntity); } - private static async Task SetEntityPropertiesAsync(TransferNote entity, TransferNoteImportInput input) + /// + /// 确认对应的记录单 + /// + /// + /// + [HttpPost("confirm/{id}")] + public virtual async Task ConfirmAsync(Guid id) { - await Task.CompletedTask.ConfigureAwait(false); - - entity.UseOnTheWayLocation = false;//不需要中间库 - - entity.Confirmed = true;//自动确认 - + var entity = await _transferNoteManager.ConfirmAsync(id).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteMapperProfile.cs index 3509ad258..e2ba27294 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteMapperProfile.cs @@ -12,6 +12,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .ReverseMap(); + CreateMap() + .IgnoreAuditedObjectProperties() + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + ; + CreateMap(); CreateMap(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs index 18722dae2..6f80a9d45 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs @@ -21,9 +21,10 @@ namespace Win_in.Sfs.Wms.Store.Application; [Authorize] [Route($"{StoreConsts.RootPath}material-request")] - -public class MaterialRequestAppService : SfsStoreRequestAppServiceBase, - IMaterialRequestAppService +public class MaterialRequestAppService : SfsStoreRequestAppServiceBase, + IMaterialRequestAppService { private readonly IMaterialRequestManager _materialRequestManager; @@ -33,20 +34,65 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync( + Dictionary 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("")] //[Authorize(MaterialRequestPermissions.Create)] public override async Task CreateAsync(MaterialRequestEditInput input) @@ -85,7 +131,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase - /// 创建并且执行叫料请求 + /// 创建并且执行叫料请求 /// /// /// @@ -185,7 +231,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase - /// 根据备料计划生成 叫料请求 + /// 根据备料计划生成 叫料请求 /// /// [HttpPost("create-and-handle-by-preparation-plan/{number}")] @@ -193,10 +239,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase - /// 检验备料计划是否存在要料请求 + /// 检验备料计划是否存在要料请求 /// /// /// private async Task> 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; } /// - /// 根据类型获取叫料请求 + /// 根据类型获取叫料请求 /// /// /// @@ -250,7 +294,6 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase> expression = p => p.Type == type; if (requestInput.Condition.Filters?.Count > 0) { @@ -261,8 +304,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase validationRresult) + /// + /// 导入验证 + /// + /// + /// + /// + protected override async Task ValidateImportModelAsync(MaterialRequestImportInput model, + List validationRresult) { _ = new Dictionary(); _ = await CheckItemBasicAsync(model, validationRresult).ConfigureAwait(false); @@ -287,11 +336,14 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase ValidateImportEntities(Dictionary dict) { 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, "事务类型", "事务类型不存在"); @@ -301,84 +353,71 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase CheckItemBasicAsync(MaterialRequestImportInput importInput, List validationRresult) + protected async Task CheckItemBasicAsync(MaterialRequestImportInput importInput, + List validationRresult) { var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); if (item == null) { - validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new string[] { "物品代码" })); + validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" })); } else if (item.StdPackQty == 0) { - validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}的标准包装不存在", new string[] { "标准包装" })); + validationRresult.Add( + new ValidationResult($"物品代码{importInput.ItemCode}的物品信息中标准包装等于0或不存在", new[] { "标准包装" })); } + return item; } - protected async Task CheckLocationAsync(MaterialRequestImportInput importInput, List validationRresult) + protected async Task CheckLocationAsync(MaterialRequestImportInput importInput, + List validationRresult) { - var location = await LocationAclService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false); + var location = await _locationAppService.GetByCodeAsync(importInput.ToLocationCode).ConfigureAwait(false); if (location == null) { - validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new string[] { "目标库位" })); + validationRresult.Add(new ValidationResult($"目标库位{importInput.ToLocationCode}不存在", new[] { "目标库位" })); } + return location; } - protected async Task CheckAreaAsync(MaterialRequestImportInput importInput, List validationRresult) + protected async Task CheckAreaAsync(MaterialRequestImportInput importInput, + List validationRresult) { var area = await _areaApp.GetByCodeAsync(importInput.FromLocationArea).ConfigureAwait(false); 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 validationRresult) + protected async Task CheckStoreRelationAsync(MaterialRequestImportInput importInput, + List 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) { - 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 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); - - if (location != null) - { - detail.ToLocationErpCode = location.ErpLocationCode; - detail.ToWarehouseCode = location.WarehouseCode; - } - } - } - await base.SaveImportAsync(dict).ConfigureAwait(false); - } + #endregion #endregion + /// + /// 根据类型 获取叫料申请 + /// + /// + /// [HttpGet("list/by-type/{type}")] - public virtual async Task> GetListByTypeAsync(string type) { var entities = await _repository.GetListAsync(c => c.Type == type).ConfigureAwait(false); @@ -386,6 +425,5 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase, List>(entities); return dtos; - } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs index 7a713aa3a..c842b5b93 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs +++ b/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.Threading; using System.Threading.Tasks; - using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; 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.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -23,43 +25,102 @@ namespace Win_in.Sfs.Wms.Store.Application; [Authorize] [Route($"{StoreConsts.RootPath}transfer-request")] public class TransferRequestAppService : SfsStoreRequestAppServiceBase - , + , ITransferRequestAppService { private readonly ITransferRequestManager _transferRequestManager; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; public TransferRequestAppService( - ITransferRequestRepository repository - , ITransferRequestManager transferRequestManager - ) : base(repository, transferRequestManager) + ITransferRequestRepository repository, + ITransferRequestManager transferRequestManager, + IBalanceAppService balanceAppService, + ILocationAppService locationAppService) : base(repository, transferRequestManager) { _transferRequestManager = transferRequestManager; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; } + #region 东阳使用 + /// - /// 【创建】库移请求 + /// 用来重写 导入数据时可以加工数据 /// - /// + /// /// - [HttpPost("")] - public override async Task CreateAsync(TransferRequestEditInput input) + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) { - var entity = ObjectMapper.Map(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(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 _transferRequestManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(entity); - - return dto; } #region 查询相关 @@ -155,6 +216,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase return await GetListForOtherBaseAsync(sfsRequestDTO, EnumTransSubType.Transfer_WIP, includeDetails, cancellationToken).ConfigureAwait(false); } + /// /// 按条件获取分页列表 /// @@ -168,7 +230,9 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase CancellationToken cancellationToken = default) { 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 ? sfsRequestDTO.Condition.Filters.ToLambda() @@ -178,84 +242,36 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase sfsRequestDTO.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); } - #endregion 查询相关 + #endregion + + #endregion + /// + /// 【创建】库移请求 /// - /// - /// - /// + /// /// - protected virtual async Task<(List entites, List deleteEntities)> - BuildImportDataAsync(ImportResult importResult, - EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false) + [HttpPost("")] + public override async Task CreateAsync(TransferRequestEditInput input) { - if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - if (!isAllowPartImport) - { - return (null, null); - } - } - - var entites = new List(); - - var details = new List(); - - var deleteEntites = new List(); - - 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(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(inputDetail); + var entity = ObjectMapper.Map(input); - //detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); + var subType = Enum.Parse(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); - entity.AddDetail(detail); - } + await _transferRequestManager.CreateAsync(entity).ConfigureAwait(false); - entites.Add(entity); - } - } + var dto = ObjectMapper.Map(entity); - return (entites, deleteEntites); + return dto; } protected async Task CheckFromLocationAsync(string locationCode, List validationRresult) @@ -268,7 +284,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase } protected virtual async Task CheckImportInputBusinessAsync(TransferRequestImportInput importInput, - EnumImportMethod importMethod, List validationRresult) + EnumImportMethod importMethod, List validationRresult) { ChecktQty(importInput, validationRresult); await CheckItemBasicAsync(importInput, validationRresult).ConfigureAwait(false); @@ -277,13 +293,15 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase await CheckToLocationAsync(importInput.ToLocationCode, validationRresult).ConfigureAwait(false); } - protected async Task CheckItemBasicAsync(TransferRequestImportInput importInput, List validationRresult) + protected async Task CheckItemBasicAsync(TransferRequestImportInput importInput, + List validationRresult) { var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); if (item == null) { validationRresult.Add("物品代码", $"物品代码{importInput.ItemCode}不存在"); } + if (importInput.Qty <= 0) { validationRresult.Add("调整数量", $"调整数量{importInput.Qty}必须大于0"); @@ -302,103 +320,4 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase protected void ChecktQty(TransferRequestImportInput importInput, List validationRresult) { } - - /// - /// 导入汇总 - /// - /// - protected override Func GetEntityExpression() - { - return p => 1; - } - - protected virtual async Task ImportDataAsync(List entites, List 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; - } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs index 7f62cdaa6..9930d91b2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs +++ b/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.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Uow; using Volo.Abp.Users; using Volo.Abp.Validation; using Win_in.Sfs.Basedata.Application.Contracts; @@ -47,6 +48,7 @@ public class InspectJobManager : SfsJobManagerBase /// /// /// + [UnitOfWork] public override async Task CompleteAsync(InspectJob input, ICurrentUser user) { //执行任务 @@ -134,12 +136,22 @@ public class InspectJobManager : SfsJobManagerBase /// public async Task 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 itemQuality = await _itemQualityAclService.GetByItemCodeAsync(summaryDetailEntity.ItemCode, jobEntity.SupplierCode).ConfigureAwait(false); + var itemQuality = await _itemQualityAclService.GetByItemCodeAsync(summaryDetailEntity.ItemCode, jobEntity.SupplierCode); if (itemQuality.InspectType != EnumInspectType.Exempt) { //获取质检标准 @@ -150,6 +162,9 @@ public class InspectJobManager : SfsJobManagerBase await CheckCompleteSummaryDetailAsync(summaryDetailEntity, aql, input).ConfigureAwait(false); } + input.GoodQty = goodqty; + summaryDetailEntity.GoodQty = goodqty; + //构造 汇总详情 await BuildInspectJobSummaryDetailAsync(input, summaryDetailEntity).ConfigureAwait(false); @@ -174,7 +189,7 @@ public class InspectJobManager : SfsJobManagerBase #endregion - await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData(CopyJob),false).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData(CopyJob)).ConfigureAwait(false); return summaryDetailEntity; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs index a1ecf3d0a..b1cc3d1ce 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/TransferNotes/TransferNote.cs @@ -28,14 +28,13 @@ public class TransferNote : SfsStoreAggregateRootBase, IHasJ /// 调拨类型 /// [Display(Name = "调拨类型")] - [IgnoreUpdate] + [Required(ErrorMessage = "调拨类型不能为空")] public string Type { get; set; } /// /// 使用中间库 /// [Display(Name = "使用中间库")] - [IgnoreUpdate] public bool UseOnTheWayLocation { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs index 9bc2cfa77..22713c44a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs +++ b/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.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode)) .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) ; - CreateMap() + CreateMap< + IssueJobDetail, ExpectInEditInput>() .MapExpectInOutFrom() - .Ignore(x => x.LocationArea) - .Ignore(x => x.LocationGroup) - .Ignore(x => x.WarehouseCode) .Ignore(x => x.Worker) .Ignore(x => x.SerialNumber) .Ignore(x => x.ExtraProperties) @@ -59,9 +58,6 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .MapExpectInOutFrom() - .Ignore(x => x.LocationArea) - .Ignore(x => x.LocationGroup) - .Ignore(x => x.WarehouseCode) .Ignore(x => x.Worker) .Ignore(x => x.SerialNumber) .Ignore(x => x.ExtraProperties); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs index 32442195c..59a16066b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs +++ b/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 CreateMap() - .Ignore(x => x.ArriveDate) .Ignore(x => x.Status) .Ignore(x => x.RecommendToLocationCode) .Ignore(x => x.RecommendToLocationErpCode) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs index 61b396cdb..70d496dfa 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/IssueJobEventHandler.cs @@ -54,7 +54,11 @@ public class IssueJobEventHandler : var expectOuts = new List(); 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); } await ExpectOutAppService.AddManyAsync(expectOuts).ConfigureAwait(false); @@ -65,33 +69,25 @@ public class IssueJobEventHandler : var expectIns = new List(); 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); } await ExpectInAppService.AddManyAsync(expectIns).ConfigureAwait(false); } - private List BuildExpectInInventoryAsync(IssueJob issueJob) + private List BuildExpectInInventoryAsync(List balanceDto, string jobNumber) { - var inputs = ObjectMapper.Map, List>(issueJob.Details); - foreach (var input in inputs) - { - input.WarehouseCode = issueJob.WarehouseCode; - input.Worker = issueJob.Worker; - input.JobNumber = issueJob.Number; - } + var inputs = ObjectMapper.Map, List>(balanceDto); return inputs; } - private List BuildExpectOutInventoryAsync(IssueJob issueJob) + private List BuildExpectOutInventoryAsync(List balanceDto, string jobNumber) { - var inputs = ObjectMapper.Map, List>(issueJob.Details); - foreach (var input in inputs) - { - input.WarehouseCode = issueJob.WarehouseCode; - input.Worker = issueJob.Worker; - input.JobNumber = issueJob.Number; - } + var inputs = ObjectMapper.Map, List>(balanceDto); return inputs; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs index a4dea093e..3c1c4d7dd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs @@ -15,51 +15,74 @@ public class InspectJobEventHandler : , ILocalEventHandler> , ILocalEventHandler>> , ILocalEventHandler> -, ILocalEventHandler> + , ILocalEventHandler> { private readonly IInspectNoteAppService _inspectNoteAppService; public InspectJobEventHandler( IInspectNoteAppService inspectNoteAppService - ) + ) { _inspectNoteAppService = inspectNoteAppService; } + /// + /// 质检任务 完成后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { - var entity = eventData.Entity; - var inspectNote = BuildInspectNote(entity); - await _inspectNoteAppService.CreateAsync(inspectNote).ConfigureAwait(false); + //var entity = eventData.Entity; + + await Task.CompletedTask.ConfigureAwait(false); } /// - /// 创建 质检任务后 + /// 质检任务创建后 /// /// /// [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - var entity = eventData.Entity; - var inspectNote = BuildInspectNote(entity); - await _inspectNoteAppService.CreateAsync(inspectNote).ConfigureAwait(false); - //await CompleteExemptInspectJobAsync(new List { entity }); + var entities = eventData.Entity; + + foreach (var entity in entities) + { + await CreateInspectNoteAsync(entity).ConfigureAwait(false); + } } + /// + /// 创建 质检任务后 + /// + /// + /// [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - _ = eventData.Entity; + var entity = eventData.Entity; + await CreateInspectNoteAsync(entity).ConfigureAwait(false); + } - //await CompleteExemptInspectJobAsync(entities); - await Task.CompletedTask.ConfigureAwait(false); + #region 私有 + /// + /// 创建质检记录 + /// + /// + /// + private async Task CreateInspectNoteAsync(InspectJob entity) + { + var input = ObjectMapper.Map(entity); + await _inspectNoteAppService.CreateAsync(input).ConfigureAwait(false); + return input; } /// - /// 汇总 详情被修改后 + /// 汇总 详情被修改后 /// /// Event data [UnitOfWork] @@ -75,7 +98,8 @@ public class InspectJobEventHandler : { var noteCreateInput = new InspectNoteEditInput(); - var noteSummaryDetailInput = ObjectMapper.Map(jobSummaryDetail); + var noteSummaryDetailInput = + ObjectMapper.Map(jobSummaryDetail); noteCreateInput.SummaryDetails.Add(noteSummaryDetailInput); @@ -92,13 +116,54 @@ public class InspectJobEventHandler : } /// - /// 构造 质检记录 + /// 完成免检任务 /// - /// + /// /// - private InspectNoteEditInput BuildInspectNote(InspectJob entity) + private async Task CompleteExemptInspectJobAsync(List entities) { - var input = ObjectMapper.Map(entity); - return input; + foreach (var inspectJob in entities) + { + var summaryDetail = inspectJob.SummaryDetails.FirstOrDefault(); + //免检任务自动完成 并调用检验记录生成业务 + if (summaryDetail?.InspectType != EnumInspectType.Exempt) + { + await CompleteExemptInspectJobAsync(inspectJob, summaryDetail).ConfigureAwait(false); + } + } + } + + /// + /// 处理免检 物品 + /// + /// + /// + /// + 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 } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs index 152c231a4..d2b597995 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs +++ b/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.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using StackExchange.Redis; using Volo.Abp.EventBus; using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -15,147 +15,116 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessJob; public class IssueJobEventHandler : StoreEventHandlerBase - , ILocalEventHandler> - , ILocalEventHandler>> , ILocalEventHandler> { - private const string MaterialRequestPrefix = "MaterialRequest"; + private const EnumTransType TransType = EnumTransType.Issue; - private readonly IMaterialRequestManager _materialRequestManager; - private readonly IIssueNoteManager _issueNoteManager; - - public IssueJobEventHandler( - IIssueNoteManager issueNoteManager - , IMaterialRequestManager materialRequestManager - , IConfiguration configuration) + private readonly IIssueNoteAppService _issueNoteAppService; + private readonly ILocationAppService _locationAppService; + public IssueJobEventHandler(IIssueNoteAppService issueNoteAppService, ILocationAppService locationAppService) { - _issueNoteManager = issueNoteManager; - _materialRequestManager = materialRequestManager; - var redisConnectionString = configuration["Redis:Configuration"]; - var redisConnection = ConnectionMultiplexer.Connect(redisConnectionString); - RedisDB = redisConnection.GetDatabase(); - + _issueNoteAppService = issueNoteAppService; + _locationAppService = locationAppService; } - - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) - { - var entity = eventData.Entity; - var cacheKey = GetCacheKey(entity.MaterialRequestNumber); - var jobNumber = entity.Number; - await RedisDB.HashSetAsync(cacheKey, jobNumber, true).ConfigureAwait(false); - } - - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> 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] public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { 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); - await _issueNoteManager.CreateAsync(issueNote).ConfigureAwait(false); - + await _issueNoteAppService.CreateAsync(issueNote).ConfigureAwait(false); } + #region 私有 + /// - /// 创建补料记录实体 + /// 创建补料记录实体 /// /// /// - private async Task BuildIssueNoteAsync(IssueJob entity) + private async Task BuildIssueNoteAsync(IssueJob entity) { - var issueNote = ObjectMapper.Map(entity); - var locationCodes = issueNote.Details.Select(p => p.ToLocationCode).Distinct().ToList(); - var locations = await LocationAclService.GetByCodesAsync(locationCodes).ConfigureAwait(false); + var issueNoteCreateInput = ObjectMapper.Map(entity); + var locationCodes = issueNoteCreateInput.Details.Select(p => p.ToLocationCode).Distinct().ToList(); + 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); - 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.ToWarehouseCode = location.WarehouseCode; - detail.FromWarehouseCode = location.WarehouseCode; } - return issueNote; + return issueNoteCreateInput; } /// - /// 去除箱码 托码 批次 + /// 去除箱码 托码 批次 /// - private async Task RemovePackingCodeAndContainerCodeAndLot(IssueNoteDetail issueNoteDetail, EnumLocationType locationType) + private async Task RemovePackingCodeAndContainerCodeAndLotAsync(IssueNoteDetailInput issueNoteDetail, + EnumLocationType locationType) { switch (locationType) { case EnumLocationType.WIP: + { + //用开关控制 发料到线边后去除箱码和托码 ??? + if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode) + .ConfigureAwait(false)) + { + issueNoteDetail.ToPackingCode = ""; + } + + if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode) + .ConfigureAwait(false)) { - //用开关控制 发料到线边后去除箱码和托码 ??? - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemovePackingCode).ConfigureAwait(false)) - { - issueNoteDetail.ToPackingCode = ""; - } - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveContainerCode).ConfigureAwait(false)) - { - issueNoteDetail.ToContainerCode = ""; - } - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) - { - issueNoteDetail.ToLot = ""; - } - - break; + issueNoteDetail.ToContainerCode = ""; } + + if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToWip.IsRemoveLot).ConfigureAwait(false)) + { + issueNoteDetail.ToLot = ""; + } + + break; + } 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 = ""; - } - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode).ConfigureAwait(false)) - { - issueNoteDetail.ToContainerCode = ""; - } - if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) - { - issueNoteDetail.ToLot = ""; - } - - break; + issueNoteDetail.ToPackingCode = ""; } - } - } + if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveContainerCode) + .ConfigureAwait(false)) + { + issueNoteDetail.ToContainerCode = ""; + } - private static string GetCacheKey(string requestNumber) - { - return $"{StoreConsts.CachePrefix}:{MaterialRequestPrefix}:{requestNumber}"; + if (await SettingManager.IsTrueAsync(StoreSettings.Issue.ToSemi.IsRemoveLot).ConfigureAwait(false)) + { + issueNoteDetail.ToLot = ""; + } + + break; + } + } } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs index 2c42c9098..830bba2b0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs +++ b/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.Text; using System.Threading.Tasks; +using FluentValidation.Validators; using Volo.Abp; using Volo.Abp.EventBus; using Volo.Abp.SettingManagement; @@ -20,19 +21,61 @@ public class MaterialRequestEventHandler , ILocalEventHandler> , ILocalEventHandler> , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> { private readonly IIssueJobAppService _issueJobAppService; private readonly IProductionLineAppService _productionLineAppService; + private readonly IMaterialRequestManager _materialRequestManager; + private readonly ILocationAppService _locationAppService; public MaterialRequestEventHandler( IIssueJobAppService issueJobAppService , IProductionLineAppService productionLineAppService - ) + , IMaterialRequestManager materialRequestManager + , ILocationAppService locationAppService) { _issueJobAppService = issueJobAppService; _productionLineAppService = productionLineAppService; + _materialRequestManager = materialRequestManager; + _locationAppService = locationAppService; } + /// + /// 创建后 + /// + /// Event data + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + + if (entity.AutoSubmit) + { + await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 批量创建后 + /// + /// Event data + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + } + + /// + /// 执行后 + /// + /// + /// public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) { var entity = eventData.Entity; @@ -43,12 +86,22 @@ public class MaterialRequestEventHandler } } + /// + /// 驳回后 + /// + /// + /// public virtual async Task HandleEventAsync(SfsAbortedEntityEventData eventData) { var entity = eventData.Entity; await _issueJobAppService.CancelByMaterialRequestAsync(entity.Number).ConfigureAwait(false); } + /// + /// 完成后 + /// + /// + /// public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { _ = eventData.Entity; @@ -63,7 +116,7 @@ public class MaterialRequestEventHandler var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); 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)) { @@ -76,7 +129,7 @@ public class MaterialRequestEventHandler } 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); if (job == null || job.Details.Any(p => p.ToLocationCode != materialRequestDetail.ToLocationCode)) { @@ -170,10 +223,27 @@ public class MaterialRequestEventHandler var detail = ObjectMapper.Map(balance); detail.RequestLocationCode = materialRequestDetail.ToLocationCode; - detail.ToLocationCode = materialRequestDetail.ToLocationCode; - detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode; detail.WorkStation = materialRequestDetail.WorkStation; 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.DistributionType =//TODO //detail.TruncType = //TODO @@ -206,4 +276,5 @@ public class MaterialRequestEventHandler } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs index acc5b6388..b6f22120f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs @@ -70,7 +70,6 @@ public class PutawayRequestEventHandler /// private async Task BulidPutawayJobCreateInputAsync(PutawayRequest putawayRequest) { - await Task.CompletedTask.ConfigureAwait(false); var createInput = ObjectMapper.Map(putawayRequest); createInput.JobType = EnumJobType.PutawayJob; createInput.JobStatus = EnumJobStatus.Open; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs index 2e663dca0..2fefa0657 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs @@ -1,8 +1,12 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; using Volo.Abp.EventBus; +using Volo.Abp.EventBus.Local; using Volo.Abp.SettingManagement; using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Domain; @@ -12,18 +16,29 @@ namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; public class TransferRequestEventHandler : StoreEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> , ILocalEventHandler> + //, ILocalEventHandler> + //, ILocalEventHandler> + { private readonly ITransferNoteManager _transferNoteManager; + private readonly ILocationAppService _locationAppService; + private readonly ITransferRequestManager _transferRequestManager; + protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService(); public TransferRequestEventHandler( - ITransferNoteManager transferNoteManager) + ITransferNoteManager transferNoteManager, ILocationAppService locationAppService, ITransferRequestManager transferRequestManager) { _transferNoteManager = transferNoteManager; + _locationAppService = locationAppService; + _transferRequestManager = transferRequestManager; } + /// - /// 库存转移 审批通过 后 + /// 库存转移 审批通过 后 /// /// /// @@ -32,28 +47,29 @@ public class TransferRequestEventHandler public async Task HandleEventAsync(SfsHandledEntityEventData eventData) { var entity = eventData.Entity; - EnumTransSubType enumTransSubType = Enum.Parse(entity.Type); + var enumTransSubType = Enum.Parse(entity.Type); if (entity.DirectCreateNote) { var input = ObjectMapper.Map(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); - } switch (enumTransSubType) { case EnumTransSubType.Transfer_Inside: case EnumTransSubType.Transfer_Area: - break; case EnumTransSubType.Transfer_Warehouse: case EnumTransSubType.Transfer_Customer: @@ -63,4 +79,67 @@ public class TransferRequestEventHandler break; } } + + /// + /// 库移创建后 + /// + /// Event data + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + if (entity.AutoSubmit) + { + await _transferRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 库移批量创建后 + /// + /// Event data + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _transferRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + } + + ///// + ///// 提交后 + ///// + ///// Event data + //[UnitOfWork] + //public virtual async Task HandleEventAsync(SfsSubmittedEntityEventData eventData) + //{ + // var entity = eventData.Entity; + // if (entity.AutoAgree) + // { + // entity.Agree(); + // await LocalEventBus.PublishAsync(new SfsAgreedEntityEventData(entity), false) + // .ConfigureAwait(false); + // } + //} + + ///// + ///// 审批后 + ///// + ///// Event data + //[UnitOfWork] + //public virtual async Task HandleEventAsync(SfsAgreedEntityEventData eventData) + //{ + // var entity = eventData.Entity; + // if (entity.AutoHandle) + // { + // entity.Handle(); + // await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false) + // .ConfigureAwait(false); + // } + //} } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs index c16c3cc10..a55d73a54 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs @@ -57,6 +57,8 @@ public class InspectNoteEventHandler FromContainerCode = detail.ContainerCode, FromLocationCode = detail.LocationCode, FromLocationErpCode = detail.LocationErpCode, + FromLocationArea = detail.LocationArea, + FromLocationGroup = detail.LocationGroup, FromLot = detail.Lot, FromPackingCode = detail.PackingCode, FromStatus = EnumInventoryStatus.INSP, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs index 47c5787d6..891d194c9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs @@ -303,6 +303,8 @@ public class PurchaseReceiptNoteEventHandler createInput.Details.ForEach(p => { + p.LocationGroup = inspectLocation.LocationGroupCode; + p.LocationArea = inspectLocation.AreaCode; p.LocationCode = inspectLocation.Code; p.LocationErpCode = inspectLocation.ErpLocationCode; p.WarehouseCode = inspectLocation.WarehouseCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs index 581325a77..4e451144d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs +++ b/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 Volo.Abp.EventBus; using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -16,13 +17,16 @@ public class TransferNoteEventHandler : StoreInventoryEventHandlerBase , ILocalEventHandler> , ILocalEventHandler> + , ILocalEventHandler>> { 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; } /// @@ -43,6 +47,25 @@ public class TransferNoteEventHandler await AddTransferLogsAsync(inputList).ConfigureAwait(false); } + /// + /// 批量创建 后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> 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); + } + } + /// /// 确认 后 /// @@ -63,7 +86,7 @@ public class TransferNoteEventHandler transferLogs.AddRange(inputList); - await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); } @@ -81,40 +104,47 @@ public class TransferNoteEventHandler { var transferLog = ObjectMapper.Map(detail); - if (note.UseOnTheWayLocation) + var fromLocation = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocation = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var transferOnTheWay = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + + switch (route) { - var fromLocation = await LocationAclService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); - var toLocation = await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - var transferOnTheWay = await LocationAclService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); - - switch (route) - { - case EnumTransferRoute.SourceToOnTheWay: - transferLog.FromLocationCode = fromLocation.Code; - transferLog.FromLocationArea = fromLocation.AreaCode; - transferLog.FromLocationErpCode = fromLocation.ErpLocationCode; - transferLog.FromLocationGroup = fromLocation.LocationGroupCode; - - transferLog.ToLocationCode = transferOnTheWay.Code; - transferLog.ToLocationArea = transferOnTheWay.AreaCode; - transferLog.ToLocationErpCode = transferOnTheWay.ErpLocationCode; - transferLog.ToLocationGroup = transferOnTheWay.LocationGroupCode; - break; - case EnumTransferRoute.OnTheWayToDestination: - transferLog.FromLocationCode = transferOnTheWay.Code; - transferLog.FromLocationArea = transferOnTheWay.AreaCode; - transferLog.FromLocationErpCode = transferOnTheWay.ErpLocationCode; - transferLog.FromLocationGroup = transferOnTheWay.LocationGroupCode; - - transferLog.ToLocationCode = toLocation.Code; - transferLog.ToLocationArea = toLocation.AreaCode; - transferLog.ToLocationErpCode = toLocation.ErpLocationCode; - transferLog.ToLocationGroup = toLocation.LocationGroupCode; - break; - case EnumTransferRoute.SourceToDestination: - default: - throw new ArgumentOutOfRangeException(nameof(route), route, null); - } + case EnumTransferRoute.SourceToOnTheWay: + transferLog.FromLocationCode = fromLocation.Code; + transferLog.FromLocationArea = fromLocation.AreaCode; + transferLog.FromLocationErpCode = fromLocation.ErpLocationCode; + transferLog.FromLocationGroup = fromLocation.LocationGroupCode; + + transferLog.ToLocationCode = transferOnTheWay.Code; + transferLog.ToLocationArea = transferOnTheWay.AreaCode; + transferLog.ToLocationErpCode = transferOnTheWay.ErpLocationCode; + transferLog.ToLocationGroup = transferOnTheWay.LocationGroupCode; + break; + case EnumTransferRoute.OnTheWayToDestination: + transferLog.FromLocationCode = transferOnTheWay.Code; + transferLog.FromLocationArea = transferOnTheWay.AreaCode; + transferLog.FromLocationErpCode = transferOnTheWay.ErpLocationCode; + transferLog.FromLocationGroup = transferOnTheWay.LocationGroupCode; + + transferLog.ToLocationCode = toLocation.Code; + transferLog.ToLocationArea = toLocation.AreaCode; + transferLog.ToLocationErpCode = toLocation.ErpLocationCode; + transferLog.ToLocationGroup = toLocation.LocationGroupCode; + break; + 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: + throw new ArgumentOutOfRangeException(nameof(route), route, null); } transferLog.TransType = TransType; diff --git a/build/src/docker/publish/conf/settings/appsettings.Development.json b/build/src/docker/publish/conf/settings/appsettings.Development.json index 30b0a75ba..d7703852e 100644 --- a/build/src/docker/publish/conf/settings/appsettings.Development.json +++ b/build/src/docker/publish/conf/settings/appsettings.Development.json @@ -1,5 +1,5 @@ { - "AlwaysAllowAuthorization": "False", + "AlwaysAllowAuthorization": "True", "App": { "CorsOrigins": [ "http://localhost:59080", @@ -110,31 +110,31 @@ }, "RemoteServices": { "Auth": { - "BaseUrl": "http://localhost:21293/" + "BaseUrl": "http://dev.ccwin-in.com:21293/" }, "BaseData": { - "BaseUrl": "http://localhost:21294/" + "BaseUrl": "http://dev.ccwin-in.com:21294/" }, "Default": { - "BaseUrl": "http://localhost:21293/" + "BaseUrl": "http://dev.ccwin-in.com:21293/" }, "FileStorage": { - "BaseUrl": "http://localhost:21292/" + "BaseUrl": "http://dev.ccwin-in.com:21292/" }, "Inventory": { - "BaseUrl": "http://localhost:59095/" + "BaseUrl": "http://dev.ccwin-in.com:21295/" }, "Job": { - "BaseUrl": "http://localhost:59095/" + "BaseUrl": "http://dev.ccwin-in.com:21295/" }, "Label": { - "BaseUrl": "http://localhost:21292/" + "BaseUrl": "http://dev.ccwin-in.com:21292/" }, "Message": { - "BaseUrl": "http://localhost:21292/" + "BaseUrl": "http://dev.ccwin-in.com:21292/" }, "Store": { - "BaseUrl": "http://localhost:59095/" + "BaseUrl": "http://dev.ccwin-in.com:21295/" } }, "Serilog": { diff --git a/build/src/docker/publish/conf/settings/appsettings.json b/build/src/docker/publish/conf/settings/appsettings.json index 315fb9b4b..8ad836316 100644 --- a/build/src/docker/publish/conf/settings/appsettings.json +++ b/build/src/docker/publish/conf/settings/appsettings.json @@ -48,7 +48,7 @@ //ids4的建权服务端配置 "AuthServer": { "Audience": "Auth", - "Authority": "http://dev.ccwin-in.com:21293/", + "Authority": "http://localhost:59093", "ClientId": "Auth_App", "ClientSecret": "1q2w3E*", "RequireHttpsMetadata": "false", @@ -106,7 +106,7 @@ "BaseUrl": "http://dev.ccwin-in.com:59094/" }, "Default": { - "BaseUrl": "http://dev.ccwin-in.com:59093" + "BaseUrl": "http://dev.ccwin-in.com:59093/" }, "FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:59092/" diff --git a/build/src/win-x64/publish/TaskKill.exe b/build/src/win-x64/publish/TaskKill.exe new file mode 100644 index 000000000..806031c5d Binary files /dev/null and b/build/src/win-x64/publish/TaskKill.exe differ diff --git a/build/src/win-x64/publish/stop.cmd.example b/build/src/win-x64/publish/stop.cmd.example index 6d38da8f6..6bbdb1e3f 100644 --- a/build/src/win-x64/publish/stop.cmd.example +++ b/build/src/win-x64/publish/stop.cmd.example @@ -1,3 +1,4 @@ @ECHO OFF -taskkill /im supervisord.exe /f /t \ No newline at end of file +taskkill /im supervisord.exe /f /t +TaskKill.exe \ No newline at end of file