Browse Source

修改发料

集成Redis
郑勃旭 2 years ago
parent
commit
6f12e0770c
  1. 5
      be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs
  2. 42
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs
  3. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs
  4. 67
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs

5
be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAppService.cs

@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -23,15 +24,17 @@ public class TransferLogAppService
{ {
private readonly ITransferLogManager _transferLogManager; private readonly ITransferLogManager _transferLogManager;
private readonly IInterfaceCalendarAclService _interfaceCalendarAclService; private readonly IInterfaceCalendarAclService _interfaceCalendarAclService;
private readonly ILocationAppService _locationAppService;
public TransferLogAppService( public TransferLogAppService(
ITransferLogRepository repository ITransferLogRepository repository
, ITransferLogManager transferLogManager , ITransferLogManager transferLogManager
, IInterfaceCalendarAclService interfaceCalendarAclService , IInterfaceCalendarAclService interfaceCalendarAclService
) : base(repository) , ILocationAppService locationAppService) : base(repository)
{ {
_transferLogManager = transferLogManager; _transferLogManager = transferLogManager;
_interfaceCalendarAclService = interfaceCalendarAclService; _interfaceCalendarAclService = interfaceCalendarAclService;
_locationAppService = locationAppService;
} }
[HttpPost("add")] [HttpPost("add")]

42
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/IssueJobAutoMapperProfile.cs

@ -56,37 +56,37 @@ public partial class StoreEventAutoMapperProfile : Profile
; ;
CreateMap<IssueJobDetail, ExpectOutEditInput>() CreateMap<IssueJobDetail, ExpectOutEditInput>()
.MapExpectInOutFrom() .MapExpectInOutFrom()
.Ignore(x => x.Worker) .Ignore(x => x.Worker)
.Ignore(x => x.SerialNumber) .Ignore(x => x.SerialNumber)
.Ignore(x => x.ExtraProperties); .Ignore(x => x.ExtraProperties);
CreateMap<IssueJob, IssueNoteEditInput>() CreateMap<IssueJob, IssueNoteEditInput>()
.ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.MaterialRequestNumber))
.Ignore(x => x.Confirmed) .Ignore(x => x.Confirmed)
.Ignore(x => x.JobNumber) .Ignore(x => x.JobNumber)
.Ignore(x => x.RequestNumber)
.Ignore(x => x.ActiveDate) .Ignore(x => x.ActiveDate)
; ;
CreateMap<IssueJobDetail, IssueNoteDetailInput>() CreateMap<IssueJobDetail, IssueNoteDetailInput>()
.Ignore(x => x.IssueTime) .ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty))
.Ignore(x => x.FromPackingCode) .ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now))
.Ignore(x => x.ToPackingCode) .ForMember(x => x.FromPackingCode, y => y.MapFrom(d =>d.HandledPackingCode))
.Ignore(x => x.FromContainerCode) .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode))
.Ignore(x => x.ToContainerCode) .ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.HandledContainerCode))
.Ignore(x => x.FromLot) .ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.HandledContainerCode))
.Ignore(x => x.ToLot) .ForMember(x => x.FromLot, y => y.MapFrom(d => d.HandledLot))
.Ignore(x => x.SupplierBatch) .ForMember(x => x.ToLot, y => y.MapFrom(d => d.HandledLot))
.Ignore(x => x.ArriveDate) .ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch))
.Ignore(x => x.ProduceDate) .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate))
.Ignore(x => x.ExpireDate) .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate))
.Ignore(x => x.FromLocationCode) .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime))
.Ignore(x => x.FromLocationArea) .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode))
.Ignore(x => x.FromLocationGroup) .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea))
.Ignore(x => x.FromLocationErpCode) .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup))
.Ignore(x => x.FromWarehouseCode) .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode))
.Ignore(x => x.FromStatus) .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode))
.Ignore(x => x.ToStatus) .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status))
.Ignore(x => x.Qty) .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status))
; ;
} }
} }

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs

@ -187,6 +187,7 @@ public class MaterialRequestEventHandler
job.WarehouseCode = fromLocation.WarehouseCode; job.WarehouseCode = fromLocation.WarehouseCode;
job.ProdLine = fromLocation.LocationGroupCode; job.ProdLine = fromLocation.LocationGroupCode;
job.Worker = materialRequest.Worker; job.Worker = materialRequest.Worker;
job.MaterialRequestNumber = materialRequest.Number;
return job; return job;
} }

