diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs
index 8adf9ce95..6da296b61 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs
@@ -99,6 +99,10 @@ public class PurchaseReturnRequestAppService :
var labelDto = await _inventoryLabelApp.GetByCodeAsync(detail.PackingCode).ConfigureAwait(false);
var balanceDto = await BalanceAclService.GetByPackingCodeAsync(detail.PackingCode).ConfigureAwait(false);
var locationDto= await _locationAppService.GetByCodeAsync(balanceDto.LocationCode).ConfigureAwait(false);
+ CheckLabel(labelDto, detail);
+ CheckBalance(balanceDto, detail);
+ CheckLocation(locationDto, balanceDto);
+
var purchaseOrderDto= await _purchaseOrderAppService.GetByNumberAsync(labelDto.PoNumber).ConfigureAwait(false);
purchaseOrderDto = await _purchaseOrderAppService.GetAsync(purchaseOrderDto.Id).ConfigureAwait(false);
@@ -187,6 +191,52 @@ public class PurchaseReturnRequestAppService :
}
}
+ #region 校验
+
+ ///
+ /// 校验库位
+ ///
+ ///
+ ///
+ ///
+ private static void CheckLocation(LocationDTO locationDto, BalanceDTO balanceDto)
+ {
+ if (locationDto == null)
+ {
+ throw new UserFriendlyException($"库位为【{balanceDto.LocationCode}】不存在");
+ }
+ }
+
+ ///
+ /// 校验库存
+ ///
+ ///
+ ///
+ ///
+ private static void CheckBalance(BalanceDTO balanceDto, PurchaseReturnRequestDetail detail)
+ {
+ if (balanceDto == null)
+ {
+ throw new UserFriendlyException($"库存为【{detail.PackingCode}】不存在");
+ }
+ }
+
+ ///
+ /// 校验标签
+ ///
+ ///
+ ///
+ ///
+ private static void CheckLabel(InventoryLabelDto labelDto, PurchaseReturnRequestDetail detail)
+ {
+ if (labelDto == null)
+ {
+ throw new UserFriendlyException($"标签为【{detail.PackingCode}】不存在");
+ }
+ }
+
+ #endregion
+
#endregion
#region 校验
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/SupplierAsns/SupplierAsnManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/SupplierAsns/SupplierAsnManager.cs
index cbc2f0e0f..784fa00cd 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/SupplierAsns/SupplierAsnManager.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/SupplierAsns/SupplierAsnManager.cs
@@ -1,7 +1,12 @@
+using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
+using Volo.Abp.Data;
using Volo.Abp.Uow;
+using Win_in.Sfs.Basedata.Application.Contracts;
+using Win_in.Sfs.Label.Application.Contracts;
+using Win_in.Sfs.Label.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Domain;
@@ -14,10 +19,14 @@ public class SupplierAsnManager : SfsStoreManagerBase CreateAsync(SupplierAsn entity)
{
- if (!string.IsNullOrWhiteSpace(entity.Number))//考虑 接口过来的数据是有Number的
+ if (!string.IsNullOrWhiteSpace(entity.Number))//接口过来的数据是有Number的
{
entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number);
entity = await Repository.InsertAsync(entity).ConfigureAwait(false);
@@ -86,7 +95,6 @@ public class SupplierAsnManager : SfsStoreManagerBase details)
{
foreach (var detail in details)
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs
index 5d0666e85..20456a5e7 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/MaterialRequests/MaterialRequestManager.cs
@@ -85,7 +85,7 @@ public class MaterialRequestManager
var issueJobs = await _issueJobRepository.GetListAsync(t => t.MaterialRequestNumber == materialRequest.Number).ConfigureAwait(false);
if (issueJobs.Count > 0)
{
- if (issueJobs.All(t => t.JobStatus == EnumJobStatus.Done || t.JobStatus == EnumJobStatus.Closed || t.JobStatus == EnumJobStatus.Cancelled))
+ if (issueJobs.All(t => t.JobStatus is EnumJobStatus.Done or EnumJobStatus.Closed or EnumJobStatus.Cancelled))
{
if (materialRequest.Details.All(p => p.ReceivedQty >= p.Qty))
{
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
index 143c43909..373067035 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Orders/PurchaseOrderEventHandler.cs
@@ -267,15 +267,18 @@ public class PurchaseOrderEventHandler
SupplierItemDTO supplierItemDto)
{
if (itemBasicDto == null)
+ {
+ throw new UserFriendlyException($"【{itemBasicDto.Code}】物品不存在");
+ }
if (supplierDto == null)
{
- throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商为空");
+ throw new UserFriendlyException($"【{supplierAsn.SupplierCode}】供应商为空");
}
if (supplierItemDto == null)
{
- throw new UserFriendlyException($"{supplierAsn.SupplierCode}供应商零件或{itemBasicDto.Code}零件信息为空");
+ throw new UserFriendlyException($"【{supplierAsn.SupplierCode}】供应商零件或{itemBasicDto.Code}零件信息为空");
}
var inputLabel = new InventoryLabelEditInput();
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 8646730cf..d79ffa44f 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
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Volo.Abp;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
@@ -76,15 +77,27 @@ public class ProductReceiptNoteEventHandler
var transaction = ObjectMapper.Map(detail);
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
- ;
+ var locationDtos = await _locationAppService.GetListByTypesAndErpCodeAsync(
+ new List { EnumLocationType.WIP },
+ detail.LocationErpCode).ConfigureAwait(false);
+
+ if (locationDtos == null)
+ {
+ throw new UserFriendlyException(
+ $"Erp储位为【{detail.LocationErpCode}】,库位类型为{EnumLocationType.WIP.GetDisplayName()}的库位不存在。");
+ }
+
+ if (itemBasicDto == null)
+ {
+ throw new UserFriendlyException(
+ $"物品编号为【{detail.ItemCode}】不存在。");
+ }
+
detail.ItemDesc1 = itemBasicDto.Desc1;
detail.ItemDesc2 = itemBasicDto.Desc2;
detail.ItemName=itemBasicDto.Name;
detail.StdPackQty=itemBasicDto.StdPackQty;
-
- var erpLocationDtos= await _locationAppService.GetListByTypesAndErpCodeAsync(new List { EnumLocationType.WIP },
- detail.LocationErpCode).ConfigureAwait(false);
- var erpLocationDto = erpLocationDtos.First();
+ var erpLocationDto = locationDtos.First();
detail.LocationArea = erpLocationDto.Code;
detail.LocationGroup = erpLocationDto.LocationGroupCode;
detail.LocationErpCode= erpLocationDto.Code;