Browse Source

mes注塑粒子叫料

dev_DY_CC
lvzb 12 months ago
parent
commit
47a55497e4
  1. 39
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs
  2. 44
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs
  3. 10
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs
  4. 7
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs
  5. 27
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs
  6. 12
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs
  7. 1
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs
  8. 3
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs
  9. 2
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs
  10. 3
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs
  11. 63
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs
  12. 101
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs
  13. 121
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs
  14. 20
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs
  15. 7
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
  16. 3
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs
  17. 34
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs
  18. 36
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs
  19. 45
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml
  20. 4
      be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs
  21. 15
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs
  22. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs

39
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs

@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
public class CallMtl : Entity
{
/// <summary>
/// 序号
/// </summary>
[Key]
public string mesout_callmtl_id { get; set; }
/// <summary>
/// 物料
/// </summary>
public string mesout_callmtl_erpno { get; set; }
/// <summary>
/// 库位
/// </summary>
public string mesout_callmtl_loc { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal mesout_callmtl_num { get; set; }
/// <summary>
/// 时间
/// </summary>
public string mesout_callmtl_wt { get; set; }
/// <summary>
/// 是否读取(0,1)
/// </summary>
public long Yl1 { get; set; }
public override object[] GetKeys()
{
return new object[] { mesout_callmtl_id };
}
}

44
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
public class CallMtlManager : DomainService, ICallMtlManager
{
private readonly ICallMtlRepository _repository;
public CallMtlManager(ICallMtlRepository repository)
{
_repository = repository;
}
public virtual async Task<List<CallMtl>> GetToBeProcessedListAsync()
{
var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false);
return plans;
}
public virtual async Task UpdateProcesseErrordListAsync(List<CallMtl> entities)
{
var ids = entities.Select(p => p.mesout_callmtl_id);
var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_callmtl_id)).ConfigureAwait(false);
plans.ForEach(p =>
{
p.Yl1 = 2;
// p.WmsDate = Clock.Now;
});
await _repository.UpdateManyAsync(plans).ConfigureAwait(false);
}
public virtual async Task UpdateProcessedListAsync(List<CallMtl> entities)
{
var ids = entities.Select(p => p.mesout_callmtl_id);
var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_callmtl_id)).ConfigureAwait(false);
plans.ForEach(p =>
{
p.Yl1 = 1;
// p.WmsDate = Clock.Now;
});
await _repository.UpdateManyAsync(plans).ConfigureAwait(false);
}
}

10
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs

@ -0,0 +1,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
public interface ICallMtlManager
{
Task<List<CallMtl>> GetToBeProcessedListAsync();
Task UpdateProcessedListAsync(List<CallMtl> entities);
Task UpdateProcesseErrordListAsync(List<CallMtl> entities);
}

7
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs

@ -0,0 +1,7 @@
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
public interface ICallMtlRepository : IRepository<CallMtl>
{
}

27
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs

@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes;
public static class CallMtlDbContextModelCreatingExtensions
{
public static void ConfigureCallMtl(this ModelBuilder builder, MesModelBuilderConfigurationOptions options)
{
builder.Entity<CallMtl>(b =>
{
//Configure table & schema Name
b.ToTable(options.TablePrefix + "mesout_callmtl", options.Schema);
//Configure ABP properties
b.ConfigureByConvention();
//Properties
b.Property(q => q.mesout_callmtl_id).HasMaxLength(20);
b.Property(q => q.mesout_callmtl_erpno).HasMaxLength(20);
b.Property(q => q.mesout_callmtl_loc).HasMaxLength(10);
b.Property(q => q.mesout_callmtl_num).HasPrecision(10, 2);
b.Property(q => q.mesout_callmtl_wt).HasMaxLength(20);
b.Property(q => q.Yl1);
});
}
}

12
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs

@ -0,0 +1,12 @@
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
namespace Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes;
public class CallMtlEfCoreRepository : EfCoreRepository<MesDbContext, CallMtl>, ICallMtlRepository
{
public CallMtlEfCoreRepository(IDbContextProvider<MesDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
}

1
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeDbContextModelCreatingExtensions.cs

@ -30,5 +30,6 @@ public static class DataExchangeDbContextModelCreatingExtensions
builder.ConfigureQtyrfe(options);
builder.ConfigureFrozen(options);
builder.ConfigureDelivery(options);
builder.ConfigureCallMtl(options);
}
}

