Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
lvzb 1 year ago
parent
commit
8a1206f275
  1. 64
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
  2. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
  3. 4
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs
  4. 13
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs
  5. 24
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs

64
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;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.ObjectMapping; using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared;
@ -33,6 +34,49 @@ public class ThirdLocationJobAppService
_thirdLocationJobManager = thirdLocationJobManager; _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>
/// 根据物品和库位 检查是否存在发料任务 /// 根据物品和库位 检查是否存在发料任务
/// </summary> /// </summary>
@ -54,10 +98,10 @@ public class ThirdLocationJobAppService
return dtos; return dtos;
} }
[HttpPost("cancel-by-request/{assembleNumber}")] [HttpPost("cancel-by-request/{thirdLocationNumber}")]
public virtual async Task CancelByMaterialRequestAsync(string assembleNumber) public virtual async Task CancelByMaterialRequestAsync(string thirdLocationNumber)
{ {
var entities = await _repository.GetListAsync(p => p.RequestNumber == assembleNumber).ConfigureAwait(false); var entities = await _repository.GetListAsync(p => p.RequestNumber == thirdLocationNumber).ConfigureAwait(false);
foreach (var entity in entities) foreach (var entity in entities)
{ {
await _thirdLocationJobManager.CancelAsync(entity).ConfigureAwait(false); await _thirdLocationJobManager.CancelAsync(entity).ConfigureAwait(false);
@ -76,19 +120,7 @@ public class ThirdLocationJobAppService
await _thirdLocationJobManager.CancelAsync(thirdLocationJob).ConfigureAwait(false); 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}")] [HttpPost("by-type/{requestType}")]
public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput, public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput,
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) string requestType, bool includeDetails = false, CancellationToken cancellationToken = default)

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs

@ -409,7 +409,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
/// </summary> /// </summary>
/// <param name="transferNoteEditInput"></param> /// <param name="transferNoteEditInput"></param>
/// <returns></returns> /// <returns></returns>
private async Task<bool> WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput) private async Task<bool> WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput, SplitPacking_UpdateJobDetailInput updateJobDetailInput = null)
{ {
List<SplitPackingRecEditInput> recLst = new List<SplitPackingRecEditInput>(); List<SplitPackingRecEditInput> recLst = new List<SplitPackingRecEditInput>();
foreach (var inputDetail in transferNoteEditInput.Details) foreach (var inputDetail in transferNoteEditInput.Details)
@ -421,6 +421,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
packRec.FromStdPackQty = inputDetail.StdPackQty; packRec.FromStdPackQty = inputDetail.StdPackQty;
packRec.FromUom = inputDetail.Uom; packRec.FromUom = inputDetail.Uom;
packRec.FromQty = inputDetail.Qty; packRec.FromQty = inputDetail.Qty;
packRec.ToPackingCode = inputDetail.ToPackingCode; packRec.ToPackingCode = inputDetail.ToPackingCode;
//packRec.ToTopPackingCode = inputDetail.; //packRec.ToTopPackingCode = inputDetail.;
packRec.ToStdPackQty = inputDetail.StdPackQty; packRec.ToStdPackQty = inputDetail.StdPackQty;
@ -438,6 +439,11 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
//packRec.TaskOrderNumber = inputDetail.; //任务单 //packRec.TaskOrderNumber = inputDetail.; //任务单
//packRec.ReceiptRecNumber = inputDetail.; //收货记录单 //packRec.ReceiptRecNumber = inputDetail.; //收货记录单
//packRec.PutOnShelfNumber = inputDetail.; //上架单 //packRec.PutOnShelfNumber = inputDetail.; //上架单
if (updateJobDetailInput != null)
{
packRec.FromQty = updateJobDetailInput.FromQty;
packRec.ToQty = updateJobDetailInput.ToQty;
}
recLst.Add(packRec); recLst.Add(packRec);
} }
var ret = await _splitPackingRecAppService.BatchInsertAsync(recLst).ConfigureAwait(false); var ret = await _splitPackingRecAppService.BatchInsertAsync(recLst).ConfigureAwait(false);
@ -455,7 +461,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
{ {
var jobRet = await _purchaseReceiptJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false); var jobRet = await _purchaseReceiptJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false);
var requestRet = await _purchaseReceiptRequestAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput, jobRet.PurchaseReceiptRequestNumber).ConfigureAwait(false); var requestRet = await _purchaseReceiptRequestAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput, jobRet.PurchaseReceiptRequestNumber).ConfigureAwait(false);
bool ret = await WriteSplitPackingRec(transferNoteEditInput).ConfigureAwait(false); //采购收货-目检-拆箱时,还没有入库,不涉及库存操作 bool ret = await WriteSplitPackingRec(transferNoteEditInput, updateJobDetailInput).ConfigureAwait(false); //采购收货-目检-拆箱时,还没有入库,不涉及库存操作
return ret; return ret;
} }

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>() CreateMap<ThirdLocationJobDetail, ThirdLocationNoteDetailInput>()
.ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) .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.IssueTime, y => y.MapFrom(d => DateTime.Now))
.ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode))
.ForMember(x => x.ToPackingCode, 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.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch))
.ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate)) .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate))
.ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate)) .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate))
.ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime)) .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime))
.ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode))
.ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea)) .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea))
.ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup)) .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup))
.ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) .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.CompleteTime = Clock.Now;
entity.JobStatus = EnumJobStatus.Done; entity.JobStatus = EnumJobStatus.Done;
foreach (var detail in eventData.Entity.Details) //foreach (var detail in eventData.Entity.Details)
{ //{
detail.SetHandledFromRecommend(); // detail.SetHandledFromRecommend();
} //}
var thirdLocationNote = await BuildThirdLocationNoteAsync(entity).ConfigureAwait(false); var thirdLocationNote = await BuildThirdLocationNoteAsync(entity).ConfigureAwait(false);
await _thirdLocationNoteAppService.CreateAsync(thirdLocationNote).ConfigureAwait(false); await _thirdLocationNoteAppService.CreateAsync(thirdLocationNote).ConfigureAwait(false);
@ -80,6 +80,11 @@ public class ThirdLocationJobEventHandler :
detail.FromLocationErpCode = locationFrom.ErpLocationCode; detail.FromLocationErpCode = locationFrom.ErpLocationCode;
detail.FromWarehouseCode = locationFrom.WarehouseCode; detail.FromWarehouseCode = locationFrom.WarehouseCode;
detail.FromStatus = EnumInventoryStatus.OK; detail.FromStatus = EnumInventoryStatus.OK;
detail.FromPackingCode = "";
detail.ToPackingCode = "";
detail.FromLot = "";
detail.ToLot = "";
} }
return thirdLocationNoteCreateInput; return thirdLocationNoteCreateInput;

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

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
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.Basedata.Application.Contracts;
@ -10,6 +11,7 @@ using Win_in.Sfs.Shared.Event;
using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts;
using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain;
using Win_in.Sfs.Wms.Store.Event.Transaction; using Win_in.Sfs.Wms.Store.Event.Transaction;
using static ClosedXML.Excel.XLPredefinedFormat;
namespace Win_in.Sfs.Wms.Store.Event.Transactions; namespace Win_in.Sfs.Wms.Store.Event.Transactions;
@ -23,12 +25,14 @@ public class ThirdLocationNoteEventHandler
private readonly ILocationAppService _locationAppService; private readonly ILocationAppService _locationAppService;
private readonly IThirdLocationRequestManager _thirdLocationRequestManager; private readonly IThirdLocationRequestManager _thirdLocationRequestManager;
private readonly IThirdLocationRequestRepository _ThirdLocationRequestRepository;
public ThirdLocationNoteEventHandler(ILocationAppService locationAppService public ThirdLocationNoteEventHandler(ILocationAppService locationAppService
, IThirdLocationRequestManager thirdLocationRequestManager) , IThirdLocationRequestRepository ThirdLocationRequestRepository, IThirdLocationRequestManager thirdLocationRequestManager)
{ {
_locationAppService = locationAppService; _locationAppService = locationAppService;
_thirdLocationRequestManager = thirdLocationRequestManager; _thirdLocationRequestManager = thirdLocationRequestManager;
_ThirdLocationRequestRepository = ThirdLocationRequestRepository;
} }
[UnitOfWork] [UnitOfWork]
@ -44,9 +48,21 @@ public class ThirdLocationNoteEventHandler
await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
if (!string.IsNullOrEmpty(entity.RequestNumber)) if (!string.IsNullOrEmpty(entity.RequestNumber))
{ {
var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); //var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false);
await _thirdLocationRequestManager.CompleteAsync(thirdLocationRequest).ConfigureAwait(false);
var entities = await _ThirdLocationRequestRepository.GetListAsync(p => p.Number == entity.RequestNumber, "Number", true).ConfigureAwait(false);
if(entities.Count>0)
{
foreach (var item in entities[0].Details)
{
item.IssuedQty = entity.Details[0].RecommendQty;
item.ReceivedQty = entity.Details[0].HandledQty;
}
await _thirdLocationRequestManager.CompleteAsync(entities[0]).ConfigureAwait(false);
}
} }
} }

Loading…
Cancel
Save