Browse Source

装配TYRP接口修改

dev_DY_CC
周红军 11 months ago
parent
commit
d9324a7472
  1. 105
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs
  2. 51
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs
  3. 65
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs

105
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs

@ -0,0 +1,105 @@
using AutoMapper;
using Microsoft.OpenApi.Extensions;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event;
public partial class StoreEventAutoMapperProfile : Profile
{
private void AssembleIssueNoteAutoMapperProfile()
{
CreateMap<AssembleIssueNoteDetail, TransferLogEditInput>()
.Ignore(x => x.DocNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.TransType)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.TransSubType)
.ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot))
.ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode))
.ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode))
.ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup))
.ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea))
.ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode))
.ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode))
;
CreateMap<AssembleIssueNote, IssueNoteDTO>()
.ForMember(x => x.RequestType, y => y.MapFrom(t => t.IssueRequestType.GetDisplayName()))
.Ignore(x => x.Workshop)
;
CreateMap<AssembleIssueNoteDetail, IssueNoteDetailDTO>()
.ForMember(x => x.IssueTime, y => y.MapFrom(t => t.CreationTime))
.ForMember(x => x.WorkStation, y => y.MapFrom(t => t.ProdLine))
.ForMember(x => x.RecommendQty, y => y.MapFrom(t => t.RecommendFromQty))
.ForMember(x => x.RecommendContainerCode, y => y.MapFrom(t => t.RecommendFromContainerCode))
.ForMember(x => x.RecommendPackingCode, y => y.MapFrom(t => t.RecommendFromPackingCode))
.ForMember(x => x.RecommendSupplierBatch, y => y.MapFrom(t => t.RecommendFromSupplierBatch))
.ForMember(x => x.RecommendArriveDate, y => y.MapFrom(t => t.RecommendFromArriveDate))
.ForMember(x => x.RecommendProduceDate, y => y.MapFrom(t => t.RecommendFromProduceDate))
.ForMember(x => x.RecommendExpireDate, y => y.MapFrom(t => t.RecommendFromExpireDate))
.ForMember(x => x.RecommendLot, y => y.MapFrom(t => t.RecommendFromLot))
.ForMember(x => x.HandledContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.HandledPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.HandledSupplierBatch, y => y.MapFrom(t => t.HandledToSupplierBatch))
.ForMember(x => x.HandledArriveDate, y => y.MapFrom(t => t.HandledToArriveDate))
.ForMember(x => x.HandledProduceDate, y => y.MapFrom(t => t.HandledToProduceDate))
.ForMember(x => x.HandledExpireDate, y => y.MapFrom(t => t.HandledToExpireDate))
.ForMember(x => x.HandledLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.HandledQty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot))
.ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledToSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledToArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledToProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledToExpireDate))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode))
.ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea))
.ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup))
.ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode))
.ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode))
.ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.ItemCode, y => y.MapFrom(t => t.ItemCode))
.Ignore(x => x.ExpiredTime)
;
}
}

51
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs

@ -1,51 +0,0 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Event;
public partial class StoreEventAutoMapperProfile : Profile
{
private void AssembleIssueNoteAutoMapperProfile()
{
CreateMap<AssembleIssueNoteDetail, TransferLogEditInput>()
.Ignore(x => x.DocNumber)
.Ignore(x => x.JobNumber)
.Ignore(x => x.Worker)
.Ignore(x => x.TransType)
.Ignore(x => x.ExtraProperties)
.Ignore(x => x.TransSubType)
.ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty))
.ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode))
.ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode))
.ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot))
.ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode))
.ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode))
.ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot))
.ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode))
.ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode))
.ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode))
.ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup))
.ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea))
.ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode))
.ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode))
;
}
}

65
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs

@ -37,44 +37,45 @@ public class AssembleIssueNoteEventHandler
protected override async Task AddExchangeDataAsync(List<AssembleIssueNote> entities)
{
var dtos = ObjectMapper.Map<List<AssembleIssueNote>, List<AssembleIssueNoteDTO>>(entities);
var dtos = ObjectMapper.Map<List<AssembleIssueNote>, List<IssueNoteDTO>>(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;
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.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.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;
}
}
}
// if (string.IsNullOrEmpty(detail.HandledToWarehouseCode))
// {
// detail.HandledToWarehouseCode = location.WarehouseCode;
// }
// }
//}
}
var toErpDto = new List<AssembleIssueNoteDTO>();
var toErpDto = new List<IssueNoteDTO>();
foreach (var item in dtos)
{
if (item.Details != null && item.Details.Count != 0)
@ -84,10 +85,10 @@ public class AssembleIssueNoteEventHandler
}
//2023-12-6要求同储位不传入接口 按历史规则
var result = new List<AssembleIssueNoteDTO>();
var result = new List<IssueNoteDTO>();
foreach (var assembleIssueNoteDto in toErpDto)
{
assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode);
assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode);
if (assembleIssueNoteDto.Details.Count > 0)
{
result.Add(assembleIssueNoteDto);

Loading…
Cancel
Save