3
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/DataExchangeEntityFrameworkCoreFawtygModule.cs

@ -3,6 +3,7 @@ using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Modularity;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
@ -38,6 +39,6 @@ public class DataExchangeEntityFrameworkCoreFawtygModule : AbpModule
context.Services.AddTransient<IQtyrfeRepository, QtyrfeEfCoreRepository>();
context.Services.AddTransient<IFrozenRepository, FrozenEfCoreRepository>();
context.Services.AddTransient<IDeliveryRepository, DeliveryEfCoreRepository>();
context.Services.AddTransient<ICallMtlRepository, CallMtlEfCoreRepository>();
}
}

2
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/IMesDbContext.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
@ -29,4 +30,5 @@ public interface IMesDbContext : IEfCoreDbContext
DbSet<Frozen> Frozen { get; }
DbSet<Delivery> Delivery { get; }
DbSet<CallMtl> CallMtl { get; }
}

3
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesDbContext.cs

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Delivery;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Frozen;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes;
@ -30,6 +31,8 @@ public class MesDbContext :
public virtual DbSet<Frozen> Frozen { get; }
public virtual DbSet<Delivery> Delivery { get; }
public virtual DbSet<CallMtl> CallMtl { get; }
public MesDbContext(DbContextOptions<MesDbContext> options)
: base(options)
{

63
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs

@ -5,6 +5,7 @@ using Win_in.Sfs.Wms.DataExchange.Domain;
using Win_in.Sfs.Wms.DataExchange.WMS.BackFlushNote;
using Win_in.Sfs.Wms.DataExchange.WMS.DeliverNote;
using Win_in.Sfs.Wms.DataExchange.WMS.DeliverRequest;
using Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest;
using Win_in.Sfs.Wms.DataExchange.WMS.MaterialRequest;
using Win_in.Sfs.Wms.DataExchange.WMS.MesNote;
using Win_in.Sfs.Wms.DataExchange.WMS.PCK;
@ -152,16 +153,14 @@ public class FawtygAutoMapperProfile : Profile
.IgnoreIHasRecommendAndHandledFrom();
CreateMap<IssueNoteDTO, IssueNoteExchangeDto>()
.Ignore(x => x.Detail)
;
.Ignore(x => x.Detail);
CreateMap<IssueNoteDetailDTO, IssueNoteDetailExchangeDto>();
CreateMap<ScrapNoteExchangeDto, ScrapNoteEditInput>()
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Number)
.Ignore(x => x.JobNumber)
;
.Ignore(x => x.JobNumber);
CreateMap<ScrapNoteDetailExchangeDto, ScrapNoteDetailInput>()
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
@ -179,15 +178,14 @@ public class FawtygAutoMapperProfile : Profile
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
;
.Ignore(x => x.StdPackQty);
CreateMap<TransferNoteExchangeDto, TransferNoteEditInput>()
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.RequestNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.CallRequestNumber)
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.RequestNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.CallRequestNumber)
.Ignore(x => x.CallJobNumber)
.Ignore(x => x.CallBusinessType)
.Ignore(x => x.CallServerName)
@ -196,7 +194,6 @@ public class FawtygAutoMapperProfile : Profile
.Ignore(x => x.ConfirmTime)
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties);
;
CreateMap<TransferNoteDetailExchangeDto, TransferNoteDetailInput>()
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
@ -220,17 +217,15 @@ public class FawtygAutoMapperProfile : Profile
.Ignore(x => x.ProduceDate)
.Ignore(x => x.ExpireDate)
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
;
.Ignore(x => x.StdPackQty);
CreateMap<MesNoteExchangeDto, MesNoteEditInput>()
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties);
;
CreateMap<MesNoteDetailExchangeDto, MesNoteDetailInput>()
.ForMember(x=>x.FromLocationCode,y=>y.MapFrom(t=>t.FromLocationErpCode))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.FromLocationErpCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.ToLocationErpCode))
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
@ -252,21 +247,19 @@ public class FawtygAutoMapperProfile : Profile
.Ignore(x => x.ProduceDate)
.Ignore(x => x.ExpireDate)
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
;
.Ignore(x => x.StdPackQty);
CreateMap<DeliverRequestExchangeDto, DeliverRequestEditInput>()
.Ignore(x => x.DeliverPlanNumber)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Details)
.Ignore(x=>x.CustomerAddressCode)
.Ignore(x => x.CustomerAddressCode)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.AutoSubmit)
.Ignore(x => x.AutoAgree)
.Ignore(x => x.AutoHandle)
.Ignore(x => x.AutoCompleteJob)
.Ignore(x => x.DirectCreateNote)
;
.Ignore(x => x.DirectCreateNote);
CreateMap<DeliverRequestDetailExchangeDto, DeliverRequestDetailInput>()
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
@ -274,6 +267,32 @@ public class FawtygAutoMapperProfile : Profile
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2);
;
CreateMap<InjectionIssueRequestExchangeDto, InjectionIssueRequestEditInput>()
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Details)
.Ignore(x => x.AutoSubmit)
.Ignore(x => x.AutoAgree)
.Ignore(x => x.AutoHandle)
.Ignore(x => x.AutoCompleteJob)
.Ignore(x => x.DirectCreateNote)
.Ignore(x => x.UseOnTheWayLocation);
CreateMap<InjectionIssueRequestDetailExchangeDto, InjectionIssueRequestDetailInput>()
.Ignore(x => x.Uom)
.Ignore(x => x.StdPackQty)
.Ignore(x => x.Remark)
.Ignore(x => x.ItemName)
.Ignore(x => x.ItemDesc1)
.Ignore(x => x.ItemDesc2)
.Ignore(x => x.ProdLine)
.Ignore(x => x.ToLocationErpCode)
.Ignore(x => x.ToLocationArea)
.Ignore(x => x.ToLocationGroup)
.Ignore(x => x.ToWarehouseCode)
.Ignore(x => x.RequestStatus)
.Ignore(x => x.IssuedQty)
.Ignore(x => x.ReceivedQty)
.Ignore(x => x.Status)
.Ignore(x => x.PositionCode);
}
}

