Browse Source

三方库增加校验

dev_DY_CC
周红军 12 months ago
parent
commit
e390ed2b4d
  1. 58
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
  2. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs
  3. 13
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs
  4. 5
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs

58
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs

@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared;
@ -33,6 +34,49 @@ public class ThirdLocationJobAppService
_thirdLocationJobManager = thirdLocationJobManager;
}
/// <summary>
/// 完成任务
/// </summary>
/// <param name="id"></param>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("handle/{id}")]
[UnitOfWork]
public override async Task<ThirdLocationJobDTO> CompleteAsync(Guid id, ThirdLocationJobDTO dto)
{
var handleEntity = ObjectMapper.Map<ThirdLocationJobDTO, ThirdLocationJob>(dto);
var job = await _repository.GetAsync(id).ConfigureAwait(false);
if (job.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None or EnumJobStatus.Done)//需要考虑下 多次提交的问题 所以不判断 进行中
{
throw new UserFriendlyException($"任务状态错误:编号为【{job.Number}】的任务已经【{job.JobStatus.GetDisplayName()}】");
}
if(dto.Details.Count==0)
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number} 的任务未包含明细");
}
else
{
if (dto.Details[0].HandledQty > job.Details[0].RecommendQty)
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{dto.Details[0].HandledQty}】不能大于申请数量【{dto.Details[0].RecommendQty}】");
}
if(dto.Details[0].ToLocationCode != job.Details[0].ToLocationCode)
{
throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{dto.Details[0].ToLocationCode}】与申请目标库位【{job.Details[0].ToLocationCode}】不一致");
}
}
var handleResult = await _thirdLocationJobManager.CompleteAsync(handleEntity,CurrentUser).ConfigureAwait(false);
//判断申请是否执行完成
if (job.JobStatus == EnumJobStatus.Done)
{
}
var handleDto = ObjectMapper.Map<ThirdLocationJob, ThirdLocationJobDTO>(handleResult);
return handleDto;
}
/// <summary>
/// 根据物品和库位 检查是否存在发料任务
/// </summary>
@ -76,19 +120,7 @@ public class ThirdLocationJobAppService
await _thirdLocationJobManager.CancelAsync(thirdLocationJob).ConfigureAwait(false);
}
/// <summary>
/// 根据叫料请求类型获取发料任务
/// </summary>
/// <param name="requestInput"></param>
/// <param name="requestType">
/// 叫料请求类型:
/// 人工拉动:Issue_Manual;
/// 线边拉动:Issue_WIP;
/// </param>
/// <param name="includeDetails"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpPost("by-type/{requestType}")]
public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput,
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default)

4
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs

@ -69,6 +69,7 @@ public partial class StoreEventAutoMapperProfile : Profile
;
CreateMap<ThirdLocationJobDetail, ThirdLocationNoteDetailInput>()
.ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.RecommendFromLocationCode))
.ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode))
.ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode))
@ -79,8 +80,7 @@ public partial class StoreEventAutoMapperProfile : Profile
.ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode))
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode))

13
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs

@ -41,10 +41,10 @@ public class ThirdLocationJobEventHandler :
entity.CompleteTime = Clock.Now;
entity.JobStatus = EnumJobStatus.Done;
foreach (var detail in eventData.Entity.Details)
{
detail.SetHandledFromRecommend();
}
//foreach (var detail in eventData.Entity.Details)
//{
// detail.SetHandledFromRecommend();
//}
var thirdLocationNote = await BuildThirdLocationNoteAsync(entity).ConfigureAwait(false);
await _thirdLocationNoteAppService.CreateAsync(thirdLocationNote).ConfigureAwait(false);
@ -80,6 +80,11 @@ public class ThirdLocationJobEventHandler :
detail.FromLocationErpCode = locationFrom.ErpLocationCode;
detail.FromWarehouseCode = locationFrom.WarehouseCode;
detail.FromStatus = EnumInventoryStatus.OK;
detail.FromPackingCode = "";
detail.ToPackingCode = "";
detail.FromLot = "";
detail.ToLot = "";
}
return thirdLocationNoteCreateInput;

5
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs

@ -46,6 +46,11 @@ public class ThirdLocationNoteEventHandler
if (!string.IsNullOrEmpty(entity.RequestNumber))
{
var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false);
foreach(var item in thirdLocationRequest.Details)
{
item.IssuedQty = entity.Details[0].RecommendQty;
item.ReceivedQty = entity.Details[0].HandledQty;
}
await _thirdLocationRequestManager.CompleteAsync(thirdLocationRequest).ConfigureAwait(false);
}
}

Loading…
Cancel
Save