Browse Source

备品、注塑、装配、喷涂TYRP接口更新

dev_DY_CC
周红军 1 year ago
parent
commit
c67ace76d4
  1. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/AssembleIssueNoteEventHandler.cs
  2. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs
  3. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs
  4. 0
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/KittingIssueNoteEventHandler.cs
  5. 107
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/AssembleIssueNoteEventHandler.cs

65
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/CoatingIssueNoteEventHandler.cs

@ -37,44 +37,45 @@ public class CoatingIssueNoteEventHandler
protected override async Task AddExchangeDataAsync(List<CoatingIssueNote> entities) protected override async Task AddExchangeDataAsync(List<CoatingIssueNote> entities)
{ {
var dtos = ObjectMapper.Map<List<CoatingIssueNote>, List<CoatingIssueNoteDTO>>(entities); var dtos = ObjectMapper.Map<List<CoatingIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details)) foreach (var detail in dtos.SelectMany(dto => dto.Details))
{ {
if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
{ //if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); //{
if (location != null) // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
{ // if (location != null)
detail.HandledFromLocationErpCode = location.ErpLocationCode; // {
detail.HandledFromLocationGroup = location.LocationGroupCode; // detail.HandledFromLocationErpCode = location.ErpLocationCode;
detail.HandledFromLocationArea = location.AreaCode; // detail.HandledFromLocationGroup = location.LocationGroupCode;
// detail.HandledFromLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
{ // {
detail.HandledFromWarehouseCode = location.WarehouseCode; // detail.HandledFromWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) //if (string.IsNullOrEmpty(detail.HandledToLocationErpCode))
{ //{
var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
if (location != null) // if (location != null)
{ // {
detail.HandledToLocationErpCode = location.ErpLocationCode; // detail.HandledToLocationErpCode = location.ErpLocationCode;
detail.HandledToLocationGroup = location.LocationGroupCode; // detail.HandledToLocationGroup = location.LocationGroupCode;
detail.HandledToLocationArea = location.AreaCode; // detail.HandledToLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
{ // {
detail.HandledToWarehouseCode = location.WarehouseCode; // detail.HandledToWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
} }
var toErpDto = new List<CoatingIssueNoteDTO>(); var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos) foreach (var item in dtos)
{ {
if (item.Details != null && item.Details.Count != 0) if (item.Details != null && item.Details.Count != 0)
@ -84,10 +85,10 @@ public class CoatingIssueNoteEventHandler
} }
//2023-12-6要求同储位不传入接口 按历史规则 //2023-12-6要求同储位不传入接口 按历史规则
var result = new List<CoatingIssueNoteDTO>(); var result = new List<IssueNoteDTO>();
foreach (var coatingIssueNoteDto in toErpDto) foreach (var coatingIssueNoteDto in toErpDto)
{ {
coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); coatingIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (coatingIssueNoteDto.Details.Count > 0) if (coatingIssueNoteDto.Details.Count > 0)
{ {
result.Add(coatingIssueNoteDto); result.Add(coatingIssueNoteDto);

65
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/InjectionIssueNoteEventHandler.cs

@ -37,44 +37,45 @@ public class InjectionIssueNoteEventHandler
protected override async Task AddExchangeDataAsync(List<InjectionIssueNote> entities) protected override async Task AddExchangeDataAsync(List<InjectionIssueNote> entities)
{ {
var dtos = ObjectMapper.Map<List<InjectionIssueNote>, List<InjectionIssueNoteDTO>>(entities); var dtos = ObjectMapper.Map<List<InjectionIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details)) foreach (var detail in dtos.SelectMany(dto => dto.Details))
{ {
if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
{ //if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); //{
if (location != null) // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
{ // if (location != null)
detail.HandledFromLocationErpCode = location.ErpLocationCode; // {
detail.HandledFromLocationGroup = location.LocationGroupCode; // detail.HandledFromLocationErpCode = location.ErpLocationCode;
detail.HandledFromLocationArea = location.AreaCode; // detail.HandledFromLocationGroup = location.LocationGroupCode;
// detail.HandledFromLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
{ // {
detail.HandledFromWarehouseCode = location.WarehouseCode; // detail.HandledFromWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
if(string.IsNullOrEmpty(detail.HandledToLocationErpCode)) //if(string.IsNullOrEmpty(detail.HandledToLocationErpCode))
{ //{
var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
if (location != null) // if (location != null)
{ // {
detail.HandledToLocationErpCode = location.ErpLocationCode; // detail.HandledToLocationErpCode = location.ErpLocationCode;
detail.HandledToLocationGroup = location.LocationGroupCode; // detail.HandledToLocationGroup = location.LocationGroupCode;
detail.HandledToLocationArea = location.AreaCode; // detail.HandledToLocationArea = location.AreaCode;
if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
{ // {
detail.HandledToWarehouseCode = location.WarehouseCode; // detail.HandledToWarehouseCode = location.WarehouseCode;
} // }
} // }
} //}
} }
var toErpDto = new List<InjectionIssueNoteDTO>(); var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos) foreach (var item in dtos)
{ {
if (item.Details != null && item.Details.Count != 0) if (item.Details != null && item.Details.Count != 0)
@ -84,10 +85,10 @@ public class InjectionIssueNoteEventHandler
} }
//2023-12-6要求同储位不传入接口 按历史规则 //2023-12-6要求同储位不传入接口 按历史规则
var result = new List<InjectionIssueNoteDTO>(); var result = new List<IssueNoteDTO>();
foreach (var injectionIssueNoteDto in toErpDto) foreach (var injectionIssueNoteDto in toErpDto)
{ {
injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (injectionIssueNoteDto.Details.Count > 0) if (injectionIssueNoteDto.Details.Count > 0)
{ {
result.Add(injectionIssueNoteDto); result.Add(injectionIssueNoteDto);

0
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/KittingIssueNoteEventHandler.cs → be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/KittingIssueNoteEventHandler.cs

107
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/Issue/SparePartIssueNoteEventHandler.cs

@ -0,0 +1,107 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Shared.Domain;
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;
/// <summary>
/// 备品发料记录传给TYRP(线边仓领料单)
/// </summary>
public class SparePartIssueNoteEventHandler
: StoreDataExchangeEventHandlerBase<SparePartIssueNote>
, ILocalEventHandler<SfsCreatedEntityEventData<SparePartIssueNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<SparePartIssueNote>>>
{
//线边仓领料单
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Issue;
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<SparePartIssueNote> eventData)
{
var entity = eventData.Entity;
await AddExchangeDataAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<SparePartIssueNote>> eventData)
{
var entities = eventData.Entity;
await AddExchangeDataAsync(entities).ConfigureAwait(false);
}
protected override async Task AddExchangeDataAsync(List<SparePartIssueNote> entities)
{
var dtos = ObjectMapper.Map<List<SparePartIssueNote>, List<IssueNoteDTO>>(entities);
foreach (var detail in dtos.SelectMany(dto => dto.Details))
{
await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false);
//if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode))
//{
// var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false);
// if (location != null)
// {
// detail.HandledFromLocationErpCode = location.ErpLocationCode;
// detail.HandledFromLocationGroup = location.LocationGroupCode;
// detail.HandledFromLocationArea = location.AreaCode;
// if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode))
// {
// detail.HandledFromWarehouseCode = location.WarehouseCode;
// }
// }
//}
//if(string.IsNullOrEmpty(detail.HandledToLocationErpCode))
//{
// var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false);
// if (location != null)
// {
// detail.HandledToLocationErpCode = location.ErpLocationCode;
// detail.HandledToLocationGroup = location.LocationGroupCode;
// detail.HandledToLocationArea = location.AreaCode;
// if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
// {
// detail.HandledToWarehouseCode = location.WarehouseCode;
// }
// }
//}
}
var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos)
{
if (item.Details != null && item.Details.Count != 0)
{
toErpDto.Add(item);
}
}
//2023-12-6要求同储位不传入接口 按历史规则
var result = new List<IssueNoteDTO>();
foreach (var sparePartIssueNoteDto in toErpDto)
{
sparePartIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (sparePartIssueNoteDto.Details.Count > 0)
{
result.Add(sparePartIssueNoteDto);
}
}
if (result.Count > 0)
{
var exchangeDataerp =
await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result)
.ConfigureAwait(false);
await AddManyAsync(exchangeDataerp).ConfigureAwait(false);
}
}
}
Loading…
Cancel
Save