67
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/IssueNoteEventHandler.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.EventBus; using Volo.Abp.EventBus;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
@ -20,6 +21,13 @@ public class IssueNoteEventHandler
{ {
private const EnumTransType TransType = EnumTransType.Issue; private const EnumTransType TransType = EnumTransType.Issue;
private readonly ILocationAppService _locationAppService;
public IssueNoteEventHandler(ILocationAppService locationAppService)
{
_locationAppService = locationAppService;
}
[UnitOfWork] [UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueNote> eventData) public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<IssueNote> eventData)
{ {
@ -68,7 +76,7 @@ public class IssueNoteEventHandler
private async Task AddTransferLogsAsync(List<TransferLogEditInput> inputList) private async Task AddTransferLogsAsync(List<TransferLogEditInput> inputList)
{ {
var transferLogs = new List<TransferLogEditInput>(); var transferLogs = new List<TransferLogEditInput>();
transferLogs.AddRange(inputList); transferLogs.AddRange(inputList);
@ -83,42 +91,48 @@ public class IssueNoteEventHandler
{ {
var transferLog = ObjectMapper.Map<IssueNoteDetail, TransferLogEditInput>(detail); var transferLog = ObjectMapper.Map<IssueNoteDetail, TransferLogEditInput>(detail);
LocationDTO fromLocationDTO = null;
LocationDTO toLocationDTO = null;
if (issueNote.UseOnTheWayLocation) if (issueNote.UseOnTheWayLocation)
{ {
var location = await LocationAclService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); var location = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
switch (route) switch (route)
{ {
case EnumTransferRoute.SourceToOnTheWay: case EnumTransferRoute.SourceToOnTheWay:
detail.ToLocationCode = detail.OnTheWayLocationCode; fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
detail.ToLocationErpCode = location.ErpLocationCode;
detail.ToWarehouseCode = location.WarehouseCode; toLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
detail.ToLocationArea = location.AreaCode;
break; break;
case EnumTransferRoute.OnTheWayToDestination: case EnumTransferRoute.OnTheWayToDestination:
detail.FromLocationCode = detail.OnTheWayLocationCode; fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false);
detail.FromLocationErpCode = location.ErpLocationCode;
detail.FromWarehouseCode = location.WarehouseCode; toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
detail.FromLocationArea = location.AreaCode;
await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog).ConfigureAwait(false);
break; break;
case EnumTransferRoute.SourceToDestination: case EnumTransferRoute.SourceToDestination:
default: default:
throw new ArgumentOutOfRangeException(nameof(route), route, null); throw new ArgumentOutOfRangeException(nameof(route), route, null);
} }
} }
else
if (issueNote.UseOnTheWayLocation)
{ {
transferLog.FromLocationCode = detail.OnTheWayLocationCode; fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
var location = await LocationAclService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
transferLog.FromLocationGroup = location.LocationGroupCode;
transferLog.FromLocationArea = location.AreaCode;
transferLog.FromLocationErpCode = location.ErpLocationCode;
transferLog.FromWarehouseCode=location.WarehouseCode;
} }
transferLog.TransType = TransType; transferLog.FromLocationCode = fromLocationDTO.Code;
transferLog.FromLocationArea = fromLocationDTO.AreaCode;
transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode;
transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode;
transferLog.ToLocationCode = toLocationDTO.Code;
transferLog.ToLocationArea = toLocationDTO.AreaCode;
transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode;
transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode;
transferLog.TransSubType = Enum.Parse<EnumTransSubType>(issueNote.RequestType); transferLog.TransSubType = Enum.Parse<EnumTransSubType>(issueNote.RequestType);
transferLog.Worker = issueNote.Worker; transferLog.TransType = TransType;
transferLog.DocNumber = issueNote.Number; transferLog.DocNumber = issueNote.Number;
transferLog.JobNumber = issueNote.JobNumber; transferLog.JobNumber = issueNote.JobNumber;
@ -128,4 +142,17 @@ public class IssueNoteEventHandler
return transferLogs; return transferLogs;
} }
private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogEditInput transferLogCreateInput)
{
transferLogCreateInput.ToPackingCode = "";
transferLogCreateInput.ToLot = "";
transferLogCreateInput.ToContainerCode = "";
transferLogCreateInput.FromPackingCode = "";
transferLogCreateInput.FromLot = "";
transferLogCreateInput.FromContainerCode = "";
}
} }

Loading…
Cancel
Save