101
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.InjectionIssueRequest;
using Win_in.Sfs.Wms.Store.Application.Contracts;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming;
public class CallMtlConverter : IIncomingConverter
{
private readonly IIncomingFromExternalManager _incomingFromExternalManager;
private readonly IIncomingToWmsManager _incomingToWmsManager;
private readonly IObjectMapper _objectMapper;
private readonly IItemBasicAppService _itemBasicAppService;
private readonly ILocationAppService _locationAppService;
private readonly ILogger<CallMtlConverter> _logger;
public CallMtlConverter(
IIncomingToWmsManager incomingToWmsManager
, IObjectMapper objectMapper
, IItemBasicAppService itemBasicAppService
, ILogger<CallMtlConverter> logger,
ILocationAppService locationAppService,
IIncomingFromExternalManager incomingFromExternalManager)
{
_incomingToWmsManager = incomingToWmsManager;
_objectMapper = objectMapper;
_itemBasicAppService = itemBasicAppService;
_logger = logger;
_locationAppService = locationAppService;
_incomingFromExternalManager = incomingFromExternalManager;
}
public virtual async Task ConvertAsync(List<IncomingFromExternal> incomingFromExternalList)
{
if (!incomingFromExternalList.Any())
{
_logger.LogInformation("no CallMtls");
return;
}
//按Number合并InjectionIssue单据
var transferNoteList = await BuildIncomingToWmsOfInjectionIssueAsync(incomingFromExternalList).ConfigureAwait(false);
await _incomingToWmsManager.CreateManyAsync(transferNoteList).ConfigureAwait(false);
//归档
await _incomingFromExternalManager.ArchiveManyAsync(incomingFromExternalList).ConfigureAwait(false);
}
private async Task<List<IncomingToWms>> BuildIncomingToWmsOfInjectionIssueAsync(List<IncomingFromExternal> incomingDataList)
{
var incomingToWmsList = new List<IncomingToWms>();
foreach (var incomingData in incomingDataList)
{
var incomingToWms = new IncomingToWms()
{
DataType = incomingData.DataType,
DataAction = incomingData.DataAction,
SourceSystem = incomingData.SourceSystem,
DataIdentityCode = incomingData.SourceDataGroupCode,
};
incomingToWms.SetEffectiveDate(incomingData.EffectiveDate);
var exchangeInjectionIssue = JsonSerializer.Deserialize<InjectionIssueRequestExchangeDto>(incomingData.DestinationDataContent);
var wmsInjectionIssueDetail = _objectMapper.Map<InjectionIssueRequestDetailExchangeDto, InjectionIssueRequestDetailInput>(exchangeInjectionIssue.Detail);
var wmsInjectionIssue = _objectMapper.Map<InjectionIssueRequestExchangeDto, InjectionIssueRequestEditInput>(exchangeInjectionIssue);
wmsInjectionIssue.Details = new List<InjectionIssueRequestDetailInput>();
var item = await _itemBasicAppService.GetByCodeAsync(wmsInjectionIssueDetail.ItemCode).ConfigureAwait(false);
try
{
if (item != null)
{
wmsInjectionIssueDetail.ItemName = item.Name;
wmsInjectionIssueDetail.ItemDesc1 = !string.IsNullOrEmpty(item.Desc1) ? item.Desc1 : "";
wmsInjectionIssueDetail.ItemDesc2 = !string.IsNullOrEmpty(item.Desc2) ? item.Desc2 : "";
wmsInjectionIssueDetail.Uom = !string.IsNullOrEmpty(item.BasicUom) ? item.BasicUom : "";
wmsInjectionIssueDetail.StdPackQty = item.StdPackQty;
}
}
catch (Exception)
{
wmsInjectionIssueDetail.ItemName = "";
wmsInjectionIssueDetail.ItemDesc1 = "";
wmsInjectionIssueDetail.ItemDesc2 = "";
wmsInjectionIssueDetail.Uom = "";
}
wmsInjectionIssue.Details.Add(wmsInjectionIssueDetail);
incomingToWms.DataContent = JsonSerializer.Serialize(wmsInjectionIssue);
incomingToWmsList.Add(incomingToWms);
}
return incomingToWmsList;
}
}

