From 319c4fe3fb3656ba33903d8c9364ae3d548dd038 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期四, 06 三月 2025 09:33:29 +0800 Subject: [PATCH] 2 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs index ded801d..7b5b5b2 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseServices/ServiceBase.cs @@ -225,7 +225,10 @@ { return WebResponseContent.Instance.Error("浼犲弬閿欒,鍙傛暟涓嶈兘涓虹┖"); } - string validResult = typeof(TEntity).ValidateDicInEntity(saveModel.MainData, true, TProperties); + + var x = saveModel.MainData; + + string validResult = typeof(TEntity).ValidateDicInEntity(x, true, TProperties); if (!string.IsNullOrEmpty(validResult)) { @@ -286,7 +289,7 @@ List<TDetail> list = detailDics.DicToIEnumerable<TDetail>(); - ((SqlSugarClient)BaseDal.Db).BeginTran(); + ((SqlSugarScope)BaseDal.Db).BeginTran(); int id = BaseDal.Db.Insertable(entity).ExecuteReturnIdentity(); @@ -298,13 +301,13 @@ BaseDal.Db.Insertable(list).ExecuteCommand(); - ((SqlSugarClient)BaseDal.Db).CommitTran(); + ((SqlSugarScope)BaseDal.Db).CommitTran(); content = WebResponseContent.Instance.OK(); } catch (Exception ex) { - ((SqlSugarClient)BaseDal.Db).RollbackTran(); + ((SqlSugarScope)BaseDal.Db).RollbackTran(); content = WebResponseContent.Instance.Error(ex.Message); } return content; @@ -457,7 +460,7 @@ object mainId = typeof(TEntity).GetPropertyValue(entity, typeof(TEntity).GetKeyName()); if (mainId != null) { - ((SqlSugarClient)BaseDal.Db).BeginTran(); + ((SqlSugarScope)BaseDal.Db).BeginTran(); if (dynamicDelKeys.Count > 0) BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{detailType.GetKeyName()} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange(); @@ -474,7 +477,7 @@ BaseDal.Db.Insertable(addRows).ExecuteCommand(); - ((SqlSugarClient)BaseDal.Db).CommitTran(); + ((SqlSugarScope)BaseDal.Db).CommitTran(); content = WebResponseContent.Instance.OK(); } @@ -486,7 +489,7 @@ } catch (Exception ex) { - ((SqlSugarClient)BaseDal.Db).RollbackTran(); + ((SqlSugarScope)BaseDal.Db).RollbackTran(); content = WebResponseContent.Instance.Error(ex.Message); } return content; @@ -532,14 +535,14 @@ { dynamicDelKeys.Add(keys[i]); } - ((SqlSugarClient)BaseDal.Db).BeginTran(); + ((SqlSugarScope)BaseDal.Db).BeginTran(); if (dynamicDelKeys.Count > 0) BaseDal.Db.Deleteable<object>().AS(detailType.Name).Where($"{name} in (@id)", new { id = dynamicDelKeys.ToArray() }).ExecuteCommandHasChange(); BaseDal.DeleteDataByIds(keys); - ((SqlSugarClient)BaseDal.Db).CommitTran(); + ((SqlSugarScope)BaseDal.Db).CommitTran(); return WebResponseContent.Instance.OK(); } @@ -551,7 +554,7 @@ } catch (Exception ex) { - ((SqlSugarClient)BaseDal.Db).RollbackTran(); + ((SqlSugarScope)BaseDal.Db).RollbackTran(); return WebResponseContent.Instance.Error(ex.Message); } } -- Gitblit v1.9.3