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.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.Fawtyg.EosAgent/EosAgentModule.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs index 86d84862a..20a68644a 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/EosAgentModule.cs @@ -165,8 +165,8 @@ public class EosAgentModule : AbpModule ApplicationInitializationContext context) { - context.AddBackgroundWorkerAsync(); - // context.AddBackgroundWorkerAsync(); + // context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/ArriveConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/ArriveConverter.cs index 791c8ae4f..e79c43aeb 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/ArriveConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Outgoing/ArriveConverter.cs @@ -7,6 +7,7 @@ using Win_in.Sfs.Wms.DataExchange.Domain; using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.EOS; using Win_in.Sfs.Wms.DataExchange.Domain.Shared; using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReceipt; +using Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote; using Win_in.Sfs.Wms.Store.Application.Contracts; namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent; @@ -18,6 +19,7 @@ public class ArriveConverter : IOutgoingConverter private readonly ISupplierAsnAppService _supplierAsnAppService; private readonly IObjectMapper _objectMapper; + public ArriveConverter( IOutgoingFromWmsManager outgoingFromWmsManager , IOutgoingToExternalManager outgoingToExternalManager @@ -35,11 +37,11 @@ public class ArriveConverter : IOutgoingConverter { var outgoingToExternalList = new List(); - var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.PurchaseReceipt, EnumSystemType.EOS).ConfigureAwait(false); + var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.Putaway, EnumSystemType.EOS).ConfigureAwait(false); foreach (var outgoingFromWms in outgoingFromWmsList) { - var wmsReceipt = JsonSerializer.Deserialize(outgoingFromWms.DataContent); + var wmsReceipt = JsonSerializer.Deserialize(outgoingFromWms.DataContent); foreach (var detail in wmsReceipt.Details) { var outgoingToExternal = new OutgoingToExternal() @@ -49,14 +51,14 @@ public class ArriveConverter : IOutgoingConverter SourceSystem = EnumSystemType.WMS.ToString(), SourceDataId = detail.Id.ToString(), SourceDataGroupCode = wmsReceipt.Number, - SourceDataDetailCode = detail.PackingCode, + SourceDataDetailCode = detail.ToPackingCode, Writer = nameof(EosOutgoingBackgroundWorker), - DestinationSystem = EnumSystemType.SCP.ToString(), + DestinationSystem = EnumSystemType.EOS.ToString(), DestinationDataId = "", }; outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); - var exchangeReceipt = await BuildPurchaseReceiptExchangeDtoAsync(wmsReceipt, detail).ConfigureAwait(false); + var exchangeReceipt = await BuildPutawayExchangeDtoAsync(wmsReceipt, detail).ConfigureAwait(false); outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); var arrive = BuildArrive(exchangeReceipt); outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); @@ -71,25 +73,25 @@ public class ArriveConverter : IOutgoingConverter return outgoingToExternalList; } - private static ArriveNote BuildArrive(PurchaseReceiptNoteExchangeDto exchangeReceipt) + private ArriveNote BuildArrive(PutawayNoteExchangeDto exchangeReceipt) { var detail = exchangeReceipt.Detail; var arrive = new ArriveNote() { - PlanBillNo = exchangeReceipt.PoNumber, - ShipBillNo = exchangeReceipt.AsnNumber, + PlanBillNo = detail.PoNumber, + ShipBillNo = detail.AsnNumber, DocNo = exchangeReceipt.Number, - DetailMatNo = detail.PackingCode, + DetailMatNo = detail.ToPackingCode, ERP = detail.ItemCode, - Qty = detail.Qty, + Qty = detail.ShippedQty, HgQty = detail.Qty, ProductDate = detail.ProduceDate, - ProductBatch = detail.Lot, - Loc = detail.LocationErpCode, - ShipDate = exchangeReceipt.ShipDate, + ProductBatch = detail.ToLot, + Loc = detail.ToLocationErpCode, + ShipDate = detail.ShipDate, ShipBillState = 0, - SupplierCode = exchangeReceipt.SupplierCode, - PlanUserCode = exchangeReceipt.ContactName, + SupplierCode = detail.SupplierCode, + PlanUserCode = detail.PlanUserCode,//筹措员 EosState = 0, // EosDate = DateTime.MinValue, WmsDate = DateTime.Now, @@ -98,14 +100,11 @@ public class ArriveConverter : IOutgoingConverter return arrive; } - private async Task BuildPurchaseReceiptExchangeDtoAsync(PurchaseReceiptNoteDTO wmsReceipt, PurchaseReceiptNoteDetailDTO wmsReceiptDetail) + private Task BuildPutawayExchangeDtoAsync(PutawayNoteDTO wmsReceipt, PutawayNoteDetailDTO wmsReceiptDetail) { - var exchangeReceipt = _objectMapper.Map(wmsReceipt); - var exchangeReceiptDetail = _objectMapper.Map(wmsReceiptDetail); - var asn = await _supplierAsnAppService.GetByNumberAsync(exchangeReceipt.AsnNumber).ConfigureAwait(false); - exchangeReceipt.ShipDate = asn?.ShipDate; - exchangeReceipt.ContactName = asn == null ? "" : asn.ContactName; + var exchangeReceipt = _objectMapper.Map(wmsReceipt); + var exchangeReceiptDetail = _objectMapper.Map(wmsReceiptDetail); exchangeReceipt.Detail = exchangeReceiptDetail; - return exchangeReceipt; + return Task.FromResult(exchangeReceipt); } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json index 83cadac0a..4002a48b9 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/appsettings.json @@ -2,7 +2,7 @@ "ConnectionStrings": { "Default": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;TrustServerCertificate=True", "DataExchange": "Server=dev.ccwin-in.com,21195;Database=DataExchange_Main;uid=sa;pwd=aA123456!;TrustServerCertificate=True", - "EOS": "Server=61.139.155.47;Database=EOSCC;Uid=wms;Pwd=1;TrustServerCertificate=True" + "EOS": "Server=61.139.155.47;Database=EOSSH;Uid=wms;Pwd=1;TrustServerCertificate=True" }, "AuthServer": { 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..ce937c504 --- /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 = DateTime.ParseExact(backflu.scmout_dt_w, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), + 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/ScrapConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/ScrapConverter.cs index 2475f2b77..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 @@ -86,7 +86,9 @@ public class ScrapConverter : IIncomingConverter wmsScrapDetail.FromLot = ""; wmsScrapDetail.FromWarehouseCode = ""; wmsScrapDetail.ToWarehouseCode = ""; - wmsScrapDetail.FromStatus = EnumInventoryStatus.OK; + wmsScrapDetail.FromStatus = EnumInventoryStatus.OK; + wmsScrapDetail.FromLocationArea = ""; + wmsScrapDetail.ToLocationGroup = ""; var item = await _itemBasicAppService.GetByCodeAsync(wmsScrapDetail.ItemCode).ConfigureAwait(false); if (item != null) { 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/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 47d6bcd34..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 @@ -28,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/FawtygAutoMapperProfile.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/FawtygAutoMapperProfile.cs index 0a7c85483..f8ba7366d 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/FawtygAutoMapperProfile.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/FawtygAutoMapperProfile.cs @@ -14,13 +14,16 @@ using Win_in.Sfs.Wms.DataExchange.WMS.Deparment; using Win_in.Sfs.Wms.DataExchange.WMS.Dict; using Win_in.Sfs.Wms.DataExchange.WMS.InterfaceCalendar; using Win_in.Sfs.Wms.DataExchange.WMS.ItemBasic; +using Win_in.Sfs.Wms.DataExchange.WMS.ItemTransformNote; using Win_in.Sfs.Wms.DataExchange.WMS.PCK; using Win_in.Sfs.Wms.DataExchange.WMS.ProductionReturnNote; using Win_in.Sfs.Wms.DataExchange.WMS.ProductReceiptNote; +using Win_in.Sfs.Wms.DataExchange.WMS.ProductRecycleNote; using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseOrder; using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseReturn; using Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote; using Win_in.Sfs.Wms.DataExchange.WMS.RecycledMaterialReceiptNote; +using Win_in.Sfs.Wms.DataExchange.WMS.ScrapNote; using Win_in.Sfs.Wms.DataExchange.WMS.Supplier; using Win_in.Sfs.Wms.DataExchange.WMS.TransferNote; using Win_in.Sfs.Wms.DataExchange.WMS.UnplannedIssueNote; @@ -34,6 +37,12 @@ public class FawtygAutoMapperProfile : Profile { public FawtygAutoMapperProfile() { + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + + CreateMap(); CreateMap() .Ignore(x => x.Items); @@ -45,6 +54,9 @@ public class FawtygAutoMapperProfile : Profile CreateMap(); CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); CreateMap(); @@ -85,16 +97,25 @@ public class FawtygAutoMapperProfile : Profile .Ignore(x => x.Detail); CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); CreateMap(); + + CreateMap() + .Ignore(x => x.Details) + .Ignore(x => x.MaterialDetails); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); } } 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..f3f502241 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) @@ -93,8 +93,8 @@ public class BackFluReader : IReader 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)), + ActiveDate = DateTime.ParseExact(backflu.scmout_dt_w, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture), + // 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 }; 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/CountAdjustNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs index 705cf6919..af7d5d81d 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/CountAdjustNoteConverter.cs @@ -44,80 +44,72 @@ public class CountAdjustNoteConverter : IOutgoingConverter foreach (var outgoingFromWms in outgoingFromWmsList) { var wmsCountAdjust = JsonSerializer.Deserialize(outgoingFromWms.DataContent); - 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.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) }); - foreach (var detail in details.Where(r => r.CountQty == 0)) - { - var outgoingToExternal = new OutgoingToExternal() + + 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.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) }); + var detal = details.ToList(); + foreach (var detail in detal) { - DataType = outgoingFromWms.DataType, - DataAction = outgoingFromWms.DataAction, - SourceSystem = EnumSystemType.WMS.ToString(), - SourceDataId = wmsCountAdjust.Number, - SourceDataGroupCode = wmsCountAdjust.Number, - SourceDataDetailCode = detail.ItemCode, - Writer = nameof(TyrpOutgoingBackgroundWorker), - DestinationSystem = EnumSystemType.ERP.ToString(), - DestinationDataId = "", - }; - outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); - - var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, detail).ConfigureAwait(false); - outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue); - var arrive = BuildIssue(exchangeIssue, departmentCode); - outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); + //判断盘点数与库存数是否相等 + if (detail.CountQty != detail.InventoryQty) + { + var outgoingToExternal = new OutgoingToExternal() + { + DataType = outgoingFromWms.DataType, + DataAction = outgoingFromWms.DataAction, + SourceSystem = EnumSystemType.WMS.ToString(), + SourceDataId = wmsCountAdjust.Number, + SourceDataGroupCode = wmsCountAdjust.Number, + SourceDataDetailCode = details.FirstOrDefault().ItemCode, + Writer = nameof(TyrpOutgoingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + DestinationDataId = "", + }; + outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); + var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, detail).ConfigureAwait(false); + outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeIssue); + var arrive = BuildIssue(exchangeIssue, departmentCode); + outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(arrive); - outgoingToExternalList.Add(outgoingToExternal); - } + outgoingToExternalList.Add(outgoingToExternal); + } + } + } - await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); + //将outgoingFromWms数据归档 + await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); return outgoingToExternalList; + //插入到中间表OutgoingToExternal } - private static CountAdjust BuildIssue(CountAdjustNoteExchangeDto exchangeCountAdjust, string departmentCode) + private CountAdjust BuildIssue(CountAdjustNoteExchangeDto exchangeCountAdjust, string departmentCode) { var detail = exchangeCountAdjust.Detail; - string time = DateTime.Now.ToLongTimeString(); - string time1 = DateTime.Now.ToShortDateString().Replace("/", "").Trim(); - string date = time1 + "" + time; - string asdtype = ""; - - if (Enum.Parse(exchangeCountAdjust.Type) == EnumTransSubType.CountAdjust_WIP) - { - asdtype = "4041"; - } - else if (Enum.Parse(exchangeCountAdjust.Type) == EnumTransSubType.CountAdjust_Warehouse) - { - asdtype = "4003"; - } var counta = new CountAdjust() { mesout_asd_refc = departmentCode, - mesout_asd_dt_w = date, - mesout_asd_type = asdtype, + mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + mesout_asd_type = "4003", mesout_asd_part = detail.ItemCode, - mesout_asd_date = exchangeCountAdjust.ActiveDate.ToShortDateString().Replace("/", "").Trim(), - mesout_asd_loc = detail.LocationErpCode, + mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"), + mesout_asd_loc = string.Empty, mesout_asd_code = detail.ReasonCode, - mesout_asd_qty = detail.CountQty, + mesout_asd_qty = detail.CountQty + detail.InventoryQty, mesout_asd_user = exchangeCountAdjust.Worker, mesout_asd_k = string.Empty, mesout_asd_stat = "Y" }; + return counta; + } private async Task BuildPurchaseReceiptExchangeDtoAsync( CountAdjustNoteDTO wmsCountAdjust, CountAdjustNoteDetailExchangeDto wmsCountAdjustDetail) { - await Task.CompletedTask.ConfigureAwait(false); var exchangeCountAdjust = _objectMapper.Map(wmsCountAdjust); - //var exchangeCountAdjustDetail = - // _objectMapper.Map(wmsCountAdjustDetail); - //var userdep = await _supplierAsnAppService.GetByNumberAsync(exchangeCountAdjust.Worker); - //exchangeCountAdjust.DepartmentCode = userdep.DepartmentCode; + exchangeCountAdjust.Detail = wmsCountAdjustDetail; return exchangeCountAdjust; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs index 785aedbce..dd628e54c 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/IssueNoteConverter.cs @@ -78,7 +78,7 @@ public class IssueNoteConverter : IOutgoingConverter outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); var exchangeReceiptDetail = _objectMapper.Map(detail); outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); - var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail); + var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, putawayNote.scontrol_dt_w); outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteDetail); outgoingToExternalList.Add(outgoingDetailToExternal); } @@ -115,12 +115,12 @@ public class IssueNoteConverter : IOutgoingConverter /// /// /// - private Scmsend BuildDataInterfaceDetail(IssueNoteExchangeDto exchangeOrder, IssueNoteDetailExchangeDto exchangeDetailOrder) + private Scmsend BuildDataInterfaceDetail(IssueNoteExchangeDto exchangeOrder, IssueNoteDetailExchangeDto exchangeDetailOrder, string dt_w) { var ret = new Scmsend() { scmsend_type = billtype, - scmsend_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scmsend_dt_w = dt_w, scmsend_nbr = exchangeOrder.Number, scmsend_stat1 = "1", scmsend_part = exchangeDetailOrder.ItemCode, @@ -130,7 +130,7 @@ public class IssueNoteConverter : IOutgoingConverter scmsend_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), scmsend_qty = exchangeDetailOrder.Qty, scmsend_wipd_loc = exchangeDetailOrder.ToLocationErpCode, - scmsend_userid = exchangeOrder.Worker + scmsend_userid = string.IsNullOrEmpty(exchangeOrder.Worker) ? "" : exchangeOrder.Worker.Length>6?(exchangeOrder.Worker).Substring(0, 6): exchangeOrder.Worker }; return ret; } 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 index 8e25bb6a7..bae2a8231 100644 --- 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 @@ -46,7 +46,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; var wmsCountAdjust = JsonSerializer.Deserialize(outgoingFromWms.DataContent); if (Enum.Parse(wmsCountAdjust.Type) == EnumTransSubType.Item_Transform) { - var department = await _departmentAppService.GetByUsernameAsync(wmsCountAdjust.Worker).ConfigureAwait(false); + 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) @@ -100,16 +100,11 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; 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_type = "4003", mesout_asd_part = detail.ItemCode, mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"), mesout_asd_loc = detail.LocationErpCode, diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductReceiptNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductReceiptNoteConverter.cs index 3289b919f..4782151d0 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductReceiptNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductReceiptNoteConverter.cs @@ -27,6 +27,8 @@ public class ProductReceiptNoteConverter : IOutgoingConverter _objectMapper = objectMapper; } + + public virtual async Task> ConvertAsync() { var outgoingToExternalList = new List(); @@ -67,7 +69,7 @@ public class ProductReceiptNoteConverter : IOutgoingConverter return outgoingToExternalList; } - private static ProductReceiptNote BuildProductReceiptNote(ProductReceiptNoteExchangeDto exchangeProductReceiptNote) + private ProductReceiptNote BuildProductReceiptNote(ProductReceiptNoteExchangeDto exchangeProductReceiptNote) { var detail = exchangeProductReceiptNote.Detail; var ret = new ProductReceiptNote() @@ -90,7 +92,6 @@ public class ProductReceiptNoteConverter : IOutgoingConverter private async Task BuildProductReceiptNoteExchangeDtoAsync(ProductReceiptNoteDTO wmsReceipt, ProductReceiptNoteDetailDTO wmsReceiptDetail) { - await Task.CompletedTask.ConfigureAwait(false); var exchangeReceipt = _objectMapper.Map(wmsReceipt); var exchangeReceiptDetail = _objectMapper.Map(wmsReceiptDetail); exchangeReceipt.Detail = exchangeReceiptDetail; diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs index 18069fd9e..778dad2a5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductRecycleNoteConverter.cs @@ -87,7 +87,7 @@ public class ProductRecycleNoteConverter : IOutgoingConverter DataAction = outgoingFromWms.DataAction, SourceSystem = EnumSystemType.WMS.ToString(), SourceDataId = materialDetail.Id.ToString(), - SourceDataGroupCode = detail.ItemCode, + SourceDataGroupCode = wmsReceipt.Number, SourceDataDetailCode = materialDetail.ItemCode, Writer = nameof(TyrpOutgoingBackgroundWorker), DestinationSystem = EnumSystemType.ERP.ToString(), @@ -134,7 +134,7 @@ public class ProductRecycleNoteConverter : IOutgoingConverter wmsoutm_stock_stat = "", wmsoutm_open_part = exchangeOrder.ItemCode, wmsoutm_open_loc = exchangeOrder.LocationErpCode, - wmsoutm_open_hours = 0, + wmsoutm_open_hours = 1,//无法取到转移工时 目前默认为1 wmsoutm_tyrp_k = "", wmsoutm_id = 0,//明细中最大scmsend_id wmsoutm_open_qt = exchangeOrderDetail.Qty, @@ -147,7 +147,7 @@ public class ProductRecycleNoteConverter : IOutgoingConverter /// /// /// - private static Wmsoutd BuildDataInterfaceDetail(ProductRecycleNoteExchangeDto exchangeOrder, ProductRecycleMaterialDetailExchangeDto exchangeDetailOrder) + private Wmsoutd BuildDataInterfaceDetail(ProductRecycleNoteExchangeDto exchangeOrder, ProductRecycleMaterialDetailExchangeDto exchangeDetailOrder) { var ret = new Wmsoutd() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductionReturnNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductionReturnNoteConverter.cs index 2711e5c5d..ddbc84b36 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductionReturnNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ProductionReturnNoteConverter.cs @@ -77,7 +77,7 @@ public class ProductionReturnNoteConverter : IOutgoingConverter outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); var exchangeReceiptDetail = _objectMapper.Map(detail); outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); - var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail); + var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, putawayNote.scontrol_dt_w); outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteDetail); outgoingToExternalList.Add(outgoingDetailToExternal); } @@ -114,12 +114,12 @@ public class ProductionReturnNoteConverter : IOutgoingConverter /// /// /// - private Scmsend BuildDataInterfaceDetail(ProductionReturnNoteExchangeDto exchangeOrder, ProductionReturnNoteDetailExchangeDto exchangeDetailOrder) + private Scmsend BuildDataInterfaceDetail(ProductionReturnNoteExchangeDto exchangeOrder, ProductionReturnNoteDetailExchangeDto exchangeDetailOrder, string dt_w) { var ret = new Scmsend() { scmsend_type = billtype, - scmsend_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scmsend_dt_w = dt_w, scmsend_nbr = exchangeOrder.Number, scmsend_stat1 = "2", scmsend_part = exchangeDetailOrder.ItemCode, @@ -129,7 +129,7 @@ public class ProductionReturnNoteConverter : IOutgoingConverter scmsend_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), scmsend_qty = exchangeDetailOrder.Qty, scmsend_wipd_loc = exchangeDetailOrder.FromLocationErpCode, - scmsend_userid = exchangeOrder.Worker + scmsend_userid = string.IsNullOrEmpty(exchangeOrder.Worker) ? "" : exchangeOrder.Worker }; return ret; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs index a24a2ebd6..8f4f6c1db 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseOrderConverter.cs @@ -85,7 +85,7 @@ public class PurchaseOrderConverter : IOutgoingConverter outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); var exchangeReceiptDetail = _objectMapper.Map(detail); outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); - var purchaseOrderDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail); + var purchaseOrderDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, purchaseOrder.scontrol_dt_w); outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(purchaseOrderDetail); outgoingToExternalList.Add(outgoingDetailToExternal); } @@ -122,12 +122,12 @@ public class PurchaseOrderConverter : IOutgoingConverter /// /// /// - private Scmsend BuildDataInterfaceDetail(PurchaseOrderExchangeDto exchangeOrder, PurchaseOrderDetailExchangeDto exchangeDetailOrder) + private Scmsend BuildDataInterfaceDetail(PurchaseOrderExchangeDto exchangeOrder, PurchaseOrderDetailExchangeDto exchangeDetailOrder, string dt_w) { var ret = new Scmsend() { scmsend_type = billtype, - scmsend_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scmsend_dt_w = dt_w, scmsend_nbr = exchangeOrder.Number, scmsend_stat1 = "3", scmsend_part = exchangeDetailOrder.ItemCode, @@ -137,7 +137,7 @@ public class PurchaseOrderConverter : IOutgoingConverter scmsend_date = exchangeOrder.OrderDate.ToString("yyyyMMdd"), scmsend_qty = exchangeDetailOrder.Qty, scmsend_wipd_loc = "", - scmsend_userid = exchangeOrder.ContactName + scmsend_userid = string.IsNullOrEmpty(exchangeOrder.ContactName) ? "" : exchangeOrder.ContactName }; return ret; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseReturnConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseReturnConverter.cs index 5e718b037..81c5c7571 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseReturnConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PurchaseReturnConverter.cs @@ -82,7 +82,7 @@ public class PurchaseReturnConverter : IOutgoingConverter outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); var exchangeReceiptDetail = _objectMapper.Map(detail); outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); - var purchaseReturnDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail); + var purchaseReturnDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, purchaseReturn.scontrol_dt_w); outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(purchaseReturnDetail); outgoingToExternalList.Add(outgoingDetailToExternal); } @@ -119,14 +119,14 @@ public class PurchaseReturnConverter : IOutgoingConverter /// /// /// - private Scmsend BuildDataInterfaceDetail(PurchaseReturnNoteExchangeDto exchangeOrder, PurchaseReturnNoteDetailExchangeDto exchangeDetailOrder) + private Scmsend BuildDataInterfaceDetail(PurchaseReturnNoteExchangeDto exchangeOrder, PurchaseReturnNoteDetailExchangeDto exchangeDetailOrder, string dt_w) { var ret = new Scmsend() { scmsend_type = billtype, - scmsend_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scmsend_dt_w = dt_w, scmsend_nbr = exchangeOrder.Number, - scmsend_stat1 = "0", + scmsend_stat1 = "4", scmsend_part = exchangeDetailOrder.ItemCode, scmsend_delv_date = "", scmsend_orderno = exchangeOrder.SupplierCode, @@ -134,7 +134,7 @@ public class PurchaseReturnConverter : IOutgoingConverter scmsend_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), scmsend_qty = exchangeDetailOrder.Qty, scmsend_wipd_loc = "", - scmsend_userid = exchangeOrder.ContactName + scmsend_userid = string.IsNullOrEmpty(exchangeOrder.ContactName) ? "" : exchangeOrder.ContactName }; return ret; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs index afa25d379..8e98d56a8 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/PutawayNoteConverter.cs @@ -77,7 +77,7 @@ public class PutawayNoteConverter : IOutgoingConverter outgoingDetailToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); var exchangeReceiptDetail = _objectMapper.Map(detail); outgoingDetailToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceiptDetail); - var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail); + var putawayNoteDetail = BuildDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, putawayNote.scontrol_dt_w); outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteDetail); outgoingToExternalList.Add(outgoingDetailToExternal); } @@ -114,12 +114,12 @@ public class PutawayNoteConverter : IOutgoingConverter /// /// /// - private Scmsend BuildDataInterfaceDetail(PutawayNoteExchangeDto exchangeOrder, PutawayNoteDetailExchangeDto exchangeDetailOrder) + private Scmsend BuildDataInterfaceDetail(PutawayNoteExchangeDto exchangeOrder, PutawayNoteDetailExchangeDto exchangeDetailOrder, string dt_w) { var ret = new Scmsend() { scmsend_type = billtype, - scmsend_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scmsend_dt_w = dt_w, scmsend_nbr = exchangeOrder.Number, scmsend_stat1 = "0", scmsend_part = exchangeDetailOrder.ItemCode, @@ -129,7 +129,7 @@ public class PutawayNoteConverter : IOutgoingConverter scmsend_date = exchangeOrder.ActiveDate.ToString("yyyyMMdd"), scmsend_qty = exchangeDetailOrder.Qty, scmsend_wipd_loc = "", - scmsend_userid = exchangeOrder.Worker + scmsend_userid = string.IsNullOrEmpty(exchangeOrder.Worker) ? "" : exchangeOrder.Worker }; return ret; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs index 02d8514ad..dc64e2b06 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/RecycledMaterialReceiptNoteConverter.cs @@ -138,7 +138,7 @@ public class RecycledMaterialReceiptNoteConverter : IOutgoingConverter /// /// /// - private static Wmsoutd BuildDataInterfaceDetail(RecycledMaterialReceiptNoteExchangeDto exchangeOrder, RecycledMaterialReceiptNoteDetailExchangeDto exchangeDetailOrder) + private Wmsoutd BuildDataInterfaceDetail(RecycledMaterialReceiptNoteExchangeDto exchangeOrder, RecycledMaterialReceiptNoteDetailExchangeDto exchangeDetailOrder) { var ret = new Wmsoutd() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScrapNoteConVerter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScrapNoteConVerter.cs index 486fecdc3..8a4bb37f9 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScrapNoteConVerter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/ScrapNoteConVerter.cs @@ -38,8 +38,7 @@ IOutgoingFromWmsManager outgoingFromWmsManager public virtual async Task> ConvertAsync() { var outgoingToExternalList = new List(); - var outgoingFromWmsList = - await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.UnplannedIssue, EnumSystemType.ERP).ConfigureAwait(false); + var outgoingFromWmsList = await _outgoingFromWmsManager.GetToBeProcessedListAsync(EnumOutgoingDataType.Scrap, EnumSystemType.ERP).ConfigureAwait(false); foreach (var outgoingFromWms in outgoingFromWmsList) { var wmsCountAdjust = JsonSerializer.Deserialize(outgoingFromWms.DataContent); @@ -69,36 +68,40 @@ IOutgoingFromWmsManager outgoingFromWmsManager outgoingToExternalList.Add(outgoingToExternal); } } - await _outgoingToExternalManager.CreateManyAsync(outgoingToExternalList).ConfigureAwait(false); + //将outgoingFromWms数据归档 + await _outgoingFromWmsManager.ArchiveManyAsync(outgoingFromWmsList).ConfigureAwait(false); return outgoingToExternalList; } - private static CountAdjust BuildIssue(ScrapNoteExchangeDto exchangeScrap, string departmentCode) + private CountAdjust BuildIssue(ScrapNoteExchangeDto exchangeScrap, string departmentCode) { var detail = exchangeScrap.Detail; - string time = DateTime.Now.ToLongTimeString(); - string time1 = DateTime.Now.ToShortDateString().Replace("/", "").Trim(); - //string date = time1 + " " + time; - string date = string.Format("{0} {1}", time, time1); string asdtype = ""; - - if (Enum.Parse(exchangeScrap.Type) == EnumTransSubType.CountAdjust_WIP) + if (exchangeScrap.Type== EnumTransSubType.CountAdjust_WIP.ToString()) { asdtype = "4042"; } - else if (Enum.Parse(exchangeScrap.Type) == EnumTransSubType.CountAdjust_Warehouse) + else if (exchangeScrap.Type == EnumTransSubType.CountAdjust_Warehouse.ToString()) + { + asdtype = "4004"; + } + else if (exchangeScrap.Type == EnumTransSubType.Scrap_Manual.ToString()) { asdtype = "4004"; } + else if (exchangeScrap.Type == EnumTransSubType.Scrap_WIP.ToString()) + { + asdtype = "4042"; + } var counta = new CountAdjust() { mesout_asd_refc = departmentCode, - mesout_asd_dt_w = date, + mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), mesout_asd_type = asdtype, mesout_asd_part = detail.ItemCode, - mesout_asd_date = exchangeScrap.ActiveDate.ToShortDateString().Replace("/", "").Trim(), - mesout_asd_loc = "",//字段不明确 + mesout_asd_date = exchangeScrap.ActiveDate.ToString("yyyyMMdd"), + mesout_asd_loc = detail.FromLocationErpCode, mesout_asd_code = detail.ReasonCode, mesout_asd_qty = detail.Qty, mesout_asd_user = exchangeScrap.Worker, @@ -109,7 +112,6 @@ IOutgoingFromWmsManager outgoingFromWmsManager } private async Task BuildPurchaseReceiptExchangeDtoAsync(ScrapNoteDTO wmsScrap, ScrapNoteDetailDTO wmsScrapDetail) { - await Task.CompletedTask.ConfigureAwait(false); var exchangeScrap = _objectMapper.Map(wmsScrap); var exchangeScrapDetail = _objectMapper.Map(wmsScrapDetail); //var userdep = await _supplierAsnAppService.GetByNumberAsync(exchangeCountAdjust.Worker); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs index c3c0e45aa..3fd884c13 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/TransferNoteConverter.cs @@ -36,6 +36,7 @@ public class TransferNoteConverter : IOutgoingConverter _objectMapper = objectMapper; } + public virtual async Task> ConvertAsync() { var outgoingToExternalList = new List(); @@ -68,16 +69,17 @@ public class TransferNoteConverter : IOutgoingConverter }; outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); outgoingToExternal.SourceDataContent = JsonSerializer.Serialize(exchangeReceipt); + string dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"); if (exchangeReceipt.Type != EnumTransSubType.Transfer_Customer.ToString()) { outgoingToExternal.DataType = EnumOutgoingDataType.TransferForErp.ToString(); - var putawayNoteScontrol = BuildScontrolDataInterface(exchangeReceipt); + var putawayNoteScontrol = BuildScontrolDataInterface(exchangeReceipt, dt_w); outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteScontrol); } else { outgoingToExternal.DataType = EnumOutgoingDataType.TransferForCustom.ToString(); - var putawayNoteWmsoutm = BuildWmsoutmDataInterface(exchangeReceipt, departmentCode); + var putawayNoteWmsoutm = BuildWmsoutmDataInterface(exchangeReceipt, departmentCode, dt_w); outgoingToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteWmsoutm); } @@ -106,7 +108,7 @@ public class TransferNoteConverter : IOutgoingConverter if (exchangeReceipt.Type != EnumTransSubType.Transfer_Customer.ToString()) { - var putawayNoteDetailScmsend = BuildScmsendDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail); + var putawayNoteDetailScmsend = BuildScmsendDataInterfaceDetail(exchangeReceipt, exchangeReceiptDetail, dt_w); outgoingDetailToExternal.DestinationDataContent = JsonSerializer.Serialize(putawayNoteDetailScmsend); } else @@ -133,12 +135,12 @@ public class TransferNoteConverter : IOutgoingConverter /// /// /// - private Scontrol BuildScontrolDataInterface(TransferNoteExchangeDto exchangeOrder) + private Scontrol BuildScontrolDataInterface(TransferNoteExchangeDto exchangeOrder, string dt_w) { var ret = new Scontrol() { scontrol_nbr = exchangeOrder.Number, - scontrol_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scontrol_dt_w = dt_w, scontrol_stat = "Y", scontrol_dt_k = "", scontrol_type = billtype_s, @@ -152,12 +154,12 @@ public class TransferNoteConverter : IOutgoingConverter /// /// /// - private Scmsend BuildScmsendDataInterfaceDetail(TransferNoteExchangeDto exchangeOrder, TransferNoteDetailExchangeDto exchangeDetailOrder) + private Scmsend BuildScmsendDataInterfaceDetail(TransferNoteExchangeDto exchangeOrder, TransferNoteDetailExchangeDto exchangeDetailOrder, string dt_w) { var ret = new Scmsend() { scmsend_type = billtype_s, - scmsend_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + scmsend_dt_w = dt_w, scmsend_nbr = exchangeOrder.Number, scmsend_stat1 = "0", scmsend_part = exchangeDetailOrder.ItemCode, @@ -177,13 +179,13 @@ public class TransferNoteConverter : IOutgoingConverter /// /// /// - private Wmsoutm BuildWmsoutmDataInterface(TransferNoteExchangeDto exchangeOrder, string departmentCode) + private Wmsoutm BuildWmsoutmDataInterface(TransferNoteExchangeDto exchangeOrder, string departmentCode, string dt_w) { var ret = new Wmsoutm() { wmsoutm_nbr = exchangeOrder.Number, wmsoutm_type = billtype_w, - wmsoutm_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + wmsoutm_dt_w = dt_w, wmsoutm_stat = "Y", wmsoutm_tyrp_dt = "", wmsoutm_user = exchangeOrder.Worker, @@ -192,7 +194,7 @@ public class TransferNoteConverter : IOutgoingConverter wmsoutm_cust = "", wmsoutm_shm_nbr = "", wmsoutm_cust_loc = "", - wmsoutm_stock_stat = "", + wmsoutm_stock_stat = "1", wmsoutm_open_part = "", wmsoutm_open_loc = "", wmsoutm_open_hours = 0, @@ -208,7 +210,7 @@ public class TransferNoteConverter : IOutgoingConverter /// /// /// - private static Wmsoutd BuildWmsoutdDataInterfaceDetail(TransferNoteExchangeDto exchangeOrder, TransferNoteDetailExchangeDto exchangeDetailOrder) + private Wmsoutd BuildWmsoutdDataInterfaceDetail(TransferNoteExchangeDto exchangeOrder, TransferNoteDetailExchangeDto exchangeDetailOrder) { var ret = new Wmsoutd() { 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 52ca1123a..f51ade931 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 @@ -30,8 +30,9 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase [UnitOfWork] protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) - { + { Logger.LogInformation($"Starting: Handling {Outgoing}"); + if (!_options.Value.IncomingOptions.Active) { Logger.LogInformation($"{Outgoing} is not active!"); @@ -109,22 +110,28 @@ public class TyrpOutgoingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase var productRecycleNoteList = await productRecycleNoteConvert.ConvertAsync().ConfigureAwait(false); await wmsoutmWriter.WriteAsync(productRecycleNoteList).ConfigureAwait(false); - Logger.LogInformation($"Write CountAdjusNote");//调整单、线边仓调整单 + Logger.LogInformation($"Write CountAdjusNote");//盘点调整单 var countadjustNoteConvert = workerContext.ServiceProvider.GetRequiredService(); var countadjustNoteList = await countadjustNoteConvert.ConvertAsync().ConfigureAwait(false); var countadjustWriter = workerContext.ServiceProvider.GetRequiredService(); await countadjustWriter.WriteAsync(countadjustNoteList).ConfigureAwait(false); - Logger.LogInformation($"Write ScrapNote");//报废单、线边仓报废单 - var scrapNoteConvert = workerContext.ServiceProvider.GetRequiredService(); - var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false); - await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false); + Logger.LogInformation($"Write WIPAdjusNote");//线边仓调整单 + var wipAdjustNoteConvert = workerContext.ServiceProvider.GetRequiredService(); + var wipAdjustNoteList = await wipAdjustNoteConvert.ConvertAsync().ConfigureAwait(false); + await countadjustWriter.WriteAsync(wipAdjustNoteList).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}"); + + Logger.LogInformation($"Write ScrapNote");//报废单、线边仓报废单 + var scrapNoteConvert = workerContext.ServiceProvider.GetRequiredService(); + var scrapNoteList = await scrapNoteConvert.ConvertAsync().ConfigureAwait(false); + await countadjustWriter.WriteAsync(scrapNoteList).ConfigureAwait(false); + } } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs index d302b0278..8a48b7e26 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedIssueNoteConverter.cs @@ -49,7 +49,7 @@ public class UnplannedIssueNoteConverter : IOutgoingConverter var exchangeReceipt = _objectMapper.Map(wmsReceipt); var department = await _departmentAppService.GetByUsernameAsync(exchangeReceipt.Worker).ConfigureAwait(false); var departmentCode = department == null ? "" : department.Code; - var purchaseOrder = BuildDataInterface(exchangeReceipt, departmentCode); + var purchaseOrder = BuildDataInterface(exchangeReceipt); var outgoingToExternal = new OutgoingToExternal() { DataType = EnumOutgoingDataType.UnplannedIssue.ToString(), @@ -106,7 +106,7 @@ public class UnplannedIssueNoteConverter : IOutgoingConverter /// /// /// - private Wmsoutm BuildDataInterface(UnplannedIssueNoteExchangeDto exchangeOrder, string departmentCode) + private Wmsoutm BuildDataInterface(UnplannedIssueNoteExchangeDto exchangeOrder) { var ret = new Wmsoutm() @@ -138,7 +138,7 @@ public class UnplannedIssueNoteConverter : IOutgoingConverter /// /// /// - private static Wmsoutd BuildDataInterfaceDetail(UnplannedIssueNoteExchangeDto exchangeOrder, UnplannedIssueNoteDetailExchangeDto exchangeDetailOrder) + private Wmsoutd BuildDataInterfaceDetail(UnplannedIssueNoteExchangeDto exchangeOrder, UnplannedIssueNoteDetailExchangeDto exchangeDetailOrder) { var ret = new Wmsoutd() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs index c45eb07b8..bc4f6f856 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/UnplannedReceiptNoteConverter.cs @@ -138,7 +138,7 @@ public class UnplannedReceiptNoteConverter : IOutgoingConverter /// /// /// - private static Wmsoutd BuildDataInterfaceDetail(UnplannedReceiptNoteExchangeDto exchangeOrder, UnplannedReceiptNoteDetailExchangeDto exchangeDetailOrder) + private Wmsoutd BuildDataInterfaceDetail(UnplannedReceiptNoteExchangeDto exchangeOrder, UnplannedReceiptNoteDetailExchangeDto exchangeDetailOrder) { var ret = new Wmsoutd() { diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/WIPAdjusNoteConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/WIPAdjusNoteConverter.cs new file mode 100644 index 000000000..7f3498c07 --- /dev/null +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Outgoing/WIPAdjusNoteConverter.cs @@ -0,0 +1,112 @@ +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.CountAdjustNote; +using Win_in.Sfs.Wms.Store.Application.Contracts; + +namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent.Outgoing; + +public class WIPAdjusNoteConverter : IOutgoingConverter +{ + private readonly IOutgoingFromWmsManager _outgoingFromWmsManager; + private readonly IOutgoingToExternalManager _outgoingToExternalManager; + private readonly ISupplierAsnAppService _supplierAsnAppService; + private readonly IDepartmentAppService _departmentAppService; + private readonly IObjectMapper _objectMapper; + + public WIPAdjusNoteConverter( + 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.WIPAdjust, EnumSystemType.ERP).ConfigureAwait(false); + foreach (var outgoingFromWms in outgoingFromWmsList) + { + var wmsCountAdjust = JsonSerializer.Deserialize(outgoingFromWms.DataContent); + 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.LocationErpCode }).Select(p => new CountAdjustNoteDetailExchangeDto { CountQty = p.Sum(itm => itm.CountQty), InventoryQty = p.Sum(itm => itm.InventoryQty), ItemCode = p.Key.ItemCode, LocationErpCode = p.Key.LocationErpCode, ReasonCode = String.Join("、", p.Select(x => x.ReasonCode).ToArray()) }); + var detal = details.ToList(); + foreach (var detail in detal) + { + //判断盘点数与库存数是否相等 + if (detail.CountQty != detail.InventoryQty) + { + var outgoingToExternal = new OutgoingToExternal() + { + DataType = outgoingFromWms.DataType, + DataAction = outgoingFromWms.DataAction, + SourceSystem = EnumSystemType.WMS.ToString(), + SourceDataId = wmsCountAdjust.Number, + SourceDataGroupCode = wmsCountAdjust.Number, + SourceDataDetailCode = details.FirstOrDefault().ItemCode, + Writer = nameof(TyrpOutgoingBackgroundWorker), + DestinationSystem = EnumSystemType.ERP.ToString(), + DestinationDataId = "", + }; + outgoingToExternal.SetEffectiveDate(outgoingFromWms.EffectiveDate); + var exchangeIssue = await BuildPurchaseReceiptExchangeDtoAsync(wmsCountAdjust, detail).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(CountAdjustNoteExchangeDto exchangeCountAdjust, string departmentCode) + { + var detail = exchangeCountAdjust.Detail; + var counta = new CountAdjust() + { + mesout_asd_refc = departmentCode, + mesout_asd_dt_w = DateTime.Now.ToString("yyyyMMdd HH:mm:ss"), + mesout_asd_type = "4041", + mesout_asd_part = detail.ItemCode, + mesout_asd_date = exchangeCountAdjust.ActiveDate.ToString("yyyyMMdd"), + mesout_asd_loc = string.Empty, + mesout_asd_code = detail.ReasonCode, + mesout_asd_qty = detail.CountQty + detail.InventoryQty, + mesout_asd_user = exchangeCountAdjust.Worker, + mesout_asd_k = string.Empty, + mesout_asd_stat = "Y" + }; + return counta; + } + + private async Task BuildPurchaseReceiptExchangeDtoAsync( + CountAdjustNoteDTO wmsCountAdjust, CountAdjustNoteDetailExchangeDto wmsCountAdjustDetail) + { + var exchangeCountAdjust = _objectMapper.Map(wmsCountAdjust); + + exchangeCountAdjust.Detail = wmsCountAdjustDetail; + return exchangeCountAdjust; + } +} diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs index 7b996e278..215ea8659 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/TyrpAgentModule.cs @@ -172,8 +172,8 @@ public class TyrpAgentModule : AbpModule ApplicationInitializationContext context) { - context.AddBackgroundWorkerAsync(); - // context.AddBackgroundWorkerAsync(); + // context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); } } 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..692eb9497 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(); } } 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.Application.Contracts/WMS/CountAdjustNote/CountAdjustNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/CountAdjustNote/CountAdjustNoteDetailExchangeDto.cs index 2b9bde390..2f85e4307 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/CountAdjustNote/CountAdjustNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/CountAdjustNote/CountAdjustNoteDetailExchangeDto.cs @@ -4,7 +4,6 @@ namespace Win_in.Sfs.Wms.DataExchange.WMS.CountAdjustNote; public class CountAdjustNoteDetailExchangeDto { - /// /// 物品代码 /// @@ -21,9 +20,18 @@ public class CountAdjustNoteDetailExchangeDto [Display(Name = "原因代码")] public string ReasonCode { get; set; } /// + /// 库存数量 + /// + [Display(Name = "库存数量")] + public decimal InventoryQty { get; set; } + /// + /// 调整数量 + /// + [Display(Name = "调整数量")] + public decimal AdjustQty { get; set; } + /// /// 盘点数量 /// [Display(Name = "盘点数量")] public decimal CountQty { get; set; } - } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteDetailExchangeDto.cs index 8fed844ed..21b82f5e1 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteDetailExchangeDto.cs @@ -1,3 +1,4 @@ +using System; using System.ComponentModel.DataAnnotations; namespace Win_in.Sfs.Wms.DataExchange.WMS.PutawayNote; @@ -26,9 +27,58 @@ public class PutawayNoteDetailExchangeDto [Display(Name = "目标ERP库位")] public string ToLocationErpCode { get; set; } + /// + /// 箱标签 + /// + [Display(Name = "箱标签")] + public string ToPackingCode { get; set; } + /// /// 数量 /// [Display(Name = "数量")] public decimal Qty { get; set; } + + /// + /// 数量 + /// + [Display(Name = "订单数量")] + public decimal ShippedQty { get; set; } + + /// + /// 供应商代码 + /// + [Display(Name = "供应商代码")] + public string SupplierCode { get; set; } + /// + /// 批次 + /// + [Display(Name = "批次")] + public string ToLot { get; set; } + /// + /// 生产时间 + /// + [Display(Name = "生产时间")] + public DateTime ProduceDate { get; set; } = DateTime.Now; + /// + /// 发货单号 + /// + [Display(Name = "发货单号")] + public string AsnNumber { get; set; } + /// + /// 发货时间 + /// + + public DateTime? ShipDate { get; set; } + /// + /// 筹措员 + /// + + public string PlanUserCode { get; set; } + + + + + [Display(Name = "备注")] + public string Remark { get; set; } } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteExchangeDto.cs index 74034bbdf..dc0d65103 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/PutawayNote/PutawayNoteExchangeDto.cs @@ -27,4 +27,6 @@ public class PutawayNoteExchangeDto [Display(Name = "操作员")] public string Worker { get; set; } + public PutawayNoteDetailExchangeDto Detail { get; set; } = new(); + } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml index b7dad136f..e4bc696cb 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml @@ -411,6 +411,16 @@ 原因代码 + + + 库存数量 + + + + + 调整数量 + + 盘点数量 @@ -1116,11 +1126,51 @@ 目标ERP库位 + + + 箱标签 + + 数量 + + + 数量 + + + + + 供应商代码 + + + + + 批次 + + + + + 生产时间 + + + + + 发货单号 + + + + + 发货时间 + + + + + 筹措员 + + 上架单号 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 cc783226f..74cb9fe37 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 @@ -24,13 +24,14 @@ public enum EnumOutgoingDataType ProductionReturn = 16, ProductReceipt = 17, Deliver = 18, - CountAdjust = 19, + CountAdjust = 19,//盘点整单 CustomerReturn = 20, UnplannedIssue = 21, RecycledMaterialReceipt = 22, - ScrapNote = 23, + Scrap = 23, ProductRecycle = 24, - Item_Transform = 25 + Item_Transform = 25,//线边仓调整单 + WIPAdjust = 26//回收料调整单 } public enum EnumExchangeTableType { 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 907793da8..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 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/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 37c115932..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) { 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/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs index 7c0a2e9f0..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 @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithFromToInputBase : SfsStoreD [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 b3e0870be..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 @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendToDetailWithFromToInputBase : SfsStoreDet [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/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs index 827b3dead..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 @@ -34,7 +34,6 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 订单类型 /// [Display(Name = "订单类型")] - [Required(ErrorMessage = "{0}是必填项")] public string PoType { get; set; } /// @@ -179,7 +178,6 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 明细-类型 暂定:备件是B 辅材是F 生产为空 /// [Display(Name = "明细-类型 备件是B 辅材是F 生产为空")] - [Required(ErrorMessage = "{0}是必填项")] public string Ctype { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs index 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/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/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs index 77ff33bb5..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 @@ -131,8 +131,10 @@ public class PurchaseReturnRequestAppService : /// /// 赋值详情 /// + /// /// /// + /// /// private async Task SetDetailPropertiesAsync( PurchaseReturnRequestDetail detail, 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/UnplannedIssueRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs index 630967205..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 @@ -107,7 +107,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA detail.Lot = balance.Lot; detail.ContainerCode = balance.ContainerCode; detail.PackingCode = balance.PackingCode; - detail.Qty = balance.Qty; + detail.Qty = detail.Qty; detail.Status = balance.Status; } 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 index 819a11568..5b0d6f098 100644 --- 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 @@ -134,6 +134,7 @@ public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase /// 新增实体 /// /// CreateInput + [HttpPost("")] public override async Task CreateAsync(WipWarehouseAdjustRequestEditInput input) { var entity = ObjectMapper.Map(input); 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.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs index bec022137..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 @@ -29,6 +29,14 @@ public partial class StoreEventAutoMapperProfile : Profile .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/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/PurchaseReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PurchaseReceiptNoteEventHandler.cs index 5afa1533b..332591e09 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PurchaseReceiptNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PurchaseReceiptNoteEventHandler.cs @@ -40,8 +40,5 @@ public class PurchaseReceiptNoteEventHandler //QAD var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false); - //EOS - var exchangeData_eos = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.EOS, EnumExchangeDataType.PurchaseReceipt, dtos).ConfigureAwait(false); - await AddManyAsync(exchangeData_eos).ConfigureAwait(false); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PutawayNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PutawayNoteEventHandler.cs index 1031ccca6..da7e53b71 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PutawayNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/PutawayNoteEventHandler.cs @@ -39,5 +39,8 @@ public class PutawayNoteEventHandler } var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false); + //EOS + var exchangeData_eos = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.EOS, ExchangeDataType, dtos).ConfigureAwait(false); + await AddManyAsync(exchangeData_eos).ConfigureAwait(false); } } 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/IHasLocationDtoExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs index 8bfaac66e..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; } } } @@ -28,6 +30,9 @@ public static class IHasLocationExtensions 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;