diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 000000000..8d5c24c89 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\WZC2.sln", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/Backflu.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/Backflu.cs new file mode 100644 index 000000000..ef57f4aff --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/Backflu.cs @@ -0,0 +1,58 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Domain.Entities; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; +public class Backflu : Entity +{ + + /// + /// MES写入时间 + /// + public string scmout_dt_w { get; set; } + /// + /// 单据类型 + /// + public string scmout_type { get; set; } + /// + /// TYRP单号 + /// + [Key] + public string scmout_nbr { get; set; } + /// + /// 料号 + /// + public string scmout_part { get; set; } + /// + /// 追加码/预定交货日/序号/储位 + /// + public string scmout_no { get; set; } + /// + /// TYRP异动储位 + /// + public string scmout_loc { get; set; } + /// + /// 库存交易年月 + /// + public string scmout_ym { get; set; } + /// + /// 库存交易日 + /// + public string scmout_date { get; set; } + /// + /// 数量 + /// + public decimal scmout_qty { get; set; } + /// + /// 调入储位 + /// + public string scmout_in_loc { get; set; } + /// + /// 有效码 + /// + public string scmout_stat { get; set; } + + public override object[] GetKeys() + { + return new object[] { scmout_nbr }; + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/BackfluManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/BackfluManager.cs new file mode 100644 index 000000000..aa2e1a195 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/BackfluManager.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; +public class BackfluManager : DomainService, IBackfluManager +{ + private readonly IBackfluRepository _repository; + public BackfluManager(IBackfluRepository repository) + { + _repository = repository; + } + public async Task> GetToBeProcessedListAsync() + { + var Backflu = await _repository.GetListAsync().ConfigureAwait(false); + + return Backflu.ToList(); + } + public virtual async Task UpdateProcessedListAsync(List entities) + { + foreach (var entitie in entities) + { + entitie.scmout_stat = "N"; + await _repository.UpdateAsync(entitie).ConfigureAwait(false); + } + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/IBackfluManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/IBackfluManager.cs new file mode 100644 index 000000000..d87b62978 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/IBackfluManager.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; +public interface IBackfluManager : IDomainService +{ + Task> GetToBeProcessedListAsync(); + Task UpdateProcessedListAsync(List entities); +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/IBackfluRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/IBackfluRepository.cs new file mode 100644 index 000000000..26f50aeb3 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/Backflus/IBackfluRepository.cs @@ -0,0 +1,7 @@ +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; +public interface IBackfluRepository : IRepository +{ + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/PullTask/PullTask.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/PullTask/PullTask.cs index a00d40b80..0fc592abd 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/PullTask/PullTask.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/PullTask/PullTask.cs @@ -19,7 +19,7 @@ public class PullTask : Entity /// /// 数量 /// - public decimal Planqty { get; set; } + public string Planqty { get; set; } /// /// 单号 /// diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/BackfluManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/BackfluManager.cs index fbdaa8e1d..d25f37ee5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/BackfluManager.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/BackfluManager.cs @@ -19,5 +19,12 @@ public class BackfluManager : DomainService, IBackfluManager return Backflu.ToList(); } - + public virtual async Task UpdateProcessedListAsync(List entities) + { + foreach (var entitie in entities) + { + entitie.scmout_stat = "N"; + await _repository.UpdateAsync(entitie).ConfigureAwait(false); + } + } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/IBackfluManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/IBackfluManager.cs index c7face679..6de3f20b1 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/IBackfluManager.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp/Backflus/IBackfluManager.cs @@ -7,5 +7,5 @@ namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; public interface IBackfluManager : IDomainService { Task> GetToBeProcessedListAsync(); - //Task UpdateProcessedListAsync(List entities); + Task UpdateProcessedListAsync(List entities); } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..46b15138e --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusDbContextModelCreatingExtensions.cs @@ -0,0 +1,31 @@ + +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public static class BackfluDbContextModelCreatingExtensions +{ + public static void ConfigureBackflu(this ModelBuilder builder, MesModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema Name + b.ToTable(options.TablePrefix + "scmout", options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + b.Property(q => q.scmout_dt_w).HasMaxLength(20); + b.Property(q => q.scmout_type).HasMaxLength(6); + b.Property(q => q.scmout_nbr).HasMaxLength(12); + b.Property(q => q.scmout_part).HasMaxLength(20); + b.Property(q => q.scmout_no).HasMaxLength(10); + b.Property(q => q.scmout_loc).HasMaxLength(10); + b.Property(q => q.scmout_ym).HasMaxLength(6); + b.Property(q => q.scmout_date).HasMaxLength(8); + b.Property(q => q.scmout_qty).HasPrecision(10, 2); + b.Property(q => q.scmout_in_loc).HasMaxLength(10); + b.Property(q => q.scmout_stat).HasMaxLength(1); + }); + + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusEfCoreRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusEfCoreRepository.cs new file mode 100644 index 000000000..b0b452778 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/Backflus/BackflusEfCoreRepository.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; + +namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes; +public class BackfluEfCoreRepository : EfCoreRepository, IBackfluRepository +{ + public BackfluEfCoreRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs index d9a084b20..3d5d56d79 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs @@ -26,6 +26,6 @@ public static class DataExchangeDbContextModelCreatingExtensions builder.ConfigurePullTask(options); builder.ConfigureScrap(options); builder.ConfigurePck(options); - + builder.ConfigureBackflu(options); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs index 13459e207..ea5d271be 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs @@ -31,5 +31,6 @@ public class DataExchangeEntityFrameworkCoreFawtygModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs index 10caffc24..60810373f 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs @@ -19,4 +19,5 @@ public interface IMesDbContext : IEfCoreDbContext DbSet MesOuts { get; } DbSet PullTasks { get; } + DbSet Backflu { get; } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs index f99c3cac6..775047674 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs @@ -20,6 +20,7 @@ public class MesDbContext : public virtual DbSet PullTasks { get; } public virtual DbSet Issue { get; } + public virtual DbSet Backflu { get; } public MesDbContext(DbContextOptions options) : base(options) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/PullTask/PullTaskDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/PullTask/PullTaskDbContextModelCreatingExtensions.cs index 0c955f22e..77c9c9330 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/PullTask/PullTaskDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/PullTask/PullTaskDbContextModelCreatingExtensions.cs @@ -20,7 +20,7 @@ public static class PullTaskDbContextModelCreatingExtensions b.Property(q => q.no).HasMaxLength(255); b.Property(q => q.Itemno).HasMaxLength(255); b.Property(q => q.Plant).HasMaxLength(255); - b.Property(q => q.Planqty).HasPrecision(18, 2); + b.Property(q => q.Planqty).HasMaxLength(255); b.Property(q => q.Yl1); }); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs new file mode 100644 index 000000000..87a025842 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluConverter.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Wms.DataExchange.Domain; +using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; + +public class BackFluConverter : IIncomingConverter +{ + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly IIncomingToWmsManager _incomingToWmsManager; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly IObjectMapper _objectMapper; + private readonly ILogger _logger; + public BackFluConverter( + IIncomingToWmsManager incomingToWmsManager, + IItemBasicAppService itemBasicAppService, + IObjectMapper objectMapper, + ILogger logger +, + IIncomingFromExternalManager incomingFromExternalManager + +) + { + _incomingToWmsManager = incomingToWmsManager; + _itemBasicAppService = itemBasicAppService; + _objectMapper = objectMapper; + _logger = logger; + _incomingFromExternalManager = incomingFromExternalManager; + } + public virtual async Task ConvertAsync(List incomingFromExternalList) + { + if (!incomingFromExternalList.Any()) + { + _logger.LogInformation("no backflus"); + return; + } + var incomingToWmsDataList = await BuildIncomingToWmsOfPurchaseOrderAsync(incomingFromExternalList).ConfigureAwait(false); + await _incomingToWmsManager.CreateManyAsync(incomingToWmsDataList).ConfigureAwait(false); + //归档 + await _incomingFromExternalManager.ArchiveBulkAsync(incomingFromExternalList).ConfigureAwait(false); + + } + + private async Task> BuildIncomingToWmsOfPurchaseOrderAsync(List incomingDataList) + { + await Task.CompletedTask.ConfigureAwait(false); + var incomingToWmsList = new List(); + var groups = incomingDataList.GroupBy(p => p.SourceDataGroupCode); + foreach (var group in groups) + { + var first = group.First(); + var incomingToWms = new IncomingToWms() + { + DataType = first.DataType, + DataAction = first.DataAction, + SourceSystem = first.SourceSystem, + DataIdentityCode = first.SourceDataGroupCode, + }; + incomingToWms.SetEffectiveDate(first.EffectiveDate); + var exchangeBack = JsonSerializer.Deserialize(first.DestinationDataContent); + var wmsBack = _objectMapper.Map(exchangeBack); + wmsBack.Details = new List(); + foreach (var incomingFromExternal in group.ToList()) + { + var back = JsonSerializer.Deserialize(incomingFromExternal.DestinationDataContent); + var wmsBackDetail = _objectMapper.Map(back.Detail); + + wmsBack.Details.Add(wmsBackDetail); + } + incomingToWms.DataContent = JsonSerializer.Serialize(wmsBack); + incomingToWmsList.Add(incomingToWms); + } + return incomingToWmsList; + } + +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluReader.cs new file mode 100644 index 000000000..f479fed59 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/BackFluReader.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using Win_in.Sfs.Wms.DataExchange.Domain; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; + +using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; + +public class BackFluReader : IReader +{ + private readonly IBackfluManager _ibackfluManager; + private readonly IIncomingFromExternalManager _incomingFromExternalManager; + private readonly ILogger _logger; + private readonly IConfiguration _configuration; + public BackFluReader( + IBackfluManager ibackfuManager + , IIncomingFromExternalManager incomingFromExternalManager + , ILogger logger + , IConfiguration configuration + ) + { + _ibackfluManager = ibackfuManager; + _incomingFromExternalManager = incomingFromExternalManager; + _logger = logger; + _configuration = configuration; + } + public virtual async Task> ReadAsync() + { + //从Tyrp读取待处理bom + var BackFull = await _ibackfluManager.GetToBeProcessedListAsync().ConfigureAwait(false); + var toBeProcessedBack = BackFull.Where(p => p.scmout_stat == "Y").ToList(); + if (!toBeProcessedBack.Any()) + { + _logger.LogInformation("no backflus"); + return new List(); + } + //bom逐一转换为bomNote + var incomingDataList = BuildIncomingFromExternalFromBomAsync(toBeProcessedBack); + await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); + await _ibackfluManager.UpdateProcessedListAsync(toBeProcessedBack).ConfigureAwait(false); + return incomingDataList; + } + private List BuildIncomingFromExternalFromBomAsync(List toBeProcessedIssue) + { + var incomingDataList = new List(); + foreach (var backflu in toBeProcessedIssue) + { + var incomingData = BuildIncomingFromExternal(backflu); + + incomingData.SetEffectiveDate(DateTime.Now); + + try + { + var bm = BuildScrapNoteOrderExchangeMes(backflu); + incomingData.DestinationDataContent = JsonSerializer.Serialize(backflu); + } + catch (Exception ex) + { + incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString()); + } + + incomingDataList.Add(incomingData); + + } + return incomingDataList; + } + private IncomingFromExternal BuildIncomingFromExternal(Backflu backflu) + { + var incomingData = new IncomingFromExternal() + { + DataType = EnumIncomingDataType.BackFlush.ToString(), + DataAction = EnumExchangeDataAction.Add, + SourceSystem = EnumSystemType.ERP.ToString(), + SourceDataId = backflu.scmout_type, + SourceDataGroupCode = backflu.scmout_nbr, + SourceDataDetailCode = backflu.scmout_part, + SourceDataContent = JsonSerializer.Serialize(backflu), + WriteTime = DateTime.Now, + Writer = nameof(MesIncomingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + }; + return incomingData; + } + + private static BackFlushNoteExchangeDto BuildScrapNoteOrderExchangeMes(Backflu backflu) + { + + var back = new BackFlushNoteExchangeDto() + { + + ActiveDate = Convert.ToDateTime(backflu.scmout_dt_w.Substring(0, 4) + "-" + backflu.scmout_dt_w.Substring(4, 2) + "-" + backflu.scmout_dt_w.Substring(6, 2)), + ItemCode = backflu.scmout_part, + Number = backflu.scmout_nbr + }; + var bakcdetail = new BackFlushNoteDetailExchangeDto() + { + Number = backflu.scmout_nbr, + ItemCode = backflu.scmout_part, + Qty = backflu.scmout_qty, + LocationErpCode = backflu.scmout_loc + }; + back.Detail = bakcdetail; + return back; + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs index 558588868..750af9290 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs @@ -34,21 +34,21 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase Logger.LogInformation($"{Incoming} is not active!"); return; } - Logger.LogInformation($"Read MesOut");//缴库 - var mesOutReader = workerContext.ServiceProvider.GetRequiredService(); - var mesOutConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保存MesOut - var mesOutsFromExternalList = await mesOutReader.ReadAsync().ConfigureAwait(false); - //转换MesOut - await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false); + //Logger.LogInformation($"Read MesOut");//缴库 + //var mesOutReader = workerContext.ServiceProvider.GetRequiredService(); + //var mesOutConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保存MesOut + //var mesOutsFromExternalList = await mesOutReader.ReadAsync().ConfigureAwait(false); + ////转换MesOut + //await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false); - Logger.LogInformation($"Read PullTask");//拉动任务 - var pullTaskReader = workerContext.ServiceProvider.GetRequiredService(); - var pullTaskConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保存PullTask - var pullTaskFromExternalList = await pullTaskReader.ReadAsync().ConfigureAwait(false); - //转换PullTask - await pullTaskConverter.ConvertAsync(pullTaskFromExternalList).ConfigureAwait(false); + //Logger.LogInformation($"Read PullTask");//拉动任务 + //var pullTaskReader = workerContext.ServiceProvider.GetRequiredService(); + //var pullTaskConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保存PullTask + //var pullTaskFromExternalList = await pullTaskReader.ReadAsync().ConfigureAwait(false); + ////转换PullTask + //await pullTaskConverter.ConvertAsync(pullTaskFromExternalList).ConfigureAwait(false); Logger.LogInformation($"Read Scrap"); var scrapReader = workerContext.ServiceProvider.GetRequiredService(); @@ -58,14 +58,21 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase //转换Scrap await scrapConverter.ConvertAsync(scrapsFromExternalList).ConfigureAwait(false); - Logger.LogInformation($"Read Issue"); - var pckHandleService = workerContext.ServiceProvider.GetRequiredService(); - var pckConverter = workerContext.ServiceProvider.GetRequiredService(); - //读取并保持Pck - var pcksFromExternalList = await pckHandleService.ReadAsync().ConfigureAwait(false); - //转换Pck - await pckConverter.ConvertAsync(pcksFromExternalList).ConfigureAwait(false); + //Logger.LogInformation($"Read Issue"); + //var pckHandleService = workerContext.ServiceProvider.GetRequiredService(); + //var pckConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保持Pck + //var pcksFromExternalList = await pckHandleService.ReadAsync().ConfigureAwait(false); + ////转换Pck + //await pckConverter.ConvertAsync(pcksFromExternalList).ConfigureAwait(false); + //Logger.LogInformation($"Read BackFlush");//耗用单 + //var BackFlushReader = workerContext.ServiceProvider.GetRequiredService(); + //var BackFlushConverter = workerContext.ServiceProvider.GetRequiredService(); + ////读取并保存Customer + //var backFlushsFromExternalList = await BackFlushReader.ReadAsync().ConfigureAwait(false); + ////转换Customer + //await BackFlushConverter.ConvertAsync(backFlushsFromExternalList).ConfigureAwait(false); Logger.LogInformation($"Completed: Handling {Incoming}"); } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs index ea92dcf1d..097550573 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs @@ -5,6 +5,7 @@ using System.Text.Json; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using Org.BouncyCastle.Asn1.Pkcs; using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -77,6 +78,7 @@ public class MesOutConverter : IIncomingConverter wmsProductReceiptNote.WorkShop = "";//车间 wmsProductReceiptNote.Worker = _configuration["Authentication:username"];//操作人 wmsProductReceiptNote.ReceiptType = EnumReceiptType.MesScanReceipt;//完工收货方式 + wmsProductReceiptNote.WarehouseCode = ""; wmsProductReceiptNote.Details = new List(); foreach (var incomingFromExternal in group.ToList()) @@ -86,20 +88,24 @@ public class MesOutConverter : IIncomingConverter wmsProductReceiptNoteDetail.Lot = ""; //排序批次 wmsProductReceiptNoteDetail.PackingCode = "";//箱标签 wmsProductReceiptNoteDetail.Status = EnumInventoryStatus.OK; + wmsProductReceiptNoteDetail.WarehouseCode = ""; + wmsProductReceiptNoteDetail.LocationArea = ""; + wmsProductReceiptNoteDetail.LocationGroup = ""; var loc = await _locationAppService.GetListByTypesAndErpCodeAsync(types, wmsProductReceiptNoteDetail.LocationErpCode).ConfigureAwait(false); if (loc != null) { wmsProductReceiptNoteDetail.LocationCode = loc[0].Code; } -; try + try { var item = await _itemBasicAppService.GetByCodeAsync(wmsProductReceiptNoteDetail.ItemCode).ConfigureAwait(false); if (item != null) { wmsProductReceiptNoteDetail.ItemName = item.Name; - wmsProductReceiptNoteDetail.ItemDesc1 = item.Desc1; - wmsProductReceiptNoteDetail.ItemDesc2 = item.Desc2; - wmsProductReceiptNoteDetail.Uom = item.BasicUom; + wmsProductReceiptNoteDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsProductReceiptNoteDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsProductReceiptNoteDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; + } } catch (Exception) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskConverter.cs index 9c452e010..06d94bf12 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskConverter.cs @@ -11,6 +11,7 @@ using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest; using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming; @@ -77,16 +78,16 @@ public class PullTaskConverter : IIncomingConverter foreach (var incomingFromExternal in group.ToList()) { var materialRequest = JsonSerializer.Deserialize(incomingFromExternal.DestinationDataContent); - var wmsMaterialRequestDetail = _objectMapper.Map(materialRequest.Detail); + var wmsMaterialRequestDetail = _objectMapper.Map(materialRequest.Detail); var item = await _itemBasicAppService.GetByCodeAsync(wmsMaterialRequestDetail.ItemCode).ConfigureAwait(false); try { if (item != null) { wmsMaterialRequestDetail.ItemName = item.Name; - wmsMaterialRequestDetail.ItemDesc1 = item.Desc1; - wmsMaterialRequestDetail.ItemDesc2 = item.Desc2; - wmsMaterialRequestDetail.Uom = item.BasicUom; + wmsMaterialRequestDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsMaterialRequestDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsMaterialRequestDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; } } catch (Exception) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskReader.cs index 1faa0b6f8..5996e66ef 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/PullTaskReader.cs @@ -29,6 +29,7 @@ public class PullTaskReader : IReader } public virtual async Task> ReadAsync() + { //从MES读取待处理PullTask var toBeProcessedPillTasks = await _pullTaskManager.GetToBeProcessedListAsync().ConfigureAwait(false); @@ -101,7 +102,7 @@ public class PullTaskReader : IReader var materialRequestDetail = new MaterialRequestDetailExchangeDto() { ItemCode = pullTask.Itemno, - Qty = pullTask.Planqty, + Qty = decimal.Parse(pullTask.Planqty), ToLocationCode = pullTask.Plant, }; diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs index 11d70263a..4a096d624 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs @@ -85,15 +85,17 @@ public class ScrapConverter : IIncomingConverter wmsScrapDetail.FromPackingCode = ""; wmsScrapDetail.FromLot = ""; wmsScrapDetail.FromWarehouseCode = ""; - wmsScrapDetail.ToWarehouseCode = ""; - wmsScrapDetail.Uom = ""; + wmsScrapDetail.ToWarehouseCode = ""; wmsScrapDetail.FromStatus = EnumInventoryStatus.OK; - var item = await _itemBasicAppService.GetByCodeAsync(wmsScrapDetail.ItemCode).ConfigureAwait(false); + wmsScrapDetail.FromLocationArea = ""; + wmsScrapDetail.ToLocationGroup = ""; + var item = await _itemBasicAppService.GetByCodeAsync(wmsScrapDetail.ItemCode).ConfigureAwait(false); if (item != null) { - wmsScrapDetail.ItemName = item.Name; - wmsScrapDetail.ItemDesc1 = item.Desc1; - wmsScrapDetail.ItemDesc2 = item.Desc2; + wmsScrapDetail.ItemName = item.Name; + wmsScrapDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : ""; + wmsScrapDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : ""; + wmsScrapDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : ""; } wmsScarp.Details.Add(wmsScrapDetail); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapReader.cs index 2112becd3..f01b1ab02 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapReader.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes; using Win_in.Sfs.Wms.DataExchange.Domain.Shared; @@ -95,8 +96,8 @@ public class ScrapReader : IReader var crap = new ScrapNoteExchangeDto() { Worker = scrap.mesout_asd_user, - ActiveDate = DateTime.ParseExact(scrap.Mesout_asd_date, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) - + ActiveDate = DateTime.ParseExact(scrap.Mesout_asd_date, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), + Type = EnumTransSubType.Scrap_WIP.ToString() }; var crapDetail = new ScrapNoteDetailExchangeDto() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/MesAgentModule.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/MesAgentModule.cs index 388c48ee8..2a845ffc5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/MesAgentModule.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/MesAgentModule.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Polly; using Volo.Abp; +using Volo.Abp.Account; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.BackgroundJobs; @@ -39,7 +40,8 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent; typeof(DataExchangeDomainModule), typeof(DataExchangeEntityFrameworkCoreModule), typeof(DataExchangeDomainFawtygMesModule), - typeof(DataExchangeEntityFrameworkCoreFawtygModule) + typeof(DataExchangeEntityFrameworkCoreFawtygModule), + typeof(AbpAccountApplicationContractsModule) )] public class MesAgentModule : AbpModule { @@ -153,13 +155,13 @@ public class MesAgentModule : AbpModule typeof(LabelApplicationContractsModule).Assembly, "Label" ); - } - - public override async Task OnApplicationInitializationAsync( - ApplicationInitializationContext context) + } + public override void OnApplicationInitialization( + ApplicationInitializationContext context) { - await context.AddBackgroundWorkerAsync().ConfigureAwait(false); - await context.AddBackgroundWorkerAsync().ConfigureAwait(false); - } + context.AddBackgroundWorkerAsync(); + //context.AddBackgroundWorkerAsync(); + } } + diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.csproj b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.csproj index 464b89db6..3637b0414 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.csproj +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.csproj @@ -11,6 +11,7 @@ + @@ -27,6 +28,7 @@ + diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json index 72ca5624c..2ea101bee 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/appsettings.json @@ -1,12 +1,12 @@ { "ConnectionStrings": { - "Default": "Server=dev.ccwin-in.com,13319;Database=DyWmsAuth;uid=ccwin-in;pwd=Microsoft@2022;", - "DataExchange": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;", - "MES": "Server=dev.ccwin-in.com;Port=13306;Database=MES;Uid=ccwinin;Pwd=Microsoft@2022;" + "Default": "Server=dev.ccwin-in.com,21195;Database= WMS;uid=sa;pwd=aA123456!;TrustServerCertificate=True;", + "DataExchange": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;TrustServerCertificate=True;", + "MES": "Server=10.164.1.12;Port=3306;Database=erp;Uid=wms;Pwd=123456;" }, "AuthServer": { - "Authority": "http://dev.ccwin-in.com:59093/", + "Authority": "http://dev.ccwin-in.com:21293/", "RequireHttpsMetadata": "false", "SwaggerClientId": "admin", "SwaggerClientSecret": "1q2w3E*", @@ -24,13 +24,13 @@ "RemoteServices": { "BaseData": { - "BaseUrl": "http://dev.ccwin-in.com:59094/" + "BaseUrl": "http://dev.ccwin-in.com:21294/" }, "Store": { - "BaseUrl": "http://dev.ccwin-in.com:59095/" + "BaseUrl": "http://dev.ccwin-in.com:21295/" }, "Label": { - "BaseUrl": "http://dev.ccwin-in.com:59092/" + "BaseUrl": "http://dev.ccwin-in.com:21292/" } }, "MesOptions": { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/BackFluReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/BackFluReader.cs index 933f3328b..a8676a368 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/BackFluReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/BackFluReader.cs @@ -43,7 +43,7 @@ public class BackFluReader : IReader //bom逐一转换为bomNote var incomingDataList = BuildIncomingFromExternalFromBomAsync(toBeProcessedBack); await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false); - //await _ibackfluManager.UpdateProcessedListAsync(toBeProcessedBack); + await _ibackfluManager.UpdateProcessedListAsync(toBeProcessedBack).ConfigureAwait(false); return incomingDataList; } private List BuildIncomingFromExternalFromBomAsync(List toBeProcessedIssue) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs index e489620b7..a50d73ebf 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs @@ -49,7 +49,7 @@ public class ItemBasicConverter : IIncomingConverter var materialRequestList = await BuildIncomingToWmsOfItemBasicRequestAsync(incomingFromExternalList).ConfigureAwait(false); await _incomingToWmsManager.CreateBulkAsync(materialRequestList).ConfigureAwait(false); //归档 - await _incomingFromExternalManager.ArchiveBulkAsync(incomingFromExternalList); + await _incomingFromExternalManager.ArchiveBulkAsync(incomingFromExternalList).ConfigureAwait(false); } private async Task> BuildIncomingToWmsOfItemBasicRequestAsync(List incomingDataList) diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs new file mode 100644 index 000000000..8e25bb6a7 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ItemTransformNoteConverter.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading.Tasks; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Auth.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.Domain; +using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Tyrp; +using Win_in.Sfs.Wms.DataExchange.Domain.Shared; +using Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; + + public class ItemTransformNoteConverter : IOutgoingConverter + { + private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; + private readonly IOutgoingToExternalManager _outgoingToExternalManager; + private readonly ISupplierAsnAppService _supplierAsnAppService; + private readonly IDepartmentAppService _departmentAppService; + private readonly IObjectMapper _objectMapper; + + public ItemTransformNoteConverter( + IOutgoingFromWmsManager outgoingFromWmsManager + , IOutgoingToExternalManager outgoingToExternalManager + , ISupplierAsnAppService supplierAsnAppService + , IDepartmentAppService departmentAppService + , IObjectMapper objectMapper + ) + { + _outgoingFromWmsManager = outgoingFromWmsManager; + _outgoingToExternalManager = outgoingToExternalManager; + _supplierAsnAppService = supplierAsnAppService; + _departmentAppService = departmentAppService; + _objectMapper = objectMapper; + } + + public virtual async Task> ConvertAsync() + { + var outgoingToExternalList = new List(); + var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.Item_Transform, EnumSystemType.ERP).ConfigureAwait(false); + foreach (var outgoingFromWms in outgoingFromWmsList) + { + var wmsCountAdjust = JsonSerializer.Deserialize(outgoingFromWms.DataContent); + if (Enum.Parse(wmsCountAdjust.Type) == EnumTransSubType.Item_Transform) + { + var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false); + var departmentCode = department == null ? "" : department.Code; + var details = wmsCountAdjust.Details.GroupBy(r => new { r.ItemCode, r.ToItemCode, r.LocationErpCode, r.ToLocationCode }).Select(p => new ItemTransformNoteDetailExchangeDto { ToQty = p.Sum(itm => itm.ToQty), FromQty = p.Sum(itm => itm.FromQty), ItemCode = p.Key.ItemCode, ToItemCode = p.Key.ToItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) }); + foreach (var detail in details) + { + List ItemTransform = new List(); + ItemTransformNoteDetailExchangeDto ItemTrans = new ItemTransformNoteDetailExchangeDto(); + ItemTrans.ItemCode = detail.ItemCode; + ItemTrans.LocationErpCode = detail.LocationErpCode; + ItemTrans.FromQty = detail.FromQty - detail.FromQty - detail.FromQty; + ItemTrans.ReasonCode = detail.ReasonCode; + ItemTransform.Add(ItemTrans); + ItemTransformNoteDetailExchangeDto ItemTranss = new ItemTransformNoteDetailExchangeDto(); + ItemTranss.ItemCode = detail.ToItemCode; + ItemTranss.LocationErpCode = detail.LocationErpCode; + ItemTranss.FromQty = detail.ToQty; + ItemTranss.ReasonCode = detail.ReasonCode; + ItemTransform.Add(ItemTranss); + foreach (var Item in ItemTransform) + { + var outgoingToExternal = new OutgoingToExternal() + { + DataType = outgoingFromWms.DataType, + DataAction = outgoingFromWms.DataAction, + SourceSystem = EnumSystemType.WMS.ToString(), + SourceDataId = wmsCountAdjust.Number, + SourceDataGroupCode = wmsCountAdjust.Number, + SourceDataDetailCode = Item.ItemCode, + Writer = nameof(TyrpOutgoingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + DestinationDataId = "", + }; + outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); + var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, Item).ConfigureAwait(false); + outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue); + var arrive = BuildIssue(exchangeIssue, departmentCode); + outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); + + outgoingToExternalList.Add(outgoingToExternal); + } + + } + } + } + await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); ; + //将outgoingFromWms数据归档 + await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); ; + return outgoingToExternalList; + //插入到中间表OutgoingToExternal + } + + private CountAdjust BuildIssue(ItemTransformNoteExchangeDto exchangeCountAdjust, string departmentCode) + { + var detail = exchangeCountAdjust.Detail; + string asdtype = ""; + if (Enum.Parse(exchangeCountAdjust.Type) == EnumTransSubType.Item_Transform) + { + asdtype = "4003"; + } + var counta = new CountAdjust() + { + mesout_asd_refc = departmentCode, + mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + mesout_asd_type = asdtype, + mesout_asd_part = detail.ItemCode, + mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"), + mesout_asd_loc = detail.LocationErpCode, + mesout_asd_code = detail.ReasonCode, + mesout_asd_qty = detail.FromQty, + mesout_asd_user = exchangeCountAdjust.Worker, + mesout_asd_k = string.Empty, + mesout_asd_stat = "Y" + + }; + + + return counta; + + } + + private async Task BuildPurchaseReceiptExchangeDtoAsync( + ItemTransformNoteDTO wmsCountAdjust, ItemTransformNoteDetailExchangeDto wmsCountAdjustDetail) + { + + var exchangeCountAdjust = _objectMapper.Map(wmsCountAdjust); + + exchangeCountAdjust.Detail = wmsCountAdjustDetail; + return exchangeCountAdjust; + } + } + diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs index 0344a59ed..52ca1123a 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TyrpOutgoingBackgroundWorker.cs @@ -120,6 +120,10 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false); await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false); + Logger.LogInformation($"Write ItemTransformNote");//回收料调整单 + var ItemTransformNoteConvert = workerContext.ServiceProvider.GetRequiredService(); + var ItemTransformNoteList = await ItemTransformNoteConvert.ConvertAsync().ConfigureAwait(false); + await countadjustWriter.WriteAsync(ItemTransformNoteList).ConfigureAwait(false); Logger.LogInformation($"Completed: Handling {Outgoing}"); } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj index bdec28966..f7135a83a 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.csproj @@ -31,6 +31,7 @@ + diff --git a/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs b/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs index 085cf9304..441352764 100644 --- a/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs +++ b/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs @@ -22,7 +22,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad; [ApiExplorerSettings(GroupName = SwaggerGroupConsts.WmsWebApi)] public class PurchaseOrderAppService : ApplicationService, IPurchaseOrderAppService { - private readonly Store.Application.Contracts.IPurchaseOrderAppService _purchaseOrderAppService; + //private readonly Store.Application.Contracts.IPurchaseOrderAppService _purchaseOrderAppService; private readonly IPo_mstrRepository _po_mstrRepository; @@ -34,7 +34,7 @@ public class PurchaseOrderAppService : ApplicationService, IPurchaseOrderAppServ IConfiguration configuration ) { - _purchaseOrderAppService = purchaseOrderAppService; + //_purchaseOrderAppService = purchaseOrderAppService; _po_mstrRepository = po_mstrRepository; _configuration = configuration; } @@ -77,7 +77,7 @@ public class PurchaseOrderAppService : ApplicationService, IPurchaseOrderAppServ targetObj.ContactEmail = ""; #endregion - await _purchaseOrderAppService.UpsertAsync(targetObj).ConfigureAwait(false); + //await _purchaseOrderAppService.UpsertAsync(targetObj).ConfigureAwait(false); } catch (Exception ex) { diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs index de009e0fb..3b5a3402e 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs @@ -149,7 +149,7 @@ public class AgentModule : AbpModule public override void OnApplicationInitialization( ApplicationInitializationContext context) { - // context.AddBackgroundWorkerAsync(); - context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); + //context.AddBackgroundWorkerAsync(); } } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs index 907622f56..9dafc2553 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs @@ -79,64 +79,64 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase switch (dataType) { case EnumIncomingDataType.Department: - await incomingToWms.HandleDepartmentsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleDepartmentsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.User: - await incomingToWms.HandleUsersAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleUsersAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Item: - await incomingToWms.HandleItemsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleItemsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Location: await incomingToWms.HandleErpLocationsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Bom: - await incomingToWms.HandleBomsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleBomsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Dict: await incomingToWms.HandleDictsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Supplier: - await incomingToWms.HandleSuppliersAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleSuppliersAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.SupplierItem: - await incomingToWms.HandleSupplierItemsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleSupplierItemsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.ItemPack: - await incomingToWms.HandleItemPacksAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleItemPacksAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Customer: - await incomingToWms.HandleCustomersAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleCustomersAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.CustomerItem: - await incomingToWms.HandleCustomerItemsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleCustomerItemsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.InterfaceCalendar: - await incomingToWms.HandleInterfaceCalendarsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleInterfaceCalendarsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.PurchaseOrder: - await incomingToWms.HandlePurchaseOrdersAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandlePurchaseOrdersAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.SaleOrder: - await incomingToWms.HandleSaleOrdersAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleSaleOrdersAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.SupplierAsn: - await incomingToWms.HandleAsnsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleAsnsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.ProductReceipt: - await incomingToWms.HandleProductReceiptsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleProductReceiptsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.MaterialRequest: await incomingToWms.HandleMaterialRequestsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.Scrap: - await incomingToWms.HandleScrapsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleScrapsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.IssueConfirm: - await incomingToWms.HandleIssueNoteConfirmAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleIssueNoteConfirmAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.PurchaseLabel: - await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false); + //await incomingToWms.HandleInventoryLabelsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.BackFlush: await incomingToWms.HandleBackFlushsAsync(workerContext).ConfigureAwait(false); diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs index 1378228d0..c5d859310 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumOutgoingDataType.cs @@ -30,6 +30,7 @@ public enum EnumOutgoingDataType RecycledMaterialReceipt = 22, Scrap = 23, ProductRecycle = 24, + Item_Transform = 25 } public enum EnumExchangeTableType { diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs index 939f02642..be8a7352b 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/AsnTimeWindowController.cs @@ -8,6 +8,7 @@ using Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers; +using System.Diagnostics.Metrics; using System.Linq; using Win_in.Sfs.Basedata.Application.Contracts; @@ -29,28 +30,28 @@ public class AsnTimeWindowController : AbpController [HttpGet("asn-time-window")] public virtual async Task> GetAsnTimeWindowsAsync() { - return await GetAsnTimeWindowDashboardsAsync().ConfigureAwait(false); + return await GetAsnTimeWindowDashboardsAsync(); } private async Task> GetAsnTimeWindowDashboardsAsync() { - var supplierAsns = await GetSupplierAsnsAsync().ConfigureAwait(false); + var supplierAsns = await this.GetSupplierAsnsAsync(); var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct(); - var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false); + var suppliers = await GetSuppliersAsync(supplierCodes); var asnNumbers = supplierAsns.Select(t => t.Number); - var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers).ConfigureAwait(false); + var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers); - return ConvertToAsnTimeWindowDashboards( + return this.ConvertToAsnTimeWindowDashboards( supplierAsns, suppliers, purchaseReceiptNotes); } - private static List ConvertToAsnTimeWindowDashboards( + private List ConvertToAsnTimeWindowDashboards( List supplierAsns, List suppliers, List purchaseReceiptNotes) @@ -70,16 +71,12 @@ public class AsnTimeWindowController : AbpController var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode); if (supplier == null) - { continue; - } supplierShortName = supplier.ShortName; if (dtos.Exists(t => t.TimeSpan == timeSpan && t.SupplierShortName == supplierShortName)) - { continue; - } var purchaseReceiptNote = purchaseReceiptNotes.FirstOrDefault(t => t.AsnNumber == supplierAsn.Number); @@ -111,17 +108,26 @@ public class AsnTimeWindowController : AbpController endTime.AddDays(-1); } - return await _supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime).ConfigureAwait(false); + return await this._supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime); } private async Task> GetSuppliersAsync(IEnumerable codes) { - return await _supplierApp.GetByCodesAsync(codes).ConfigureAwait(false); + return await this._supplierApp.GetByCodesAsync(codes); } private async Task> GetPurchaseReceiptNotesAsync(IEnumerable asnNumbers) { - return await _purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false); + return await this._purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers); } + /// + /// + /// + /// + [HttpGet("get-server-date-time")] + public virtual async Task GetServerDate() + { + return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } } diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs index c3ff248e8..3e1eea770 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/MaterialRequestController.cs @@ -2,151 +2,156 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc; +using Win_in.Sfs.Label.Application.Contracts; using Win_in.Sfs.Wms.Dashboard.Host.Models; -namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers; - -using System.Linq; - -using NUglify.Helpers; +namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers +{ + using System.Linq; -using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Store.Application.Contracts; + using NUglify.Helpers; -[ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}material-request")] + using Win_in.Sfs.Shared.Domain.Shared; + using Win_in.Sfs.Wms.Inventory.Application.Contracts; + using Win_in.Sfs.Wms.Store.Application.Contracts; + using static IdentityServer4.Models.IdentityResources; -public class MaterialRequestController : AbpController -{ - private readonly IMaterialRequestAppService _materialRequestApp; + [ApiController] + [Route($"{PdaHostConst.ROOT_ROUTE}material-request")] - private readonly IIssueNoteAppService _issueNoteApp; - public MaterialRequestController(IMaterialRequestAppService materialRequestApp, IIssueNoteAppService issueNoteApp) + public class MaterialRequestController : AbpController { - _materialRequestApp = materialRequestApp; - _issueNoteApp = issueNoteApp; - } + private readonly IMaterialRequestAppService _materialRequestApp; - [HttpGet("un-handled-order-sum")] - public virtual async Task GetUnHandledOrderSumAsync() - { - var dto = new MaterialRequestUnHandledOrderSumDto(); + private readonly IIssueNoteAppService _issueNoteApp; + public MaterialRequestController(IMaterialRequestAppService materialRequestApp, IIssueNoteAppService issueNoteApp) + { + _materialRequestApp = materialRequestApp; + _issueNoteApp = issueNoteApp; + } - var list = await GetMaterialRequestAsync().ConfigureAwait(false); + [HttpGet("un-handled-order-sum")] + public virtual async Task GetUnHandledOrderSumAsync() + { + var dto = new MaterialRequestUnHandledOrderSumDto(); - dto.Sum = list.Where(t => t.RequestStatus == EnumRequestStatus.New).Count(); + var list = await GetMaterialRequestAsync(); - return dto; - } + dto.Sum = list.Where(t => t.RequestStatus == EnumRequestStatus.New).Count(); - [HttpGet("un-issued-item-qty-sum")] - public virtual async Task GetUnIssuedItemQtySumAsync() - { - var dto = new MaterialRequestUnIssuedItemQtySumDto(); + return dto; + } - var list = await GetMaterialRequestAsync().ConfigureAwait(false); + [HttpGet("un-issued-item-qty-sum")] + public virtual async Task GetUnIssuedItemQtySumAsync() + { + var dto = new MaterialRequestUnIssuedItemQtySumDto(); - dto.Sum = list.Where(t => t.RequestStatus != EnumRequestStatus.New) - .Sum(t => t.Details.Sum(t1 => t1.Qty - t1.IssuedQty)); + var list = await GetMaterialRequestAsync(); - return dto; - } + dto.Sum = list.Where(t => t.RequestStatus != EnumRequestStatus.New) + .Sum(t => t.Details.Sum(t1 => t1.Qty - t1.IssuedQty)); - [HttpGet("un-received-item-qty-by-item-list")] - public virtual async Task> - GetUnIssuedItemQtySumByItemListAsync() - { - var dtos = new List(); + return dto; + } - var list = await GetMaterialRequestAsync().ConfigureAwait(false); + [HttpGet("un-received-item-qty-by-item-list")] + public virtual async Task> + GetUnIssuedItemQtySumByItemListAsync() + { + var dtos = new List(); + + var list = await GetMaterialRequestAsync(); - var details = new List(); + var details = new List(); - list.Where(t => t.RequestStatus != EnumRequestStatus.New).ForEach( - item => + list.Where(t => t.RequestStatus != EnumRequestStatus.New).ForEach( + item => { item.Details.ForEach( detail => + { + if (detail.IssuedQty - detail.ReceivedQty > 0) { - if (detail.IssuedQty - detail.ReceivedQty > 0) - { - details.Add(detail); - } - }); + details.Add(detail); + } + }); }); - dtos = details.GroupBy(t => t.ItemCode).Select( - item => new MaterialRequestUnReceivedItemQtyByItemDto() - { - ItemCode = item.Key, - Sum = item.Sum(t => t.IssuedQty - t.ReceivedQty) - }).ToList(); + dtos = details.GroupBy(t => t.ItemCode).Select( + item => new MaterialRequestUnReceivedItemQtyByItemDto() + { + ItemCode = item.Key, + Sum = item.Sum(t => t.IssuedQty - t.ReceivedQty) + }).ToList(); - return dtos; - } + return dtos; + } - [HttpGet("item-qty-by-received-status-list")] - public virtual async Task> GetItemQtyByReceivedStatusListAsync() - { - var dtos = new List(); + [HttpGet("item-qty-by-received-status-list")] + public virtual async Task> GetItemQtyByReceivedStatusListAsync() + { + var dtos = new List(); - var ToBeIssuedQty = 0.0M; + var ToBeIssuedQty = 0.0M; - var ToBeReceivedQty = 0.0M; + var ToBeReceivedQty = 0.0M; - var Received = 0.0M; + var Received = 0.0M; - var list = await GetMaterialRequestAsync().ConfigureAwait(false); + var list = await GetMaterialRequestAsync(); - list.ForEach( - item => + list.ForEach( + item => { ToBeIssuedQty += item.Details.Sum(t => t.ToBeIssuedQty); ToBeReceivedQty += item.Details.Sum(t => t.ToBeReceivedQty); Received += item.Details.Sum(t => t.ReceivedQty); }); - dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求未发", Sum = ToBeIssuedQty }); - dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "已发未收", Sum = ToBeReceivedQty }); - dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求已收", Sum = Received }); - - return dtos; - } - [HttpGet("un-received-item-list")] - public virtual async Task> GetUnReceivedItemListAsync() - { - var dtos = new List(); + dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求未发", Sum = ToBeIssuedQty }); + dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "已发未收", Sum = ToBeReceivedQty }); + dtos.Add(new MaterialRequestItemQtyByReceivedStatusDto() { ReceivedStatus = "请求已收", Sum = Received }); - var notes = await GetIssueNotesAsync().ConfigureAwait(false); + return dtos; + } - foreach (var note in notes) + [HttpGet("un-received-item-list")] + public virtual async Task> GetUnReceivedItemListAsync() { - foreach (var noteDetail in note.Details) + var dtos = new List(); + + var notes = await this.GetIssueNotesAsync(); + + foreach (var note in notes) { - var dto = new MaterialRequestUnReceivedItemDto(); + foreach (var noteDetail in note.Details) + { + var dto = new MaterialRequestUnReceivedItemDto(); - dto.Number = note.RequestNumber; - dto.ItemCode = noteDetail.ItemCode; - dto.ItemDesc1 = noteDetail.ItemDesc1; - dto.PackingCode = noteDetail.FromPackingCode; - dto.IssuedQty = noteDetail.Qty; - dto.IssuedTime = note.ActiveDate; + dto.Number = note.RequestNumber; + dto.ItemCode = noteDetail.ItemCode; + dto.ItemDesc1 = noteDetail.ItemDesc1; + dto.PackingCode = noteDetail.FromPackingCode; + dto.IssuedQty = noteDetail.Qty; + dto.IssuedTime = note.ActiveDate; - dtos.Add(dto); + dtos.Add(dto); + } } - } - return dtos; - } + return dtos; + } - private async Task> GetIssueNotesAsync() - { - return await _issueNoteApp.GetListUnConfirmedByTypeAsync(EnumTransSubType.Issue_WIP.ToString()).ConfigureAwait(false); - } + private async Task> GetIssueNotesAsync() + { + return await this._issueNoteApp.GetListUnConfirmedByTypeAsync(EnumTransSubType.Issue_WIP.ToString()); + } - private async Task> GetMaterialRequestAsync() - { - return await _materialRequestApp.GetListByTypeAsync(EnumTransSubType.Issue_WIP.ToString()).ConfigureAwait(false); + private async Task> GetMaterialRequestAsync() + { + return await this._materialRequestApp.GetListByTypeAsync(EnumTransSubType.Issue_WIP.ToString()); + } } } 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 0dc46b18f..d54bb4b54 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 @@ -1,174 +1,194 @@ -using System; 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; +using System; +using System.Linq; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Store.Application.Contracts; -namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers; - -[ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}plan-and-actual")] - -public class PlanAndActualController : AbpController +namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers { - private readonly ISupplierAsnAppService _supplierAsnApp; - private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteApp; - private readonly IPutawayNoteAppService _putawayNoteApp; - private readonly ISupplierAppService _supplierApp; - private readonly IItemSafetyStockAppService _itemSafetyStockApp; - public PlanAndActualController(ISupplierAsnAppService supplierAsnApp, IPurchaseReceiptNoteAppService purchaseReceiptNoteApp, IPutawayNoteAppService putawayNoteApp, ISupplierAppService supplierApp, IItemSafetyStockAppService itemSafetyStockApp) - { - _supplierAsnApp = supplierAsnApp; - _purchaseReceiptNoteApp = purchaseReceiptNoteApp; - _putawayNoteApp = putawayNoteApp; - _supplierApp = supplierApp; - _itemSafetyStockApp = itemSafetyStockApp; - } + [ApiController] + [Route($"{PdaHostConst.ROOT_ROUTE}plan-and-actual")] - [HttpGet("plan-actual-list")] - public virtual async Task> GetPlanAndActualListAsync() + public class PlanAndActualController : AbpController { - return await GetPlanAndActualDashboardsAsync().ConfigureAwait(false); - } + private readonly ISupplierAsnAppService _supplierAsnApp; + private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteApp; + private readonly IPutawayNoteAppService _putawayNoteApp; + private readonly ISupplierAppService _supplierApp; + private readonly IItemSafetyStockAppService _itemSafetyStockApp; + private readonly IPurchaseOrderAppService _purchaseOrderApp; + private readonly IPurchaseReceiptJobAppService _purchaseReceiptJobApp; + + public PlanAndActualController(ISupplierAsnAppService supplierAsnApp, IPurchaseReceiptNoteAppService purchaseReceiptNoteApp, IPutawayNoteAppService putawayNoteApp, ISupplierAppService supplierApp, IItemSafetyStockAppService itemSafetyStockApp, IPurchaseOrderAppService purchaseOrderApp, IPurchaseReceiptJobAppService purchaseReceiptJobApp) + { + _supplierAsnApp = supplierAsnApp; + _purchaseReceiptNoteApp = purchaseReceiptNoteApp; + _putawayNoteApp = putawayNoteApp; + _supplierApp = supplierApp; + _itemSafetyStockApp = itemSafetyStockApp; + _purchaseOrderApp = purchaseOrderApp; + _purchaseReceiptJobApp = purchaseReceiptJobApp; + } - private async Task> GetPlanAndActualDashboardsAsync() - { - var supplierAsns = await GetSupplierAsnsAsync().ConfigureAwait(false); - var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct(); + [HttpGet("plan-actual-list")] + public virtual async Task> GetPlanAndActualListAsync() + { + return await GetPlanAndActualDashboardsAsync(); + } - var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false); + private async Task> GetPlanAndActualDashboardsAsync() + { + var supplierAsns = await this.GetSupplierAsnsAsync(); - var asnNumbers = supplierAsns.Select(t => t.Number); + var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct(); - var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers).ConfigureAwait(false); + var suppliers = await GetSuppliersAsync(supplierCodes); - var putawayNotes = await GetPutawayNotesAsync(asnNumbers).ConfigureAwait(false); + var asnNumbers = supplierAsns.Select(t => t.Number); - var itemSafetyStorks = await GetItemSafetyStocksAsync(supplierAsns).ConfigureAwait(false); + var purchaseReceiptNotes = await GetPurchaseReceiptNotesAsync(asnNumbers); - return ConvertToPlanAndActualDashboards( - supplierAsns, - suppliers, - purchaseReceiptNotes, - putawayNotes, - itemSafetyStorks); - } + var putawayNotes = await this.GetPutawayNotesAsync(asnNumbers); - private static List ConvertToPlanAndActualDashboards(List supplierAsns, List suppliers, List purchaseReceiptNotes, List putawayNotes, List itemSafetyStorks) - { - var dtos = new List(); + var itemSafetyStorks = await this.GetItemSafetyStocksAsync(supplierAsns); + + return await this.ConvertToPlanAndActualDashboards( + supplierAsns, + suppliers, + purchaseReceiptNotes, + putawayNotes, + itemSafetyStorks); + } - foreach (var supplierAsn in supplierAsns) + private async Task> ConvertToPlanAndActualDashboards(List supplierAsns, List suppliers, List purchaseReceiptNotes, List putawayNotes, List itemSafetyStorks) { - var purchaseReceipts = purchaseReceiptNotes.FindAll(t => t.AsnNumber == supplierAsn.Number); - var putaways = putawayNotes.FindAll(t => t.AsnNumber == supplierAsn.Number); + var dtos = new List(); - var supplierShortName = string.Empty; + foreach (var supplierAsn in supplierAsns) + { + var purchaseReceipts = purchaseReceiptNotes.FindAll(t => t.AsnNumber == supplierAsn.Number); + var putaways = putawayNotes.FindAll(t => t.AsnNumber == supplierAsn.Number); - var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode); + var supplierShortName = string.Empty; - if (supplier == null) - { - continue; - } + var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode); - supplierShortName = supplier.ShortName; + if (supplier == null) + continue; - foreach (var detail in supplierAsn.Details) - { - var dto = dtos.FirstOrDefault(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode); + supplierShortName = supplier.ShortName; - if (dto == null) + foreach (var detail in supplierAsn.Details) { - dto = new PlanAndActualDashboardDto(); + var dto = dtos.FirstOrDefault(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode); - dto.SupplierShortName = supplierShortName; - dto.ItemCode = detail.ItemCode; - dto.ItemDesc1 = detail.ItemDesc1; - dto.ItemName = detail.ItemName; + if (dto == null) + { + dto = new PlanAndActualDashboardDto(); - var itemSafetyStork = itemSafetyStorks.FirstOrDefault(t => t.ItemCode == detail.ItemCode); + dto.SupplierShortName = supplierShortName; + dto.ItemCode = detail.ItemCode; + dto.ItemDesc1 = detail.ItemDesc1; + dto.ItemName = detail.ItemName; - if (itemSafetyStork != null) - { - dto.MaxQty = itemSafetyStork.MaxStock; - dto.MinQty = itemSafetyStork.MinStock; - } + var itemSafetyStork = itemSafetyStorks.FirstOrDefault(t => t.ItemCode == 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); + if (itemSafetyStork != null) + { + dto.MaxQty = itemSafetyStork.MaxStock; + dto.MinQty = itemSafetyStork.MinStock; + } - dtos.Add(dto); - } + var purchaseOrderDtos = await _purchaseOrderApp.GetListBySupplierCodeAsync(supplierAsn.SupplierCode, detail.ItemCode); + var supllierAsn = await _supplierAsnApp.GetForTodayListAsync(); + var poNumberList = supllierAsn.Select(p => p.PoNumber).ToList(); - dto.SupplierAsnCount += 1; + purchaseOrderDtos = purchaseOrderDtos.Where(p => poNumberList.Contains(p.Number)).ToList(); - dto.PlanArriveQty += detail.Qty; - } - } - return dtos.OrderBy(t => t.SupplierShortName).ToList(); - } + decimal allPutawayQty = 0; + decimal allReceiptQty = 0; + decimal allPlanArriveQty = 0; - private static decimal CountPutawayQty(List putawayNotes, string itemCode, string lot) - { - return putawayNotes.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.ToLot == lot).Sum(t => t.Qty)); - } + foreach (var purchaseOrderDTO in purchaseOrderDtos) + { + allPutawayQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.PutAwayQty); + allReceiptQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ReceivedQty); + allPlanArriveQty += purchaseOrderDTO.Details.Where(p => p.ItemCode == detail.ItemCode).Sum(p => p.ShippedQty); + } - private static decimal CountReceiptQty(List purchaseReceipts, string itemCode, string lot) - { - return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.HandledLot == lot).Sum(t => t.Qty)); - } + dto.PutawayQty = allPutawayQty; + dto.PlanArriveQty = allPlanArriveQty; + dto.ReceiptQty = allReceiptQty; - private static int CountReceiptNoteCount(List purchaseReceipts, string itemCode, string lot) - { - return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode && t.Lot == lot)); - } + dtos.Add(dto); + } - private async Task> GetSupplierAsnsAsync() - { - var startTime = DateTime.Today.AddHours(DashboardConst.AsnReceiptTimeLimitHour); + var purchaseReceiptJobDtos = await _purchaseReceiptJobApp.GetListBySupplierCodeOnTodayAsync(supplierAsn.SupplierCode); + + dto.ReceiptNoteCount = purchaseReceiptJobDtos.Count(p => p.JobStatus == EnumJobStatus.Done); - var endTime = startTime.AddDays(1).AddSeconds(-1); + dto.SupplierAsnCount = purchaseReceiptJobDtos.Count(); + } + } + + return dtos.OrderBy(t => t.SupplierShortName).ToList(); + } - if (DateTime.Now.Hour < DashboardConst.AsnReceiptTimeLimitHour) + private decimal CountReceiptQty(List purchaseReceipts, string itemCode) { - startTime.AddDays(-1); - endTime.AddDays(-1); + return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty)); } - return await _supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime).ConfigureAwait(false); - } + private int CountReceiptNoteCount(List purchaseReceipts, string itemCode) + { + return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode)); + } - private async Task> GetSuppliersAsync(IEnumerable codes) - { - return await _supplierApp.GetByCodesAsync(codes).ConfigureAwait(false); - } + private async Task> GetSupplierAsnsAsync() + { + var startTime = DateTime.Today.AddHours(DashboardConst.AsnReceiptTimeLimitHour); - private async Task> GetPurchaseReceiptNotesAsync(IEnumerable asnNumbers) - { - return await _purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false); - } + var endTime = startTime.AddDays(1).AddSeconds(-1); - private async Task> GetPutawayNotesAsync(IEnumerable asnNumbers) - { - return await _putawayNoteApp.GetListByAsnNumbers(asnNumbers).ConfigureAwait(false); - } - private async Task> GetItemSafetyStocksAsync(List supplierAsns) - { - var itemCodes = new List(); + if (DateTime.Now.Hour < DashboardConst.AsnReceiptTimeLimitHour) + { + startTime.AddDays(-1); + endTime.AddDays(-1); + } - supplierAsns.ForEach(t => { itemCodes.AddRange(t.Details.Select(t => t.ItemCode).ToList()); }); + return await this._supplierAsnApp.GetByStartTimeEndTimeAsync(startTime, endTime); + } - var itemSafetyStorks = await _itemSafetyStockApp.GetByItemCodesAsync(itemCodes).ConfigureAwait(false); - return itemSafetyStorks; + private async Task> GetSuppliersAsync(IEnumerable codes) + { + return await this._supplierApp.GetByCodesAsync(codes); + } + + private async Task> GetPurchaseReceiptNotesAsync(IEnumerable asnNumbers) + { + return await this._purchaseReceiptNoteApp.GetListByAsnNumbers(asnNumbers); + } + + private async Task> GetPutawayNotesAsync(IEnumerable asnNumbers) + { + return await this._putawayNoteApp.GetListByAsnNumbers(asnNumbers); + } + private async Task> GetItemSafetyStocksAsync(List supplierAsns) + { + var itemCodes = new List(); + + supplierAsns.ForEach(t => { itemCodes.AddRange(t.Details.Select(t => t.ItemCode).ToList()); }); + + var itemSafetyStorks = await this._itemSafetyStockApp.GetByItemCodesAsync(itemCodes); + return itemSafetyStorks; + } } } diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs index d4ff0307c..6ecbf7f47 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PurchaseReceiptController.cs @@ -5,233 +5,255 @@ using Volo.Abp.AspNetCore.Mvc; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.Dashboard.Host.Models; -namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers; - -using System.Linq; +namespace Win_in.Sfs.Wms.Dashboard.Host.Controllers +{ + using System; + using System.Linq; -using Win_in.Sfs.Label.Application.Contracts; -using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Wms.Inventory.Application.Contracts; -using Win_in.Sfs.Wms.Store.Application.Contracts; + using Volo.Abp; -[ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}purchase-receipt")] + using Win_in.Sfs.Label.Application.Contracts; + using Win_in.Sfs.Label.Domain; + using Win_in.Sfs.Shared.Domain.Shared; + using Win_in.Sfs.Wms.Inventory.Application.Contracts; + using Win_in.Sfs.Wms.Store.Application.Contracts; -public class PurchaseReceiptController : AbpController -{ - private readonly IBalanceAppService _balanceApp; - private readonly IInventoryLabelAppService _labelService; - private readonly ISupplierAppService _supplierApp; - private readonly ISupplierAsnAppService _supplierAsnApp; + [ApiController] + [Route($"{PdaHostConst.ROOT_ROUTE}purchase-receipt")] - public PurchaseReceiptController(IBalanceAppService balanceApp, IInventoryLabelAppService labelService, ISupplierAppService supplierApp, ISupplierAsnAppService supplierAsnApp) + public class PurchaseReceiptController : AbpController { - this._balanceApp = balanceApp; - this._labelService = labelService; - this._supplierApp = supplierApp; - this._supplierAsnApp = supplierAsnApp; - } + private readonly IBalanceAppService _balanceApp; + private readonly IInventoryLabelAppService _labelService; + private readonly ISupplierAppService _supplierApp; + private readonly ISupplierAsnAppService _supplierAsnApp; + private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService; + private readonly IInspectNoteAppService _inspectNoteAppService; + + public PurchaseReceiptController(IBalanceAppService balanceApp, IInventoryLabelAppService labelService, ISupplierAppService supplierApp, ISupplierAsnAppService supplierAsnApp, IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService, IInspectNoteAppService inspectNoteAppService) + { + this._balanceApp = balanceApp; + this._labelService = labelService; + this._supplierApp = supplierApp; + this._supplierAsnApp = supplierAsnApp; + _purchaseReceiptNoteAppService = purchaseReceiptNoteAppService; + _inspectNoteAppService = inspectNoteAppService; + } - [HttpGet("receipt-sum-qty")] - public virtual async Task GetReceiptSumQtyAsync() - { - var dto = new PurchaseReceiptSumQtyDashboardDto(); + /// + /// 未上架数量 + /// + /// + [HttpGet("no-put-away-sum-qty")] + public virtual async Task GetNoPutAwaySumQtyAsync() + { + var dto = new PurchaseReceiptSumQtyDashboardDto(); - var items = await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); + var items = await GetPurchaseReceiptItemDashboardAsync(); - dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) }; + dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) }; - return dto; - } + return dto; + } - [HttpGet("receipt-count-by-supplier")] - public virtual async Task> GetReceiptCountBySupplierQtyAsync() - { - var items = await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); + /// + /// 未上架汇总 + /// + /// + [HttpGet("no-put-away-by-supplier")] + public virtual async Task> GetNoPutAwayBySupplierAsync() + { + var items = await GetPurchaseReceiptItemDashboardAsync(); - var dtos = items.GroupBy(t => t.SupplierShortName) - .Select( - t => new PurchaseReceiptCountBySupplierDashboardDto - { - SupplierShortName = t.Key, - Qty = t.Sum(t1 => t1.Qty) - }).OrderBy(t => t.SupplierShortName).ToList(); + var dtos = items.GroupBy(t => t.SupplierShortName) + .Select( + t => new PurchaseReceiptCountBySupplierDashboardDto + { + SupplierShortName = t.Key, + Qty = t.Sum(t1 => t1.Qty) + }).OrderBy(t => t.SupplierShortName).ToList(); - return dtos; - } + return dtos; + } - [HttpGet("receipt-item-list")] - public virtual async Task> GetReceiptItemListAsync() - { - return await GetPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); - } + /// + /// 未上架明细 + /// + /// + [HttpGet("no-put-away-item-list")] + public virtual async Task> GetReceiptItemListAsync() + { + return await GetPurchaseReceiptItemDashboardAsync(); + } - [HttpGet("un-receipt-sum-qty")] - public virtual async Task GetUnReceiptSumQtyAsync() - { - var dto = new PurchaseReceiptSumQtyDashboardDto(); + [HttpGet("un-receipt-sum-qty")] + public virtual async Task GetUnReceiptSumQtyAsync() + { + var dto = new PurchaseReceiptSumQtyDashboardDto(); - var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); + var items = await this.GetUnPurchaseReceiptItemDashboardAsync(); - dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) }; + dto = new PurchaseReceiptSumQtyDashboardDto() { Qty = items.Sum(t => t.Qty) }; - return dto; - } + return dto; + } - [HttpGet("un-receipt-count-by-supplier")] - public virtual async Task> GetUnReceiptCountBySupplierQtyAsync() - { - var items = await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); + [HttpGet("un-receipt-count-by-supplier")] + public virtual async Task> GetUnReceiptCountBySupplierQtyAsync() + { + var items = await GetUnPurchaseReceiptItemDashboardAsync(); - var dtos = items.GroupBy(t => t.SupplierShortName) - .Select( - t => new PurchaseReceiptCountBySupplierDashboardDto - { - SupplierShortName = t.Key, - Qty = t.Sum(t1 => t1.Qty) - }).OrderBy(t => t.SupplierShortName).ToList(); + var dtos = items.GroupBy(t => t.SupplierShortName) + .Select( + t => new PurchaseReceiptCountBySupplierDashboardDto + { + SupplierShortName = t.Key, + Qty = t.Sum(t1 => t1.Qty) + }).OrderBy(t => t.SupplierShortName).ToList(); - return dtos; - } + return dtos; + } - [HttpGet("un-receipt-item-list")] - public virtual async Task> GetUnReceiptItemListAsync() - { - return await GetUnPurchaseReceiptItemDashboardAsync().ConfigureAwait(false); - } + [HttpGet("un-receipt-item-list")] + public virtual async Task> GetUnReceiptItemListAsync() + { + return await this.GetUnPurchaseReceiptItemDashboardAsync(); + } - private async Task> GetPurchaseReceiptItemDashboardAsync() - { - var balances = await GetBalancesAsync("INSPECT", EnumInventoryStatus.OK).ConfigureAwait(false); + private async Task> GetPurchaseReceiptItemDashboardAsync() + { + var inspectNoteDetailDto = await _inspectNoteAppService.GetInspectNoteDetailByToDayTaskAsync(); + var packingCodeList = inspectNoteDetailDto.Where(p => p.Status == EnumInventoryStatus.OK).Select(p => p.PackingCode).ToList(); + var balances = await _balanceApp.GetListByPackingCodesAsync(packingCodeList); + balances = balances.Where(p => p.LocationCode == "INSPECT").ToList(); - var packingcodes = balances.Select(t => t.PackingCode).Distinct(); + //var balances = await GetBalancesAsync("INSPECT", EnumInventoryStatus.OK); - var labels = await GetLabelsAsync(packingcodes).ConfigureAwait(false); + var packingcodes = balances.Select(t => t.PackingCode).Distinct(); - var supplierCodes = labels.Select(t => t.SupplierCode).Distinct(); + var labels = await GetLabelsAsync(packingcodes); - var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false); + var supplierCodes = labels.Select(t => t.SupplierCode).Distinct(); - return ConvertToPurchaseReceiptItemDashboard(balances, labels, suppliers); - } + var suppliers = await GetSuppliersAsync(supplierCodes); - private static List ConvertToPurchaseReceiptItemDashboard( - List balances, - List labels, - List suppliers) - { - var dtos = new List(); + return ConvertToPurchaseReceiptItemDashboard(balances, labels, suppliers); + } - foreach (var balance in balances) + private List ConvertToPurchaseReceiptItemDashboard( + List balances, + List labels, + List suppliers) { - var supplierShortName = string.Empty; + var dtos = new List(); - var label = labels.FirstOrDefault(t => t.Code == balance.PackingCode); - - if (label == null) + foreach (var balance in balances) { - continue; - } + var supplierShortName = string.Empty; - var supplier = suppliers.FirstOrDefault(t => t != null && t.Code == label.SupplierCode); + var label = labels.FirstOrDefault(t => t.Code == balance.PackingCode); - if (supplier == null) - { - continue; - } + if (label == null) + continue; - supplierShortName = supplier.ShortName; + var supplier = suppliers.FirstOrDefault(t => t != null && t.Code == label.SupplierCode); - var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == balance.ItemCode); + if (supplier == null) + continue; - if (dto == null) - { - dto = new PurchaseReceiptItemDashboardDto(); + supplierShortName = supplier.ShortName; - dto.SupplierShortName = supplierShortName; - dto.ItemCode = balance.ItemCode; - dto.ItemDesc1 = balance.ItemDesc1; - dto.Qty = 0; + var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == balance.ItemCode); - dtos.Add(dto); - } + if (dto == null) + { + dto = new PurchaseReceiptItemDashboardDto(); - dto.Qty += balance.Qty; - } + dto.SupplierShortName = supplierShortName; + dto.ItemCode = balance.ItemCode; + dto.ItemDesc1 = balance.ItemDesc1; + dto.Qty = 0; - return dtos.OrderBy(t => t.SupplierShortName).ToList(); - } + dtos.Add(dto); + } - private async Task> GetBalancesAsync(string locationCode, EnumInventoryStatus status) - { - return await _balanceApp.GetListByLocationCodeAndStatusAsync(locationCode, status).ConfigureAwait(false); - } - private async Task> GetLabelsAsync(IEnumerable codes) - { - return await _labelService.GetByCodesAsync(codes).ConfigureAwait(false); - } - private async Task> GetSuppliersAsync(IEnumerable codes) - { - return await _supplierApp.GetByCodesAsync(codes).ConfigureAwait(false); - } + dto.Qty += balance.Qty; + } - private async Task> GetSupplierAsnsAsync() - { - return await _supplierAsnApp.GetForTodayUnReceivedListAsync().ConfigureAwait(false); - } + return dtos.OrderBy(t => t.SupplierShortName).ToList(); + } - private static List ConvertToUnPurchaseReceiptItemDashboard( - List supplierAsns, - List suppliers) - { - var dtos = new List(); + private async Task> GetBalancesAsync(string locationCode, EnumInventoryStatus status) + { + return await this._balanceApp.GetListByLocationCodeAndStatusAsync(locationCode, status); + } + private async Task> GetLabelsAsync(IEnumerable codes) + { + return await this._labelService.GetByCodesAsync(codes); + } + private async Task> GetSuppliersAsync(IEnumerable codes) + { + return await this._supplierApp.GetByCodesAsync(codes); + } - foreach (var supplierAsn in supplierAsns) + private async Task> GetSupplierAsnsAsync() { - var supplierShortName = string.Empty; + return await this._supplierAsnApp.GetForTodayUnReceivedListAsync(); + } - var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode); + private List ConvertToUnPurchaseReceiptItemDashboard( + List supplierAsns, + List suppliers) + { + var dtos = new List(); - if (supplier == null) + foreach (var supplierAsn in supplierAsns) { - continue; - } + var supplierShortName = string.Empty; - supplierShortName = supplier.ShortName; + var supplier = suppliers.FirstOrDefault(t => t.Code == supplierAsn.SupplierCode); - foreach (var detail in supplierAsn.Details) - { - var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode); + if (supplier == null) + continue; - if (dto == null) + supplierShortName = supplier.ShortName; + + foreach (var detail in supplierAsn.Details) { - dto = new PurchaseReceiptItemDashboardDto(); + var dto = dtos.Find(t => t.SupplierShortName == supplierShortName && t.ItemCode == detail.ItemCode); - dto.SupplierShortName = supplierShortName; - dto.ItemCode = detail.ItemCode; - dto.ItemDesc1 = detail.ItemDesc1; - dto.Qty = 0; + if (dto == null) + { + dto = new PurchaseReceiptItemDashboardDto(); - dtos.Add(dto); - } + dto.SupplierShortName = supplierShortName; + dto.ItemCode = detail.ItemCode; + dto.ItemDesc1 = detail.ItemDesc1; + dto.Qty = 0; + + dtos.Add(dto); + } - dto.Qty += detail.Qty; + dto.Qty += detail.Qty; + } } - } - return dtos.OrderBy(t => t.SupplierShortName).ToList(); - } + return dtos.OrderBy(t => t.SupplierShortName).ToList(); + } - private async Task> GetUnPurchaseReceiptItemDashboardAsync() - { - var dtos = new List(); + private async Task> GetUnPurchaseReceiptItemDashboardAsync() + { + var dtos = new List(); - var supplierAsns = await GetSupplierAsnsAsync().ConfigureAwait(false); + var supplierAsns = await this.GetSupplierAsnsAsync(); - var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct(); + var supplierCodes = supplierAsns.Select(t => t.SupplierCode).Distinct(); - var suppliers = await GetSuppliersAsync(supplierCodes).ConfigureAwait(false); + var suppliers = await GetSuppliersAsync(supplierCodes); - return ConvertToUnPurchaseReceiptItemDashboard(supplierAsns, suppliers); + return this.ConvertToUnPurchaseReceiptItemDashboard(supplierAsns, suppliers); + } } + + } 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 8cbecdc09..9e908aedd 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 @@ -1863,6 +1863,52 @@ CREATE TABLE [Store_WarehouseTransferNote] ( ) +CREATE TABLE [Store_WipWarehouseAdjustNote] ( + [Id] uniqueidentifier NOT NULL, + [Type] nvarchar(64) NULL, + [RequestNumber] nvarchar(max) NULL, + [JobNumber] nvarchar(64) NULL, + [Confirmed] bit NOT NULL, + [ConfirmTime] datetime2 NULL, + [ExtraProperties] nvarchar(max) NULL, + [ConcurrencyStamp] nvarchar(40) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [TenantId] uniqueidentifier NULL, + [Remark] nvarchar(3072) NULL, + [Worker] nvarchar(max) NULL, + [Number] nvarchar(64) NOT NULL, + [ActiveDate] datetime2 NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustNote] PRIMARY KEY ([Id]) +) + + +CREATE TABLE [Store_WipWarehouseAdjustRequest] ( + [Id] uniqueidentifier NOT NULL, + [Type] nvarchar(64) NULL, + [ExtraProperties] nvarchar(max) NULL, + [ConcurrencyStamp] nvarchar(40) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [TenantId] uniqueidentifier NULL, + [Remark] nvarchar(3072) NULL, + [Worker] nvarchar(max) NULL, + [Number] nvarchar(64) NOT NULL, + [ActiveDate] datetime2 NOT NULL, + [AutoSubmit] bit NOT NULL, + [AutoAgree] bit NOT NULL, + [AutoHandle] bit NOT NULL, + [AutoCompleteJob] bit NOT NULL, + [DirectCreateNote] bit NOT NULL, + [RequestStatus] nvarchar(64) NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustRequest] PRIMARY KEY ([Id]) +) + + CREATE TABLE [Store_WorkOrder] ( [Id] uniqueidentifier NOT NULL, [WorkOrderId] nvarchar(64) NULL, @@ -3069,6 +3115,7 @@ CREATE TABLE [Store_InspectNoteDetail] ( [Weight] nvarchar(max) NULL, [OtherPropertyJson] nvarchar(max) NULL, [StdPackQty] decimal(18,6) NOT NULL, + [InspectDate] datetime2 NOT NULL, [CreationTime] datetime2 NOT NULL, [CreatorId] uniqueidentifier NULL, [LastModificationTime] datetime2 NULL, @@ -5068,6 +5115,98 @@ CREATE TABLE [Store_WarehouseTransferNoteDetail] ( ) +CREATE TABLE [Store_WipWarehouseAdjustNoteDetail] ( + [Id] uniqueidentifier NOT NULL, + [Reason] nvarchar(64) NULL, + [ReasonCode] nvarchar(max) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [MasterID] uniqueidentifier NOT NULL, + [TenantId] uniqueidentifier NULL, + [Number] nvarchar(64) NOT NULL, + [Remark] nvarchar(3072) NULL, + [ItemName] nvarchar(64) NULL, + [ItemDesc1] nvarchar(64) NULL, + [ItemDesc2] nvarchar(64) NULL, + [ItemCode] nvarchar(64) NOT NULL, + [Uom] nvarchar(64) NOT NULL, + [Qty] decimal(18,6) NOT NULL, + [StdPackQty] decimal(18,6) NOT NULL, + [FromPackingCode] nvarchar(450) NULL, + [ToPackingCode] nvarchar(max) NULL, + [FromContainerCode] nvarchar(max) NULL, + [ToContainerCode] nvarchar(max) NULL, + [FromLot] nvarchar(max) NULL, + [ToLot] nvarchar(max) NULL, + [SupplierBatch] nvarchar(64) NULL, + [ArriveDate] datetime2 NOT NULL, + [ProduceDate] datetime2 NOT NULL, + [ExpireDate] datetime2 NOT NULL, + [FromLocationCode] nvarchar(64) NOT NULL, + [FromLocationArea] nvarchar(64) NULL, + [FromLocationGroup] nvarchar(64) NULL, + [FromLocationErpCode] nvarchar(64) NOT NULL, + [FromWarehouseCode] nvarchar(64) NOT NULL, + [FromStatus] nvarchar(64) NOT NULL, + [ToLocationCode] nvarchar(64) NOT NULL, + [ToLocationArea] nvarchar(64) NULL, + [ToLocationGroup] nvarchar(64) NULL, + [ToLocationErpCode] nvarchar(64) NOT NULL, + [ToWarehouseCode] nvarchar(64) NOT NULL, + [ToStatus] nvarchar(64) NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustNoteDetail] PRIMARY KEY ([Id]), + CONSTRAINT [FK_Store_WipWarehouseAdjustNoteDetail_Store_WipWarehouseAdjustNote_MasterID] FOREIGN KEY ([MasterID]) REFERENCES [Store_WipWarehouseAdjustNote] ([Id]) ON DELETE CASCADE +) + + +CREATE TABLE [Store_WipWarehouseAdjustRequestDetail] ( + [Id] uniqueidentifier NOT NULL, + [Reason] nvarchar(max) NULL, + [ReasonCode] nvarchar(max) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [MasterID] uniqueidentifier NOT NULL, + [TenantId] uniqueidentifier NULL, + [Number] nvarchar(64) NOT NULL, + [Remark] nvarchar(3072) NULL, + [ItemName] nvarchar(64) NULL, + [ItemDesc1] nvarchar(64) NULL, + [ItemDesc2] nvarchar(64) NULL, + [ItemCode] nvarchar(64) NOT NULL, + [Uom] nvarchar(64) NOT NULL, + [Qty] decimal(18,6) NOT NULL, + [StdPackQty] decimal(18,6) NOT NULL, + [FromPackingCode] nvarchar(max) NULL, + [ToPackingCode] nvarchar(max) NULL, + [FromContainerCode] nvarchar(max) NULL, + [ToContainerCode] nvarchar(max) NULL, + [FromLot] nvarchar(max) NULL, + [ToLot] nvarchar(max) NULL, + [SupplierBatch] nvarchar(64) NULL, + [ArriveDate] datetime2 NOT NULL, + [ProduceDate] datetime2 NOT NULL, + [ExpireDate] datetime2 NOT NULL, + [FromLocationCode] nvarchar(64) NOT NULL, + [FromLocationArea] nvarchar(64) NULL, + [FromLocationGroup] nvarchar(64) NULL, + [FromLocationErpCode] nvarchar(64) NOT NULL, + [FromWarehouseCode] nvarchar(64) NOT NULL, + [FromStatus] nvarchar(64) NOT NULL, + [ToLocationCode] nvarchar(64) NOT NULL, + [ToLocationArea] nvarchar(64) NULL, + [ToLocationGroup] nvarchar(64) NULL, + [ToLocationErpCode] nvarchar(64) NOT NULL, + [ToWarehouseCode] nvarchar(64) NOT NULL, + [ToStatus] nvarchar(64) NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustRequestDetail] PRIMARY KEY ([Id]), + CONSTRAINT [FK_Store_WipWarehouseAdjustRequestDetail_Store_WipWarehouseAdjustRequest_MasterID] FOREIGN KEY ([MasterID]) REFERENCES [Store_WipWarehouseAdjustRequest] ([Id]) ON DELETE CASCADE +) + + CREATE TABLE [Store_WorkOrderDetail] ( [Id] uniqueidentifier NOT NULL, [EffectiveDate] datetime2 NOT NULL, @@ -5698,6 +5837,21 @@ CREATE INDEX [IX_Store_WarehouseTransferNoteDetail_MasterID] ON [Store_Warehouse CREATE UNIQUE INDEX [IX_Store_WarehouseTransferNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode] ON [Store_WarehouseTransferNoteDetail] ([Number], [FromPackingCode], [FromLocationCode], [ToLocationCode]) WHERE [FromPackingCode] IS NOT NULL +CREATE UNIQUE INDEX [IX_Store_WipWarehouseAdjustNote_Number] ON [Store_WipWarehouseAdjustNote] ([Number]) + + +CREATE INDEX [IX_Store_WipWarehouseAdjustNoteDetail_MasterID] ON [Store_WipWarehouseAdjustNoteDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_WipWarehouseAdjustNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode_FromStatus_ToStatus] ON [Store_WipWarehouseAdjustNoteDetail] ([Number], [FromPackingCode], [FromLocationCode], [ToLocationCode], [FromStatus], [ToStatus]) WHERE [FromPackingCode] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_WipWarehouseAdjustRequest_Number] ON [Store_WipWarehouseAdjustRequest] ([Number]) + + +CREATE INDEX [IX_Store_WipWarehouseAdjustRequestDetail_MasterID] ON [Store_WipWarehouseAdjustRequestDetail] ([MasterID]) + + CREATE UNIQUE INDEX [IX_Store_WorkOrder_Number] ON [Store_WorkOrder] ([Number]) 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 dbaf0e54a..3c2da6dba 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 @@ -21,7 +21,7 @@ using PdaMenuGroupDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuGroupDto; namespace Win_in.Sfs.Wms.Pda.Controllers.Accounts; /// -/// +/// /// [AllowAnonymous] [ApiController] @@ -38,12 +38,15 @@ public class AccountController : AbpController private readonly ILogger _logger; /// - /// + /// /// /// /// /// /// + /// + /// + /// public AccountController(IProfileAppService profileAppService , ITokenService tokenService , IUserMenuAppService userMenuAppService @@ -59,13 +62,22 @@ public class AccountController : AbpController _logger = logger; } + /// + /// + /// [Display] public class LoginModel { + /// + /// + /// [Display] [Required] public string UserName { get; set; } + /// + /// + /// [Display] [Required] public string Password { get; set; } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs index 4c5488710..444f4c83c 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs @@ -39,6 +39,7 @@ public class BalanceController : AbpController /// /// /// + /// public BalanceController( IBalanceAppService balanceAppService, IItemBasicAppService itemBasicAppService, @@ -440,7 +441,7 @@ public class BalanceController : AbpController public async Task> GetListByLocationTypeAndInventoryStatusAndNotExpectOutAsync( BalanceListByIssueInputByInventoryStatusAndLocationType listInput) { - var expectOut = await _expectOutAppService.GetListByPackingCodeAsync(listInput.packingCode); + var expectOut = await _expectOutAppService.GetListByPackingCodeAsync(listInput.packingCode).ConfigureAwait(false); if (expectOut != null && expectOut.Any()) { 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 ead6be2c7..b6d428c62 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 @@ -71,7 +71,7 @@ public class JobController : AbpController /// /// [HttpGet("")] - public virtual async Task> CountAsync() + public virtual async Task> CountAsync(bool isToday) { var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); @@ -146,7 +146,7 @@ public class JobController : AbpController }).ConfigureAwait(false); list.Add(new JobCountDto { JobType = EnumJobType.ProductReceiveJob, Count = productReceiveJobs }); - var purchaseReceiptJobs = await _purchaseReceiptJobAppService.GetCountByFilterAsync(new SfsJobRequestInputBase + var purchaseReceiptJobRequest = new SfsJobRequestInputBase { Condition = new Condition { @@ -156,8 +156,12 @@ public class JobController : AbpController new(nameof(PurchaseReceiptJobDTO.JobStatus),jsonStatus,"In") } } - }).ConfigureAwait(false); - list.Add(new JobCountDto { JobType = EnumJobType.PurchaseReceiptJob, Count = purchaseReceiptJobs }); + }; + if (isToday)//只看当日 + { + purchaseReceiptJobRequest.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), Clock.Now.ToString("yyyy-MM-dd"), ">=", "And")); + purchaseReceiptJobRequest.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), Clock.Now.AddDays(1).ToString("yyyy-MM-dd"), "<=", "And")); + } var purchaseReturnJobs = await _purchaseReturnJobAppService.GetCountByFilterAsync(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 dc0477c94..d9b57eb5d 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 @@ -32,9 +32,7 @@ public class PurchaseReceiptJobController : AbpController /// /// /// - /// /// - /// public PurchaseReceiptJobController( IPurchaseReceiptJobAppService purchaseReceiptJobAppService , IUserWorkGroupAppService userWorkGroupAppService @@ -53,7 +51,7 @@ public class PurchaseReceiptJobController : AbpController [HttpGet("{id}")] public virtual async Task> GetAsync(Guid id) { - var result = await _purchaseReceiptJobAppService.GetNoCacheAsync(id).ConfigureAwait(false); + var result = await _purchaseReceiptJobAppService.GetAsync(id).ConfigureAwait(false); var supplier = await _supplierAppService.GetByCodeAsync(result.SupplierCode).ConfigureAwait(false); result.SupplierName = supplier.Name; diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs index 450e9326c..86c329304 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs @@ -33,7 +33,7 @@ public class IssueNoteController : AbpController [HttpPost("")] public virtual async Task CreateAsync([FromBody] IssueNoteEditInput input) { - input.RequestType = EnumMaterialRequestType.Direct_Issue.ToString(); + input.RequestType = EnumMaterialRequestType.Issue_Direct.ToString(); input.Details.ForEach(p => { @@ -54,5 +54,4 @@ public class IssueNoteController : AbpController { return await _issueNoteAppService.ConfirmAsync(id).ConfigureAwait(false); } - } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs index a3b534eaa..6b6a9fd09 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs @@ -54,7 +54,7 @@ public class L7Controller : AbpController [HttpPost("create-product-recycle-note-with-l7")] public virtual async Task CreateProductRecycleNoteWithL7Async(ProductRecycleNoteEditInput input) { - return await _productRecycleNoteAppService.CreateWithL7Async(input).ConfigureAwait(false); + return await _productRecycleNoteAppService.CreateAsync(input).ConfigureAwait(false); } /// diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs index 0fd4dd012..c5682b153 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs @@ -26,7 +26,7 @@ public class RecycledMaterialReceiptNoteController : AbpController } /// - /// 获取盘点任务详情 + /// 回收料调整 /// /// /// diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/TestController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/TestController.cs deleted file mode 100644 index 3c8af2a80..000000000 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/TestController.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Account; -using Volo.Abp.Application.Services; -using Volo.Abp.AspNetCore.Mvc; -using Win_in.Sfs.Auth.Application.Contracts; -using Win_in.Sfs.Wms.Pda.Authenticaitons; -using Win_in.Sfs.Wms.Pda.Models; -using PdaMenuDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuDto; -using PdaMenuGroupDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuGroupDto; - -namespace Win_in.Sfs.Wms.Pda.Controllers.Accounts; - -/// -/// -/// -[AllowAnonymous] -[ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}asfasf")] - -public class TestController: AbpController -{ - //private readonly IProfileAppService _profileAppService; - //private readonly ITokenService _tokenService; - private readonly IUserMenuAppService _userMenuAppService; - //private readonly IUserWorkGroupAppService _userWorkGroupAppService; - - /// - /// - /// - /// - /// - /// - /// - public TestController( - IUserMenuAppService userMenuAppService - , IUserWorkGroupAppService userWorkGroupAppService - ) - { - //_profileAppService = profileAppService; - //_tokenService = tokenService; - _userMenuAppService = userMenuAppService; - //_userWorkGroupAppService = userWorkGroupAppService; - } - - /// - /// Test - /// - /// - [HttpGet("Test")] - public virtual async Task> Test() - { - return new List() { "sdfsdf'" }; - } -} diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Uoms/Inputs/UomImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Uoms/Inputs/UomImportInput.cs index 43aadd97c..ee648999a 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Uoms/Inputs/UomImportInput.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Uoms/Inputs/UomImportInput.cs @@ -19,6 +19,7 @@ public class UomImportInput : SfsBaseDataImportInputBase /// 名称 /// [Display(Name = "名称")] + [Required(ErrorMessage = "{0}是必填项")] [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string Name { get; set; } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs new file mode 100644 index 000000000..211d70c8c --- /dev/null +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteDetailExchangeDto.cs @@ -0,0 +1,45 @@ + +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote; + +public class ItemTransformNoteDetailExchangeDto +{ + /// + /// 物品代码 + /// + [Display(Name = "物品代码")] + public string ItemCode { get; set; } + /// + /// ERP库位 + /// + [Display(Name = "ERP库位")] + public string LocationErpCode { get; set; } + /// + /// 原因代码 + /// + [Display(Name = "原因代码")] + public string ReasonCode { get; set; } + /// + /// 调整数量 + /// + [Display(Name = "来源数量")] + public decimal FromQty { get; set; } + /// + /// 目标数量 + /// + [Display(Name = "目标数量")] + public decimal ToQty { get; set; } + /// + /// 目标库位 + /// + [Display(Name = "目标库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string ToLocationCode { get; set; } + /// + /// 目标物品代码 + /// + [Display(Name = "目标物品代码")] + public string ToItemCode { get; set; } + +} diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs new file mode 100644 index 000000000..64c529b77 --- /dev/null +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemTransformNote/ItemTransformNoteExchangeDto.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel.DataAnnotations; +namespace Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote; + +public class ItemTransformNoteExchangeDto +{ + /// + /// 单据号 + /// + public string Number { get; set; } + /// + /// 生效日期 + /// + public DateTime ActiveDate { get; set; } = DateTime.Now.Date; + /// + /// 操作员 + /// + public string Worker { get; set; } + + /// + /// 类型 + /// + public string Type { get; set; } + + /// + /// 明细 + /// + [Display(Name = "明细")] + public ItemTransformNoteDetailExchangeDto Detail { get; set; } = new(); +} diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs index e30d65560..68b010434 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -23,15 +24,17 @@ public class TransferLogAppService { private readonly ITransferLogManager _transferLogManager; private readonly IInterfaceCalendarAclService _interfaceCalendarAclService; + private readonly ILocationAppService _locationAppService; public TransferLogAppService( ITransferLogRepository repository , ITransferLogManager transferLogManager , IInterfaceCalendarAclService interfaceCalendarAclService - ) : base(repository) + , ILocationAppService locationAppService) : base(repository) { _transferLogManager = transferLogManager; _interfaceCalendarAclService = interfaceCalendarAclService; + _locationAppService = locationAppService; } [HttpPost("add")] diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs index 7eb2e6173..a7babf41a 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs @@ -105,6 +105,15 @@ public class BalanceManager : DomainService, IBalanceManager } else { + if (existBalance.IsActive == false) + { + throw new UserFriendlyException($"库位在{existBalance.LocationCode}," + + $"物品编号为{existBalance.ItemCode}," + + $"箱码为{existBalance.PackingCode}," + + $"批次为{existBalance.Lot}," + + $"状态为{existBalance.Status.GetDisplayName()}" + + $"的库存是不可用状态"); + } //如果单件管理的库存已存在,报错 transaction.CheckSingleUnitHasExist(); existBalance.IncreaseQty(transaction.Qty); @@ -202,6 +211,16 @@ public class BalanceManager : DomainService, IBalanceManager } else { + if (existBalance.IsActive == false) + { + throw new UserFriendlyException($"库位在{existBalance.LocationCode}," + + $"物品编号为{existBalance.ItemCode}," + + $"箱码为{existBalance.PackingCode}," + + $"批次为{existBalance.Lot}," + + $"状态为{existBalance.Status}" + + $"的库存是不可用状态"); + } + existBalance.IncreaseQty(transaction.Qty); switch (existBalance.Qty) { @@ -244,6 +263,16 @@ public class BalanceManager : DomainService, IBalanceManager balance.Status ).ConfigureAwait(false); + //if (!existBalance.IsActive) + //{ + // throw new UserFriendlyException( + // $"箱码为{balance.PackingCode}," + + // $"库位在{balance.LocationCode}," + + // $"批次为{balance.Lot}," + + // $"状态为{balance.Status.GetDisplayName()}" + + // $"的库存是不可用状态"); + //} + existBalance.Qty = balance.Qty; existBalance.ItemName = balance.ItemName; existBalance.ItemDesc1 = balance.ItemDesc1; @@ -423,9 +452,12 @@ public class BalanceManager : DomainService, IBalanceManager expression = expression.And(p => p.ExpireDate > DateTime.Now); } //筛选有效库区 - if (validLocationAreas.Any()) + if (validLocationAreas.Any() ) { - expression = expression.And(p => validLocationAreas.Contains(p.LocationArea)); + if (!string.IsNullOrEmpty(validLocationAreas[0])) + { + expression = expression.And(p => validLocationAreas.Contains(p.LocationArea)); + } } var allBalances = await (await _balanceRepository.GetDbSetAsync().ConfigureAwait(false)) diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs index d2dc012b1..723b2350c 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs @@ -207,4 +207,11 @@ public class InventoryLabelWithoutCodeCreateInput [Display(Name = "要求到货时间")] [Required(ErrorMessage = "{0}是必填项")] public DateTime PlanArriveDate { get; set; } + + /// + /// 备注 + /// + [Display(Name = "备注")] + public string Remark { get; set; } + } diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application/Bases/SfsLabelAppServiceWithCodeBase.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application/Bases/SfsLabelAppServiceWithCodeBase.cs index 312404b9c..033bb43b3 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application/Bases/SfsLabelAppServiceWithCodeBase.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application/Bases/SfsLabelAppServiceWithCodeBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -38,10 +39,12 @@ public class SfsLabelAppServiceWithCodeBase GetByCodeAsync(string code) { - var dto = await Cache.GetOrAddItemAsync( - $"{typeof(TEntityDto).Name}:{code}".ToString(), - async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), - SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + // var dto = await Cache.GetOrAddItemAsync( + // $"{typeof(TEntityDto).Name}:{code}".ToString(), + // async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), + // SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + + var dto = await GetFromRepositoryAsync(code).ConfigureAwait(false); return dto; } @@ -50,18 +53,22 @@ public class SfsLabelAppServiceWithCodeBase> GetByCodesAsync(IEnumerable codes) { - var dtoList = new List(); - foreach (var code in codes) - { - var dto = await Cache.GetOrAddItemAsync( - $"{typeof(TEntityDto).Name}:{code}".ToString(), - async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), - SfsCacheConst.SeveralMinutes).ConfigureAwait(false); - if (dto != null) - { - dtoList.Add(dto); - } - } + // var dtoList = new List(); + // foreach (var code in codes) + // { + // var dto = await Cache.GetOrAddItemAsync( + // $"{typeof(TEntityDto).Name}:{code}".ToString(), + // async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), + // SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + // if (dto != null) + // { + // dtoList.Add(dto); + // } + // } + // return dtoList; + + var entities = await _repository.GetListAsync(p => codes.Contains(p.Code)).ConfigureAwait(false); + var dtoList = ObjectMapper.Map, List>(entities); return dtoList; } diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs index 76770e7eb..e88e07199 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; @@ -15,6 +16,7 @@ using Win_in.Sfs.Label.Application.Contracts; using Win_in.Sfs.Label.Domain; using Win_in.Sfs.Label.Domain.Shared; using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Label.Application; @@ -33,12 +35,14 @@ public class InventoryLabelAppService private new readonly IInventoryLabelRepository _repository; private readonly ISupplierAppService _supplierAppService; private readonly ISupplierItemAppService _supplierItemAppService; + private readonly IItemBasicAppService _itemBasicAppService; public InventoryLabelAppService( IInventoryLabelRepository repository, ILabelDefinitionManager labelDefinitionManager , ISupplierAppService supplierAppService , IItemPackAppService itemPackAppService , ISupplierItemAppService supplierItemAppService + , IItemBasicAppService itemBasicAppService ) : base(repository) { _repository = repository; @@ -46,6 +50,7 @@ public class InventoryLabelAppService _supplierAppService = supplierAppService; _itemPackAppService = itemPackAppService; _supplierItemAppService = supplierItemAppService; + _itemBasicAppService = itemBasicAppService; } [HttpPost("")] @@ -60,6 +65,45 @@ public class InventoryLabelAppService return await base.CreateAsync(input).ConfigureAwait(false); } + /// + /// 按Id获取实体 + /// + /// 实体Id + /// + [HttpGet("{id}")] + public override async Task GetAsync(Guid id) + { + var dto = await base.GetAsync(id).ConfigureAwait(false); + + if (dto != null) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(dto.ItemCode).ConfigureAwait(false); + if (itemBasicDto != null) + { + switch (itemBasicDto.ValidityUnit) + { + case EnumValidityUnit.Infinite: + dto.ExpireDate = DateTime.MaxValue; + break; + case EnumValidityUnit.Day: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity); + break; + case EnumValidityUnit.WeeK: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity * 7); + break; + case EnumValidityUnit.Month: + dto.ExpireDate = DateTime.Now.AddMonths(itemBasicDto.Validity); + break; + case EnumValidityUnit.None: + default: + break; + } + } + } + + return dto; + } + [HttpPost("many")] [UnitOfWork] public virtual async Task> CreateManyAsync(List inputs) @@ -83,7 +127,7 @@ public class InventoryLabelAppService [UnitOfWork] public virtual async Task> CreateManyByNoCodeAsync(List inputs) { - var entitys= ObjectMapper.Map, List>(inputs); + var entitys = ObjectMapper.Map, List>(inputs); await _repository.InsertManyAsync(entitys).ConfigureAwait(false); return ObjectMapper.Map, List>(entitys); } @@ -129,6 +173,36 @@ public class InventoryLabelAppService var createInput = ObjectMapper.Map(input); createInput.Code = numbers[i]; var dto = await base.CreateAsync(createInput).ConfigureAwait(false); + + dto.SupplierCode = input.SupplierCode; + dto.PoNumber = input.PoNumber; + dto.Remark = input.Remark; + dto.AsnNumber = input.AsnNumber; + dto.FullBarcodeString = dto.Code; + + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(dto.ItemCode).ConfigureAwait(false); + if (itemBasicDto != null) + { + switch (itemBasicDto.ValidityUnit) + { + case EnumValidityUnit.Infinite: + dto.ExpireDate = DateTime.MaxValue; + break; + case EnumValidityUnit.Day: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity); + break; + case EnumValidityUnit.WeeK: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity * 7); + break; + case EnumValidityUnit.Month: + dto.ExpireDate = DateTime.Now.AddMonths(itemBasicDto.Validity); + break; + case EnumValidityUnit.None: + default: + break; + } + } + dtos.Add(dto); } return dtos; 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 2c022d8d3..600523dce 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 @@ -512,7 +512,6 @@ public abstract class SfsCrudWithDetailsAppServiceBase /// 导入数据具体实现,可重写 /// - //[UnitOfWork] protected virtual async Task ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes) { IList modelList = null; @@ -559,7 +558,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase protected virtual async Task> ImportProcessingEntityAsync(Dictionary dictionary) { + await Task.CompletedTask.ConfigureAwait(false); return dictionary; } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs index f99e6672e..451f73df2 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs @@ -127,6 +127,12 @@ public enum EnumTransSubType [Display(Name = "安全库存拉动")] Issue_SafetyStock = 1504, + /// + /// 直接发料 + /// + [Display(Name = "直接发料")] + Issue_Direct = 1505, + /// /// 标准发货 /// diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs index 245c1f9e8..0fa48dec0 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs @@ -28,5 +28,5 @@ public enum EnumMaterialRequestType //Issue_SfaetyStock = 1504, [Display(Name = "直接发料")] - Direct_Issue = 1505 + Issue_Direct = 1505 } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/HostBuilderExtensions.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/HostBuilderExtensions.cs index 5319f16a2..189e69c1d 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/HostBuilderExtensions.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Host/HostBuilderExtensions.cs @@ -45,6 +45,7 @@ public static class HostBuilderExtensions AddJsonByUrl(cb, $"{configUrl}appsettings.{builder.Environment.EnvironmentName}.json"); if (builder.Environment.IsDevelopment()) { + cb.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json")); cb.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), $"appsettings.{builder.Environment.EnvironmentName}.json")); } }); @@ -79,7 +80,14 @@ public static class HostBuilderExtensions private static void AddJsonByUrl(IConfigurationBuilder configurationBuilder, string url) { Console.WriteLine($"load config form:{url}"); - var stream = new HttpClient().GetStreamAsync(url).Result; - configurationBuilder.AddJsonStream(stream); + try + { + var stream = new HttpClient().GetStreamAsync(url).Result; + configurationBuilder.AddJsonStream(stream); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs index 34ad65d0c..57e22858e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs @@ -79,11 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithFromToDTOBase : SfsStoreDet [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } /// /// 推荐数量 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs index 60677c614..1879df552 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatus [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs index ada92e47f..76239bc02 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendToDetailWithFromToDTOBase : SfsStoreDetai [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs index 158f925ff..cc6884027 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDT [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRequestDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRequestDTOBase.cs index b0b98b116..ef7d69ea2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRequestDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRequestDTOBase.cs @@ -3,7 +3,7 @@ using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreRequestDTOBase : SfsStoreDTOBase +public abstract class SfsStoreRequestDTOBase : SfsStoreDTOBase { /// /// 自动提交审批 @@ -18,7 +18,7 @@ public class SfsStoreRequestDTOBase : SfsStoreDTOBase public bool AutoAgree { get; set; } /// - /// 自动执行 + /// 自动执行 /// [Display(Name = "自动执行")] public bool AutoHandle { get; set; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreCreateOrUpdateInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreCreateOrUpdateInputBase.cs index b2d51a740..6e5d4644f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreCreateOrUpdateInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreCreateOrUpdateInputBase.cs @@ -5,7 +5,7 @@ using Win_in.Sfs.Shared.Domain; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreCreateOrUpdateInputBase : SfsCreateOrUpdateInputBase +public abstract class SfsStoreCreateOrUpdateInputBase : SfsCreateOrUpdateInputBase { /// /// 操作员 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreDetailWithFromToInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreDetailWithFromToInputBase.cs index 2fac6fbd8..9839fd7a7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreDetailWithFromToInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreDetailWithFromToInputBase.cs @@ -5,7 +5,7 @@ using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreDetailWithFromToInputBase +public abstract class SfsStoreDetailWithFromToInputBase : SfsStoreDetailWithQtyInputBase , IHasFromToPacking , IHasFromToLot @@ -149,5 +149,6 @@ public class SfsStoreDetailWithFromToInputBase /// [Display(Name = "目标库存状态")] public EnumInventoryStatus ToStatus { get; set; } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreImportInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreImportInputBase.cs index 5773575ac..4918540e4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreImportInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreImportInputBase.cs @@ -3,7 +3,7 @@ using Win_in.Sfs.Shared.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreImportInputBase : SfsImportInputBase +public abstract class SfsStoreImportInputBase : SfsImportInputBase { //[Display(Name = "单号")] @@ -35,7 +35,7 @@ public class SfsStoreImportInputBase : SfsImportInputBase public bool AutoAgree { get; set; } = true; /// - /// 自动执行 + /// 自动执行 /// [Display(Name = "自动执行")] [ImporterHeader(IsIgnore = true)] diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs index 9f0990c48..4cc36f820 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs @@ -4,7 +4,7 @@ using Win_in.Sfs.Shared.Domain; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreRecommendFromDetailWithFromToInputBase : SfsStoreDetailWithFromToInputBase, IHasRecommendAndHandledFrom +public abstract class SfsStoreRecommendFromDetailWithFromToInputBase : SfsStoreDetailWithFromToInputBase, IHasRecommendAndHandledFrom { #region IHasRecommendFrom /// @@ -79,12 +79,6 @@ public class SfsStoreRecommendFromDetailWithFromToInputBase : SfsStoreDetailWith [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs index b10259de3..1285007db 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatus [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs index fe80cb038..ce905ac06 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs @@ -4,7 +4,7 @@ using Win_in.Sfs.Shared.Domain; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreRecommendToDetailWithFromToInputBase : SfsStoreDetailWithFromToInputBase, IHasRecommendAndHandledTo +public abstract class SfsStoreRecommendToDetailWithFromToInputBase : SfsStoreDetailWithFromToInputBase, IHasRecommendAndHandledTo { #region IHasRecommendTo /// @@ -79,12 +79,6 @@ public class SfsStoreRecommendToDetailWithFromToInputBase : SfsStoreDetailWithFr [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs index c019b0583..f27d709cd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs @@ -81,12 +81,6 @@ public abstract class SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusIn [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRequestCreateOrUpdateInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRequestCreateOrUpdateInputBase.cs index 19703dfd1..264637389 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRequestCreateOrUpdateInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRequestCreateOrUpdateInputBase.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -public class SfsStoreRequestCreateOrUpdateInputBase : SfsStoreCreateOrUpdateInputBase +public abstract class SfsStoreRequestCreateOrUpdateInputBase : SfsStoreCreateOrUpdateInputBase { /// /// 自动提交审批 @@ -17,7 +17,7 @@ public class SfsStoreRequestCreateOrUpdateInputBase : SfsStoreCreateOrUpdateInpu public bool AutoAgree { get; set; } = true; /// - /// 自动执行 + /// 自动执行 /// [Display(Name = "自动执行")] public bool AutoHandle { get; set; } = true; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs index 1b26733b8..027134838 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs @@ -42,10 +42,8 @@ public interface IPurchaseReceiptJobAppService Task> SetInspectWithNotInspectAsync(Guid id); /// - /// 按Id获取实体 不走缓存 + /// 根据供应商编号获取收货任务 /// - /// 实体Id - /// /// - Task GetNoCacheAsync(Guid id); + Task> GetListBySupplierCodeOnTodayAsync(string supplierCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs index 8afa8d50b..f785c718e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -39,6 +40,13 @@ public class CountNoteImportInput : SfsStoreImportInputBase [Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)] public string PackingCode { get; set; } + /// + /// 库存状态 + /// + [Display(Name = "库存状态")] + [Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)] + public EnumInventoryStatus Status { get; set; } + /// /// 托码 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs index eb39e36ee..b0aab9524 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs @@ -1,4 +1,9 @@ +using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -9,4 +14,25 @@ public interface IDeliverNoteAppService : Task CreateWithL7Async(DeliverNoteEditInput input); + Task> GetForFisListAsync( + SfsStoreRequestInputBase sfsRequestDTO, + bool includeDetails = false, + CancellationToken cancellationToken = default); + + Task> GetForNormalListAsync( + SfsStoreRequestInputBase sfsRequestDTO, + bool includeDetails = false, + CancellationToken cancellationToken = default); + + Task> GetForRAWListAsync( + SfsStoreRequestInputBase sfsRequestDTO, + bool includeDetails = false, + CancellationToken cancellationToken = default); + + + Task ExportForNormalAsync(SfsStoreRequestInputBase requestInput); + + Task ExportForRAWAsync(SfsExportRequestInput requestInput); + + Task SumPrintAsync(string number); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs index eead05bf0..ea5242e09 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/InspectNotes/IInspectNoteAppService.cs @@ -21,4 +21,6 @@ public interface IInspectNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase /// /// Task> CreateSummaryDetailAndDetailByIdAsync(Guid id, InspectNoteEditInput input); + + Task> GetInspectNoteDetailByToDayTaskAsync(); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs index 10c1b8257..bf96e9680 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDTO.cs @@ -19,5 +19,8 @@ public class ItemTransformNoteDTO : SfsStoreDTOBase, [Display(Name = "任务单号")] [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string JobNumber { get; set; } - + /// + /// 调整类型 + /// + public string Type { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs index 12cd97405..6357fe2fd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ItemTransformNotes/DTOs/ItemTransformNoteDetailDTO.cs @@ -214,7 +214,11 @@ public class ItemTransformNoteDetailDTO : SfsStoreDetailDTOBase /// [Display(Name = "目标ERP储位")] public string ToLocationErpCode { get; set; } - + /// + /// ERP库位 + /// + [Display(Name = "ERP库位")] + public string LocationErpCode { get; set; } /// /// 目标仓库 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs index 8a4425a1e..426677c67 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs @@ -7,5 +7,4 @@ public interface IProductRecycleNoteAppService : { Task CreateAsync(ProductRecycleNoteEditInput input); - Task CreateWithL7Async(ProductRecycleNoteEditInput input); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs new file mode 100644 index 000000000..18f2d3f4a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs @@ -0,0 +1,41 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整-实体DTO +/// +public class WipWarehouseAdjustNoteDTO : SfsStoreDTOBase, IHasNumber +{ + /// + /// 线边仓调整申请单号 + /// + [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 Confirmed { get; set; } + + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + public DateTime? ConfirmTime { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs new file mode 100644 index 000000000..0e460c91b --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整记录-明细表 +/// +public class WipWarehouseAdjustNoteDetailDTO : SfsStoreDetailWithFromToDTOBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs new file mode 100644 index 000000000..737ae169c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IWipWarehouseAdjustNoteAppService : + ISfsStoreMasterReadOnlyAppServiceBase +{ + Task ConfirmAsync(Guid id); + + /// + /// 新增实体 + /// + /// CreateInput + Task CreateAsync(WipWarehouseAdjustNoteEditInput input); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs new file mode 100644 index 000000000..9c16118d8 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边仓调整-明细表DTO +/// +public class WipWarehouseAdjustNoteDetailInput : SfsStoreDetailWithFromToInputBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs new file mode 100644 index 000000000..5a92e2884 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 新增和更新基础DTO +/// +public class WipWarehouseAdjustNoteEditInput : SfsStoreCreateOrUpdateInputBase +{ + #region Base + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + #endregion + + #region Update + /// + /// 确认时间 + /// + [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 List Details { get; set; } = new List(); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs new file mode 100644 index 000000000..05ab88ea6 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs @@ -0,0 +1,71 @@ +using System; +using System.ComponentModel.DataAnnotations; +using DocumentFormat.OpenXml.Drawing; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class WipWarehouseAdjustNoteImportInput : SfsStoreImportInputBase +{ + /// + /// 调拨类型 + /// + [Display(Name = "调拨类型")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "调拨类型")] + [ExporterHeader(DisplayName = "调拨类型")] + [ValueMapping("区域内调拨(储位内移库)", EnumTransSubType.Transfer_Inside)] + public string Type { get; set; } + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + [ImporterHeader(IsIgnore = true)] + [Required(ErrorMessage = "{0}是必填项")] + public bool Confirmed { get; set; } + + /// + /// 物料号 + /// + [Display(Name = "物料号")] + [Required(ErrorMessage = "{0}是必填项")] + public string ItemCode { get; set; } + + /// + /// 调拨数量 + /// + [Display(Name = "调拨数量")] + [Required(ErrorMessage = "{0}是必填项")] + public decimal Qty { get; set; } + + /// + /// 调出库位 + /// + [Display(Name = "调出库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string FromLocationCode { get; set; } + + /// + /// 调入库位 + /// + [Display(Name = "调入库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string ToLocationCode { get; set; } + + /// + /// 箱码 + /// + [Display(Name = "箱码")] + [Required(ErrorMessage = "{0}是必填项")] + public string PackingCode { get; set; } + + /// + /// 状态 + /// + [Display(Name = "状态")] + [Required(ErrorMessage = "{0}是必填项")] + public EnumInventoryStatus Status { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs new file mode 100644 index 000000000..ef96ab44a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs @@ -0,0 +1,21 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class WipWarehouseAdjustNotePermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(WipWarehouseAdjustNote); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + public static void AddWipWarehouseAdjustNotePermission(this PermissionGroupDefinition permissionGroup) + { + var WipWarehouseAdjustNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(WipWarehouseAdjustNote))); + WipWarehouseAdjustNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + WipWarehouseAdjustNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + WipWarehouseAdjustNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs index 9c7fee755..c50180570 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/IPurchaseOrderAppService.cs @@ -37,4 +37,6 @@ public interface IPurchaseOrderAppService /// /// Task> CreateManyAsync(List inputs); + + Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs index c3d4b92a8..a0a9ec797 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs @@ -20,12 +20,14 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// [Display(Name = "采购订单号")] [Key] + [Required(ErrorMessage = "{0}是必填项")] public string Number { get; set; } /// /// 供应商代码 /// [Display(Name = "供应商代码")] + [Required(ErrorMessage = "{0}是必填项")] public string SupplierCode { get; set; } /// @@ -52,6 +54,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 订单日期 /// [Display(Name = "订单日期")] + [Required(ErrorMessage = "{0}是必填项")] [ImporterHeader(Name = "订单日期", Format = "yyyy/MM/dd")] [ExporterHeader(DisplayName = "订单日期", Format = "yyyy/MM/dd")] public DateTime OrderDate { get; set; } @@ -60,6 +63,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 截止日期 /// [Display(Name = "截止日期")] + [Required(ErrorMessage = "{0}是必填项")] [ImporterHeader(Name = "截止日期", Format = "yyyy/MM/dd")] [ExporterHeader(DisplayName = "截止日期", Format = "yyyy/MM/dd")] public DateTime DueDate { get; set; } @@ -81,18 +85,21 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 仓库代码 /// [Display(Name = "仓库代码")] + [Required(ErrorMessage = "{0}是必填项")] public string WarehouseCode { get; set; } /// /// 明细-订单行 /// [Display(Name = "明细-订单行")] + [Required(ErrorMessage = "{0}是必填项")] public string PoLine { get; set; } /// /// 明细-物品代码 /// [Display(Name = "明细-物品代码")] + [Required(ErrorMessage = "{0}是必填项")] public string ItemCode { get; set; } /// @@ -106,6 +113,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 数量计量单位 /// [Display(Name = "明细-数量计量单位")] + [Required(ErrorMessage = "{0}是必填项")] public string Uom { get; set; } /// @@ -126,6 +134,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 明细-供应商包装单位 /// [Display(Name = "明细-供应商包装单位")] + [Required(ErrorMessage = "{0}是必填项")] public string SupplierPackUom { get; set; } /// @@ -146,12 +155,14 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 筹措员代码 /// [Display(Name = "明细-筹措员代码")] + [Required(ErrorMessage = "{0}是必填项")] public string PlanUserCode { get; set; } /// /// 生产批次 /// [Display(Name = "明细-生产批次")] + [Required(ErrorMessage = "{0}是必填项")] public string Lot { get; set; } /// @@ -182,6 +193,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 过期时间 /// [Display(Name = "明细-过期时间")] + [Required(ErrorMessage = "{0}是必填项")] public DateTime ExpireDate { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs index ceda25aae..92bbc9d6d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs @@ -79,6 +79,9 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddReportPermission(); storeGroup.AddDashboardPermission(); + storeGroup.AddWipWarehouseAdjustRequestPermission(); + storeGroup.AddWipWarehouseAdjustNotePermission(); + #region Jobs storeGroup.AddPurchaseReceiptJobPermission(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs index 2500f94f8..440cf5973 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Plans/SupplierAsns/ISupplierAsnAppService.cs @@ -34,4 +34,6 @@ public interface ISupplierAsnAppService Task GenerateSupplierAsnNumberAsync(DateTime activeDate); Task UpdateStatusAsync(string asnNumber, EnumSupplierAsnStatus status); + + Task> GetForTodayListAsync(); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs index 09f948138..b91d9c807 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -70,7 +71,7 @@ public class ProductReceiptRequestEditInput : SfsStoreRequestCreateOrUpdateInput /// 类型 /// [Display(Name = "类型")] - public string EnumProductReceiptType { get; set; } + public EnumProductReceiptType Type { get; set; } /// /// 明细列表 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestDetailInput.cs new file mode 100644 index 000000000..d2919af98 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestDetailInput.cs @@ -0,0 +1,6 @@ +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class ProductionReturnRequestDetailInput : SfsStoreDetailWithFromToInputBase +{ + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestEditInput.cs index eb1000854..e2151cd8e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductionReturnRequests/Inputs/ProductionReturnRequestEditInput.cs @@ -24,6 +24,6 @@ public class ProductionReturnRequestEditInput : SfsStoreRequestCreateOrUpdateInp /// 明细列表 /// [Display(Name = "明细列表")] - public List Details { get; set; } = new List(); + public List Details { get; set; } = new List(); #endregion } 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 4c096c02d..ddd82519b 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 @@ -14,6 +14,8 @@ public class TransferRequestImportInput : SfsStoreImportInputBase [Required(ErrorMessage = "{0}是必填项")] [ImporterHeader(Name = "调拨类型")] [ExporterHeader(DisplayName = "调拨类型")] + [ValueMapping("区域间调拨(储位调拨)", EnumTransSubType.Transfer_Area)] + [ValueMapping("线边调拨(线边仓调拨)", EnumTransSubType.Transfer_WIP)] [ValueMapping("客户库位调拨(客户储位调拨)", EnumTransSubType.Transfer_Customer)] public string Type { get; set; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs new file mode 100644 index 000000000..80ccd8d74 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整-实体DTO +/// +public class WipWarehouseAdjustRequestDTO : SfsStoreRequestDTOBase, IHasNumber +{ + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs new file mode 100644 index 000000000..712395401 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整-明细表 +/// +public class WipWarehouseAdjustRequestDetailDTO : SfsStoreDetailWithFromToDTOBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs new file mode 100644 index 000000000..ba5a69fbd --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs @@ -0,0 +1,7 @@ +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IWipWarehouseAdjustRequestAppService + : ISfsStoreRequestMasterAppServiceBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs new file mode 100644 index 000000000..2af3ac206 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 库存转移记录-明细表 +/// +public class WipWarehouseAdjustRequestDetailInput : SfsStoreDetailWithFromToInputBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs new file mode 100644 index 000000000..729cf8338 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 新增和更新基础DTO +/// +public class WipWarehouseAdjustRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase +{ + #region Base + + /// + /// 调拨类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 明细列表 + /// + [Display(Name = "明细列表")] + public List Details { get; set; } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs new file mode 100644 index 000000000..53c947bb9 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs @@ -0,0 +1,54 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class WipWarehouseAdjustRequestImportInput : SfsStoreImportInputBase +{ + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "调整类型")] + [ExporterHeader(DisplayName = "调整类型")] + [ValueMapping("线边仓调整", EnumTransSubType.CountAdjust_WIP)] + public string Type { get; set; } + + /// + /// 物品编号 + /// + [Display(Name = "物料号")] + [Required(ErrorMessage = "{0}是必填项")] + public string ItemCode { get; set; } + + /// + /// 调整数量 + /// + [Display(Name = "调拨数量")] + [Required(ErrorMessage = "{0}是必填项")] + public decimal Qty { get; set; } + + /// + /// 调整库位 + /// + [Display(Name = "调整库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string FromLocationCode { get; set; } + + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs new file mode 100644 index 000000000..3f535c72c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs @@ -0,0 +1,24 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class WipWarehouseAdjustRequestPermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(WipWarehouseAdjustRequest); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + public static void AddWipWarehouseAdjustRequestPermission(this PermissionGroupDefinition permissionGroup) + { + var WipWarehouseAdjustRequestPermission = permissionGroup.AddPermission(Default, + StorePermissionDefinitionProvider.L(nameof(WipWarehouseAdjustRequest))); + WipWarehouseAdjustRequestPermission.AddChild(Create, + StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + WipWarehouseAdjustRequestPermission.AddChild(Update, + StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + WipWarehouseAdjustRequestPermission.AddChild(Delete, + StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj index cfb6a4466..a14d0abb2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj @@ -42,10 +42,8 @@ - - diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobWithCodeAppServiceBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobWithCodeAppServiceBase.cs index d1493e856..6102ed5d2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobWithCodeAppServiceBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsJobWithCodeAppServiceBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; @@ -37,10 +38,12 @@ public abstract class SfsJobWithCodeAppServiceBase GetByCodeAsync(string code) { - var dto = await Cache.GetOrAddItemAsync( - $"{typeof(TEntityDto).Name}:{code}".ToString(), - async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), - SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + // var dto = await Cache.GetOrAddItemAsync( + // $"{typeof(TEntityDto).Name}:{code}".ToString(), + // async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), + // SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + + var dto = await GetFromRepositoryAsync(code).ConfigureAwait(false); return dto; @@ -51,18 +54,22 @@ public abstract class SfsJobWithCodeAppServiceBase> GetByCodesAsync(IEnumerable codes) { - var dtoList = new List(); - foreach (var code in codes) - { - var dto = await Cache.GetOrAddItemAsync( - $"{typeof(TEntityDto).Name}:{code}".ToString(), - async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), - SfsCacheConst.SeveralMinutes).ConfigureAwait(false); - if (dto != null) - { - dtoList.Add(dto); - } - } + // var dtoList = new List(); + // foreach (var code in codes) + // { + // var dto = await Cache.GetOrAddItemAsync( + // $"{typeof(TEntityDto).Name}:{code}".ToString(), + // async () => await GetFromRepositoryAsync(code).ConfigureAwait(false), + // SfsCacheConst.SeveralMinutes).ConfigureAwait(false); + // if (dto != null) + // { + // dtoList.Add(dto); + // } + // } + // return dtoList; + + var entities = await _repository.GetListAsync(p => codes.Contains(p.Code)).ConfigureAwait(false); + var dtoList = ObjectMapper.Map, List>(entities); return dtoList; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs index e82144b3a..7bed7b52d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Bases/SfsStoreRequestAppServiceBase.cs @@ -157,7 +157,8 @@ public abstract class SfsStoreRequestAppServiceBase CompleteByNumberAsync(string number) { var entity = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false); - Check.NotNull(entity, typeof(TEntity).Name); + if (entity == null) return null; + // Check.NotNull(entity, typeof(TEntity).Name); var result = await _requestManager.CompleteAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(result); return dto; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs index 60673f7ac..f2b69f2c0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs @@ -71,6 +71,7 @@ public class CountJobAppService throw new AbpValidationException(result.Errors); } var entity = ObjectMapper.Map(dto); + entity.Number = checkEntity.Number; await _countJobManager.CompleteAsync(entity, CurrentUser).ConfigureAwait(false); return dto; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/DeliverJobs/DeliverJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/DeliverJobs/DeliverJobAutoMapperProfile.cs index 8457dfc62..f8bccdeb5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/DeliverJobs/DeliverJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/DeliverJobs/DeliverJobAutoMapperProfile.cs @@ -18,6 +18,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties(); + CreateMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductionReturnJobs/ProductionReturnJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductionReturnJobs/ProductionReturnJobAutoMapperProfile.cs index a0a6528a9..6eead08ba 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductionReturnJobs/ProductionReturnJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductionReturnJobs/ProductionReturnJobAutoMapperProfile.cs @@ -16,6 +16,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile .IgnoreAuditedObjectProperties() ; + CreateMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs index 22b45c3bf..2c646ae7e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs @@ -22,31 +22,21 @@ public class PurchaseReceiptJobAppService : , IPurchaseReceiptJobAppService { private readonly IFileAppService _fileAppService; - private readonly IInspectJobManager _inspectJobManager; - private readonly IInspectRequestAppService _inspectRequestAppService; private readonly IPurchaseReceiptJobManager _purchaseReceiptJobManager; - private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService; /// /// /// - /// /// /// - /// /// public PurchaseReceiptJobAppService(IPurchaseReceiptJobRepository repository, - IInspectJobManager inspectJobManager, IPurchaseReceiptJobManager purchaseReceiptJobManager, IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService, - IInspectRequestAppService inspectRequestAppService, IFileAppService fileAppService) : base(repository, purchaseReceiptJobManager) { _purchaseReceiptJobManager = purchaseReceiptJobManager; - _purchaseReceiptNoteAppService = purchaseReceiptNoteAppService; - _inspectRequestAppService = inspectRequestAppService; _fileAppService = fileAppService; - _inspectJobManager = inspectJobManager; } #region 东阳使用 @@ -151,27 +141,28 @@ public class PurchaseReceiptJobAppService : var dict = await _fileAppService.CreateManyHasDictAsync(input.FilesList).ConfigureAwait(false); detail.InspectPhotoJson = JsonSerializer.Serialize(dict); } - - if (detail != null) + else { - detail.FailedReason = input.FailedReason; - detail.MassDefect = input.MassDefect; - detail.PurchaseReceiptInspectStatus = input.PurchaseReceiptInspectStatus; - detail.HandledLot = detail.RecommendLot; - detail.HandledSupplierBatch = detail.RecommendSupplierBatch; - detail.HandledArriveDate = detail.RecommendArriveDate; - detail.HandledProduceDate = detail.RecommendProduceDate; - detail.HandledExpireDate = detail.RecommendExpireDate; - detail.HandledToLocationArea=detail.RecommendToLocationArea; - detail.HandledToLocationGroup=detail.RecommendToLocationGroup; - detail.HandledContainerCode = detail.RecommendContainerCode; - detail.HandledToLocationCode = detail.RecommendToLocationCode; - detail.HandledToLocationErpCode = detail.RecommendToLocationErpCode; - detail.HandledToWarehouseCode = detail.RecommendToWarehouseCode; - detail.HandledPackingCode = detail.RecommendPackingCode; - detail.HandledQty = detail.RecommendQty; + detail.InspectPhotoJson = string.Empty; } + detail.FailedReason = input.FailedReason; + detail.MassDefect = input.MassDefect; + detail.PurchaseReceiptInspectStatus = input.PurchaseReceiptInspectStatus; + detail.HandledLot = detail.RecommendLot; + detail.HandledSupplierBatch = detail.RecommendSupplierBatch; + detail.HandledArriveDate = detail.RecommendArriveDate; + detail.HandledProduceDate = detail.RecommendProduceDate; + detail.HandledExpireDate = detail.RecommendExpireDate; + detail.HandledToLocationArea = detail.RecommendToLocationArea; + detail.HandledToLocationGroup = detail.RecommendToLocationGroup; + detail.HandledContainerCode = detail.RecommendContainerCode; + detail.HandledToLocationCode = detail.RecommendToLocationCode; + detail.HandledToLocationErpCode = detail.RecommendToLocationErpCode; + detail.HandledToWarehouseCode = detail.RecommendToWarehouseCode; + detail.HandledPackingCode = detail.RecommendPackingCode; + detail.HandledQty = detail.RecommendQty; + var entity = await _repository.UpdateAsync(job).ConfigureAwait(false); return ObjectMapper.Map( @@ -182,7 +173,6 @@ public class PurchaseReceiptJobAppService : /// 按Id获取实体 不走缓存 /// /// 实体Id - /// /// [HttpGet("no-cache/{id}")] public virtual async Task GetNoCacheAsync(Guid id) @@ -194,6 +184,7 @@ public class PurchaseReceiptJobAppService : #endregion /// + /// 取消收货 /// /// [HttpPost("cancel-by-request/{purchaseReceiptRequestNumber}")] @@ -207,6 +198,37 @@ public class PurchaseReceiptJobAppService : } } + /// + /// 根据供应商编号获取收货任务 + /// + /// + [HttpPost("get-by-supplier-code-on-today/{supplierCode}")] + public virtual async Task> GetListBySupplierCodeOnTodayAsync(string supplierCode) + { + var purchaseReceiptJobs = await _repository.GetListAsync(p => + p.SupplierCode == supplierCode && + p.PlanArriveDate.Year == DateTime.Now.Year && + p.PlanArriveDate.Month == DateTime.Now.Month && + p.PlanArriveDate.Day == DateTime.Now.Day).ConfigureAwait(false); + var dto = ObjectMapper.Map, List>(purchaseReceiptJobs); + return dto; + } + + ///// + ///// 取消请求 + ///// + ///// + //[HttpPost("cancel-by-request/{purchaseReceiptRequestNumber}")] + //public virtual async Task CancelByPurchaseReceiptRequestAsync(string purchaseReceiptRequestNumber) + //{ + // var entities = await _repository + // .GetListAsync(p => p.PurchaseReceiptRequestNumber == purchaseReceiptRequestNumber).ConfigureAwait(false); + // foreach (var entity in entities) + // { + // await _purchaseReceiptJobManager.CancelAsync(entity).ConfigureAwait(false); + // } + //} + /* /// /// 承接收货任务 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs index 26971205d..a1529c8b5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs @@ -21,5 +21,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs index 015825e1f..278f8a52c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs @@ -1,11 +1,15 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Domain.Repositories; +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.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -25,16 +29,80 @@ public class CountNoteAppService : { private readonly ICountNoteManager _countNoteManager; private readonly ICountPlanAppService _countPlanAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; public CountNoteAppService( ICountNoteRepository repository, - ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService) : base(repository) + ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService) : base(repository) { _countNoteManager = countNoteManager; _countPlanAppService = countPlanAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } + #region 东阳 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var dataList = dictionary.Select(p => p.Key);//查询所有的导入盘点数据 + var resultDictionary = new Dictionary(); + + var allCountPlanNumbersList= dataList.GroupBy(p => p.CountPlanNumber).Select(p => p.Key).ToList(); + //特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录 + foreach (var countPlanNumber in allCountPlanNumbersList) + { + var countPlanDto = await _countPlanAppService.GetByNumberAsync(countPlanNumber).ConfigureAwait(false); + if (countPlanDto.RequestType != CountPlanRequestType.Import) + { + throw new UserFriendlyException("非Excel盘点执行方式不能使用导入"); + } + await _repository.DeleteAsync(p => p.CountPlanNumber == countPlanNumber).ConfigureAwait(false); + } + + foreach (var countNote in dataList) + { + countNote.Worker = CurrentUser.GetUserName(); + countNote.CreatorId = CurrentUser.Id; + countNote.BeginTime= DateTime.Now; + countNote.Adjusted = false; + countNote.EndTime=DateTime.Now; + countNote.Stage = EnumCountStage.Audit; + + foreach (var detail in countNote.Details) + { + var locationDto= await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + var itemcBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + + detail.CountLabel =Guid.NewGuid().ToString(); + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup= locationDto.LocationGroupCode; + detail.LocationErpCode= locationDto.ErpLocationCode; + detail.WarehouseCode= locationDto.WarehouseCode; + + detail.ItemCode = itemcBasicDto.Code; + detail.ItemDesc1 = itemcBasicDto.Desc1; + detail.ItemDesc2 = itemcBasicDto.Desc2; + detail.ItemName= itemcBasicDto.Name; + detail.Uom = itemcBasicDto.BasicUom; + } + + resultDictionary.Add(countNote,EntityState.Added); + } + + return resultDictionary; + } + + #endregion + /// /// 新增接口 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs index ebeda8f63..fb83ae1ac 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs @@ -69,7 +69,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Adjusted) .Ignore(X => X.StdPackQty) .Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) - .Ignore(x => x.Status) .Ignore(x => x.SupplierBatch) .Ignore(x => x.ArriveDate) .Ignore(x => x.ProduceDate) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs index 83f622f60..8c4bcb8a4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InspectNotes/InspectNoteAppService.cs @@ -87,4 +87,29 @@ public class InspectNoteAppService : SfsStoreWithDetailsAppServiceBase< return ObjectMapper.Map, List>(inspectNotes); } + + [HttpPost("detail-list/by-to-day")] + public virtual async Task> GetInspectNoteDetailByToDayTaskAsync() + { + var entitys = await _repository.GetListAsync( + p => p.Details.Any( + y => y.InspectDate.Year == DateTime.Now.Year + && y.InspectDate.Month == DateTime.Now.Month + && y.InspectDate.Day == DateTime.Now.Day), true + ).ConfigureAwait(false); + + List list = new List(); + + + foreach (var entity in entitys) + { + list.AddRange(entity.Details.Where(y => y.InspectDate.Year == DateTime.Now.Year + && y.InspectDate.Month == DateTime.Now.Month + && y.InspectDate.Day == DateTime.Now.Day)); + } + + var detailDtos = ObjectMapper.Map, List>(list); + + return detailDtos; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs index ea96420d5..af6df5643 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs @@ -8,7 +8,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -50,9 +52,11 @@ public class IssueNoteAppService : [HttpPost("confirm/{id}")] public virtual async Task ConfirmAsync(Guid id) { - var entity = await _issueNoteManager.ConfirmAsync(id).ConfigureAwait(false); - var dto = ObjectMapper.Map(entity); - return dto; + var issueNote= await _repository.GetAsync(id).ConfigureAwait(false); + issueNote.Confirmed = true; + issueNote=await _repository.UpdateAsync(issueNote).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(issueNote), false).ConfigureAwait(false); + return ObjectMapper.Map(issueNote); } [HttpPost("confirm-by-number/{number}")] diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs index 8180238fa..0d361afa1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs @@ -12,7 +12,7 @@ namespace Win_in.Sfs.Wms.Store.Application; /// 回收料调整记录 /// [Authorize] -[Route($"{StoreConsts.RootPath}item-transfrom-note")] +[Route($"{StoreConsts.RootPath}item-transform-note")] public class ItemTransformNoteAppService : SfsStoreWithDetailsAppServiceBase, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs index c26dee52a..341d1b2ac 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs @@ -22,5 +22,15 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x=>x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAutoMapperProfile.cs index 9cd37feef..cb730c146 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductReceiptNotes/ProductReceiptNoteAutoMapperProfile.cs @@ -11,12 +11,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile { CreateMap() .ReverseMap(); - + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.ProdLine) .ReverseMap(); + CreateMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs index 36e876a07..db384ee8f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs @@ -54,23 +54,6 @@ public class ProductRecycleNoteAppService : return dto; } - /// - /// 新增退货接口 - /// - /// - /// - [HttpPost("create-with-l7")] - public virtual async Task CreateWithL7Async(ProductRecycleNoteEditInput input) - { - var entity = ObjectMapper.Map(input); - - await _productRecycleNoteManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(entity); - - return dto; - } - [HttpGet("note-and-back-flush/{id}")] public virtual async Task GetNoteAndBackFlushAsync(Guid id) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAutoMapperProfile.cs index a0f5bbb51..bed3ee5c7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAutoMapperProfile.cs @@ -13,6 +13,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.NoteAndBackFlushDetails) .ReverseMap(); + CreateMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) @@ -26,6 +28,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile .ForMember(x => x.ProductItemDesc2, y => y.MapFrom(d => d.ItemDesc2)) .ReverseMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs index 302071a0f..35db79092 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs @@ -28,7 +28,7 @@ public class ProductionReturnNoteAppService : } /// - /// 新增接口 + /// 新增实体 /// /// /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAutoMapperProfile.cs index 313efa987..c6731932e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAutoMapperProfile.cs @@ -14,11 +14,21 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap(); + CreateMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x=>x.Remark) + .Ignore(x=>x.ExtraProperties) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs index ad717ec51..ba42b49cf 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs @@ -1,6 +1,11 @@ using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; +using FluentValidation.Validators; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -22,24 +27,54 @@ public class RecycledMaterialReceiptNoteAppService : { private readonly IRecycledMaterialReceiptNoteManager _RecycledMaterialReceiptNoteManager; private readonly ILocationCapacityAppService _locationCapacityAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; public RecycledMaterialReceiptNoteAppService(IRecycledMaterialReceiptNoteRepository repository, IRecycledMaterialReceiptNoteManager RecycledMaterialReceiptNoteManager, - ILocationCapacityAppService locationCapacityAppService) : base(repository) + ILocationCapacityAppService locationCapacityAppService, + ILocationAppService locationAppService, + IItemBasicAppService itemBasicAppService) : base(repository) { _RecycledMaterialReceiptNoteManager = RecycledMaterialReceiptNoteManager; _locationCapacityAppService = locationCapacityAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } + /// + /// 新增实体 + /// + /// CreateInput [HttpPost("")] - //[Authorize(RecycledMaterialReceiptNotePermissions.Create)] public override async Task CreateAsync(RecycledMaterialReceiptNoteEditInput input) { - var entity = ObjectMapper.Map(input); - await _RecycledMaterialReceiptNoteManager.CreateAsync(entity).ConfigureAwait(false); + var entity= ObjectMapper.Map(input); - var dto = ObjectMapper.Map(entity); + entity.Number=string.IsNullOrEmpty(input.Number) + ? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) + .ConfigureAwait(false) + : input.Number; - return dto; + foreach (var detail in entity.Details) + { + var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) + .ConfigureAwait(false); + detail.Number=detailNumber; + var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + detail.LocationErpCode = locationDto.ErpLocationCode; + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup = locationDto.LocationGroupCode; + detail.WarehouseCode=locationDto.WarehouseCode; + var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.StdPackQty = itemBasicDto.StdPackQty; + detail.Uom = itemBasicDto.BasicUom; + } + + entity=await _repository.InsertAsync(entity).ConfigureAwait(false); + + await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData(entity),false).ConfigureAwait(false); + + return ObjectMapper.Map(entity); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs index edd59fb19..35ee6a020 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs @@ -22,5 +22,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap< RecycledMaterialReceiptNoteEditInput,RecycledMaterialReceiptNote > () + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs index 9407d0b7e..2316a0843 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Application.Dtos; using Volo.Abp.EventBus; +using Win_in.Sfs.Basedata.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; @@ -27,9 +28,14 @@ public class ScrapNoteAppService : ScrapNoteDetail, ScrapNoteDetailDTO, SfsStoreRequestInputBase, ScrapNoteImportInput>, IScrapNoteAppService { + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; + public ScrapNoteAppService( - IScrapNoteRepository repository) : base(repository) + IScrapNoteRepository repository, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService) : base(repository) { + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } [HttpPost("")] @@ -42,7 +48,24 @@ public class ScrapNoteAppService : foreach (var detail in entity.Details) { + var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); + detail.FromLocationArea = fromLocation.AreaCode; + detail.FromLocationErpCode = fromLocation.ErpLocationCode; + detail.FromLocationGroup = fromLocation.LocationGroupCode; + detail.FromWarehouseCode = fromLocation.WarehouseCode; + + detail.ToLocationArea = toLocation.AreaCode; + detail.ToLocationErpCode = toLocation.ErpLocationCode; + detail.ToLocationGroup = toLocation.LocationGroupCode; + detail.ToWarehouseCode = toLocation.WarehouseCode; + + detail.ToStatus = detail.FromStatus; + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty = itemBasicDto.StdPackQty; } entity = await _repository.InsertAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs index 1880e6110..0733dd99a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs @@ -21,5 +21,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs new file mode 100644 index 000000000..49dcab912 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +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.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; + +namespace Win_in.Sfs.Wms.Store.Application; + +/// +/// 线边调整记录 +/// +[Authorize] +[Route($"{StoreConsts.RootPath}wip-warehouse-adjust-note")] +public class WipWarehouseAdjustNoteAppService : SfsStoreWithDetailsAppServiceBase + , + IWipWarehouseAdjustNoteAppService +{ + private readonly IWipWarehouseAdjustNoteManager _WipWarehouseAdjustNoteManager; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; + + public WipWarehouseAdjustNoteAppService( + IWipWarehouseAdjustNoteRepository repository, + IWipWarehouseAdjustNoteManager WipWarehouseAdjustNoteManager, + IBalanceAppService balanceAppService, + ILocationAppService locationAppService) : base(repository) + { + _WipWarehouseAdjustNoteManager = WipWarehouseAdjustNoteManager; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; + } + + #region 东阳使用 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var WipWarehouseAdjustNote in addList) + { + if (WipWarehouseAdjustNote.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) //储位内调拨 + { + WipWarehouseAdjustNote.Type = EnumTransSubType.Transfer_Inside.ToString();//重点 需要转换 + foreach (var detail in WipWarehouseAdjustNote.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; + } + } + } + + return dictionary; + } + + /// + /// 确认对应的记录单 + /// + /// + /// + [HttpPost("confirm/{id}")] + public virtual async Task ConfirmAsync(Guid id) + { + var entity = await _WipWarehouseAdjustNoteManager.ConfirmAsync(id).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; + } + + /// + /// 新增实体 + /// + /// CreateInput + [HttpPost("")] + public override async Task CreateAsync(WipWarehouseAdjustNoteEditInput input) + { + var entity = ObjectMapper.Map(input); + + entity=await _WipWarehouseAdjustNoteManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + + return dto; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs new file mode 100644 index 000000000..3d08493f8 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs @@ -0,0 +1,88 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void WipWarehouseAdjustNoteMapperProfile() + { + CreateMap() + .ReverseMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + ; + + CreateMap(); + + CreateMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + .Ignore(x => x.TenantId) + .Ignore(x => x.ConcurrencyStamp) + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ConfirmTime) + .Ignore(x => x.RequestNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.ActiveDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.Details) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.PackingCode)) + .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.PackingCode)) + .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) + .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromLocationArea) + .Ignore(x => x.FromLocationErpCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToLocationErpCode) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.Reason) + .Ignore(x => x.SupplierBatch).Ignore(x => x.ArriveDate).Ignore(x => x.ProduceDate).Ignore(x => x.ExpireDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.ToContainerCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.ToLot) + .Ignore(x => x.StdPackQty) + .Ignore(x => x.Uom) + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs index e386edc0c..5967d9876 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs @@ -3,23 +3,15 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; -using DocumentFormat.OpenXml.Office2010.ExcelAc; -using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; -using Volo.Abp.Uow; -using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; -using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; -using PurchaseOrderDetail = Win_in.Sfs.Wms.Store.Domain.PurchaseOrderDetail; namespace Win_in.Sfs.Wms.Store.Application; @@ -34,7 +26,7 @@ public class PurchaseOrderAppService : private readonly IPurchaseOrderManager _purchaseOrderManager; private readonly ISupplierAppService _supplierAppService; private readonly IItemBasicAppService _itemBasicAppService; - + public PurchaseOrderAppService( IPurchaseOrderRepository repository, IPurchaseOrderManager purchaseOrderManager, @@ -53,30 +45,31 @@ public class PurchaseOrderAppService : #region 东阳使用 /// - /// 用来重写 导入数据时可以加工数据 + /// 用来重写 导入数据时可以加工数据 /// /// /// protected override async Task> ImportProcessingEntityAsync( Dictionary dictionary) { - var addList= dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); foreach (var purchaseOrder in addList) { purchaseOrder.CreatorId = CurrentUser.Id; purchaseOrder.Worker = CurrentUser.Name; - var supplierDto=await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); + var supplierDto = + await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); purchaseOrder.SupplierCode = supplierDto.Code; purchaseOrder.SupplierAddress = supplierDto.Address; - purchaseOrder.SupplierName= supplierDto.Name; + purchaseOrder.SupplierName = supplierDto.Name; foreach (var detail in purchaseOrder.Details) { - var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - detail.ItemName= itemBasicDto.Name; + detail.ItemName = itemBasicDto.Name; detail.ItemDesc1 = itemBasicDto.Desc1; detail.ItemDesc2 = itemBasicDto.Desc2; } @@ -87,10 +80,8 @@ public class PurchaseOrderAppService : #endregion - - /// - /// 【创建】采购订单 + /// 【创建】采购订单 /// /// /// @@ -111,7 +102,7 @@ public class PurchaseOrderAppService : } /// - /// 【批量创建】采购订单 + /// 【批量创建】采购订单 /// /// /// @@ -163,8 +154,6 @@ public class PurchaseOrderAppService : await _repository.UpdateAsync(entity).ConfigureAwait(false); } - #region Function - [HttpPost("complete/{number}")] public async Task CompleteAsync(string number) { @@ -173,9 +162,6 @@ public class PurchaseOrderAppService : } [HttpPost("cancel/{id}")] - - #endregion - [HttpPost("{id}/detail/open/{detailId}")] public virtual async Task OpenDetailAsync(Guid id, Guid detailId) { @@ -188,13 +174,6 @@ public class PurchaseOrderAppService : await _purchaseOrderManager.CloseDetailAsync(id, detailId).ConfigureAwait(false); } - [HttpPost("check-status")] - public virtual async Task CheckStatusAsync(string number) - { - await Task.CompletedTask.ConfigureAwait(false); - throw new NotImplementedException(); - } - [HttpPost("upsert")] public virtual async Task UpsertAsync(PurchaseOrderEditInput input) { @@ -202,6 +181,27 @@ public class PurchaseOrderAppService : await _repository.UpsertAsync(entity).ConfigureAwait(false); } + + [HttpGet("get-list-by-item-code")] + public virtual async Task> GetListByItemCodeAsync(string itemCode) + { + var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode)) + .ConfigureAwait(false); + + var dtos = ObjectMapper.Map, List>(entitys); + + return dtos; + } + + #region 校验 + + [HttpPost("check-status")] + public virtual async Task CheckStatusAsync(string number) + { + await Task.CompletedTask.ConfigureAwait(false); + throw new NotImplementedException(); + } + protected virtual async Task CheckImportInputBusinessAsync(PurchaseOrderImportInput importInput, EnumImportMethod importMethod, List validationRresult) { @@ -231,29 +231,17 @@ public class PurchaseOrderAppService : Check.NotNull(item, "供应商代码", "供应商不存在"); } - protected override async Task GetEntityAsync(PurchaseOrderImportInput importInput) - { - return await _repository.FindAsync(t => t.Number == importInput.Number).ConfigureAwait(false); - } - - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } - - protected override Func GetEntityExpression() - { - return t => t.Number; - } + #endregion - [HttpGet("get-list-by-item-code")] - public virtual async Task> GetListByItemCodeAsync(string itemCode) + [HttpGet("get-list-by-supplier-code-and-item-code")] + public virtual async Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode) { - var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode)) - .ConfigureAwait(false); + var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entitys); return dtos; } + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs index 597a98ee4..de9cea2ea 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs @@ -106,7 +106,7 @@ public class CountPlanAppService : public virtual async Task UpdateByJobAsync(CountPlanEditInput input) { var entity = ObjectMapper.Map(input); - + entity.Number = input.Number; await _countPlanManager.CompleteByJobAsync(entity).ConfigureAwait(false); } @@ -121,23 +121,6 @@ public class CountPlanAppService : await _countPlanManager.CompleteAsync(id, type).ConfigureAwait(false); } - /* - /// - /// 校正库存 - /// - /// - /// - [HttpPost("adjust/{id}")] - public virtual async Task AdjustAsync(Guid id) - { - - var entity = await _repository.FindAsync(id); - Check.NotNull(entity, EntityClassName); - - await _countPlanManager.AdjustAsync(entity); - - } - */ [HttpPost("check-status")] public virtual async Task CheckStatusAsync(string number) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs index 060a9b36a..fbac04195 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs @@ -39,5 +39,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs index b57a4890e..1bf717949 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs @@ -73,7 +73,7 @@ public class SupplierAsnAppService : /// /// 生成ASN订单号 /// - /// + /// /// [HttpPost("generate-supplierasn-number")] public async Task GenerateSupplierAsnNumberAsync(DateTime activeDate) @@ -96,6 +96,15 @@ public class SupplierAsnAppService : await _repository.UpdateAsync(supplierAsn).ConfigureAwait(false); } + [HttpGet("list-for-today")] + public virtual async Task> GetForTodayListAsync() + { + var entities = await _repository.GetListAsync( + p => p.PlanArriveDate.Year == DateTime.Now.Year && p.PlanArriveDate.Month == DateTime.Now.Month && + p.PlanArriveDate.Day == DateTime.Now.Day, true).ConfigureAwait(false); + + return ObjectMapper.Map, List>(entities); + } #endregion diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs index b843bf578..9f4dece77 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -14,15 +15,14 @@ public abstract class CountAdjustRequestAppService : , ICountAdjustRequestAppService { - private readonly ICountAdjustRequestManager _CountAdjustRequestManager; + private readonly ICountAdjustRequestManager _countAdjustRequestManager; public CountAdjustRequestAppService( ICountAdjustRequestRepository repository, - ICountAdjustRequestManager CountAdjustRequestManager + ICountAdjustRequestManager countAdjustRequestManager - ) : base(repository, CountAdjustRequestManager) + ) : base(repository, countAdjustRequestManager) { - _CountAdjustRequestManager = CountAdjustRequestManager; + _countAdjustRequestManager = countAdjustRequestManager; } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 1f2a8185c..9f59ab043 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; using Win_in.Sfs.Basedata.Application.Contracts; @@ -29,7 +30,6 @@ public class DeliverRequestAppService : { private readonly IDeliverRequestManager _deliverRequestManager; private readonly IAreaAppService _areaApp; - private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; @@ -46,6 +46,7 @@ public class DeliverRequestAppService : _customerApp = customerApp; _customerAddressApp = customerAddressApp; } + [HttpPost("list")] public override Task> GetPagedListByFilterAsync( SfsStoreRequestInputBase sfsRequestInput, @@ -58,6 +59,23 @@ public class DeliverRequestAppService : return base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken); } + /// + /// 【创建】发货申请 + /// + /// + /// + [HttpPost("")] + //[Authorize(DeliverRequestPermissions.Create)] + public override async Task CreateAsync(DeliverRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + #region import protected virtual async Task CheckImportInputBusinessAsync( DeliverRequestImportInput importInput diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs index 63ee8239c..4b0e04202 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs @@ -17,6 +17,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .ReverseMap(); + CreateMap(); + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) @@ -24,6 +26,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Number) .Ignore(x => x.Id); + CreateMap() .ForMember(x => x.DeliverRequestType, y => y.MapFrom(t => EnumDeliverRequestType.Normal)) .Ignore(x => x.CustomerAddressCode) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs index 84975add6..484fe8dfb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Data; @@ -32,22 +33,97 @@ public class DeliverRequestFisAppService : private readonly IAreaAppService _areaApp; private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; + private readonly ITransactionTypeAppService _transactionTypeAppService; + private readonly IBalanceAppService _balanceAppService; + private readonly IItemBasicAppService _itemBasicAppService; public DeliverRequestFisAppService( IDeliverRequestRepository repository, - IDeliverRequestManager DeliverRequestManager, + IDeliverRequestManager deliverRequestManager, IAreaAppService areaApp, ICustomerAppService customerApp, - ICustomerAddressAppService customerAddressApp - ) - : base(repository, DeliverRequestManager) + ICustomerAddressAppService customerAddressApp, + ITransactionTypeAppService transactionTypeAppService, + IBalanceAppService balanceAppService, + IItemBasicAppService itemBasicAppService) + : base(repository, deliverRequestManager) { - _deliverRequestManager = DeliverRequestManager; + _deliverRequestManager = deliverRequestManager; _areaApp = areaApp; _customerApp = customerApp; _customerAddressApp = customerAddressApp; + _transactionTypeAppService = transactionTypeAppService; + _balanceAppService = balanceAppService; + _itemBasicAppService = itemBasicAppService; } + #region 东阳 + + private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.Deliver_FIS).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + entity.DeliverRequestType = EnumDeliverRequestType.FIS; + } + + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var itemTransformRequest in addList) + { + itemTransformRequest.Worker = CurrentUser.GetUserName(); + itemTransformRequest.CreatorId = CurrentUser.Id; + itemTransformRequest.DeliverRequestType = EnumDeliverRequestType.FIS; + await SetRequestAutoPropertiesAsync(itemTransformRequest).ConfigureAwait(false); + foreach (var detail in itemTransformRequest.Details) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var transactionType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Deliver, + EnumTransSubType.Deliver_FIS) + .ConfigureAwait(false); + + var balances = await _balanceAppService.GetRecommendBalancesAsync( + new RecommendBalanceRequestInput() + { + ItemCode = itemBasicDto.Code, + Qty = detail.Qty, + LocationTypes = transactionType.OutLocationTypes, + LocationAreas = new List() { detail.AreaCode }, + Statuses = transactionType.OutInventoryStatuses + }).ConfigureAwait(false); + + var balanceSumQty = balances.Sum(t => t.Qty); + + if (balanceSumQty < detail.Qty) + { + throw new UserFriendlyException($"物料号 {detail.ItemCode} " + + $"在库位类型 {transactionType.OutLocationTypes.JoinAsString(",")}," + + $"库区 {detail.AreaCode} " + + $"状态 {transactionType.OutInventoryStatuses.JoinAsString(",")}" + + $"库存余额 {balanceSumQty} 小于 {detail.Qty}。"); + } + + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2 = itemBasicDto.Desc2; + detail.ItemName = itemBasicDto.Name; + detail.Uom = itemBasicDto.BasicUom; + + } + } + + return dictionary; + } + + #endregion + [HttpPost("list")] public override Task> GetPagedListByFilterAsync( SfsStoreRequestInputBase sfsRequestInput, @@ -55,11 +131,29 @@ public class DeliverRequestFisAppService : CancellationToken cancellationToken = default) { sfsRequestInput.Condition.Filters.Add( - new Filter(nameof(DeliverRequest.DeliverRequestType), "2")); + new Filter(nameof(DeliverRequest.DeliverRequestType), "FIS")); return base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken); } + + /// + /// 【创建】发货申请 + /// + /// + /// + [HttpPost("")] + //[Authorize(DeliverRequestPermissions.Create)] + public override async Task CreateAsync(DeliverRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + #region import protected virtual async Task CheckImportInputBusinessAsync( @@ -267,19 +361,7 @@ public class DeliverRequestFisAppService : await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); } - private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.Deliver_FIS).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - entity.DeliverRequestType = EnumDeliverRequestType.FIS; - } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs index a0479d957..647f38610 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs @@ -6,10 +6,13 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Win_in.Sfs.Label.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; @@ -20,7 +23,7 @@ namespace Win_in.Sfs.Wms.Store.Application; /// 回收料调整申请 /// [Authorize] -[Route($"{StoreConsts.RootPath}item-transfrom-request")] +[Route($"{StoreConsts.RootPath}item-transform-request")] public class ItemTransformRequestAppService : SfsStoreRequestAppServiceBase, IItemTransformRequestAppService @@ -29,14 +32,17 @@ public class ItemTransformRequestAppService : private readonly IItemTransformRequestManager _manager; private readonly IInventoryLabelAppService _inventoryLabelAppService; + private readonly IBalanceAppService _balanceAppService; public ItemTransformRequestAppService( - IItemTransformRequestRepository repository - , IItemTransformRequestManager manager, - IInventoryLabelAppService inventoryLabelAppService) : base(repository, manager) + IItemTransformRequestRepository repository, + IItemTransformRequestManager manager, + IInventoryLabelAppService inventoryLabelAppService, + IBalanceAppService balanceAppService) : base(repository, manager) { _manager = manager; _inventoryLabelAppService = inventoryLabelAppService; + _balanceAppService = balanceAppService; } /// @@ -57,6 +63,52 @@ public class ItemTransformRequestAppService : return dto; } + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var itemTransformRequest in addList) + { + itemTransformRequest.Worker = CurrentUser.GetUserName(); + itemTransformRequest.CreatorId = CurrentUser.Id; + foreach (var detail in itemTransformRequest.Details) + { + var fromLocationDto= await LocationAclService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocationDto= await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var itemBasicDto=await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var balanceDto= await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, + detail.FromLocationCode).ConfigureAwait(false); + + detail.FromLocationArea = fromLocationDto.AreaCode; + detail.FromLocationErpCode = fromLocationDto.ErpLocationCode; + detail.FromLocationGroup = fromLocationDto.LocationGroupCode; + detail.FromWarehouseCode = fromLocationDto.WarehouseCode; + + detail.FromSupplierBatch = balanceDto.SupplierBatch; + detail.FromLot = balanceDto.Lot; + detail.FromStatus = balanceDto.Status; + + detail.ToSupplierBatch = string.Empty; + detail.ToLot = balanceDto.Lot; + detail.ToStatus = balanceDto.Status; + + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2= itemBasicDto.Desc2; + detail.ItemName= itemBasicDto.Name; + detail.Uom = itemBasicDto.BasicUom; + } + } + + return dictionary; + + + } + protected virtual async Task ImportDataAsync(List entites, List deleteEntities) { await _manager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); 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 6f80a9d45..7a3ddd00b 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 @@ -5,14 +5,19 @@ using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using IdentityModel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -37,7 +42,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase HandleAsync(Guid id) + { + var entity=await _repository.GetAsync(id).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false).ConfigureAwait(false); + return ObjectMapper.Map(entity); } #endregion @@ -158,19 +172,35 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase(input); + foreach (var detail in entity.Details) + { + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false); + + detail.ToLocationArea= toLocationDto.AreaCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToWarehouseCode= toLocationDto.WarehouseCode; + } + + entity.UseOnTheWayLocation = true; var result = await _materialRequestManager.CreateBynNumberAsync(entity).ConfigureAwait(false); @@ -360,7 +390,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase CheckItemBasicAsync(MaterialRequestImportInput importInput, List validationRresult) { - var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); + var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); if (item == null) { validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" })); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs index 5a388cefe..f6c44ac51 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs @@ -6,12 +6,14 @@ using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using DocumentFormat.OpenXml.Office.CustomUI; +using FluentValidation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; +using Volo.Abp.Validation; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -84,7 +86,6 @@ public class ProductReceiptRequestAppService : /// 赋值详情 /// /// - /// /// private async Task SetDetailPropertiesAsync(ProductReceiptRequestDetail detail) { @@ -176,7 +177,12 @@ public class ProductReceiptRequestAppService : bool includeDetails = false, CancellationToken cancellationToken = default) { - Expression> expression = p => p.Type.ToString() == type; + if (!EnumProductReceiptType.TryParse(type, true, out EnumProductReceiptType enumType)) + { + throw new AbpValidationException($"type {type} is not valid"); + } + + Expression> expression = p => p.Type == enumType; if (requestInput.Condition.Filters?.Count > 0) { expression = expression.And(requestInput.Condition.Filters.ToLambda()); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAutoMapperProfile.cs index 1aa818d21..c68a16c19 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAutoMapperProfile.cs @@ -15,6 +15,9 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .ReverseMap(); + CreateMap(); + + CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.MasterID) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs index c974a01d1..9275973f6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -17,6 +18,7 @@ namespace Win_in.Sfs.Wms.Store.Application; using System.ComponentModel.DataAnnotations; using Volo.Abp.Data; +using Volo.Abp.Domain.Entities; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -27,23 +29,34 @@ using Win_in.Sfs.Wms.Inventory.Application.Contracts; [Route($"{StoreConsts.RootPath}product-recycle-request")] public class ProductRecycleRequestAppService : - SfsStoreRequestAppServiceBase, + SfsStoreRequestAppServiceBase, IProductRecycleRequestAppService { private readonly IProductRecycleRequestManager _productRecycleRequestManager; private readonly IBomAppService _bomApp; private readonly IItemStoreRelationAppService _itemStoreRelationApp; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; + private readonly ITransactionTypeAppService _transactionTypeAppService; public ProductRecycleRequestAppService( IProductRecycleRequestRepository repository, IProductRecycleRequestManager productRecycleRequestManager, IBomAppService bomApp, - IItemStoreRelationAppService itemStoreRelationApp) + IItemStoreRelationAppService itemStoreRelationApp, + ILocationAppService locationAppService, + IBalanceAppService balanceAppService, + ITransactionTypeAppService transactionTypeAppService) : base(repository, productRecycleRequestManager) { _productRecycleRequestManager = productRecycleRequestManager; _bomApp = bomApp; _itemStoreRelationApp = itemStoreRelationApp; + _locationAppService = locationAppService; + _balanceAppService = balanceAppService; + _transactionTypeAppService = transactionTypeAppService; base.CreatePolicyName = ProductRecycleRequestPermissions.Create; base.UpdatePolicyName = ProductRecycleRequestPermissions.Update; @@ -75,6 +88,100 @@ public class ProductRecycleRequestAppService : throw new NotImplementedException(); } + #region 东阳 + + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var productRecycleRequest in addList) + { + await SetRequestAutoPropertiesAsync(productRecycleRequest) + .ConfigureAwait(false); + productRecycleRequest.Worker = CurrentUser.GetUserName(); + + foreach (var detail in productRecycleRequest.Details) + { + var balance = await _balanceAppService.GetByItemLocationAndPackingAsync( + string.Empty, + detail.ItemCode, + detail.LocationCode).ConfigureAwait(false); + + if (balance != null) + { + detail.Status = balance.Status; + } + + var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode) + .ConfigureAwait(false); + + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); + } + } + + return dictionary; + } + + private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) + { + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.ProductRecycle, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + private async Task SetDetailPropertiesAsync( + ProductRecycleRequestDetail detail) + { + 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.Uom = item.BasicUom; + detail.Qty = detail.Qty; + } + + var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + + if (location != null) + { + detail.LocationErpCode = location.ErpLocationCode; + detail.WarehouseCode = location.WarehouseCode; + detail.LocationGroup = location.LocationGroupCode; + detail.LocationArea = location.AreaCode; + } + + var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); + + if (rawLocation != null) + { + detail.RawLocationErpCode = rawLocation.ErpLocationCode; + detail.RawWarehouseCode = rawLocation.WarehouseCode; + detail.RawLocationArea = rawLocation.AreaCode; + detail.RawLocationGroup = rawLocation.LocationGroupCode; + } + + var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( + string.Empty, + detail.ItemCode, + detail.LocationCode).ConfigureAwait(false); + + if (balance != null) + { + detail.Status = balance.Status; + } + } + + #endregion + #region Import protected virtual async Task CheckImportInputBusinessAsync(ProductRecycleRequestImportInput importInput, EnumImportMethod importMethod, List validationRresult) @@ -202,147 +309,6 @@ public class ProductRecycleRequestAppService : return boms; } - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _productRecycleRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } - - 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) - { - 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).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); - - detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); - - await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false); - entity.AddDetail(detail); - } - - entites.Add(entity); - } - } - - return (entites, deleteEntites); - } - - private async Task SetDetailPropertiesAsync( - ProductRecycleRequestDetail detail, - ProductRecycleRequestImportInput input) - { - 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.Qty = input.Qty; - } - - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - } - - var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); - - if (rawLocation != null) - { - detail.RawLocationErpCode = rawLocation.ErpLocationCode; - detail.RawWarehouseCode = rawLocation.WarehouseCode; - } - - var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( - string.Empty, - detail.ItemCode, - input.LocationCode).ConfigureAwait(false); - - if (balance != null) - { - detail.Status = balance.Status; - } - - detail.SetProperty(nameof(input.PreStartTime), input.PreStartTime); - detail.SetProperty(nameof(input.WorkHour), input.WorkHour); - } - - private async Task SetEntityPropertiesAsync(ProductRecycleRequest entity, ProductRecycleRequestImportInput input) - { - entity.Worker = CurrentUser.GetUserName(); - - await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); - } - - private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.ProductRecycle, EnumTransSubType.None).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } - #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAutoMapperProfile.cs index 35735aaff..5f5d91fbe 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAutoMapperProfile.cs @@ -23,6 +23,9 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Number) .Ignore(x => x.Id); + CreateMap(); + + CreateMap(); CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs index a45dc5677..2b7f6a0d5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -27,22 +28,76 @@ public class ProductionReturnRequestAppService : IProductionReturnRequestAppService { private readonly IProductionReturnRequestManager _productionReturnRequestManager; - private readonly IItemStoreRelationAppService _itemStoreRelationApp; - private readonly IPurchaseOrderAppService _purchaseOrderApp; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ILocationAppService _locationAppService; public ProductionReturnRequestAppService( IProductionReturnRequestRepository repository, IProductionReturnRequestManager productionRequestReturnManager, IItemStoreRelationAppService itemStoreRelationApp, - IPurchaseOrderAppService purchaseOrderApp - ) + IPurchaseOrderAppService purchaseOrderApp, + IItemBasicAppService itemBasicAppService, + ILocationAppService locationAppService) : base(repository, productionRequestReturnManager) { _productionReturnRequestManager = productionRequestReturnManager; _itemStoreRelationApp = itemStoreRelationApp; _purchaseOrderApp = purchaseOrderApp; + _itemBasicAppService = itemBasicAppService; + _locationAppService = locationAppService; + } + + /// + /// 【创建】生成退料申请 + /// + /// + /// + [HttpPost("")] + //[Authorize(ProductionReturnRequestPermissions.Create)] + public override async Task CreateAsync(ProductionReturnRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _productionReturnRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var productionReturnRequest in addList) + { + productionReturnRequest.Worker = CurrentUser.GetUserName(); + productionReturnRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(productionReturnRequest).ConfigureAwait(false); + foreach (var detail in productionReturnRequest.Details) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty=itemBasicDto.StdPackQty; + + var fromLocationDto= await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + + detail.FromLocationArea = fromLocationDto.AreaCode; + detail.FromWarehouseCode = fromLocationDto.WarehouseCode; + detail.FromLocationGroup = fromLocationDto.LocationGroupCode; + detail.FromLocationErpCode= fromLocationDto.ErpLocationCode; + + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + } + } + + return dictionary; } #region import diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs index 8f26ca256..18c6c170f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs @@ -16,9 +16,10 @@ public partial class StoreApplicationAutoMapperProfile : Profile .IgnoreAuditedObjectProperties() .ReverseMap(); - CreateMap() + CreateMap(); + + CreateMap() .IgnoreAuditedObjectProperties() - .Ignore(x => x.ToWarehouseCode) .Ignore(x => x.MasterID) .Ignore(x => x.TenantId) .Ignore(x => x.Number) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs index 11691171d..d07e428e6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs @@ -55,6 +55,23 @@ public class PurchaseReturnRequestAppService : base.DeletePolicyName = PurchaseReturnRequestPermissions.Delete; } + /// + /// 【创建】采购退货申请 + /// + /// + /// + [HttpPost("")] + //[Authorize(PurchaseReturnRequestPermissions.Create)] + public override async Task CreateAsync(PurchaseReturnRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _purchaseReturnRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + [HttpPost("check-status")] public virtual async Task CheckStatusAsync(string number) { @@ -114,8 +131,10 @@ public class PurchaseReturnRequestAppService : /// /// 赋值详情 /// + /// /// /// + /// /// private async Task SetDetailPropertiesAsync( PurchaseReturnRequestDetail detail, @@ -251,7 +270,7 @@ public class PurchaseReturnRequestAppService : /// /// /// - /// + /// /// /// private static void CheckTransactionType( diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs index be7623764..d23d8c20f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs @@ -70,20 +70,22 @@ public class ScrapRequestAppService : SfsStoreRequestAppServiceBase scrapRequest.Type = scrapRequest.Type; EnumTransSubType enumTransSubType = 0; - if (scrapRequest.Type == "原料报废") { enumTransSubType = EnumTransSubType.Scrap_Manual; + scrapRequest.Type = EnumTransSubType.Scrap_Manual.ToString(); } if (scrapRequest.Type== "线边报废") { enumTransSubType = EnumTransSubType.Scrap_WIP; + scrapRequest.Type = EnumTransSubType.Scrap_WIP.ToString(); } if (scrapRequest.Type == "完工报废") { enumTransSubType = EnumTransSubType.Scrap_Product; + scrapRequest.Type= EnumTransSubType.Scrap_Product.ToString(); } await SetEntityPropertiesAsync(scrapRequest, enumTransSubType).ConfigureAwait(false); 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 409de9b89..c0b214534 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 @@ -64,54 +64,87 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase foreach (var transferRequest in addList) { - if (transferRequest.Type == EnumTransSubType.Transfer_Customer.GetDisplayName()) //客户储位调拨 + EnumTransSubType enumTransSubType = EnumTransSubType.None; + + //储位 + if (transferRequest.Type == EnumTransSubType.Transfer_Area.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_Area.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Area; + transferRequest.UseOnTheWayLocation = false; + } + //储位内 + if (transferRequest.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_Inside.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Inside; + transferRequest.UseOnTheWayLocation = false; + } + + //库间 + if (transferRequest.Type == EnumTransSubType.Transfer_Warehouse.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_Warehouse.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Warehouse; + transferRequest.UseOnTheWayLocation = true; + } + //客户储位 + if (transferRequest.Type == EnumTransSubType.Transfer_Customer.GetDisplayName()) { transferRequest.Type = EnumTransSubType.Transfer_Customer.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Customer; + transferRequest.UseOnTheWayLocation = true; + } + //线边调拨 + if (transferRequest.Type == EnumTransSubType.Transfer_WIP.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_WIP.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_WIP; 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) + 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 = detail.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) + .ConfigureAwait(false); } return dictionary; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestAppService.cs index 7fadffaf6..34086c0b9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestAppService.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -25,4 +26,21 @@ public abstract class UnplannedIssueRequestAppService : _unplannedIssueRequestManager = unplannedIssueRequestManager; } + /// + /// 【创建】计划外出库申请 + /// + /// + /// + [HttpPost("")] + //[Authorize(UnplannedIssueRequestPermissions.Create)] + public override async Task CreateAsync(UnplannedIssueRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _unplannedIssueRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs index a55992254..77e876b6f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs @@ -20,16 +20,189 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA { private readonly IDepartmentAppService _departmentApp; private readonly IUnplannedIssueRequestManager _unplannedIssueRequestManager; + private readonly IBalanceAppService _balanceAppService; + private readonly IDepartmentAppService _departmentAppService; public UnplannedIssueRequestForDongyangAppService(IUnplannedIssueRequestRepository repository, IUnplannedIssueRequestManager unplannedIssueRequestManager, - IDepartmentAppService departmentApp - ) : base(repository, unplannedIssueRequestManager) + IDepartmentAppService departmentApp, IBalanceAppService balanceAppService, IDepartmentAppService departmentAppService) : base(repository, unplannedIssueRequestManager) { _unplannedIssueRequestManager = unplannedIssueRequestManager; _departmentApp = departmentApp; + _balanceAppService = balanceAppService; + _departmentAppService = departmentAppService; } + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var unplannedIssueRequest in addList) + { + unplannedIssueRequest.Worker = CurrentUser.GetUserName(); + unplannedIssueRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + await SetEntityPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + + foreach (var detail in unplannedIssueRequest.Details) + { + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); + } + } + + return dictionary; + } + + #region 赋值 + + /// + /// 赋值详情 + /// + /// + /// + private async Task SetDetailPropertiesAsync(UnplannedIssueRequestDetail detail) + { + var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + if (itemBasic != null) + { + detail.ItemCode = itemBasic.Code; + detail.ItemName = itemBasic.Name; + detail.ItemDesc1 = itemBasic.Desc1; + detail.ItemDesc2 = itemBasic.Desc2; + + detail.StdPackQty = itemBasic.StdPackQty; + detail.Uom = itemBasic.BasicUom; + } + + var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + + if (location != null) + { + detail.WarehouseCode = location.WarehouseCode; + detail.LocationErpCode = location.ErpLocationCode; + detail.LocationGroup = location.LocationGroupCode; + detail.LocationArea = location.AreaCode; + detail.LocationCode = location.Code; + } + + var balance = await _balanceAppService.GetByItemLocationAndPackingAsync( + string.Empty, + detail.ItemCode, + detail.LocationCode).ConfigureAwait(false); + + if (balance != null) + { + detail.SupplierBatch = balance.SupplierBatch; + detail.ArriveDate = balance.ArriveDate; + detail.ProduceDate = balance.ProduceDate; + detail.ExpireDate = balance.ExpireDate; + + detail.Lot = balance.Lot; + detail.ContainerCode = balance.ContainerCode; + detail.PackingCode = balance.PackingCode; + detail.Qty = detail.Qty; + detail.Status = balance.Status; + } + + //if (!string.IsNullOrEmpty(detail)) + //{ + // var dict = await DictAppService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); + + // 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 DictAppService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); + + // 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 DictAppService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); + + // 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(UnplannedIssueRequest entity) + { + var userName = CurrentUser.GetUserName(); + + var department = await _departmentAppService.GetByUsernameAsync(userName).ConfigureAwait(false); + + if (department != null) + { + entity.DeptCode = department.Code; + entity.DeptName = department.Name; + } + + entity.Worker = userName; + + entity.BuildDate = DateTime.Now; + + await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); + } + + /// + /// 赋值业务事务 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(UnplannedIssueRequest entity) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedIssue, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + #endregion + + #region 校验 + protected async Task CheckBalanceAsync(UnplannedIssueRequestImportInput importInput, List validationRresult) { var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( @@ -155,127 +328,5 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA } } - protected override Func GetEntityExpression() - { - return p => (1); - } - - protected override async Task ValidateImportEntityAsync(UnplannedIssueRequestImportInput input, UnplannedIssueRequest entity, List validationRresult) - { - foreach (var detail in entity.Details) - { - var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - - if (itemBasic != null) - { - detail.ItemName = itemBasic.Name; - detail.ItemDesc1 = itemBasic.Desc1; - detail.ItemDesc2 = itemBasic.Desc2; - detail.StdPackQty = itemBasic.StdPackQty; - } - - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - } - - // var balance = await this._balanceApp.GetByPackingCodeAsync(input.PackingCode); - - var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( - string.Empty, - input.ItemCode, - input.LocationCode).ConfigureAwait(false); - - if (balance != null) - { - detail.SupplierBatch = balance.SupplierBatch; - detail.ArriveDate = balance.ArriveDate; - detail.ProduceDate = balance.ProduceDate; - detail.ExpireDate = balance.ExpireDate; - detail.Lot = balance.Lot; - detail.ContainerCode = balance.ContainerCode; - detail.PackingCode = balance.PackingCode; - detail.Qty = input.Qty; - detail.Status = balance.Status; - } - - if (!string.IsNullOrEmpty(input.OnceBusiCode)) - { - var dict = await DictAppService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); - - 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 DictAppService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); - - 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 DictAppService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); - - 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); - } - } - } - } - - protected override async Task ValidateImportEntities(Dictionary dicts) - { - foreach (var entity in dicts.Keys) - { - var userName = CurrentUser.GetUserName(); - - var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); - - if (department != null) - { - entity.DeptCode = department.Code; - entity.DeptName = department.Name; - } - - entity.Worker = userName; - - entity.BuildDate = DateTime.Now; - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedIssue, EnumTransSubType.None).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } - return await base.ValidateImportEntities(dicts).ConfigureAwait(false); - } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAppService.cs index 09a40d0b4..bd52a2e00 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAppService.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -23,4 +24,21 @@ public abstract class UnplannedReceiptRequestAppService : _unplannedReceiptRequestManager = unplannedReceiptRequestManager; } + /// + /// 【创建】计划外入库申请 + /// + /// + /// + [HttpPost("")] + //[Authorize(UnplannedReceiptRequestPermissions.Create)] + public override async Task CreateAsync(UnplannedReceiptRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _unplannedReceiptRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs index d48b11807..078029270 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs @@ -59,6 +59,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.ContainerCode) .Ignore(x => x.Lot) .Ignore(x => x.Status) - .Ignore(x => x.Number); + .Ignore(x => x.Number) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs index e69792f7b..b4e3d4656 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; - +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Data; using Win_in.Sfs.Auth.Application.Contracts; @@ -29,75 +29,160 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ _departmentApp = departmentApp; } - protected virtual async Task<(List entites, List deleteEntities)> BuildImportDataAsync(ImportResult importResult, EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false) + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) { - if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var unplannedIssueRequest in addList) { - if (!isAllowPartImport) + unplannedIssueRequest.Worker = CurrentUser.GetUserName(); + unplannedIssueRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + await SetEntityPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + + foreach (var detail in unplannedIssueRequest.Details) { - return (null, null); + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); } } - var entites = new List(); + return dictionary; + } - var details = new List(); + #region 赋值 - var deleteEntites = new List(); + /// + /// 赋值详情 + /// + /// + /// + private async Task SetDetailPropertiesAsync(UnplannedReceiptRequestDetail detail) + { + var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - var entityExpression = GetEntityExpression(); + if (itemBasic != null) + { + detail.ItemName = itemBasic.Name; + detail.ItemDesc1 = itemBasic.Desc1; + detail.ItemDesc2 = itemBasic.Desc2; + detail.StdPackQty = itemBasic.StdPackQty; + detail.Uom = itemBasic.BasicUom; + } - var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList(); + var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - foreach (var group in groupList) + if (location != null) { - var input = group.FirstOrDefault(); + detail.LocationErpCode = location.ErpLocationCode; + detail.WarehouseCode = location.WarehouseCode; + detail.LocationArea = location.AreaCode; + detail.LocationGroup = location.LocationGroupCode; + } - var inputDetails = group.ToList(); + detail.Lot = string.Empty; + detail.ContainerCode = string.Empty; + detail.PackingCode = string.Empty; + detail.Status = EnumInventoryStatus.OK; - if (!inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - var exist = await GetEntityAsync(input).ConfigureAwait(false); + //if (!string.IsNullOrEmpty(detail.OnceBusiCode)) + //{ + // var dict = await DictAclService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); - var entity = ObjectMapper.Map(input); + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.OnceBusiCode); - await SetEntityPropertiesAsync(entity, input).ConfigureAwait(false); + // Check.NotNull(item, "次交易码", "次交易码不存在"); - switch (importMethod) - { - case EnumImportMethod.Update: - if (exist != null) - { - entity.SetId(exist.Id); - } - break; - - case EnumImportMethod.Replace: - if (exist != null) - { - deleteEntites.Add(exist); - } - break; - } + // detail.SetProperty("OnceBusiCode", item.Code); + // detail.SetProperty("OnceBusiName", item.Name); + // } + //} - foreach (var inputDetail in inputDetails) - { - var detail = ObjectMapper.Map(inputDetail); + //if (!string.IsNullOrEmpty(input.CaseCode)) + //{ + // var dict = await DictAclService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); - detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.CaseCode); - await SetDetailPropertiesAsync(detail, inputDetail).ConfigureAwait(false); - entity.AddDetail(detail); - } + // Check.NotNull(item, "专案代码", "专案代码不存在"); - entites.Add(entity); - } + // detail.SetProperty("CaseCode", item.Code); + // detail.SetProperty("CaseName", item.Name); + // } + //} + + //if (!string.IsNullOrEmpty(input.ProjCapacityCode)) + //{ + // var dict = await DictAclService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); + + // 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(UnplannedReceiptRequest entity) + { + var userName = CurrentUser.GetUserName(); + + var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); + + if (department != null) + { + entity.DeptCode = department.Code; + entity.DeptName = department.Name; } - return (entites, deleteEntites); + entity.Worker = userName; + + entity.BuildDate = DateTime.Now; + + await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); } - protected async Task CheckBalanceAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + /// + /// 赋值业务事务 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(UnplannedReceiptRequest entity) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedReceipt, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + #endregion + + #region 校验 + + protected virtual async Task CheckBalanceAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( string.Empty, @@ -118,7 +203,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return balance; } - protected async Task CheckCaseCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + protected virtual async Task CheckCaseCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { if (!string.IsNullOrEmpty(importInput.CaseCode)) { @@ -161,7 +246,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ //} } - protected async Task CheckItemBasicAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + protected virtual async Task CheckItemBasicAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); if (item == null) @@ -176,7 +261,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return item; } - protected async Task CheckLocationAsync(string locationCode, List validationRresult) + protected virtual async Task CheckLocationAsync(string locationCode, List validationRresult) { var location = await LocationAclService.GetByCodeAsync(locationCode).ConfigureAwait(false); if (location == null) @@ -186,7 +271,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return location; } - protected async Task CheckOnceBusiCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + protected virtual async Task CheckOnceBusiCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { if (!string.IsNullOrEmpty(importInput.OnceBusiCode)) { @@ -208,7 +293,8 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ } } } - protected async Task CheckProjCapacityCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + + protected virtual async Task CheckProjCapacityCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { var dict = await DictAclService.GetByCodeAsync(nameof(importInput.ProjCapacityCode)).ConfigureAwait(false); if (dict == null) @@ -227,7 +313,8 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ } } } - protected async Task CheckTransactionTypeAsync(EnumTransType enumTransType, List validationRresult) + + protected virtual async Task CheckTransactionTypeAsync(EnumTransType enumTransType, List validationRresult) { var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(enumTransType, EnumTransSubType.None).ConfigureAwait(false); if (transactionType == null) @@ -237,116 +324,5 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return transactionType; } - protected override Func GetEntityExpression() - { - return p => (1); - } - - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _unplannedReceiptRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } - private async Task SetDetailPropertiesAsync(UnplannedReceiptRequestDetail detail, UnplannedReceiptRequestImportInput input) - { - var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - - if (itemBasic != null) - { - detail.ItemName = itemBasic.Name; - detail.ItemDesc1 = itemBasic.Desc1; - detail.ItemDesc2 = itemBasic.Desc2; - detail.StdPackQty = itemBasic.StdPackQty; - } - - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - detail.Lot = string.Empty; - detail.ContainerCode = string.Empty; - } - - detail.PackingCode = string.Empty; - - detail.Status = EnumInventoryStatus.OK; - - if (!string.IsNullOrEmpty(input.OnceBusiCode)) - { - var dict = await DictAclService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); - - 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 DictAclService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); - - 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 DictAclService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); - - 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(UnplannedReceiptRequest entity, UnplannedReceiptRequestImportInput input) - { - var userName = CurrentUser.GetUserName(); - - var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); - - if (department != null) - { - entity.DeptCode = department.Code; - entity.DeptName = department.Name; - } - - entity.Worker = userName; - - entity.BuildDate = DateTime.Now; - - await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); - } - - private async Task SetRequestAutoPropertiesAsync(UnplannedReceiptRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedReceipt, EnumTransSubType.None).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs new file mode 100644 index 000000000..5b0d6f098 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +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 Volo.Abp.Domain.Entities; +using Volo.Abp.ObjectMapping; +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; + +namespace Win_in.Sfs.Wms.Store.Application; + +/// +/// 调拨转移记录 +/// +[Authorize] +[Route($"{StoreConsts.RootPath}wip-warehouse-adjust-request")] +public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase + , + IWipWarehouseAdjustRequestAppService +{ + private readonly IWipWarehouseAdjustRequestManager _WipWarehouseAdjustRequestManager; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; + + public WipWarehouseAdjustRequestAppService( + IWipWarehouseAdjustRequestRepository repository, + IWipWarehouseAdjustRequestManager WipWarehouseAdjustRequestManager, + IBalanceAppService balanceAppService, + ILocationAppService locationAppService, + IItemBasicAppService itemBasicAppService) : base(repository, WipWarehouseAdjustRequestManager) + { + _WipWarehouseAdjustRequestManager = WipWarehouseAdjustRequestManager; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; + } + + #region 东阳使用 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var WipWarehouseAdjustRequest in addList) + { + WipWarehouseAdjustRequest.Worker = CurrentUser.GetUserName(); + WipWarehouseAdjustRequest.CreatorId = CurrentUser.Id; + + await SetEntityPropertiesAsync(WipWarehouseAdjustRequest, EnumTransSubType.CountAdjust_WIP).ConfigureAwait(false); + foreach (var detail in WipWarehouseAdjustRequest.Details) + { + detail.ToLocationCode = detail.FromLocationCode;//调整库位一致 + + var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) + .ConfigureAwait(false); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) + .ConfigureAwait(false); + + detail.ItemCode = itemBasicDto.Code; + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2 = itemBasicDto.Desc2; + detail.ItemName = itemBasicDto.Name; + + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty = itemBasicDto.StdPackQty; + + detail.Qty = detail.Qty; + + detail.FromLocationErpCode = fromLocationDto.ErpLocationCode; + detail.FromLocationGroup = fromLocationDto.LocationGroupCode; + detail.FromLocationArea = fromLocationDto.AreaCode; + detail.FromWarehouseCode = fromLocationDto.WarehouseCode; + + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + + detail.FromPackingCode = string.Empty; + detail.FromContainerCode = string.Empty; + detail.ToPackingCode = string.Empty; + detail.ToContainerCode = string.Empty; + detail.FromStatus = EnumInventoryStatus.OK; + detail.ToStatus = EnumInventoryStatus.OK; + detail.FromLot = string.Empty; + detail.ToLot = string.Empty; + } + } + + return dictionary; + } + + private async Task SetEntityPropertiesAsync(WipWarehouseAdjustRequest entity, EnumTransSubType subType) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Adjust, subType) + .ConfigureAwait(false); + entity.Worker = CurrentUser.GetUserName(); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + /// + /// 新增实体 + /// + /// CreateInput + [HttpPost("")] + public override async Task CreateAsync(WipWarehouseAdjustRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _WipWarehouseAdjustRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs new file mode 100644 index 000000000..e5ecad6a2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs @@ -0,0 +1,77 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void WipWarehouseAdjustRequestMapperProfile() + { + CreateMap() + .ReverseMap(); + + CreateMap(); + + CreateMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ActiveDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.RequestStatus) + .Ignore(x => x.Details) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x=>x.ToPackingCode) + .Ignore(x => x.FromPackingCode) + .Ignore(x => x.FromStatus) + .Ignore(x => x.ToStatus) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromLocationArea) + .Ignore(x => x.FromLocationErpCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToLocationErpCode) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.SupplierBatch).Ignore(x => x.ArriveDate).Ignore(x => x.ProduceDate).Ignore(x => x.ExpireDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.ToContainerCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.ToLot) + .Ignore(x => x.StdPackQty) + .Ignore(x => x.Uom) + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Id) + .Ignore(x => x.Number) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + .Ignore(x => x.TenantId) + ; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs index c146f557f..8dfb70eb6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs @@ -23,6 +23,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile PutawayRequestAutoMapperProfile(); CountAdjustRequestAutoMapperProfile(); ScrapRequestAutoMapperProfile(); + WipWarehouseAdjustRequestMapperProfile(); #endregion @@ -78,6 +79,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile TransferNoteMapperProfile(); NoOkConvertOkNoteAutoMapperProfile(); InventoryInitialNoteAutoMapperProfile(); + WipWarehouseAdjustNoteMapperProfile(); + #endregion #region Jobs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj index 1d06fbf89..8baf5221b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj @@ -22,6 +22,7 @@ + diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs index 32f1f35b8..322ddb0b1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs @@ -66,11 +66,6 @@ public abstract class SfsStoreRecommendFromDetailWithFromToEntityBase : SfsStore /// public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs index 9b40c3155..da3d66f64 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs @@ -66,10 +66,6 @@ public abstract class SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatus /// public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } /// /// 推荐数量 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs index 2fc010c5a..6084e48d1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs @@ -66,11 +66,6 @@ public abstract class SfsStoreRecommendToDetailWithFromToEntityBase : SfsStoreDe /// public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs index 8b7da50a4..d907f953e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs @@ -66,11 +66,6 @@ public abstract class SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEn /// public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs index 4dae593bf..70535ce5f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs @@ -25,4 +25,10 @@ public enum EnumExchangeDataType RecycledMaterialReceipt = 23, ProductRecycle = 24, PurchaseOrder = 25, + //报废 + Scrap = 26, + //线边调整 + WipAdjust = 27, + //回收料调整 + Item_Transform = 28 } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs index 7590d0ddc..ead66142e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs @@ -33,8 +33,17 @@ public class IssueJobManager : SfsJobManagerBase, IIss foreach (var detail in input.Details) { //发料子任务 赋值实际转移 - await entity.BuildDetail(detail.Id, detail.HandledFromLocationCode, detail.HandledFromLocationErpCode, detail.HandledFromWarehouseCode, - detail.HandledQty, detail.HandledSupplierBatch, detail.HandledArriveDate, detail.HandledProduceDate, detail.HandledExpireDate, detail.HandledContainerCode, detail.HandledLot, + await entity.BuildDetail(detail.Id, + detail.HandledFromLocationCode, + detail.HandledFromLocationErpCode, + detail.HandledFromWarehouseCode, + detail.HandledQty, + detail.HandledSupplierBatch, + detail.HandledArriveDate, + detail.HandledProduceDate, + detail.HandledExpireDate, + detail.HandledContainerCode, + detail.HandledLot, detail.HandledPackingCode).ConfigureAwait(false); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs index 6c4886b40..e91cbe0db 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InspectNotes/InspectNoteDetail.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Win_in.Sfs.Shared.Domain; @@ -161,4 +162,9 @@ public class InspectNoteDetail : SfsStoreDetailWithLotPackingLocationStatusEntit [Column(TypeName = "decimal(18,6)")] public decimal StdPackQty { get; set; } + /// + /// 质检时间 + /// + [Display(Name = "质检时间")] + public DateTime InspectDate { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs index f45395934..7a96bcad8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs @@ -4,5 +4,5 @@ namespace Win_in.Sfs.Wms.Store.Domain; public interface IRecycledMaterialReceiptNoteManager : ISfsStoreManager { - Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote); + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs index 1ccb6c7b1..0b0ea9e7f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs @@ -10,18 +10,4 @@ public class RecycledMaterialReceiptNoteManager : SfsStoreManagerBase CreateAsync(RecycledMaterialReceiptNote entity) - { - return await base.CreateAsync(entity).ConfigureAwait(false); - - } - - public virtual async Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote) - { - var RecycledMaterialReceiptNote = ObjectMapper.Map(purchaseReceiptNote); - - await base.CreateAsync(RecycledMaterialReceiptNote).ConfigureAwait(false); - } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs new file mode 100644 index 000000000..8e610fb9e --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs @@ -0,0 +1,11 @@ +using System; +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IWipWarehouseAdjustNoteManager : + ISfsStoreManager, IBulkImportService +{ + Task ConfirmAsync(Guid id); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs new file mode 100644 index 000000000..64a7411c6 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs @@ -0,0 +1,8 @@ +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IWipWarehouseAdjustNoteRepository : ISfsStoreRepositoryBase, + ISfsBulkRepositoryBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs new file mode 100644 index 000000000..3ded8d094 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp; +using Win_in.Sfs.Shared.Domain.Entities; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 盘点差异调整记录 +/// +public class WipWarehouseAdjustNote : SfsStoreAggregateRootBase, IHasJobNumber +{ + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 任务ID + /// + [IgnoreUpdate] + public string RequestNumber { get; set; } + + /// + /// 任务ID + /// + [IgnoreUpdate] + public string JobNumber { get; set; } + + /// + /// 明细列表 + /// + [IgnoreUpdate] + public override List Details { get; set; } = new(); + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + [IgnoreUpdate] + public DateTime? ConfirmTime { get; set; } + + public void Confirm(DateTime confirmTime) + { + CheckStatus(Confirmed); + Confirmed = true; + ConfirmTime = confirmTime; + } + + private static void CheckStatus(bool confirmed) + { + if (confirmed) + { + throw new UserFriendlyException("当前状态为 【已确认】 ,无法再次确认!"); + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs new file mode 100644 index 000000000..878d8fd63 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 盘点差异调整记录-明细表 +/// +public class WipWarehouseAdjustNoteDetail : SfsStoreDetailWithFromToEntityBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs new file mode 100644 index 000000000..ba26d8c9e --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Event; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class WipWarehouseAdjustNoteManager : SfsStoreManagerBase, + IWipWarehouseAdjustNoteManager +{ + private readonly IWipWarehouseAdjustNoteRepository _repository; + + public WipWarehouseAdjustNoteManager( + IWipWarehouseAdjustNoteRepository repository + ) : base(repository) + { + _repository = repository; + } + + [UnitOfWork] + public virtual async Task ConfirmAsync(Guid id) + { + var entity = await Repository.FindAsync(id).ConfigureAwait(false); + Check.NotNull(entity, EntityClassName); + entity.Confirm(Clock.Now); + await PublishConfirmedAsync(entity).ConfigureAwait(false); + return await Repository.UpdateAsync(entity).ConfigureAwait(false); + } + + private async Task PublishConfirmedAsync(WipWarehouseAdjustNote entity) + { + try + { + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(entity), false) + .ConfigureAwait(false); + } + catch (Exception ex) + { + Logger.LogDebug($"{nameof(WipWarehouseAdjustNote)} Confirmed Event:{ex.Message}", null); + Console.WriteLine(ex.Source); + throw; + } + } + + /// + /// 执行导入 + /// + public virtual async Task ImportDataAsync(List mergeEntities, + List deleteEntities = null) + { + if (deleteEntities != null && deleteEntities.Count > 0) + { + await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); + } + + foreach (var entity in mergeEntities) + { + entity.SetIdAndNumberWithDetails(GuidGenerator, + await GenerateNumberAsync(nameof(WipWarehouseAdjustNote), Clock.Now).ConfigureAwait(false)); + } + + await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); + + var insertDetails = new List(); + + foreach (var item in mergeEntities) + { + await SetDetailAsync(item.Details).ConfigureAwait(false); + + insertDetails.AddRange(item.Details); + } + + await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false); + } + + private async Task SetDetailAsync(List details) + { + foreach (var detail in details) + { + var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); + + if (item != null) + { + detail.ItemName = item.Name; + detail.ItemDesc1 = item.Desc1; + detail.ItemDesc2 = item.Desc2; + } + + var balance = await BalanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + Check.NotNull(balance, "库存", + $"不存在箱码为{detail.FromPackingCode},零件编码为{detail.ItemCode},库位为{detail.FromLocationCode},状态为{detail.FromStatus}的库存!"); + + detail.SupplierBatch = balance.SupplierBatch; + detail.ArriveDate = balance.ArriveDate; + detail.ProduceDate = balance.ProduceDate; + detail.ExpireDate = balance.ExpireDate; + + //通过箱码和库位获取库存信息 + detail.FromStatus = balance.Status; + + detail.FromLot = balance.Lot; + detail.FromWarehouseCode = balance.WarehouseCode; + detail.FromContainerCode = balance.ContainerCode; + + detail.ToLot = balance.Lot; + detail.ToWarehouseCode = balance.WarehouseCode; + detail.ToContainerCode = balance.ContainerCode; + + detail.ToStatus = balance.Status; + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs index bebfabce1..f0c42a09b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs @@ -14,12 +14,14 @@ namespace Win_in.Sfs.Wms.Store.Domain; public class CountPlanManager : SfsStoreRequestManagerBase, ICountPlanManager { + private readonly ICountPlanRepository _repository; public CountPlanManager( ICountPlanRepository repository ) : base(repository) { + _repository = repository; } /// @@ -107,9 +109,11 @@ public class CountPlanManager : SfsStoreRequestManagerBase 0) { - SfsBaseDataRequestInputBase itemInput = new SfsBaseDataRequestInputBase(); - itemInput.Condition = partCondition; - itemInput.MaxResultCount = 99999; + var itemInput = new SfsBaseDataRequestInputBase + { + Condition = partCondition, + MaxResultCount = 99999 + }; var itemBaseList = await ItemBasicAppService.GetAllListByFilterAsync(itemInput, false).ConfigureAwait(false); @@ -119,16 +123,18 @@ public class CountPlanManager : SfsStoreRequestManagerBase 0) { - SfsBaseDataRequestInputBase locInput = new SfsBaseDataRequestInputBase(); - locInput.Condition = locCondition; - locInput.MaxResultCount = 99999; + var locInput = new SfsBaseDataRequestInputBase + { + Condition = locCondition, + MaxResultCount = 99999 + }; var locList = await LocationAppService.GetAllListByFilterAsync(locInput, false).ConfigureAwait(false); //库位列表 selectLocationCodes = locList.Select(p => p.Code).Distinct().ToList(); } //状态查询 - string statusStr = System.Text.Json.JsonSerializer.Serialize(selectStatusList.Select(p => (int)p).ToList()); + var statusStr = System.Text.Json.JsonSerializer.Serialize(selectStatusList.Select(p => (int)p).ToList()); //最终的查询条件语句 SfsInventoryRequestInputBase banlanceInput = new SfsInventoryRequestInputBase(); @@ -196,10 +202,8 @@ public class CountPlanManager : SfsStoreRequestManagerBase(entity), false) + .ConfigureAwait(false); + await _repository.InsertAsync(entity).ConfigureAwait(false); + return entity; } @@ -128,6 +128,13 @@ public class MaterialRequestManager oldEntity.ReplaceDetail(newDetail.Id, newDetail); } + var flag=oldEntity.Details.Any(p => p.ReceivedQty < p.Qty);//还有补料完 没收到的货 + + if (!flag) + { + oldEntity.Complete(); + } + await Repository.UpdateAsync(oldEntity).ConfigureAwait(false); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs new file mode 100644 index 000000000..3385bbe47 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs @@ -0,0 +1,9 @@ +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IWipWarehouseAdjustRequestManager : + ISfsStoreRequestManager, + IBulkImportService +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs new file mode 100644 index 000000000..dd69d923c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs @@ -0,0 +1,9 @@ +using System; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain +{ + public interface IWipWarehouseAdjustRequestRepository : ISfsStoreRepositoryBase, ISfsBulkRepositoryBase + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs new file mode 100644 index 000000000..25f00e538 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Entities; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 调拨申请 +/// +public class WipWarehouseAdjustRequest : SfsStoreRequestAggregateRootBase +{ + + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 明细列表 + /// + [IgnoreUpdate] + public override List Details { get; set; } = new List(); + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs new file mode 100644 index 000000000..aacab5098 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 线边库存调整调整明细 +/// +public class WipWarehouseAdjustRequestDetail : SfsStoreDetailWithFromToEntityBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } + + public override string ToString() + { + return JsonSerializer.Serialize(this); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs new file mode 100644 index 000000000..e11444523 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class WipWarehouseAdjustRequestManager : + SfsStoreRequestManagerBase, + IWipWarehouseAdjustRequestManager +{ + private readonly IWipWarehouseAdjustRequestRepository _repository; + + public WipWarehouseAdjustRequestManager( + IWipWarehouseAdjustRequestRepository repository + ) : base(repository) + { + _repository = repository; + } + + /// + /// 执行导入 + /// + public virtual async Task ImportDataAsync(List WipWarehouseAdjustRequests, + List deleteEntities = null) + { + if (deleteEntities != null && deleteEntities.Count > 0) + { + await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); + } + + _ = new List(); + + foreach (var item in WipWarehouseAdjustRequests) + { + await BuildDetailAsync(item.Details).ConfigureAwait(false); + } + + await CreateManyAsync(WipWarehouseAdjustRequests).ConfigureAwait(false); + } + + private async Task BuildDetailAsync(List details) + { + foreach (var detail in details) + { + var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); + + if (item != null) + { + detail.ItemName = item.Name; + detail.ItemDesc1 = item.Desc1; + detail.ItemDesc2 = item.Desc2; + } + + var balance = await BalanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + Check.NotNull(balance, "库存", + $"不存在箱码为{detail.FromPackingCode},零件编码为{detail.ItemCode},库位为{detail.FromLocationCode},状态为{detail.FromStatus}的库存!"); + + detail.SupplierBatch = balance.SupplierBatch; + detail.ArriveDate = balance.ArriveDate; + detail.ProduceDate = balance.ProduceDate; + detail.ExpireDate = balance.ExpireDate; + + //通过箱码和库位获取库存信息 + detail.FromStatus = balance.Status; + + detail.FromLot = balance.Lot; + detail.FromWarehouseCode = balance.WarehouseCode; + detail.FromContainerCode = balance.ContainerCode; + + detail.ToLot = balance.Lot; + detail.ToWarehouseCode = balance.WarehouseCode; + detail.ToContainerCode = balance.ContainerCode; + + detail.ToStatus = balance.Status; + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs index 782b3c977..c99a156c0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs @@ -29,6 +29,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet ProductRecycleRequests { get; } public DbSet ScrapRequests { get; } public DbSet CountAdjustRequests { get; } + public DbSet WipWarehouseAdjustRequests { get; } #endregion @@ -82,7 +83,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet CustomerReturnNotes { get; } public DbSet ContainerBindNotes { get; } public DbSet NoOkConvertOkNotes { get; } - + public DbSet WipWarehouseAdjustNotes { get; } #endregion #region Jobs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..971a7ef92 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class WipWarehouseAdjustNoteDbContextModelCreatingExtensions +{ + public static void ConfigureWipWarehouseAdjustNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustNote), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Properties + b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); + + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustNoteDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Configure Sfs store detail properties + b.ConfigureSfsStoreDetailBase(); + + //Properties + b.Property(q => q.Reason).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + + //Indexes + b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode, q.FromStatus, q.ToStatus }).IsUnique(); + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs new file mode 100644 index 000000000..9cac2a7c2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs @@ -0,0 +1,11 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class WipWarehouseAdjustNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase, IWipWarehouseAdjustNoteRepository +{ + public WipWarehouseAdjustNoteEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..20ce75a3f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class WipWarehouseAdjustRequestDbContextModelCreatingExtensions +{ + public static void ConfigureWipWarehouseAdjustRequest(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustRequest), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Properties + b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustRequestDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Configure Sfs store detail properties + b.ConfigureSfsStoreDetailBase(); + + //Properties + b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + + //Indexes + + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs new file mode 100644 index 000000000..75e96baeb --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs @@ -0,0 +1,13 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class WipWarehouseAdjustRequestEfCoreRepository : + SfsStoreEfCoreRepositoryBase, IWipWarehouseAdjustRequestRepository +{ + public WipWarehouseAdjustRequestEfCoreRepository(IDbContextProvider dbContextProvider) : base( + dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs index 6fc300b69..9a5dbfa35 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs @@ -28,6 +28,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet ProductRecycleRequests { get; set; } public DbSet ScrapRequests { get; set; } public DbSet CountAdjustRequests { get; set; } + public DbSet WipWarehouseAdjustRequests { get; set; } #endregion @@ -81,7 +82,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet CustomerReturnNotes { get; set; } public DbSet ContainerBindNotes { get; set; } public DbSet NoOkConvertOkNotes { get; set; } - + public DbSet WipWarehouseAdjustNotes { get; set; } #endregion #region Jobs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs index 81da8fb02..38813f279 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs @@ -59,6 +59,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigurePutawayRequest(options); builder.ConfigureScrapRequest(options); builder.ConfigureCountAdjustRequest(options); + builder.ConfigureWipWarehouseAdjustRequest(options); #endregion @@ -95,6 +96,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigureContainerBindNote(options); builder.ConfigureNoOkConvertOKNote(options); builder.ConfigureInventoryInitialNote(options); + builder.ConfigureWipWarehouseAdjustNote(options); #endregion diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs index 8f1d8db60..d51a8a347 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs @@ -63,6 +63,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); #endregion @@ -100,6 +101,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); #endregion @@ -189,6 +191,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); #endregion @@ -260,6 +264,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); #endregion 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 d78170183..9075447bc 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 @@ -56,37 +56,37 @@ public partial class StoreEventAutoMapperProfile : Profile ; CreateMap() - .MapExpectInOutFrom() + .MapExpectInOutFrom() .Ignore(x => x.Worker) .Ignore(x => x.SerialNumber) .Ignore(x => x.ExtraProperties); CreateMap() + .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.MaterialRequestNumber)) .Ignore(x => x.Confirmed) .Ignore(x => x.JobNumber) - .Ignore(x => x.RequestNumber) .Ignore(x => x.ActiveDate) ; CreateMap() - .Ignore(x => x.IssueTime) - .Ignore(x => x.FromPackingCode) - .Ignore(x => x.ToPackingCode) - .Ignore(x => x.FromContainerCode) - .Ignore(x => x.ToContainerCode) - .Ignore(x => x.FromLot) - .Ignore(x => x.ToLot) - .Ignore(x => x.SupplierBatch) - .Ignore(x => x.ArriveDate) - .Ignore(x => x.ProduceDate) - .Ignore(x => x.ExpireDate) - .Ignore(x => x.FromLocationCode) - .Ignore(x => x.FromLocationArea) - .Ignore(x => x.FromLocationGroup) - .Ignore(x => x.FromLocationErpCode) - .Ignore(x => x.FromWarehouseCode) - .Ignore(x => x.FromStatus) - .Ignore(x => x.ToStatus) - .Ignore(x => x.Qty) + .ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) + .ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) + .ForMember(x => x.FromPackingCode, y => y.MapFrom(d =>d.HandledPackingCode)) + .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) + .ForMember(x => x.FromLot, y => y.MapFrom(d => d.HandledLot)) + .ForMember(x => x.ToLot, y => y.MapFrom(d => d.HandledLot)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime)) + .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode)) + .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea)) + .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup)) + .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) + .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode)) + .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) + .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs index 2bef49393..f75b41476 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs @@ -52,9 +52,6 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .MapExpectInOutTo() - .Ignore(x => x.LocationArea) - .Ignore(x => x.LocationGroup) - .Ignore(x => x.WarehouseCode) .Ignore(x => x.SerialNumber) .Ignore(x => x.Worker) .Ignore(x => x.ExtraProperties) @@ -63,10 +60,10 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .MapExpectInOutTo() .ForMember(x => x.LocationCode, y => y.MapFrom(d => d.FromLocationCode)) + .ForMember(x => x.LocationArea, y => y.MapFrom(d => d.FromLocationArea)) + .ForMember(x => x.LocationGroup, y => y.MapFrom(d => d.FromLocationGroup)) .ForMember(x => x.LocationErpCode, y => y.MapFrom(d => d.FromLocationErpCode)) .ForMember(x => x.WarehouseCode, y => y.MapFrom(d => d.FromWarehouseCode)) - .Ignore(x => x.LocationArea) - .Ignore(x => x.LocationGroup) .Ignore(x => x.SerialNumber) .Ignore(x => x.Worker) .Ignore(x => x.ExtraProperties); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs index 88593ab57..eb5563c21 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs @@ -9,15 +9,34 @@ public partial class StoreEventAutoMapperProfile : Profile { private void TransferNoteAutoMapperProfile() { - CreateMap() + CreateMap() .Ignore(x => x.ExtraProperties) .Ignore(x => x.DocNumber) .Ignore(x => x.JobNumber) .Ignore(x => x.Worker) .Ignore(x => x.TransType) .Ignore(x => x.TransSubType) + .Ignore(x=>x.PackingCode) + .Ignore(x => x.Lot) + .Ignore(x => x.Status) + .Ignore(x => x.TransInOut) + .Ignore(x => x.LocationCode) + .Ignore(x => x.LocationGroup) + .Ignore(x => x.LocationErpCode) + .Ignore(x => x.LocationArea) + .Ignore(x => x.ContainerCode) + .Ignore(x => x.ManageType) + .Ignore(x => x.WarehouseCode) ; + CreateMap() + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.TransSubType) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs new file mode 100644 index 000000000..25cba43ed --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs @@ -0,0 +1,26 @@ +using System; +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Shared.Application; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event +{ + public partial class StoreEventAutoMapperProfile : Profile + { + private void WipWarehouseAdjustNoteAutoMapperProfile() + { + CreateMap() + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.TransSubType) + ; + } + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs index 815ec6b6a..bfd07f21d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs @@ -52,13 +52,11 @@ public partial class StoreEventAutoMapperProfile : Profile //盘点计划映射到盘点记录 CreateMap() .ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.Adjusted) ; CreateMap() .ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.Adjusted) ; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs new file mode 100644 index 000000000..99dceeb96 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs @@ -0,0 +1,24 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event; + +public partial class StoreEventAutoMapperProfile : Profile +{ + private void WipWarehouseAdjustRequestAutoMapperProfile() + { + CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter() + .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number)) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Confirmed) + .Ignore(x => x.ConfirmTime) + ; + + CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter() + ; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ItemTransformNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ItemTransformNoteEventHandler.cs new file mode 100644 index 000000000..7675ee335 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ItemTransformNoteEventHandler.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; +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.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges +{ + public class ItemTransformNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + { + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Item_Transform; + private const EnumTransSubType TransSubType = EnumTransSubType.Item_Transform; + private readonly ILocationAppService _locationAppService; + + public ItemTransformNoteEventHandler(ILocationAppService locationAppService) + { + _locationAppService = locationAppService; + } + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity); + } + + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + + foreach (var dto in dtos) + { + dto.Type = TransSubType.ToString(); + } + + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos); + await AddManyAsync(exchangeData); + } + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs index 44b1939c4..5dcc31266 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs @@ -47,7 +47,7 @@ public class ScrapNoteEventHandler } else { - var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.UnplannedIssue, dtos).ConfigureAwait(false); + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Scrap, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs new file mode 100644 index 000000000..290228ac9 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Domain.Acl.Location; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using ILocationAclService = Win_in.Sfs.Wms.Store.Domain.Acl.Location.ILocationAclService; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges +{ + public class TransferNoteEventHandler : + StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + { + private readonly Domain.Acl.Location.ILocationAclService _locationAclService; + + public TransferNoteEventHandler(ILocationAclService locationAclService) + { + _locationAclService = locationAclService; + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); + } + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); + await AddManyAsync(exchangeData).ConfigureAwait(false); + + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/WipWarehouseAdjustNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/WipWarehouseAdjustNoteEventHandler.cs new file mode 100644 index 000000000..d007e6653 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/WipWarehouseAdjustNoteEventHandler.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Acl.Location; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges +{ + public class WipWarehouseAdjustNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + { + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.WipAdjust; + + private ILocationAclService _locationAclService; + + public WipWarehouseAdjustNoteEventHandler(ILocationAclService locationAclService) + { + _locationAclService = locationAclService; + } + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity); + } + + + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); + } + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); + await AddManyAsync(exchangeData).ConfigureAwait(false); + } + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnStoreEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs similarity index 98% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnStoreEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs index 4c80640e3..5635bf206 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnStoreEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs @@ -9,7 +9,7 @@ using Win_in.Sfs.Wms.Store.Event.Inventories; namespace Win_in.Sfs.Wms.Store.Event.ExpectInOuts; -public class ProductionReturnStoreEventHandler : +public class ProductionReturnJobEventHandler : StoreExpectInOutEventHandlerBase , ILocalEventHandler> , ILocalEventHandler> diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs index 388c601e5..3ddb84994 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs @@ -16,6 +16,8 @@ public static class IHasLocationExtensions { hasLocation.LocationErpCode = location.ErpLocationCode; hasLocation.WarehouseCode = location.WarehouseCode; + hasLocation.LocationArea = location.AreaCode; + hasLocation.LocationGroup = location.LocationGroupCode; } } } @@ -26,8 +28,11 @@ public static class IHasLocationExtensions { var location = await locationAclService.GetByCodeAsync(hasFromTolocation.FromLocationCode).ConfigureAwait(false); if (location != null) - { + { hasFromTolocation.FromLocationErpCode = location.ErpLocationCode; + hasFromTolocation.FromLocationGroup = location.LocationGroupCode; + hasFromTolocation.FromLocationArea = location.AreaCode; + if (string.IsNullOrEmpty(hasFromTolocation.FromWarehouseCode)) { hasFromTolocation.FromWarehouseCode = location.WarehouseCode; @@ -40,6 +45,8 @@ public static class IHasLocationExtensions var location = await locationAclService.GetByCodeAsync(hasFromTolocation.ToLocationCode).ConfigureAwait(false); if (location != null) { + hasFromTolocation.ToLocationArea = location.AreaCode; + hasFromTolocation.ToLocationGroup = location.LocationGroupCode; hasFromTolocation.ToLocationErpCode = location.ErpLocationCode; if (string.IsNullOrEmpty(hasFromTolocation.ToWarehouseCode)) { 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 d5e645fb5..7bede24fc 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 @@ -60,7 +60,7 @@ public class IssueJobEventHandler : foreach (var detail in issueNoteCreateInput.Details) { var location = locations.First(p => p.Code == detail.ToLocationCode); - await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type); //去箱 去托 去批 + await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type).ConfigureAwait(false); //去箱 去托 去批 detail.ToLocationArea = location.AreaCode; detail.ToLocationGroup = location.LocationGroupCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs index 11cca065d..b8ac3da2a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.EventBus; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs index 05ba4fdaa..53547826f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs @@ -41,6 +41,9 @@ public class CountPlanEventHandler switch (entity.RequestType) { case CountPlanRequestType.Import: + //冻结库存 + await FreezeBalancesAsync(entity).ConfigureAwait(false); + break; case CountPlanRequestType.Manual: //冻结库存 await FreezeBalancesAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueNoteEventHandler.cs deleted file mode 100644 index 5305923a6..000000000 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/IssueNoteEventHandler.cs +++ /dev/null @@ -1,78 +0,0 @@ -//using System.Collections.Generic; -//using System.Linq; -//using System.Threading.Tasks; -//using Volo.Abp.EventBus; -//using Volo.Abp.Uow; -//using Win_in.Sfs.Shared.Event; -//using Win_in.Sfs.Wms.Store.Domain; - -//namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; - -//public class IssueNoteEventHandler -// : StoreEventHandlerBase -// , ILocalEventHandler> -// , ILocalEventHandler>> -// , ILocalEventHandler> -//{ -// private readonly IMaterialRequestManager _materialRequestManager; - -// public IssueNoteEventHandler( -// IMaterialRequestManager materialRequestManager -// ) -// { -// _materialRequestManager = materialRequestManager; -// } - -// [UnitOfWork] -// public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) -// { -// var entity = eventData.Entity; - -// await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); -// } - -// private async Task UpdateReceivedQtyMaterialRequestAsync(IssueNote entity) -// { -// var receiveQtyGroup = entity.Details -// .GroupBy(p => new { p.ItemCode, p.ToLocationCode }) -// .Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) }) -// .ToList(); - -// var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); - -// //更新叫料请求的已收数量 -// foreach (var materialRequestDetail in materialRequest.Details) -// { -// var receiveQty = receiveQtyGroup.FirstOrDefault(p => -// p.ItemCode == materialRequestDetail.ItemCode && -// p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty; -// if (receiveQty != null) -// { -// materialRequestDetail.ReceivedQty += receiveQty.Value; -// } -// } - -// await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false); -// } - -// [UnitOfWork] -// public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) -// { -// var entity = eventData.Entity; -// if (!entity.UseOnTheWayLocation) -// { -// await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); -// } - -// } - -// [UnitOfWork] -// public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) -// { -// var entities = eventData.Entity; -// foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation)) -// { -// await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); -// } -// } -//} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs index 199be122d..a71aeb6c3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs @@ -44,6 +44,16 @@ public class ItemTransformRequestEventHandler { var transformNoteDetail = new ItemTransformNoteDetailInput() { + FromLocationCode = detail.FromLocationCode, + FromLocationArea = detail.FromLocationArea, + FromLocationErpCode = detail.FromLocationErpCode, + FromLocationGroup = detail.FromLocationGroup, + + ToLocationArea = detail.ToLocationArea, + ToLocationCode = detail.ToLocationCode, + ToLocationErpCode = detail.ToLocationErpCode, + ToLocationGroup = detail.ToLocationGroup, + FromSupplierBatch = detail.FromSupplierBatch, ItemCode = detail.ItemCode, ToItemCode = detail.ToItemCode, @@ -52,7 +62,6 @@ public class ItemTransformRequestEventHandler FromExpireDate = detail.FromExpireDate, FromLot = detail.FromLot, FromPackingCode = detail.FromPackingCode, - ToLocationCode = detail.ToLocationCode, FromStatus = detail.FromStatus, ToContainerCode = detail.ToContainerCode, FromProduceDate = detail.FromProduceDate, @@ -74,6 +83,8 @@ public class ItemTransformRequestEventHandler ToProduceDate = detail.ToProduceDate, ToStatus = detail.ToStatus, ToSupplierBatch = detail.ToSupplierBatch, + FromWarehouseCode = detail.FromWarehouseCode, + ToWarehouseCode = detail.ToWarehouseCode }; createInput.Details.Add(transformNoteDetail); 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 830bba2b0..df7782591 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 @@ -68,6 +68,10 @@ public class MaterialRequestEventHandler { await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false); } + if (entity.Type == EnumMaterialRequestType.Issue_WIP.ToString()) + { + await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } } } @@ -110,7 +114,10 @@ public class MaterialRequestEventHandler await Task.CompletedTask.ConfigureAwait(false); } - private async Task> BuildIssueJobAsync(MaterialRequest materialRequest) + #region 私有 + + private async Task> BuildIssueJobAsync + (MaterialRequest materialRequest) { var jobs = new List(); @@ -118,7 +125,7 @@ public class MaterialRequestEventHandler var toLocationCodes = materialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); - foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0)) + foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0))//如果有还有剩余未叫料的数量 则创建新的任务 { var toLocation = toLocations.FirstOrDefault(p => p.Code == materialRequestDetail.ToLocationCode); Check.NotNull(toLocation, "库位代码", $"库位 {materialRequestDetail.ToLocationCode} 不存在"); @@ -180,6 +187,7 @@ public class MaterialRequestEventHandler job.WarehouseCode = fromLocation.WarehouseCode; job.ProdLine = fromLocation.LocationGroupCode; job.Worker = materialRequest.Worker; + job.MaterialRequestNumber = materialRequest.Number; return job; } @@ -206,7 +214,10 @@ public class MaterialRequestEventHandler var detail = await BuildIssueJobDetailAsync(materialRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false); if (materialRequest.UseOnTheWayLocation) { - detail.OnTheWayLocationCode = await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.IssueOnTheWayLocation).ConfigureAwait(false); + //获取在途库 + var locationDto= await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + + detail.OnTheWayLocationCode = locationDto.Code; } jobDetails.Add(detail); @@ -239,9 +250,11 @@ public class MaterialRequestEventHandler detail.RecommendFromLocationErpCode= balance.LocationErpCode; detail.RecommendFromLocationGroup= balance.LocationGroup; detail.RecommendFromWarehouseCode= balance.WarehouseCode; + detail.Uom = balance.Uom; detail.ToLocationCode = materialRequestDetail.ToLocationCode; detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode; + detail.ToLocationArea= materialRequestDetail.ToLocationArea; detail.ToWarehouseCode = materialRequestDetail.ToWarehouseCode; detail.ToLocationGroup = materialRequestDetail.ToLocationGroup; //detail.Operation = //TODO @@ -276,5 +289,5 @@ public class MaterialRequestEventHandler } - + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs new file mode 100644 index 000000000..94d4e8369 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs @@ -0,0 +1,96 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; + +public class IssueNoteEventHandler + : StoreEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> +{ + private readonly IMaterialRequestManager _materialRequestManager; + + public IssueNoteEventHandler( + IMaterialRequestManager materialRequestManager + ) + { + _materialRequestManager = materialRequestManager; + } + + /// + /// 当叫料记录创建后 修改请求的值 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) + { + var entity = eventData.Entity; + + await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); + } + + private async Task UpdateReceivedQtyMaterialRequestAsync(IssueNote entity) + { + var receiveQtyGroup = entity.Details + .GroupBy(p => new { p.ItemCode, p.ToLocationCode }) + .Select(p => new { p.Key.ItemCode, p.Key.ToLocationCode, Qty = p.Sum(d => d.Qty) }) + .ToList(); + + var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + + if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString()) + { + //更新叫料请求的已收数量 + foreach (var materialRequestDetail in materialRequest.Details) + { + var receiveQty = receiveQtyGroup.FirstOrDefault(p => + p.ItemCode == materialRequestDetail.ItemCode && + p.ToLocationCode == materialRequestDetail.ToLocationCode)?.Qty; + if (receiveQty != null) + { + materialRequestDetail.ReceivedQty += receiveQty.Value; + } + } + + await _materialRequestManager.UpdateDetailsAsync(materialRequest).ConfigureAwait(false); + } + } + + /// + /// 当叫料记录创建后 修改请求的值 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + if (!entity.UseOnTheWayLocation) + { + await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 当叫料记录创建后 修改请求的值 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + foreach (var entity in entities.Where(entity => !entity.UseOnTheWayLocation)) + { + await UpdateReceivedQtyMaterialRequestAsync(entity).ConfigureAwait(false); + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ScrapNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ScrapNoteEventHandler.cs index f9270b9be..6b4ed7381 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ScrapNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ScrapNoteEventHandler.cs @@ -1,15 +1,9 @@ -using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Volo.Abp.EventBus; using Volo.Abp.Uow; -using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; -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; using Win_in.Sfs.Wms.Store.Event.Transaction; namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs index a315b3a07..fa0a16a2e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs @@ -99,7 +99,9 @@ public class ProductRecycleRequestEventHandler LocationErpCode = detail.RawLocationErpCode, WarehouseCode = detail.RawWarehouseCode, Lot = string.Empty, - Status = EnumInventoryStatus.OK + Status = EnumInventoryStatus.OK, + LocationArea = detail.LocationArea, + LocationGroup = detail.LocationGroup, }; if (item != null) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs new file mode 100644 index 000000000..75e931018 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; +using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; + +public class WipWarehouseAdjustRequestEventHandler + : StoreEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> + +{ + private readonly IWipWarehouseAdjustNoteAppService _wipWarehouseAdjustNoteAppService; + private readonly IWipWarehouseAdjustRequestManager _wipWarehouseAdjustRequestManager; + private readonly IBalanceAppService _balanceAppService; + + public WipWarehouseAdjustRequestEventHandler( + IWipWarehouseAdjustNoteAppService wipWarehouseAdjustNoteAppService, IBalanceAppService balanceAppService, IWipWarehouseAdjustRequestManager wipWarehouseAdjustRequestManager) + { + _wipWarehouseAdjustNoteAppService = wipWarehouseAdjustNoteAppService; + _balanceAppService = balanceAppService; + _wipWarehouseAdjustRequestManager = wipWarehouseAdjustRequestManager; + } + + /// + /// 创建后 + /// + /// Event data + public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + + if (entity.AutoSubmit) + { + await _wipWarehouseAdjustRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 批量创建后 + /// + /// Event data + public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _wipWarehouseAdjustRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + } + + /// + /// 审批后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) + { + var entity = eventData.Entity; + if (entity.DirectCreateNote) + { + var note = await BuildCountAdjustNoteCreateInputAsync(entity).ConfigureAwait(false); + await _wipWarehouseAdjustNoteAppService.CreateAsync(note).ConfigureAwait(false); + } + } + + #region 私有 + + private async Task BuildCountAdjustNoteCreateInputAsync( + WipWarehouseAdjustRequest entity) + { + var createInput = ObjectMapper.Map(entity); + createInput.JobNumber = string.Empty; + createInput.RequestNumber = entity.Number; + createInput.ActiveDate = Clock.Now; + return createInput; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs index 72e46f880..9dfa74f8d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs @@ -24,6 +24,31 @@ public partial class StoreEventAutoMapperProfile : Profile //到货单 PurchaseReceiptRequestAutoMapperProfile(); + //线边调整 + WipWarehouseAdjustRequestAutoMapperProfile(); + + #endregion + + #region Jobs + + CountJobAutoMapperProfile(); + DeliverJobAutoMapperProfile(); + InspectJobAutoMapperProfile(); + IssueJobAutoMapperProfile(); + JisDeliverJobAutoMapperProfile(); + ProductionReturnJobAutoMapperProfile(); + ProductReceiveJobAutoMapperProfile(); + PurchaseReceiptJobAutoMapperProfile(); + PurchaseReturnJobAutoMapperProfile(); + PutawayJobAutoMapperProfile(); + UnplannedIssueJobAutoMapperProfile(); + UnplannedReceiptJobAutoMapperProfile(); + + #endregion + + #region Notes + + WipWarehouseAdjustNoteAutoMapperProfile(); #endregion @@ -69,21 +94,6 @@ public partial class StoreEventAutoMapperProfile : Profile CountAdjustRequestAutoMapperProfile(); InventoryInitialNoteAutoMapperProfile(); - #region Jobs - - CountJobAutoMapperProfile(); - DeliverJobAutoMapperProfile(); - InspectJobAutoMapperProfile(); - IssueJobAutoMapperProfile(); - JisDeliverJobAutoMapperProfile(); - ProductionReturnJobAutoMapperProfile(); - ProductReceiveJobAutoMapperProfile(); - PurchaseReceiptJobAutoMapperProfile(); - PurchaseReturnJobAutoMapperProfile(); - PutawayJobAutoMapperProfile(); - UnplannedIssueJobAutoMapperProfile(); - UnplannedReceiptJobAutoMapperProfile(); - #endregion } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs index f43b6e406..e77ff9309 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs @@ -5,155 +5,154 @@ 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; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; -using Win_in.Sfs.Wms.Store.Event.Transactions; +using Win_in.Sfs.Wms.Store.Event.Transaction; -namespace Win_in.Sfs.Wms.Store.Event.BusinessNote +namespace Win_in.Sfs.Wms.Store.Event.Transactions; + +public class IssueNoteEventHandler + : StoreInventoryEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> { - //public class IssueNoteEventHandler - // : StoreEventHandlerBase - // , ILocalEventHandler> - // , ILocalEventHandler>> - // , ILocalEventHandler> - //{ - // private const EnumTransType TransType = EnumTransType.Issue; - // private readonly Itranlog - - - // [UnitOfWork] - // public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) - // { - // var entity = eventData.Entity; - // var transferLogs = new List(); - // var route = entity.UseOnTheWayLocation - // ? EnumTransferRoute.SourceToOnTheWay - // : EnumTransferRoute.SourceToDestination; - - // //如果是mes拉动 先发到在途 - // if (entity.RequestType == EnumMaterialRequestType.Issue_WIP.ToString()) - // { - // route = EnumTransferRoute.SourceToOnTheWay; - // } - - // transferLogs.AddRange(await BuildTransferLogsAsync(entity, route)); - - // await TransferLogAppService.AddManyAsync(transferLogs); - // } - - - // [UnitOfWork] - // public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) - // { - // var entities = eventData.Entity; - // var transferLogs = new List(); - // //如果要做库存事务汇总,可以修改此处 - // foreach (var issueNote in entities) - // { - // var route = issueNote.UseOnTheWayLocation - // ? EnumTransferRoute.SourceToOnTheWay - // : EnumTransferRoute.SourceToDestination; - // transferLogs.AddRange(await BuildTransferLogsAsync(issueNote, route)); - // } - - // await TransferLogAppService.AddManyAsync(transferLogs); - // } - - - // [UnitOfWork] - - // public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) - // { - // var entity = eventData.Entity; - - // var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination); - // await AddTransferLogsAsync(inputList); - // } - - // private async Task AddTransferLogsAsync(List inputList) - // { - // var transferLogs = new List(); - - // transferLogs.AddRange(inputList); - - // await TransferLogAppService.AddManyAsync(transferLogs); - - // } - - // private async Task> BuildTransferLogsAsync(IssueNote issueNote, EnumTransferRoute route) - // { - // var transferLogs = new List(); - // foreach (var detail in issueNote.Details.Where(detail => detail.Qty.Qty != 0)) - // { - // var transferLog = ObjectMapper.Map(detail); - - // LocationDTO fromLocationDTO = null; - // LocationDTO toLocationDTO = null; - - // if (issueNote.UseOnTheWayLocation) - // { - // var location = await LocationAppService.GetByCodeAsync(detail.OnTheWayLocationCode); - // switch (route) - // { - // case EnumTransferRoute.SourceToOnTheWay: - // fromLocationDTO = await LocationAppService.GetByCodeAsync(detail.FromLocationCode); - - // toLocationDTO = await LocationAppService.GetByCodeAsync(detail.OnTheWayLocationCode); - // break; - // case EnumTransferRoute.OnTheWayToDestination: - // fromLocationDTO = await LocationAppService.GetByCodeAsync(detail.OnTheWayLocationCode); - - // toLocationDTO = await LocationAppService.GetByCodeAsync(detail.ToLocationCode); - - // await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog); - // break; - // case EnumTransferRoute.SourceToDestination: - // default: - // throw new ArgumentOutOfRangeException(nameof(route), route, null); - // } - // } - // else - // { - // fromLocationDTO = await LocationAppService.GetByCodeAsync(detail.FromLocationCode); - // toLocationDTO = await LocationAppService.GetByCodeAsync(detail.ToLocationCode); - // } - - // transferLog.FromLocationCode = fromLocationDTO.Code; - // transferLog.FromLocationArea = fromLocationDTO.AreaCode; - // transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode; - // transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode; - - // transferLog.ToLocationCode = toLocationDTO.Code; - // transferLog.ToLocationArea = toLocationDTO.AreaCode; - // transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode; - // transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode; - - // transferLog.TransType = TransType; - // transferLog.TransSubType = Enum.Parse(issueNote.RequestType); - // transferLog.Company = issueNote.Company; - // transferLog.Worker = issueNote.Worker; - // transferLog.DocNumber = issueNote.Number; - // transferLog.JobNumber = issueNote.JobNumber; - - // transferLogs.Add(transferLog); - // } - - // return transferLogs; - // } - // private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogCreateInput transferLogCreateInput) - // { - // transferLogCreateInput.ToPackingCode = ""; - // transferLogCreateInput.ToLot = ""; - // transferLogCreateInput.ToContainerCode = ""; - - // transferLogCreateInput.FromPackingCode = ""; - // transferLogCreateInput.FromLot = ""; - // transferLogCreateInput.FromContainerCode = ""; - - - // } - //} + private const EnumTransType TransType = EnumTransType.Issue; + + private readonly ILocationAppService _locationAppService; + + public IssueNoteEventHandler(ILocationAppService locationAppService) + { + _locationAppService = locationAppService; + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + var transferLogs = new List(); + var route = entity.UseOnTheWayLocation + ? EnumTransferRoute.SourceToOnTheWay + : EnumTransferRoute.SourceToDestination; + transferLogs.AddRange(await BuildTransferLogsAsync(entity, route).ConfigureAwait(false)); + + //如果是mes拉动 先发到在途 + if (entity.RequestType == EnumMaterialRequestType.Issue_WIP.ToString()) + { + route = EnumTransferRoute.SourceToOnTheWay; + } + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + var transferLogs = new List(); + //如果要做库存事务汇总,可以修改此处 + foreach (var issueNote in entities) + { + var route = issueNote.UseOnTheWayLocation + ? EnumTransferRoute.SourceToOnTheWay + : EnumTransferRoute.SourceToDestination; + transferLogs.AddRange(await BuildTransferLogsAsync(issueNote, route).ConfigureAwait(false)); + } + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + [UnitOfWork] + + public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) + { + var entity = eventData.Entity; + + var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination).ConfigureAwait(false); + await AddTransferLogsAsync(inputList).ConfigureAwait(false); + } + + private async Task AddTransferLogsAsync(List inputList) + { + var transferLogs = new List(); + + transferLogs.AddRange(inputList); + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + + } + + private async Task> BuildTransferLogsAsync(IssueNote issueNote, EnumTransferRoute route) + { + var transferLogs = new List(); + foreach (var detail in issueNote.Details.Where(detail => detail.Qty != 0)) + { + var transferLog = ObjectMapper.Map(detail); + + LocationDTO fromLocationDTO = null; + LocationDTO toLocationDTO = null; + + if (issueNote.UseOnTheWayLocation) + { + var location = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + switch (route) + { + case EnumTransferRoute.SourceToOnTheWay: + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + break; + case EnumTransferRoute.OnTheWayToDestination: + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + + await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog).ConfigureAwait(false); + break; + case EnumTransferRoute.SourceToDestination: + default: + throw new ArgumentOutOfRangeException(nameof(route), route, null); + } + } + else + { + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + } + + transferLog.FromLocationCode = fromLocationDTO.Code; + transferLog.FromLocationArea = fromLocationDTO.AreaCode; + transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode; + transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode; + + transferLog.ToLocationCode = toLocationDTO.Code; + transferLog.ToLocationArea = toLocationDTO.AreaCode; + transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode; + transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode; + transferLog.TransSubType = Enum.Parse(issueNote.RequestType); + transferLog.TransType = TransType; + transferLog.DocNumber = issueNote.Number; + transferLog.JobNumber = issueNote.JobNumber; + + transferLogs.Add(transferLog); + } + + return transferLogs; + } + + private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogEditInput transferLogCreateInput) + { + transferLogCreateInput.ToPackingCode = ""; + transferLogCreateInput.ToLot = ""; + transferLogCreateInput.ToContainerCode = ""; + + transferLogCreateInput.FromPackingCode = ""; + transferLogCreateInput.FromLot = ""; + transferLogCreateInput.FromContainerCode = ""; + + + } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs index af56eb5a4..c33adc601 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs @@ -72,7 +72,9 @@ public class ItemTransformNoteEventHandler TransType = Type, TransSubType = SubType, TransInOut = EnumTransInOut.Out, - + LocationArea = detail.FromLocationArea, + LocationGroup = detail.FromLocationGroup, + LocationErpCode = detail.FromLocationErpCode, PackingCode = detail.FromPackingCode, ItemCode = detail.ItemCode, Lot = detail.FromLot, @@ -106,6 +108,9 @@ public class ItemTransformNoteEventHandler ItemCode = detail.ToItemCode, Lot = detail.ToLot, Status = detail.ToStatus, + LocationArea = detail.ToLocationArea, + LocationGroup = detail.ToLocationGroup, + LocationErpCode = detail.ToLocationErpCode, WarehouseCode = detail.ToWarehouseCode, LocationCode = detail.ToLocationCode, ContainerCode = detail.ToContainerCode, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs index 4aae5fc63..cee202461 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs @@ -12,13 +12,18 @@ namespace Win_in.Sfs.Wms.Store.Event.Transactions; public class RecycledMaterialReceiptNoteEventHandler : StoreInventoryEventHandlerBase - , ILocalEventHandler> - , ILocalEventHandler>> + , ILocalEventHandler> + , ILocalEventHandler>> { private const EnumTransInOut TransInOut = EnumTransInOut.In; private const EnumTransType TransType = EnumTransType.UnplannedReceipt; private const EnumTransSubType TransSubType = EnumTransSubType.UnplannedReceipt_RecycledMaterialReceipt; + /// + /// 创建后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { @@ -26,6 +31,20 @@ public class RecycledMaterialReceiptNoteEventHandler await AddTransactionsAsync(entity).ConfigureAwait(false); } + /// + /// 批量创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddTransactionsAsync(entities).ConfigureAwait(false); + } + + #region 私有 + private async Task AddTransactionsAsync(RecycledMaterialReceiptNote RecycledMaterialReceiptNote) { var inboundTransactions = new List(); @@ -33,19 +52,10 @@ public class RecycledMaterialReceiptNoteEventHandler inboundTransactions.AddRange(BuildTransactions(RecycledMaterialReceiptNote)); await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false); - - } - - [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) - { - var entities = eventData.Entity; - await AddTransactionsAsync(entities).ConfigureAwait(false); } private async Task AddTransactionsAsync(List RecycledMaterialReceiptNotes) { - var inboundTransactions = new List(); //如果要做库存事务汇总,可以修改此处 @@ -74,7 +84,9 @@ public class RecycledMaterialReceiptNoteEventHandler transactions.Add(transaction); } + return transactions; } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs index da4d933d9..981f42265 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs @@ -7,7 +7,6 @@ using Volo.Abp.Uow; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; 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; using Win_in.Sfs.Wms.Store.Event.Transaction; @@ -74,7 +73,7 @@ public class ScrapNoteEventHandler transferLog.Worker = scrapNote.Worker; transferLog.DocNumber = scrapNote.Number; transferLog.JobNumber = scrapNote.JobNumber; - + transferLogs.Add(transferLog); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs new file mode 100644 index 000000000..b80add431 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Linq; +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; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Event.Transaction; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessNote; + +public class WipWarehouseAdjustNoteEventHandler + : StoreInventoryEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + private const EnumTransType TransType = EnumTransType.Adjust; + private const EnumTransSubType TransSubType = EnumTransSubType.CountAdjust_WIP; + + private readonly IWipWarehouseAdjustRequestAppService _wipWarehouseAdjustRequestApp; + private readonly IItemBasicAppService _itemBasicAppService; + + public WipWarehouseAdjustNoteEventHandler( + IWipWarehouseAdjustRequestAppService wipWarehouseAdjustRequestApp, IItemBasicAppService itemBasicAppService) + { + _wipWarehouseAdjustRequestApp = wipWarehouseAdjustRequestApp; + _itemBasicAppService = itemBasicAppService; + } + + /// + /// 批量创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddTransactionsAsync(entities).ConfigureAwait(false); + + foreach (var entity in entities.Where(entity => !string.IsNullOrEmpty(entity.RequestNumber))) + { + await _wipWarehouseAdjustRequestApp.CompleteByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + } + } + + /// + /// 创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entities = new List { eventData.Entity }; + await AddTransactionsAsync(entities).ConfigureAwait(false); + + foreach (var entity in entities.Where(entity => !string.IsNullOrEmpty(entity.RequestNumber))) + { + await _wipWarehouseAdjustRequestApp.CompleteByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + } + } + + #region 库存操作 + + private async Task AddTransactionsAsync(List countAdjustNotes) + { + var transactions = new List(); + //如果要做库存事务汇总,可以修改此处 + foreach (var countAdjustNote in countAdjustNotes) + { + transactions.AddRange(await BuildTransactions(countAdjustNote).ConfigureAwait(false)); + } + + await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false); + } + + private async Task> BuildTransactions(WipWarehouseAdjustNote countAdjustNote) + { + var transactions = new List(); + + foreach (var detail in countAdjustNote.Details) + { + var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + var transaction = new TransactionEditInput(); + + transaction.TransType = TransType; + transaction.TransSubType = TransSubType; + + transaction.TransInOut = detail.Qty > 0 ? EnumTransInOut.In : EnumTransInOut.Out; + + transaction.Worker = countAdjustNote.Worker; + transaction.DocNumber = countAdjustNote.Number; + transaction.JobNumber = string.Empty; + + transaction.ItemCode = detail.ItemCode; + transaction.ItemDesc1=detail.ItemDesc1; + transaction.ItemDesc2=detail.ItemDesc2; + transaction.ItemName = detail.ItemName; + transaction.StdPackQty = detail.StdPackQty; + transaction.DocNumber = detail.Number; + transaction.Uom=detail.Uom; + transaction.PackingCode = detail.ToPackingCode; + transaction.Lot = detail.ToLot; + transaction.Qty=detail.Qty; + transaction.Status = detail.ToStatus; + transaction.LocationCode = detail.ToLocationCode; + transaction.LocationGroup = detail.ToLocationGroup; + transaction.LocationArea = detail.ToLocationArea; + transaction.LocationErpCode = detail.ToLocationErpCode; + transaction.LocationCode=detail.ToLocationCode; + transaction.ContainerCode = detail.ToContainerCode; + transaction.ManageType = itemBasicDto.ManageType; + transaction.WarehouseCode = detail.ToWarehouseCode; + + transactions.Add(transaction); + } + + return transactions; + } + + #endregion +}