diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs index 10b785717..a4d163e2a 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/FawtygAutoMapperProfile.cs @@ -105,7 +105,7 @@ public class FawtygAutoMapperProfile : Profile .ForMember(x => x.SupplierItemCode, y => y.MapFrom(d => d.PackCode)) .ForMember(x => x.ItemName, y => y.MapFrom(d => d.PackName)) .ForMember(x => x.Version, y => y.MapFrom(d => d.Remark)) - .ForMember(x => x.SupplierPackQty, y => y.MapFrom(d => d.PackQty)) + .ForMember(x => x.SupplierPackQty, y => y.MapFrom(d => d.Qty)) .ForMember(x => x.SupplierPackUom, y => y.MapFrom(d => d.PackUom)); diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs index aea4041b4..a0762cda9 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.EosAgent/Incoming/ProductReader.cs @@ -102,7 +102,7 @@ public class ProductReader : IReader PackName = product.Name, Remark = product.Model, PackUom = product.UnitCode, - PackQty = Convert.ToDecimal(product.PackageCount), + Qty = Convert.ToDecimal(product.PackageCount), SupplierCode = product.SupplierCode, }; diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs index a4ba1f8e1..2d0fb7efe 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesIncomingBackgroundWorker.cs @@ -42,6 +42,7 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase //转换MesOut await mesOutConverter.ConvertAsync(mesOutsFromExternalList).ConfigureAwait(false); + //上海和安徽无此接口 //Logger.LogInformation($"Read PullTask");//拉动任务 //var pullTaskReader = workerContext.ServiceProvider.GetRequiredService(); //var pullTaskConverter = workerContext.ServiceProvider.GetRequiredService(); @@ -58,6 +59,8 @@ public class MesIncomingBackgroundWorker : AsyncPeriodicBackgroundWorkerBase //转换Scrap await scrapConverter.ConvertAsync(scrapsFromExternalList).ConfigureAwait(false); + + //上海和安徽无此接口 //Logger.LogInformation($"Read Issue"); //var pckHandleService = workerContext.ServiceProvider.GetRequiredService(); //var pckConverter = workerContext.ServiceProvider.GetRequiredService(); diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemPack/ItemPackExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemPack/ItemPackExchangeDto.cs index 310f1eeb6..3cd336fec 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemPack/ItemPackExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ItemPack/ItemPackExchangeDto.cs @@ -43,5 +43,5 @@ public class ItemPackExchangeDto /// 包装数量 /// [Display(Name = "包装数量")] - public decimal PackQty { get; set; } + public decimal Qty { get; set; } } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml index 38ca0c85c..3ef624cd8 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml @@ -696,7 +696,7 @@ 包装计量单位 - + 包装数量 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 43b0d71ae..ba964b00d 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 @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -64,7 +65,8 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); var toLocationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - + CheckLocation(toLocationDto, detail); + detail.OnTheWayLocationCode = bool.FalseString; detail.ItemCode=balanceDto.ItemCode; detail.ArriveDate=balanceDto.ArriveDate; @@ -104,6 +106,16 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase return dictionary; } + #region 校验 + private void CheckLocation(LocationDTO locationDto, TransferNoteDetail detail) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在"); + } + } + #endregion + /// /// 按条件获取线边调拨的分页列表 /// request sample diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs index 49dcab912..57537e720 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -64,6 +65,7 @@ public class WipWarehouseAdjustNoteAppService : SfsStoreWithDetailsAppServiceBas var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + CheckLocation(toLocationDto, detail); detail.ItemCode = balanceDto.ItemCode; detail.ArriveDate = balanceDto.ArriveDate; @@ -103,6 +105,16 @@ public class WipWarehouseAdjustNoteAppService : SfsStoreWithDetailsAppServiceBas return dictionary; } + #region 校验 + private void CheckLocation(LocationDTO toLocationDto, WipWarehouseAdjustNoteDetail detail) + { + if (toLocationDto == null) + { + throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在"); + } + } + #endregion + /// /// 确认对应的记录单 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs index f6c44ac51..1d1e0215a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs @@ -82,6 +82,24 @@ public class ProductReceiptRequestAppService : return dictionary; } + #region 校验 + private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) + { + if (itemBasicDto == null) + { + throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); + } + } + + private void CheckLocation(LocationDTO locationDto, string locationCode) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + /// /// 赋值详情 /// @@ -90,7 +108,7 @@ public class ProductReceiptRequestAppService : private async Task SetDetailPropertiesAsync(ProductReceiptRequestDetail detail) { var itemBasic = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - + CheckItemBasic(itemBasic, detail.ItemCode); if (itemBasic != null) { detail.ItemName = itemBasic.Name; @@ -101,7 +119,7 @@ public class ProductReceiptRequestAppService : } var location = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - + CheckLocation(location, detail.LocationCode); if (location != null) { detail.LocationErpCode = location.ErpLocationCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs index 9275973f6..fa3bcbfa7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs @@ -114,6 +114,7 @@ public class ProductRecycleRequestAppService : var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode) .ConfigureAwait(false); + CheckLocation(locationDto, detail.LocationCode); await SetDetailPropertiesAsync(detail).ConfigureAwait(false); } @@ -122,6 +123,24 @@ public class ProductRecycleRequestAppService : return dictionary; } + #region 校验 + private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) + { + if (itemBasicDto == null) + { + throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); + } + } + + private void CheckLocation(LocationDTO locationDTO, string locationCode) + { + if (locationDTO == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) { var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.ProductRecycle, EnumTransSubType.None).ConfigureAwait(false); @@ -139,7 +158,7 @@ public class ProductRecycleRequestAppService : ProductRecycleRequestDetail detail) { var item = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - + CheckItemBasic(item, detail.ItemCode); if (item != null) { detail.ItemName = item.Name; @@ -150,7 +169,7 @@ public class ProductRecycleRequestAppService : } var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - + CheckLocation(location, detail.LocationCode); if (location != null) { detail.LocationErpCode = location.ErpLocationCode; @@ -160,7 +179,7 @@ public class ProductRecycleRequestAppService : } var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); - + CheckLocation(rawLocation, detail.RawLocationCode); if (rawLocation != null) { detail.RawLocationErpCode = rawLocation.ErpLocationCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs index 2b7f6a0d5..617bc4e55 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs @@ -79,11 +79,16 @@ public class ProductionReturnRequestAppService : foreach (var detail in productionReturnRequest.Details) { var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + CheckItemBasic(itemBasicDto, detail.ItemCode); + detail.Uom = itemBasicDto.BasicUom; detail.StdPackQty=itemBasicDto.StdPackQty; var fromLocationDto= await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + CheckLocation(fromLocationDto, detail.FromLocationCode); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + CheckLocation(toLocationDto, detail.ToLocationCode); detail.FromLocationArea = fromLocationDto.AreaCode; detail.FromWarehouseCode = fromLocationDto.WarehouseCode; @@ -100,6 +105,24 @@ public class ProductionReturnRequestAppService : return dictionary; } + #region 校验 + private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) + { + if (itemBasicDto == null) + { + throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); + } + } + + private void CheckLocation(LocationDTO locationDTO, string locationCode) + { + if (locationDTO == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + #region import protected virtual async Task CheckImportInputBusinessAsync(ProductionReturnRequestImportInput importInput, EnumImportMethod importMethod, List validationRresult) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs index d23d8c20f..63091e918 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs @@ -108,6 +108,8 @@ public class ScrapRequestAppService : SfsStoreRequestAppServiceBase { var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Scrap, subType) .ConfigureAwait(false); + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + entity.Worker = CurrentUser.GetUserName(); entity.AutoCompleteJob = tranType.AutoCompleteJob; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs index c0b214534..950a6768b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; @@ -109,6 +110,7 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) .ConfigureAwait(false); + CheckLocation(toLocationDto, detail.ToLocationCode); detail.ItemCode = balanceDto.ItemCode; detail.ArriveDate = balanceDto.ArriveDate; @@ -150,10 +152,21 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase return dictionary; } + #region 校验 + private void CheckLocation(LocationDTO locationDTO, string locationCode) + { + if (locationDTO == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + private async Task SetEntityPropertiesAsync(TransferRequest entity, EnumTransSubType subType) { var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType) .ConfigureAwait(false); + Check.NotNull(tranType, "事务类型", "事务类型不存在"); entity.Worker = CurrentUser.GetUserName(); entity.AutoCompleteJob = tranType.AutoCompleteJob; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs index 77e876b6f..a91aa54e3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs @@ -59,6 +59,24 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA return dictionary; } + #region 校验 + private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) + { + if (itemBasicDto == null) + { + throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); + } + } + + private void CheckLocation(LocationDTO locationDto, string locationCode) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + #region 赋值 /// @@ -69,7 +87,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA private async Task SetDetailPropertiesAsync(UnplannedIssueRequestDetail detail) { var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - + CheckItemBasic(itemBasic, detail.ItemCode); if (itemBasic != null) { detail.ItemCode = itemBasic.Code; @@ -82,7 +100,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA } var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - + CheckLocation(location, detail.LocationCode); if (location != null) { detail.WarehouseCode = location.WarehouseCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs index b4e3d4656..e96472a85 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs @@ -55,6 +55,24 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return dictionary; } + #region 校验 + private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) + { + if (itemBasicDto == null) + { + throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); + } + } + + private void CheckLocation(LocationDTO locationDto, string locationCode) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + #region 赋值 /// @@ -65,7 +83,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ private async Task SetDetailPropertiesAsync(UnplannedReceiptRequestDetail detail) { var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - + CheckItemBasic(itemBasic, detail.ItemCode); if (itemBasic != null) { detail.ItemName = itemBasic.Name; @@ -76,7 +94,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ } var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - + CheckLocation(location, detail.LocationCode); if (location != null) { detail.LocationErpCode = location.ErpLocationCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs index 5b0d6f098..229401e12 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; using Volo.Abp.ObjectMapping; @@ -78,10 +79,15 @@ public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase detail.ToLocationCode = detail.FromLocationCode;//调整库位一致 var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + CheckItemBasic(itemBasicDto, detail.ItemCode); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) .ConfigureAwait(false); + CheckLocation(toLocationDto, detail.ToLocationCode); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) .ConfigureAwait(false); + CheckLocation(fromLocationDto, detail.FromLocationCode); detail.ItemCode = itemBasicDto.Code; detail.ItemDesc1 = itemBasicDto.Desc1; @@ -117,6 +123,24 @@ public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase return dictionary; } + #region 校验 + private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) + { + if (itemBasicDto == null) + { + throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); + } + } + + private void CheckLocation(LocationDTO locationDto, string locationCode) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + #endregion + private async Task SetEntityPropertiesAsync(WipWarehouseAdjustRequest entity, EnumTransSubType subType) { var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Adjust, subType)