diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs
new file mode 100644
index 000000000..7b9b122ee
--- /dev/null
+++ b/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
+{
+ ///
+ /// 序号
+ ///
+ [Key]
+ public string mesout_callmtl_id { get; set; }
+ ///
+ /// 物料
+ ///
+ public string mesout_callmtl_erpno { get; set; }
+ ///
+ /// 库位
+ ///
+ public string mesout_callmtl_loc { get; set; }
+ ///
+ /// 数量
+ ///
+ public decimal mesout_callmtl_num { get; set; }
+ ///
+ /// 时间
+ ///
+ public string mesout_callmtl_wt { get; set; }
+
+ ///
+ /// 是否读取(0,1)
+ ///
+ public long Yl1 { get; set; }
+
+ public override object[] GetKeys()
+ {
+ return new object[] { mesout_callmtl_id };
+ }
+
+}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs
new file mode 100644
index 000000000..d48c9e68e
--- /dev/null
+++ b/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> GetToBeProcessedListAsync()
+ {
+ var plans = await _repository.GetListAsync(p => p.Yl1 == 0).ConfigureAwait(false);
+ return plans;
+ }
+ public virtual async Task UpdateProcesseErrordListAsync(List 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 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);
+ }
+}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlManager.cs
new file mode 100644
index 000000000..7a8ffab76
--- /dev/null
+++ b/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> GetToBeProcessedListAsync();
+ Task UpdateProcessedListAsync(List entities);
+ Task UpdateProcesseErrordListAsync(List entities);
+}
\ No newline at end of file
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/ICallMtlRepository.cs
new file mode 100644
index 000000000..7ea7c5a79
--- /dev/null
+++ b/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
+{
+
+}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs
new file mode 100644
index 000000000..9a28e7a47
--- /dev/null
+++ b/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(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);
+ });
+
+ }
+}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlEfCoreRepository.cs
new file mode 100644
index 000000000..945973e60
--- /dev/null
+++ b/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, ICallMtlRepository
+{
+ public CallMtlEfCoreRepository(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 517204043..85ed867b5 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
@@ -30,5 +30,6 @@ public static class DataExchangeDbContextModelCreatingExtensions
builder.ConfigureQtyrfe(options);
builder.ConfigureFrozen(options);
builder.ConfigureDelivery(options);
+ builder.ConfigureCallMtl(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 22322c164..192205bbc 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
@@ -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();
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 98a384453..a93053241 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
@@ -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 { get; }
DbSet Delivery { get; }
+ DbSet CallMtl { 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 66350a6c2..c4efc833b 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
@@ -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 { get; }
public virtual DbSet Delivery { get; }
+
+ public virtual DbSet CallMtl { get; }
public MesDbContext(DbContextOptions options)
: base(options)
{
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs
index 124c9f0a2..7f5cc4065 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/FawtygAutoMapperProfile.cs
+++ b/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()
- .Ignore(x => x.Detail)
- ;
+ .Ignore(x => x.Detail);
CreateMap();
CreateMap()
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.Number)
- .Ignore(x => x.JobNumber)
- ;
+ .Ignore(x => x.JobNumber);
CreateMap()
.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()
- .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()
.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()
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Details)
.Ignore(x => x.ExtraProperties);
- ;
CreateMap()
- .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()
.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()
.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()
+ .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()
+ .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);
}
}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlConverter.cs
new file mode 100644
index 000000000..a3b56ccb0
--- /dev/null
+++ b/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 _logger;
+
+ public CallMtlConverter(
+ IIncomingToWmsManager incomingToWmsManager
+ , IObjectMapper objectMapper
+ , IItemBasicAppService itemBasicAppService
+ , ILogger logger,
+ ILocationAppService locationAppService,
+ IIncomingFromExternalManager incomingFromExternalManager)
+ {
+ _incomingToWmsManager = incomingToWmsManager;
+ _objectMapper = objectMapper;
+ _itemBasicAppService = itemBasicAppService;
+ _logger = logger;
+ _locationAppService = locationAppService;
+ _incomingFromExternalManager = incomingFromExternalManager;
+ }
+
+ public virtual async Task ConvertAsync(List 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> BuildIncomingToWmsOfInjectionIssueAsync(List incomingDataList)
+ {
+ var incomingToWmsList = new List();
+ 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(incomingData.DestinationDataContent);
+ var wmsInjectionIssueDetail = _objectMapper.Map(exchangeInjectionIssue.Detail);
+ var wmsInjectionIssue = _objectMapper.Map(exchangeInjectionIssue);
+ wmsInjectionIssue.Details = new List();
+ 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;
+ }
+
+}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs
new file mode 100644
index 000000000..7bc6dd95a
--- /dev/null
+++ b/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 _logger;
+ private readonly ILocationAppService _locationAppService;
+
+ public CallMtlReader(
+ ICallMtlManager pillTaskManager
+ , IIncomingFromExternalManager incomingFromExternalManager
+ , ILogger logger
+ , ILocationAppService locationAppService
+ )
+ {
+ _CallMtlManager = pillTaskManager;
+ _incomingFromExternalManager = incomingFromExternalManager;
+ _logger = logger;
+ _locationAppService = locationAppService;
+ }
+
+ public virtual async Task> ReadAsync()
+
+ {
+ //从MES读取待处理CallMtl
+ var toBeProcessedPillTasks = await _CallMtlManager.GetToBeProcessedListAsync().ConfigureAwait(false);
+ if (!toBeProcessedPillTasks.Any())
+ {
+ _logger.LogInformation("no CallMtls");
+ return new List();
+ }
+ //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 BuildIncomingFromExternalFromPillTaskAsync(List toBeProcessedCallMtls, string holdLocationCode)
+ {
+ var incomingDataList = new List();
+ 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;
+ }
+
+}
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 7ad3cf219..c32d339f7 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
@@ -113,13 +113,23 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
//await FrozenConverter.ConvertAsync(mesNoteFromExternalList).ConfigureAwait(false);
- Logger.LogInformation($"Read Delivery");//成品发运
- var DeliveryReader = workerContext.ServiceProvider.GetRequiredService();
- var DeliveryConverter = workerContext.ServiceProvider.GetRequiredService();
+ //Logger.LogInformation($"Read Delivery");//成品发运
+ //var DeliveryReader = workerContext.ServiceProvider.GetRequiredService();
+ //var DeliveryConverter = workerContext.ServiceProvider.GetRequiredService();
+ ////读取并保存Delivery
+ //var deliveryNoteFromExternalList = await DeliveryReader.ReadAsync().ConfigureAwait(false);
+ ////转换Delivery
+ //await DeliveryConverter.ConvertAsync(deliveryNoteFromExternalList).ConfigureAwait(false);
+
+
+
+ Logger.LogInformation($"Read CallMtl");//自动叫料
+ var CallMtlReader = workerContext.ServiceProvider.GetRequiredService();
+ var CallMtlConverter = workerContext.ServiceProvider.GetRequiredService();
//读取并保存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}");
}
diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
index b36b62210..6c7ca0d7a 100644
--- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
+++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsExtensions.cs
@@ -206,7 +206,12 @@ public static class IncomingToWmsExtensions
var deliverRequestAppService = workerContext.ServiceProvider.GetRequiredService();
await deliverRequestAppService.CreateAsync(deliverRequest).ConfigureAwait(false);
}
-
+ public static async Task HandleInjectionIssueRequestAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
+ {
+ var injectionIssueRequest = JsonSerializer.Deserialize(incomingConverted.DataContent);
+ var injectionIssueRequestAppService = workerContext.ServiceProvider.GetRequiredService();
+ await injectionIssueRequestAppService.CreateAsync(injectionIssueRequest).ConfigureAwait(false);
+ }
public static async Task HandleScrapsAsync(this IncomingToWms incomingConverted, PeriodicBackgroundWorkerContext workerContext)
{
var scrap = JsonSerializer.Deserialize(incomingConverted.DataContent);
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 e9f81cc9e..8d93ccf90 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
@@ -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();
diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestDetailExchangeDto.cs
new file mode 100644
index 000000000..273fcf2f5
--- /dev/null
+++ b/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
+{
+ ///
+ /// 目标ERP储位
+ ///
+ [Display(Name = "目标储位")]
+ public string ToLocationCode { get; set; }
+ ///
+ /// 数量
+ ///
+ [Display(Name = "数量")]
+ public decimal Qty { get; set; }
+
+ ///
+ /// 需求箱数量
+ ///
+ [Display(Name = "需求箱数量")]
+ public decimal BoxQty { get; set; }
+
+ ///
+ /// 物品代码
+ ///
+ [Display(Name = "物品代码")]
+ public string ItemCode { get; set; }
+
+ ///
+ /// 推荐类型
+ ///
+ public EnumRecommendType RecommendType { get; set; }
+}
diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/InjectionIssueRequest/InjectionIssueRequestExchangeDto.cs
new file mode 100644
index 000000000..123972c0e
--- /dev/null
+++ b/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
+{
+ ///
+ /// 叫料类型
+ ///
+ [Display(Name = "叫料类型")]
+ public EnumIssueRequestType IssueRequestType { get; set; }
+ ///
+ /// 操作员
+ ///
+ [Display(Name = "操作员")]
+ [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ public string Worker { get; set; }
+
+ ///
+ /// 生效日期
+ ///
+ [Display(Name = "生效日期")]
+ public DateTime ActiveDate { get; set; } = DateTime.Now.Date;
+
+ ///
+ /// 明细
+ ///
+ [Display(Name = "明细")]
+ public InjectionIssueRequestDetailExchangeDto 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 0f5dfff33..c1943c344 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
@@ -716,6 +716,51 @@
仓库代码
+
+
+ 目标ERP储位
+
+
+
+
+ 数量
+
+
+
+
+ 需求箱数量
+
+
+
+
+ 物品代码
+
+
+
+
+ 推荐类型
+
+
+
+
+ 叫料类型
+
+
+
+
+ 操作员
+
+
+
+
+ 生效日期
+
+
+
+
+ 明细
+
+
是否可用
diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs
index 172221fd0..824808a90 100644
--- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs
+++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Domain.Shared/Enums/EnumIncomingDataType.cs
@@ -126,4 +126,8 @@ public enum EnumIncomingDataType
/// 发货单
///
Delivery=30,
+ ///
+ /// 自动叫料
+ ///
+ CallMtl=31,
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs
index 023e4b786..29c1e645d 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs
+++ b/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 eventData)
{
- var entity = eventData.Entity;
- //if (entity.AutoSubmit)
- //{
- // await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false);
- //}
+ await Task.CompletedTask.ConfigureAwait(false);
}
///
@@ -66,14 +62,7 @@ public class DeliverRequestEventHandler
[UnitOfWork]
public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData)
{
- var entitys = eventData.Entity;
- //foreach (var entity in entitys)
- //{
- // if (entity.AutoSubmit)
- // {
- // await _deliverRequestManager.SubmitAsync(entity).ConfigureAwait(false);
- // }
- //}
+ await Task.CompletedTask.ConfigureAwait(false);
}
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs
index 8096320f7..80821e7f4 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs
+++ b/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);
+ }
}
}
}