20 changed files with 359 additions and 6 deletions
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.tests; |
||||
|
[Serializable] |
||||
|
public class ErpCodeRequest |
||||
|
{ |
||||
|
public string ErpCode { set; get; } |
||||
|
public string ProductType { set; get; } |
||||
|
|
||||
|
|
||||
|
public string ProductColor { set; get; } |
||||
|
|
||||
|
public string ProductState { set; get; } |
||||
|
|
||||
|
public string ProductProperty { set; get; } |
||||
|
|
||||
|
public string From { set; get; } |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.GaoTongs; |
||||
|
internal class GaoTongAppService |
||||
|
{ |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using AutoMapper; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
public partial class StoreApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void GaoTongAutoMapperProfile() |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
|
@ -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; |
||||
|
using Win_in.Sfs.Wms.Store.Notes.IssueNotes; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 涂装发料记录传给TYRP(线边领料单)
|
||||
|
/// </summary>
|
||||
|
public class CoatingIssueNoteEventHandler |
||||
|
: StoreDataExchangeEventHandlerBase<CoatingIssueNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<CoatingIssueNote>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<CoatingIssueNote>>> |
||||
|
{ |
||||
|
|
||||
|
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.CoatingIssue; |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<CoatingIssueNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<CoatingIssueNote>> eventData) |
||||
|
{ |
||||
|
var entities = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<CoatingIssueNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<CoatingIssueNote>, List<CoatingIssueNoteDTO>>(entities); |
||||
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
||||
|
{ |
||||
|
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<CoatingIssueNoteDTO>(); |
||||
|
foreach (var item in dtos) |
||||
|
{ |
||||
|
if (item.Details != null && item.Details.Count != 0) |
||||
|
{ |
||||
|
toErpDto.Add(item); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//2023-12-6要求同储位不传入接口 按历史规则
|
||||
|
var result = new List<CoatingIssueNoteDTO>(); |
||||
|
foreach (var injectionIssueNoteDto in toErpDto) |
||||
|
{ |
||||
|
injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); |
||||
|
if (injectionIssueNoteDto.Details.Count > 0) |
||||
|
{ |
||||
|
result.Add(injectionIssueNoteDto); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (result.Count > 0) |
||||
|
{ |
||||
|
var exchangeDataerp = |
||||
|
await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) |
||||
|
.ConfigureAwait(false); |
||||
|
await AddManyAsync(exchangeDataerp).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
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 InjectionIssueNoteEventHandler |
||||
|
: StoreDataExchangeEventHandlerBase<InjectionIssueNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<InjectionIssueNote>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<InjectionIssueNote>>> |
||||
|
{ |
||||
|
|
||||
|
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.InjectionIssue; |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<InjectionIssueNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<InjectionIssueNote>> eventData) |
||||
|
{ |
||||
|
var entities = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<InjectionIssueNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<InjectionIssueNote>, List<InjectionIssueNoteDTO>>(entities); |
||||
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
||||
|
{ |
||||
|
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<InjectionIssueNoteDTO>(); |
||||
|
foreach (var item in dtos) |
||||
|
{ |
||||
|
if (item.Details != null && item.Details.Count != 0) |
||||
|
{ |
||||
|
toErpDto.Add(item); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//2023-12-6要求同储位不传入接口 按历史规则
|
||||
|
var result = new List<InjectionIssueNoteDTO>(); |
||||
|
foreach (var injectionIssueNoteDto in toErpDto) |
||||
|
{ |
||||
|
injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); |
||||
|
if (injectionIssueNoteDto.Details.Count > 0) |
||||
|
{ |
||||
|
result.Add(injectionIssueNoteDto); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (result.Count > 0) |
||||
|
{ |
||||
|
var exchangeDataerp = |
||||
|
await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) |
||||
|
.ConfigureAwait(false); |
||||
|
await AddManyAsync(exchangeDataerp).ConfigureAwait(false); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue