Browse Source

修改库存初始化

集成Redis
郑勃旭 2 years ago
parent
commit
dfa146e95b
  1. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs
  2. 10
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs
  3. 22
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs
  4. 17
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InventoryInitialNotes/InventoryInitialNoteManager.cs
  5. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs

@ -41,4 +41,6 @@ public interface IInspectJobAppService
/// </summary>
/// <param name="inspectRequestNumber"></param>
Task CancelByInspectRequestAsync(string inspectRequestNumber);
Task<InspectJobDTO> GetInspectNoteDetailByPackingCodeAsync(string packingCode);
}

10
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs

@ -150,6 +150,16 @@ public class InspectJobAppService
}
}
[HttpPost("get-job/by-detail-packing")]
public virtual async Task<InspectJobDTO> GetInspectNoteDetailByPackingCodeAsync(string packingCode)
{
var entity = (await _repository.GetListAsync(p => p.Details.Any(y => y.PackingCode == packingCode), true).ConfigureAwait(false)).FirstOrDefault();
var dto = ObjectMapper.Map<InspectJob, InspectJobDTO>(entity);
return dto;
}
//[HttpPost("pick-inspect")]
//public virtual async Task AddPickInspectJobAsync(InspectJobCreateInput input)
//{

22
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs

@ -26,13 +26,18 @@ public class PutawayNoteAppService :
IPutawayNoteAppService
{
private readonly IPutawayNoteManager _putawayNoteManager;
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService;
public readonly IInspectJobAppService _inspectJobAppService;
public PutawayNoteAppService(
IPutawayNoteRepository repository,
IPutawayNoteManager putawayNoteManager
) : base(repository)
IPutawayNoteManager putawayNoteManager,
IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService,
IInspectJobAppService inspectJobAppService) : base(repository)
{
_putawayNoteManager = putawayNoteManager;
_purchaseReceiptNoteAppService = purchaseReceiptNoteAppService;
_inspectJobAppService = inspectJobAppService;
}
/// <summary>
@ -44,6 +49,19 @@ public class PutawayNoteAppService :
//[Authorize(PutawayNotePermissions.Create)]
public override async Task<PutawayNoteDTO> CreateAsync(PutawayNoteEditInput input)
{
foreach (var detail in input.Details)
{
var purchasereDetail =await _purchaseReceiptNoteAppService.GetDetailByItemAndPackingAsync(detail.ItemCode, detail.ToPackingCode).ConfigureAwait(false);
if (purchasereDetail != null)
{
var inspectJobDto =await _inspectJobAppService.GetInspectNoteDetailByPackingCodeAsync(detail.ToPackingCode).ConfigureAwait(false);
if (inspectJobDto.JobStatus != EnumJobStatus.Done)
{
throw new UserFriendlyException($"包含【{detail.ToPackingCode}】箱码的报检单,尚未完成质检");
}
}
}
var entity = ObjectMapper.Map<PutawayNoteEditInput, PutawayNote>(input);
var result = await _putawayNoteManager.CreateByPurchaseAsync(entity).ConfigureAwait(false);

17
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InventoryInitialNotes/InventoryInitialNoteManager.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Uow;
namespace Win_in.Sfs.Wms.Store.Domain;
@ -59,7 +60,11 @@ public class InventoryInitialNoteManager : SfsStoreManagerBase<InventoryInitialN
{
var item = items.FirstOrDefault(p => p.Code == detail.ItemCode);
if (item != null)
if (item == null)
{
throw new UserFriendlyException($"【{detail.ItemCode}】物品不存在");
}
else
{
detail.ItemName = item.Name;
detail.ItemDesc1 = item.Desc1;
@ -68,12 +73,18 @@ public class InventoryInitialNoteManager : SfsStoreManagerBase<InventoryInitialN
}
var location = locations.FirstOrDefault(p => p.Code == detail.LocationCode);
if (location != null)
if (location == null)
{
throw new UserFriendlyException($"【{detail.LocationCode} 库位不存在");
}
else
{
detail.LocationErpCode = location.ErpLocationCode;
detail.WarehouseCode = location.WarehouseCode;
detail.LocationArea = location.AreaCode;
detail.LocationGroup = location.LocationGroupCode;
detail.LocationCode = location.Code;
}
if (string.IsNullOrEmpty(detail.PackingCode))
{
detail.PackingCode = string.Empty;

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs

@ -81,7 +81,7 @@ public class ProductReceiptNoteEventHandler
new List<EnumLocationType> { EnumLocationType.WIP },
detail.LocationErpCode).ConfigureAwait(false);
if (locationDtos == null)
if (locationDtos == null||locationDtos.Count<1)
{
throw new UserFriendlyException(
$"Erp储位为【{detail.LocationErpCode}】,库位类型为{EnumLocationType.WIP.GetDisplayName()}的库位不存在。");

Loading…
Cancel
Save