From 3aa3b3e91f274d1544f397e9f286853d01187fcd Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周三, 04 6月 2025 17:41:04 +0800
Subject: [PATCH] 变量文档
---
HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsPlaceAppService.cs | 70 ++++++++++++++++++++++++++++------
1 files changed, 57 insertions(+), 13 deletions(-)
diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsPlaceAppService.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsPlaceAppService.cs
index 5a41555..864e7c2 100644
--- a/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsPlaceAppService.cs
+++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Application/Implements/WmsPlaceAppService.cs
@@ -1,9 +1,11 @@
-using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsPlaces;
+using CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsPlace;
using CMS.Plugin.HIAWms.Application.Contracts.Services;
using CMS.Plugin.HIAWms.Domain.Shared;
using CMS.Plugin.HIAWms.Domain.Shared.WmsPlaces;
using CMS.Plugin.HIAWms.Domain.WmsPlaces;
using CmsQueryExtensions;
+using CmsQueryExtensions.Extension;
+using System.Linq.Expressions;
using System.Text.RegularExpressions;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@@ -32,8 +34,12 @@
return ObjectMapper.Map<WmsPlace, WmsPlaceDto>(await _wmsplaceRepository.GetAsync(id));
}
- /// <inheritdoc />
- public virtual async Task<PagedResultDto<WmsPlaceDto>> GetListAsync(GetWmsMaterialInfoInput input)
+ /// <summary>
+ /// 鍒嗛〉鑾峰彇搴撲綅淇℃伅
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ public virtual async Task<PagedResultDto<WmsPlaceDto>> GetListAsync(GetWmsPlaceInput input)
{
Check.NotNull(input, nameof(input));
@@ -42,14 +48,41 @@
input.Sorting = nameof(WmsPlace.Sort);
}
- var specification = new WmsPlaceSpecification(input.Name);
- var place = ObjectMapper.Map<GetWmsMaterialInfoInput, WmsPlace>(input);
- var count = await _wmsplaceRepository.GetCountAsync(place,input.Filter, specification);
- var list = await _wmsplaceRepository.GetListAsync(place, input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification);
+ #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+
+ //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ var whereConditions = DynamicGetQueryParams(input);
+
+ #endregion
+
+ var count = await _wmsplaceRepository.GetCountAsync(whereConditions);
+ var list = await _wmsplaceRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount);
return new PagedResultDto<WmsPlaceDto>(count, ObjectMapper.Map<List<WmsPlace>, List<WmsPlaceDto>>(list));
}
+ /// <summary>
+ /// 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ /// </summary>
+ /// <param name="input">杈撳叆鍙傛暟</param>
+ /// <returns></returns>
+ private FunReturnResultModel<Expression<Func<WmsPlace, bool>>> DynamicGetQueryParams(GetWmsPlaceInput input)
+ {
+ //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ var whereConditions = WhereConditionsExtensions.GetWhereConditions<WmsPlace, GetWmsPlaceInput>(input);
+ if (!whereConditions.IsSuccess)
+ {
+ throw new Exception("鍔ㄦ�佹瀯閫犳煡璇㈡潯浠跺け璐�:" + whereConditions.ErrMsg);
+ }
+
+ //涔熷彲鍐嶆鑷畾涔夋瀯寤烘煡璇㈡潯浠�
+ Expression<Func<WmsPlace, bool>> extendExpression = a => a.IsDeleted == false;
+ // 浣跨敤 System.Linq.PredicateBuilder 鐨� And
+ var pres = (System.Linq.Expressions.Expression<Func<WmsPlace, bool>>)(whereConditions.data);
+ whereConditions.data = System.Linq.PredicateBuilder.And(pres, extendExpression);
+
+ return whereConditions;
+ }
/// <inheritdoc />
public virtual async Task<WmsPlaceDto> CreateAsync(WmsPlaceCreateDto input)
{
@@ -286,8 +319,12 @@
}
}
- /// <inheritdoc />
- public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsMaterialInfoInput input)
+ /// <summary>
+ /// 瀵煎嚭搴撲綅淇℃伅
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ public async Task<(Dictionary<string, object> Sheets, string FileName)> ExportAsync(GetWmsPlaceInput input)
{
Check.NotNull(input, nameof(input));
@@ -296,9 +333,16 @@
input.Sorting = nameof(WmsPlace.Sort);
}
- var specification = new WmsPlaceSpecification(input.Name);
- var place = ObjectMapper.Map<GetWmsMaterialInfoInput, WmsPlace>(input);
- var list = await _wmsplaceRepository.GetListAsync(place, input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true);
+ #region 鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+
+ //鍔ㄦ�佹瀯閫犳煡璇㈡潯浠�
+ var whereConditions = DynamicGetQueryParams(input);
+
+ #endregion
+
+
+
+ var list = await _wmsplaceRepository.GetListAsync(whereConditions, input.Sorting, input.MaxResultCount, input.SkipCount, includeDetails: true);
var result = ObjectMapper.Map<List<WmsPlace>, List<WmsPlaceDto>>(list);
var sheets = new Dictionary<string, object>
@@ -306,7 +350,7 @@
["閰嶇疆"] = ExportHelper.ConvertListToExportData(result),
};
- var fileName = result.Count > 1 ? "WmsPlace鍒楄〃" : result.Count == 1 ? result.First()?.PlaceNo : "WmsPlace妯$増";
+ var fileName = "搴撲綅淇℃伅";
return (sheets, fileName);
}
--
Gitblit v1.9.3