From 733e63cb362f17aea4a1020654fa348a0d0c1f06 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 24 二月 2025 00:08:59 +0800
Subject: [PATCH] 优化入库逻辑,优化直接出库逻辑,优化移库任务逻辑
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs | 127 ++++++++++++++++++++++++++++++++++++------
1 files changed, 109 insertions(+), 18 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs"
index fa36fd6..5f57b15 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs"
@@ -7,6 +7,7 @@
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Core.Enums;
namespace WIDESEA_Core.BaseRepository
{
@@ -23,12 +24,16 @@
/// <returns>鏌ヨ缁撴灉</returns>
TEntity QureyDataById(object id);
+ Task<TEntity> QureyDataByIdAsync(object id);
+
/// <summary>
/// 閫氳繃涓婚敭鏁扮粍鏌ヨ鏁版嵁
/// </summary>
/// <param name="lstIds">涓婚敭鏁扮粍</param>
/// <returns>鏌ヨ缁撴灉闆嗗悎</returns>
List<TEntity> QureyDataByIds(object[] lstIds);
+
+ Task<List<TEntity>> QureyDataByIdsAsync(object[] lstIds);
/// <summary>
/// 閫氳繃涓婚敭闆嗗悎鏌ヨ鏁版嵁
@@ -37,12 +42,16 @@
/// <returns>鏌ヨ缁撴灉闆嗗悎</returns>
List<TEntity> QureyDataByIds(List<object> lstIds);
+ Task<List<TEntity>> QureyDataByIdsAsync(List<object> lstIds);
+
/// <summary>
/// 娣诲姞鍗曟潯鏁版嵁
/// </summary>
/// <param name="entity"></param>
/// <returns>褰卞搷琛屾暟</returns>
int AddData(TEntity entity);
+
+ Task<int> AddDataAsync(TEntity entity);
/// <summary>
/// 娣诲姞澶氭潯鏁版嵁
@@ -51,12 +60,20 @@
/// <returns>褰卞搷琛屾暟</returns>
int AddData(List<TEntity> listEntity);
+ Task<int> AddDataAsync(List<TEntity> listEntity);
+
/// <summary>
/// 閫氳繃涓婚敭鍒犻櫎鏁版嵁
/// </summary>
/// <param name="id">涓婚敭</param>
/// <returns>鍒犻櫎缁撴灉</returns>
bool DeleteDataById(object id);
+
+ Task<bool> DeleteDataByIdAsync(object id);
+
+ bool DeleteAndMoveIntoHty(TEntity entity, OperateType operateType);
+
+ bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateType operateType);
/// <summary>
/// 閫氳繃涓婚敭鏁版嵁鍒犻櫎澶氭潯鏁版嵁
@@ -65,12 +82,16 @@
/// <returns>鍒犻櫎缁撴灉</returns>
bool DeleteDataByIds(object[] ids);
+ Task<bool> DeleteDataByIdsAsync(object[] ids);
+
/// <summary>
/// 閫氳繃瀹炰綋鏁版嵁鍒犻櫎鏁版嵁
/// </summary>
/// <param name="ids">涓婚敭鏁扮粍</param>
/// <returns>鍒犻櫎缁撴灉</returns>
bool DeleteData(TEntity entity);
+
+ Task<bool> DeleteDataAsync(TEntity entity);
/// <summary>
/// 閫氳繃瀹炰綋闆嗗悎鏁版嵁鍒犻櫎鏁版嵁
@@ -79,12 +100,16 @@
/// <returns>鍒犻櫎缁撴灉</returns>
bool DeleteData(List<TEntity> listEntity);
+ Task<bool> DeleteDataAsync(List<TEntity> listEntity);
+
/// <summary>
/// 鏇存柊鍗曟潯鏁版嵁
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
bool UpdateData(TEntity entity);
+
+ Task<bool> UpdateDataAsync(TEntity entity);
/// <summary>
/// 鏇存柊澶氭潯鏁版嵁
@@ -93,6 +118,8 @@
/// <returns></returns>
bool UpdateData(List<TEntity> listEntity);
+ Task<bool> UpdateDataAsync(List<TEntity> listEntity);
+
/// <summary>
/// 鎸囧畾鍒楁洿鏂版暟鎹�
/// </summary>
@@ -100,13 +127,17 @@
/// <param name="lstColumns"></param>
/// <param name="lstIgnoreColumns"></param>
/// <returns></returns>
- bool UpdateData(TEntity entity, List<string> lstColumns, List<string> lstIgnoreColumns = null);
+ bool UpdateData(TEntity entity, List<string> lstColumns, List<string>? lstIgnoreColumns = null);
+
+ Task<bool> UpdateDataAsync(TEntity entity, List<string> lstColumns, List<string>? lstIgnoreColumns = null);
/// <summary>
/// 鏌ヨ鎵�鏈夋暟鎹�
/// </summary>
/// <returns></returns>
List<TEntity> QueryData();
+
+ Task<List<TEntity>> QueryDataAsync();
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁
@@ -115,6 +146,8 @@
/// <returns></returns>
List<TEntity> QueryData(string where);
+ Task<List<TEntity>> QueryDataAsync(string where);
+
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁
/// </summary>
@@ -122,9 +155,23 @@
/// <returns></returns>
List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression);
+ Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression);
+
TEntity QueryFirst(Expression<Func<TEntity, bool>> whereExpression);
+ Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression);
+
TResult QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression);
+
+ Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression);
+
+ TResult QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression, Dictionary<string, OrderByType> orderBy);
+
+ Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression, Dictionary<string, OrderByType> orderBy);
+
+ TEntity QueryFirst(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy);
+
+ Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy);
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴�
@@ -132,7 +179,9 @@
/// <param name="whereExpression"></param>
/// <param name="orderByFields"></param>
/// <returns></returns>
- List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
+ List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, Dictionary<string, OrderByType> orderBy);
+
+ Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴�
@@ -142,6 +191,8 @@
/// <returns></returns>
List<TEntity> QueryData(string where, Dictionary<string, OrderByType> orderBy);
+ Task<List<TEntity>> QueryDataAsync(string where, Dictionary<string, OrderByType> orderBy);
+
/// <summary>
/// 鏌ヨ鎸囧畾鏁版嵁瀵硅薄
/// </summary>
@@ -149,6 +200,8 @@
/// <param name="expression"></param>
/// <returns></returns>
List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression);
+
+ Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression);
/// <summary>
/// 鏉′欢鏌ヨ鎸囧畾鏁版嵁瀵硅薄
@@ -158,7 +211,9 @@
/// <param name="whereExpression"></param>
/// <param name="orderByFields"></param>
/// <returns></returns>
- List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
+ List<TResult> QueryData<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields = "");
+
+ Task<List<TResult>> QueryDataAsync<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴�
@@ -169,6 +224,8 @@
/// <returns></returns>
List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true);
+ Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true);
+
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁骞舵帓搴�
/// </summary>
@@ -177,13 +234,7 @@
/// <returns></returns>
List<TEntity> QueryData(string where, string orderByFields);
- /// <summary>
- /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁
- /// </summary>
- /// <param name="sql"></param>
- /// <param name="parameters"></param>
- /// <returns></returns>
- List<TEntity> QueryDataBySql(string sql, SugarParameter[] parameters = null);
+ Task<List<TEntity>> QueryDataAsync(string where, string orderByFields);
/// <summary>
/// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁
@@ -191,9 +242,23 @@
/// <param name="sql"></param>
/// <param name="parameters"></param>
/// <returns></returns>
- List<dynamic> QueryDynamicDataBySql(string sql, SugarParameter[] parameters = null);
+ List<TEntity> QueryDataBySql(string sql, SugarParameter[]? parameters = null);
- List<object> QueryObjectDataBySql(string sql, SugarParameter[] parameters = null);
+ Task<List<TEntity>> QueryDataBySqlAsync(string sql, SugarParameter[]? parameters = null);
+
+ /// <summary>
+ /// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parameters"></param>
+ /// <returns></returns>
+ List<dynamic> QueryDynamicDataBySql(string sql, SugarParameter[]? parameters = null);
+
+ Task<List<dynamic>> QueryDynamicDataBySqlAsync(string sql, SugarParameter[]? parameters = null);
+
+ List<object> QueryObjectDataBySql(string sql, SugarParameter[]? parameters = null);
+
+ Task<List<object>> QueryObjectDataBySqlAsync(string sql, SugarParameter[]? parameters = null);
/// <summary>
/// 鍘熺敓Sql璇彞鎵ц鎿嶄綔
@@ -201,7 +266,9 @@
/// <param name="sql"></param>
/// <param name="sqlParameters"></param>
/// <returns></returns>
- public int ExecuteSqlCommand(string sql, params SqlParameter[] sqlParameters);
+ int ExecuteSqlCommand(string sql, params SqlParameter[] sqlParameters);
+
+ Task<int> ExecuteSqlCommandAsync(string sql, params SqlParameter[] sqlParameters);
/// <summary>
/// 鍘熺敓Sql璇彞鏌ヨ鏁版嵁
@@ -209,7 +276,9 @@
/// <param name="sql"></param>
/// <param name="parameters"></param>
/// <returns></returns>
- DataTable QueryTable(string sql, SugarParameter[] parameters = null);
+ DataTable QueryTable(string sql, SugarParameter[]? parameters = null);
+
+ Task<DataTable> QueryTableAsync(string sql, SugarParameter[]? parameters = null);
/// <summary>
/// 鏉′欢鏌ヨ鏁版嵁鎸囧畾鏁伴噺鐨勮
@@ -220,6 +289,8 @@
/// <returns></returns>
List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields);
+ Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields);
+
/// <summary>
/// 鏉′欢鏌ヨ鎸囧畾鏁伴噺鐨勮
/// </summary>
@@ -228,6 +299,8 @@
/// <param name="orderByFields"></param>
/// <returns></returns>
List<TEntity> QueryData(string where, int top, string orderByFields);
+
+ Task<List<TEntity>> QueryDataAsync(string where, int top, string orderByFields);
/// <summary>
/// 鍒嗛〉鏌ヨ
@@ -239,6 +312,8 @@
/// <returns></returns>
List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields);
+ Task<List<TEntity>> QueryDataAsync(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields);
+
/// <summary>
/// 鍒嗛〉鏌ヨ
/// </summary>
@@ -249,6 +324,8 @@
/// <returns></returns>
List<TEntity> QueryData(string where, int pageIndex, int pageSize, string orderByFields);
+ Task<List<TEntity>> QueryDataAsync(string where, int pageIndex, int pageSize, string orderByFields);
+
/// <summary>
/// 鍒嗛〉鏌ヨ
/// </summary>
@@ -257,7 +334,7 @@
/// <param name="pageSize"></param>
/// <param name="orderByFields"></param>
/// <returns></returns>
- PageGridData<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields = null);
+ PageGridData<TEntity> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string? orderByFields = null);
/// <summary>
/// 鍒嗛〉鏌ヨ
@@ -284,6 +361,20 @@
List<TResult> QueryTabs<T, T2, TResult>(
Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, TResult>> selectExpression,
+ Expression<Func<T, T2, bool>> whereExpressionT1,
+ Expression<Func<TResult, bool>> whereExpression);
+
+ List<TResult> QueryTabs<T, T2, TResult>(
+ Expression<Func<T, T2, bool>> joinExpression,
+ Expression<Func<T, T2, TResult>> selectExpression,
+ Expression<Func<T, bool>> whereExpressionT1,
+ Expression<Func<T2, bool>> whereExpressionT2,
+ Expression<Func<TResult, bool>> whereExpression);
+
+
+ Task<List<TResult>> QueryTabsAsync<T, T2, TResult>(
+ Expression<Func<T, T2, object[]>> joinExpression,
+ Expression<Func<T, T2, TResult>> selectExpression,
Expression<Func<TResult, bool>> whereExpression);
/// <summary>
@@ -305,7 +396,7 @@
Expression<Func<TResult, bool>> whereExpression,
int pageIndex = 1,
int pageSize = 20,
- string orderByFields = null);
+ string? orderByFields = null);
/// <summary>
/// 涓よ〃鑱斿悎鏌ヨ-鍒嗛〉-鍒嗙粍
@@ -328,7 +419,7 @@
Expression<Func<T, object>> groupExpression,
int pageIndex = 1,
int pageSize = 20,
- string orderByFields = null);
+ string? orderByFields = null);
//List<TResult> QueryMuch<T, T2, T3, TResult>(
// Expression<Func<T, T2, T3, object[]>> joinExpression,
@@ -336,4 +427,4 @@
// Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new();
//Task<PageModel<TEntity>> QueryPage(PaginationModel pagination);
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3