From 72d0fec2ef03dbe95999a08b475d8c5ab91e545d Mon Sep 17 00:00:00 2001
From: zhangxiaofeng <1939543722@qq.com>
Date: Fri, 6 Sep 2024 14:24:55 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Interface/ITaskManageBCService.cs | 1 +
.../TaskPlat/Method/TaskManageBCService.cs | 24 +++++++++++++++
.../TaskPlat/Method/TaskManageService.cs | 29 +++++++++++++++++--
3 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs
index 0a3dbd50..a253e7ed 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Interface/ITaskManageBCService.cs
@@ -112,5 +112,6 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// BC变更任务主键
/// 返回回执
Task> ManualSendEmailToCustomer(long taskPKId);
+ Task TestDelete(long id);
}
}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
index 85b029a0..122127d8 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageBCService.cs
@@ -3386,5 +3386,29 @@ namespace DS.WMS.Core.TaskPlat.Method
return await InnerSendEmailToCustomer(taskPKId, businessTaskMailId);
}
#endregion
+
+ public async Task TestDelete(long id)
+ {
+ var tenantDb2 = saasDbService.GetBizDbScopeById(user.TenantId);
+
+ try
+ {
+ await tenantDb2.Ado.BeginTranAsync();
+ var a = tenantDb2.ContextID;
+ var b = await tenantDb2.Deleteable().Where(x => x.ModuleName == id.ToString()).ExecuteCommandAsync();
+ //throw new Exception("fdsfsdfdsf");
+ await tenantDb2.Ado.CommitTranAsync();
+ }
+ catch (Exception)
+ {
+ await tenantDb2.Ado.RollbackTranAsync();
+ //await tenantDb2.Ado.RollbackTranAsync();
+ throw;
+ }
+
+
+
+ return DataResult.Successed("");
+ }
}
}
diff --git a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
index 496bce5a..537724e4 100644
--- a/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
+++ b/ds-wms-service/DS.WMS.Core/TaskPlat/Method/TaskManageService.cs
@@ -2750,9 +2750,35 @@ namespace DS.WMS.Core.TaskPlat.Method
public async Task TestTaskFlow(string taskType, long taskId, int testType)
{
var tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
-
+ var t11 = tenantDb.ContextID;
switch (testType)
{
+ // 事务测试
+ case 5:
+ {
+ try
+ {
+ await tenantDb.Ado.BeginTranAsync();
+ var t1 = tenantDb.ContextID;
+ var t2 = await tenantDb.Queryable().Where(x => x.Id == taskId).ToListAsync();
+ var m = new TaskFlowLogDetail()
+ {
+ ModuleName = taskId.ToString()
+ };
+ var t3 = await tenantDb.Insertable(m).ExecuteCommandAsync();
+
+ var service = serviceProvider.GetRequiredService();
+ await service.TestDelete(taskId);
+
+ await tenantDb.Ado.CommitTranAsync();
+ }
+ catch (Exception)
+ {
+ await tenantDb.Ado.RollbackTranAsync();
+ throw;
+ }
+ break;
+ }
// 任务编排执行测试
case 1:
{
@@ -2810,7 +2836,6 @@ namespace DS.WMS.Core.TaskPlat.Method
// 判断条件测试
case 4:
{
- logger.LogInformation("fdfdfd");
var condition = await tenantDb.Queryable().FirstAsync(x => x.Id == 4001);
if (condition != null)
{