121
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Win_in.Sfs.Wms.DataExchange.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain;
using System.Text.Json;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.CallMtl;
using Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent.Incoming;
public class CallMtlReader : IReader
{
private readonly ICallMtlManager _CallMtlManager;
private readonly IIncomingFromExternalManager _incomingFromExternalManager;
private readonly ILogger<CallMtlReader> _logger;
private readonly ILocationAppService _locationAppService;
public CallMtlReader(
ICallMtlManager pillTaskManager
, IIncomingFromExternalManager incomingFromExternalManager
, ILogger<CallMtlReader> logger
, ILocationAppService locationAppService
)
{
_CallMtlManager = pillTaskManager;
_incomingFromExternalManager = incomingFromExternalManager;
_logger = logger;
_locationAppService = locationAppService;
}
public virtual async Task<List<IncomingFromExternal>> ReadAsync()
{
//从MES读取待处理CallMtl
var toBeProcessedPillTasks = await _CallMtlManager.GetToBeProcessedListAsync().ConfigureAwait(false);
if (!toBeProcessedPillTasks.Any())
{
_logger.LogInformation("no CallMtls");
return new List<IncomingFromExternal>();
}
//CallMtl逐一转换为MaterialRequest
var holdLocation = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.HOLD).ConfigureAwait(false);
var incomingDataList = BuildIncomingFromExternalFromPillTaskAsync(toBeProcessedPillTasks, holdLocation == null ? "" : holdLocation.Code);
await _incomingFromExternalManager.CreateManyAsync(incomingDataList).ConfigureAwait(false);
//更新MES数据状态
await _CallMtlManager.UpdateProcessedListAsync(toBeProcessedPillTasks).ConfigureAwait(false);
return incomingDataList;
}
private static List<IncomingFromExternal> BuildIncomingFromExternalFromPillTaskAsync(List<CallMtl> toBeProcessedCallMtls, string holdLocationCode)
{
var incomingDataList = new List<IncomingFromExternal>();
foreach (var CallMtl in toBeProcessedCallMtls)
{
var incomingData = BuildIncomingFromExternal(CallMtl);
incomingData.SetEffectiveDate(DateTime.Now);
incomingData.SetSuccess();
try
{
var MaterialRequest = BuildMesNoteCreateInput(CallMtl, holdLocationCode);
incomingData.DestinationDataContent = JsonSerializer.Serialize(MaterialRequest);
}
catch (Exception ex)
{
incomingData.SetError(EnumExchangeDataErrorCode.Exception, ex.Message, ex.ToString());
}
incomingDataList.Add(incomingData);
}
return incomingDataList;
}
private static IncomingFromExternal BuildIncomingFromExternal(CallMtl CallMtl)
{
var incomingData = new IncomingFromExternal()
{
DataType = EnumIncomingDataType.CallMtl.ToString(),
DataAction = EnumExchangeDataAction.Add,
SourceSystem = EnumSystemType.MES.ToString(),
SourceDataId = CallMtl.mesout_callmtl_id.ToString(),
SourceDataGroupCode = CallMtl.mesout_callmtl_id,
SourceDataDetailCode = CallMtl.mesout_callmtl_erpno,
SourceDataContent = JsonSerializer.Serialize(CallMtl),
WriteTime = DateTime.Now,
Writer = nameof(MesIncomingBackgroundWorker),
DestinationSystem = EnumSystemType.WMS.ToString(),
};
return incomingData;
}
private static InjectionIssueRequestExchangeDto BuildMesNoteCreateInput(CallMtl CallMtl, string holdLocationCode)
{
var request = new InjectionIssueRequestExchangeDto()
{
IssueRequestType = EnumIssueRequestType.Mes,
Worker = "MesZDJL",
ActiveDate = DateTime.TryParse(CallMtl.mesout_callmtl_wt, out DateTime dateTime) ? dateTime : DateTime.Now
};
var detail = new InjectionIssueRequestDetailExchangeDto()
{
ItemCode = CallMtl.mesout_callmtl_erpno,
Qty = CallMtl.mesout_callmtl_num,
BoxQty = CallMtl.mesout_callmtl_num,
ToLocationCode = CallMtl.mesout_callmtl_loc,
RecommendType = EnumRecommendType.RAW,
};
request.Detail = detail;
return request;
}
}

