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> /// </summary>
/// <param name="inspectRequestNumber"></param> /// <param name="inspectRequestNumber"></param>
Task CancelByInspectRequestAsync(string inspectRequestNumber); 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")] //[HttpPost("pick-inspect")]
//public virtual async Task AddPickInspectJobAsync(InspectJobCreateInput input) //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 IPutawayNoteAppService
{ {
private readonly IPutawayNoteManager _putawayNoteManager; private readonly IPutawayNoteManager _putawayNoteManager;
private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService;
public readonly IInspectJobAppService _inspectJobAppService;
public PutawayNoteAppService( public PutawayNoteAppService(
IPutawayNoteRepository repository, IPutawayNoteRepository repository,
IPutawayNoteManager putawayNoteManager IPutawayNoteManager putawayNoteManager,
) : base(repository) IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService,
IInspectJobAppService inspectJobAppService) : base(repository)
{ {
_putawayNoteManager = putawayNoteManager; _putawayNoteManager = putawayNoteManager;
_purchaseReceiptNoteAppService = purchaseReceiptNoteAppService;
_inspectJobAppService = inspectJobAppService;
} }
/// <summary> /// <summary>
@ -44,6 +49,19 @@ public class PutawayNoteAppService :
//[Authorize(PutawayNotePermissions.Create)] //[Authorize(PutawayNotePermissions.Create)]
public override async Task<PutawayNoteDTO> CreateAsync(PutawayNoteEditInput input) 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 entity = ObjectMapper.Map<PutawayNoteEditInput, PutawayNote>(input);
var result = await _putawayNoteManager.CreateByPurchaseAsync(entity).ConfigureAwait(false); 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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace Win_in.Sfs.Wms.Store.Domain; 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); 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.ItemName = item.Name;
detail.ItemDesc1 = item.Desc1; detail.ItemDesc1 = item.Desc1;
@ -68,12 +73,18 @@ public class InventoryInitialNoteManager : SfsStoreManagerBase<InventoryInitialN
} }
var location = locations.FirstOrDefault(p => p.Code == detail.LocationCode); 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.LocationErpCode = location.ErpLocationCode;
detail.WarehouseCode = location.WarehouseCode; detail.WarehouseCode = location.WarehouseCode;
detail.LocationArea = location.AreaCode;
detail.LocationGroup = location.LocationGroupCode;
detail.LocationCode = location.Code;
} }
if (string.IsNullOrEmpty(detail.PackingCode)) if (string.IsNullOrEmpty(detail.PackingCode))
{ {
detail.PackingCode = string.Empty; 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 }, new List<EnumLocationType> { EnumLocationType.WIP },
detail.LocationErpCode).ConfigureAwait(false); detail.LocationErpCode).ConfigureAwait(false);
if (locationDtos == null) if (locationDtos == null||locationDtos.Count<1)
{ {
throw new UserFriendlyException( throw new UserFriendlyException(
$"Erp储位为【{detail.LocationErpCode}】,库位类型为{EnumLocationType.WIP.GetDisplayName()}的库位不存在。"); $"Erp储位为【{detail.LocationErpCode}】,库位类型为{EnumLocationType.WIP.GetDisplayName()}的库位不存在。");

Loading…
Cancel
Save