diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs
index b3f975b41..2bc8a2f43 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs
@@ -41,4 +41,6 @@ public interface IInspectJobAppService
///
///
Task CancelByInspectRequestAsync(string inspectRequestNumber);
+
+ Task GetInspectNoteDetailByPackingCodeAsync(string packingCode);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs
index c7090612f..1f534b9e1 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs
+++ b/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 GetInspectNoteDetailByPackingCodeAsync(string packingCode)
+ {
+ var entity = (await _repository.GetListAsync(p => p.Details.Any(y => y.PackingCode == packingCode), true).ConfigureAwait(false)).FirstOrDefault();
+
+ var dto = ObjectMapper.Map(entity);
+
+ return dto;
+ }
+
//[HttpPost("pick-inspect")]
//public virtual async Task AddPickInspectJobAsync(InspectJobCreateInput input)
//{
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs
index b0cbb8823..f37e3a111 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs
+++ b/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;
}
///
@@ -44,6 +49,19 @@ public class PutawayNoteAppService :
//[Authorize(PutawayNotePermissions.Create)]
public override async Task 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(input);
var result = await _putawayNoteManager.CreateByPurchaseAsync(entity).ConfigureAwait(false);
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InventoryInitialNotes/InventoryInitialNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InventoryInitialNotes/InventoryInitialNoteManager.cs
index 10fd76b56..ea3d0e779 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/InventoryInitialNotes/InventoryInitialNoteManager.cs
+++ b/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 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 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;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs
index d79ffa44f..d20477238 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ProductReceiptNoteEventHandler.cs
@@ -81,7 +81,7 @@ public class ProductReceiptNoteEventHandler
new List { EnumLocationType.WIP },
detail.LocationErpCode).ConfigureAwait(false);
- if (locationDtos == null)
+ if (locationDtos == null||locationDtos.Count<1)
{
throw new UserFriendlyException(
$"Erp储位为【{detail.LocationErpCode}】,库位类型为{EnumLocationType.WIP.GetDisplayName()}的库位不存在。");