20
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs

@ -113,13 +113,23 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
//await FrozenConverter.ConvertAsync(mesNoteFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read Delivery");//成品发运
var DeliveryReader = workerContext.ServiceProvider.GetRequiredService<DeliveryReader>();
var DeliveryConverter = workerContext.ServiceProvider.GetRequiredService<DeliveryConverter>();
//Logger.LogInformation($"Read Delivery");//成品发运
//var DeliveryReader = workerContext.ServiceProvider.GetRequiredService<DeliveryReader>();
//var DeliveryConverter = workerContext.ServiceProvider.GetRequiredService<DeliveryConverter>();
////读取并保存Delivery
//var deliveryNoteFromExternalList = await DeliveryReader.ReadAsync().ConfigureAwait(false);
////转换Delivery
//await DeliveryConverter.ConvertAsync(deliveryNoteFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Read CallMtl");//自动叫料
var CallMtlReader = workerContext.ServiceProvider.GetRequiredService<CallMtlReader>();
var CallMtlConverter = workerContext.ServiceProvider.GetRequiredService<CallMtlConverter>();
//读取并保存Delivery
var deliveryNoteFromExternalList = await DeliveryReader.ReadAsync().ConfigureAwait(false);
var callMtlFromExternalList = await CallMtlReader.ReadAsync().ConfigureAwait(false);
//转换Delivery
await DeliveryConverter.ConvertAsync(deliveryNoteFromExternalList).ConfigureAwait(false);
await CallMtlConverter.ConvertAsync(callMtlFromExternalList).ConfigureAwait(false);
Logger.LogInformation($"Completed: Handling {Incoming}");
}

7
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs

@ -206,7 +206,12 @@ public static class IncomingToWmsExtensions
var deliverRequestAppService = workerContext.ServiceProvider.GetRequiredService<IDeliverRequestAppService>();
await deliverRequestAppService.CreateAsync(deliverRequest).ConfigureAwait(false);
}
public static async Task HandleInjectionIssueRequestAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var injectionIssueRequest = JsonSerializer.Deserialize<InjectionIssueRequestEditInput>(incomingConverted.DataContent);
var injectionIssueRequestAppService = workerContext.ServiceProvider.GetRequiredService<IInjectionIssueRequestAppService>();
await injectionIssueRequestAppService.CreateAsync(injectionIssueRequest).ConfigureAwait(false);
}
public static async Task HandleScrapsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var scrap = JsonSerializer.Deserialize<ScrapNoteEditInput>(incomingConverted.DataContent);

