diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
index 6a631835f..55281ef5f 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
+++ b/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;
}
+ ///
+ /// 完成任务
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("handle/{id}")]
+ [UnitOfWork]
+ public override async Task CompleteAsync(Guid id, ThirdLocationJobDTO dto)
+ {
+ var handleEntity = ObjectMapper.Map(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(handleResult);
+ return handleDto;
+ }
+
///
/// 根据物品和库位 检查是否存在发料任务
///
@@ -54,10 +98,10 @@ public class ThirdLocationJobAppService
return dtos;
}
- [HttpPost("cancel-by-request/{assembleNumber}")]
- public virtual async Task CancelByMaterialRequestAsync(string assembleNumber)
+ [HttpPost("cancel-by-request/{thirdLocationNumber}")]
+ 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)
{
await _thirdLocationJobManager.CancelAsync(entity).ConfigureAwait(false);
@@ -76,19 +120,7 @@ public class ThirdLocationJobAppService
await _thirdLocationJobManager.CancelAsync(thirdLocationJob).ConfigureAwait(false);
}
-
- ///
- /// 根据叫料请求类型获取发料任务
- ///
- ///
- ///
- /// 叫料请求类型:
- /// 人工拉动:Issue_Manual;
- /// 线边拉动:Issue_WIP;
- ///
- ///
- ///
- ///
+
[HttpPost("by-type/{requestType}")]
public virtual async Task> GetListByTypeAsync(SfsJobRequestInputBase requestInput,
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default)
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
index 9451fe2e9..8596f6c4e 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
@@ -409,7 +409,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
///
///
///
- private async Task WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput)
+ private async Task WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput, SplitPacking_UpdateJobDetailInput updateJobDetailInput = null)
{
List recLst = new List();
foreach (var inputDetail in transferNoteEditInput.Details)
@@ -421,6 +421,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
packRec.FromStdPackQty = inputDetail.StdPackQty;
packRec.FromUom = inputDetail.Uom;
packRec.FromQty = inputDetail.Qty;
+
packRec.ToPackingCode = inputDetail.ToPackingCode;
//packRec.ToTopPackingCode = inputDetail.;
packRec.ToStdPackQty = inputDetail.StdPackQty;
@@ -438,6 +439,11 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
//packRec.TaskOrderNumber = inputDetail.; //任务单
//packRec.ReceiptRecNumber = inputDetail.; //收货记录单
//packRec.PutOnShelfNumber = inputDetail.; //上架单
+ if (updateJobDetailInput != null)
+ {
+ packRec.FromQty = updateJobDetailInput.FromQty;
+ packRec.ToQty = updateJobDetailInput.ToQty;
+ }
recLst.Add(packRec);
}
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 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;
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs
index 1731bd5e6..308e7c130 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs
@@ -69,6 +69,7 @@ public partial class StoreEventAutoMapperProfile : Profile
;
CreateMap()
.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))
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs
index 31d1acd4e..d23c13f61 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs
+++ b/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;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs
index c46ab6697..24d813bd1 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs
+++ b/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.Linq;
using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
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.Store.Domain;
using Win_in.Sfs.Wms.Store.Event.Transaction;
+using static ClosedXML.Excel.XLPredefinedFormat;
namespace Win_in.Sfs.Wms.Store.Event.Transactions;
@@ -23,12 +25,14 @@ public class ThirdLocationNoteEventHandler
private readonly ILocationAppService _locationAppService;
private readonly IThirdLocationRequestManager _thirdLocationRequestManager;
+ private readonly IThirdLocationRequestRepository _ThirdLocationRequestRepository;
public ThirdLocationNoteEventHandler(ILocationAppService locationAppService
- , IThirdLocationRequestManager thirdLocationRequestManager)
+ , IThirdLocationRequestRepository ThirdLocationRequestRepository, IThirdLocationRequestManager thirdLocationRequestManager)
{
_locationAppService = locationAppService;
_thirdLocationRequestManager = thirdLocationRequestManager;
+ _ThirdLocationRequestRepository = ThirdLocationRequestRepository;
}
[UnitOfWork]
@@ -44,9 +48,21 @@ public class ThirdLocationNoteEventHandler
await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false);
if (!string.IsNullOrEmpty(entity.RequestNumber))
- {
- var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false);
- await _thirdLocationRequestManager.CompleteAsync(thirdLocationRequest).ConfigureAwait(false);
+ {
+ //var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).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);
+
+ }
+
}
}