3
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs

@ -196,6 +196,9 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase
case EnumIncomingDataType.Delivery:
await incomingToWms.HandleDeliveryRequestAsync(workerContext).ConfigureAwait(false);
break;
case EnumIncomingDataType.CallMtl:
await incomingToWms.HandleInjectionIssueRequestAsync(workerContext).ConfigureAwait(false);
break;
case EnumIncomingDataType.None:
default:
throw new ArgumentOutOfRangeException();

34
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs

@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain.Shared;
namespace Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest;
public class InjectionIssueRequestDetailExchangeDto
{
/// <summary>
/// 目标ERP储位
/// </summary>
[Display(Name = "目标储位")]
public string ToLocationCode { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
/// <summary>
/// 需求箱数量
/// </summary>
[Display(Name = "需求箱数量")]
public decimal BoxQty { get; set; }
/// <summary>
/// 物品代码
/// </summary>
[Display(Name = "物品代码")]
public string ItemCode { get; set; }
/// <summary>
/// 推荐类型
/// </summary>
public EnumRecommendType RecommendType { get; set; }
}

36
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store;
using Win_in.Sfs.Wms.DataExchange.WMS.MesNote;
using Win_in.Sfs.Wms.DataExchange.WMS.PurchaseOrder;
namespace Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest;
public class InjectionIssueRequestExchangeDto
{
/// <summary>
/// 叫料类型
/// </summary>
[Display(Name = "叫料类型")]
public EnumIssueRequestType IssueRequestType { get; set; }
/// <summary>
/// 操作员
/// </summary>
[Display(Name = "操作员")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
public string Worker { get; set; }
/// <summary>
/// 生效日期
/// </summary>
[Display(Name = "生效日期")]
public DateTime ActiveDate { get; set; } = DateTime.Now.Date;
/// <summary>
/// 明细
/// </summary>
[Display(Name = "明细")]
public InjectionIssueRequestDetailExchangeDto Detail { get; set; } = new();
}

45
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml

@ -716,6 +716,51 @@
仓库代码
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestDetailExchangeDto.ToLocationCode">
<summary>
目标ERP储位
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestDetailExchangeDto.Qty">
<summary>
数量
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestDetailExchangeDto.BoxQty">
<summary>
需求箱数量
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestDetailExchangeDto.ItemCode">
<summary>
物品代码
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestDetailExchangeDto.RecommendType">
<summary>
推荐类型
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestExchangeDto.IssueRequestType">
<summary>
叫料类型
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestExchangeDto.Worker">
<summary>
操作员
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestExchangeDto.ActiveDate">
<summary>
生效日期
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InjectionIssueRequest.InjectionIssueRequestExchangeDto.Detail">
<summary>
明细
</summary>
</member>
<member name="P:Win_in.Sfs.Wms.DataExchange.WMS.InterfaceCalendar.InterfaceCalendarExchangeDto.Enabled">
<summary>
是否可用

4
be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs

@ -126,4 +126,8 @@ public enum EnumIncomingDataType
/// 发货单
/// </summary>
Delivery=30,
/// <summary>
/// 自动叫料
/// </summary>
CallMtl=31,
}

15
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs

@ -52,11 +52,7 @@ public class DeliverRequestEventHandler
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData<DeliverRequest> eventData)
{
var entity = eventData.Entity;
//if (entity.AutoSubmit)
//{
// await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false);
//}
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>
@ -66,14 +62,7 @@ public class DeliverRequestEventHandler
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData<List<DeliverRequest>> eventData)
{
var entitys = eventData.Entity;
//foreach (var entity in entitys)
//{
// if (entity.AutoSubmit)
// {
// await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false);
// }
//}
await Task.CompletedTask.ConfigureAwait(false);
}
/// <summary>

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs

@ -161,6 +161,8 @@ public class InjectionIssueRequestEventHandler
{
for (var i = 0; i < sumBoxQty; i++)
{
if(usableList.Any())
{
var firstUsable = usableList.First();
useBalanceList.Add(firstUsable.PackingCode);
usableList.Remove(firstUsable);
@ -172,6 +174,7 @@ public class InjectionIssueRequestEventHandler
.ConfigureAwait(false);
inputJobs.Add(injectionJobEditInput);
}
}
}
}

Loading…
Cancel
Save