From 63eb28a9ba7aa9c549bc99f9c68d0a4c051453ba Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期四, 20 三月 2025 17:38:47 +0800
Subject: [PATCH] 修正sugsql导航更新加配置的bug

---
 cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs |   24 ++++-------
 cylsg/cylsg.Web.Entry/appsettings.json            |    3 +
 cylsg/cylsg.Core/cylsg.Core.csproj                |    2 
 cylsg/cylsg.Application/CyOS/CyOSSDriver.cs       |   35 +++++++++++------
 4 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs b/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
index ddd0db6..15c2b80 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
@@ -209,14 +209,28 @@
             a.Deliveredstatus= Param.Deliveredstatus;
             a.Attachments = Param.Attachments;
 
-            return await _client.UpdateNav(a).Include(x=>x.Attachments,new SqlSugar.UpdateNavOptions()
-                { 
-                   OneToManyInsertOrUpdate = true,//閰嶇疆鍚敤 鎻掑叆銆佹洿鏂版垨鍒犻櫎妯″紡
-                }).Include(x=>x.DeliverPlans,new UpdateNavOptions()
-                {
-                    OneToManyInsertOrUpdate=true,
-                }
-                ).ExecuteCommandAsync();
+            return await _client.UpdateNav(a).Include(x=>x.Attachments).ExecuteCommandAsync();
+
+            //await _client.AsTenant().BeginTranAsync();
+            //try
+            //{
+            //    var id = await _client.Insertable(pram).ExecuteReturnIdentityAsync();
+            //    if (pram.WorkPlanAttachments?.Count > 0)
+            //    {
+            //        foreach (var item in pram.WorkPlanAttachments)
+            //        {
+            //            item.OA_WorkPlanId = id;
+
+            //        }
+            //        await _client.Insertable(pram.WorkPlanAttachments).ExecuteCommandAsync();
+            //    }
+            //    await _client.AsTenant().CommitTranAsync();
+            //}
+            //catch (Exception)
+            //{
+            //    await _client.AsTenant().RollbackTranAsync();
+            //    throw;
+            //}
 
             //await _client.AsTenant().BeginTranAsync();
             //try
@@ -457,10 +471,7 @@
                 //{
                 //     OneToManyInsertOrUpdate = true,
                 //})
-                    .Include(x => x.CarConditionAttachments,new UpdateNavOptions
-                {
-                    OneToManyInsertOrUpdate = true,
-                }).ExecuteCommandAsync();
+                    .Include(x => x.CarConditionAttachments).ExecuteCommandAsync();
             }
            
 
diff --git a/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs b/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
index 2389bff..768bf43 100644
--- a/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOsDeliverManage.cs
@@ -350,15 +350,15 @@
                 var car = await _client.Queryable<OA_CarManage>().Where(x => x.StaffID == Param.DriverId && x.MemberID == _oAServices.firmId).FirstAsync();
                 data.CarId = car == null ? 0 : car.Keyid;
 
-                foreach (var item in data.DeliverPlans)
-                {
-                    item.DriverId = Param.DriverId;
-                    item.CarId = car == null ? 0 : car.Keyid;
-                    item.Updater = Permissions.MemberId;
-                    item.LastUpdateTime = DateTime.Now;
-                    item.DeliverTime = Param.DeliverTime;
+                //foreach (var item in data.DeliverPlans)
+                //{
+                //    item.DriverId = Param.DriverId;
+                //    item.CarId = car == null ? 0 : car.Keyid;
+                //    item.Updater = Permissions.MemberId;
+                //    item.LastUpdateTime = DateTime.Now;
+                //    item.DeliverTime = Param.DeliverTime;
 
-                }
+                //}
             }
 
    
@@ -386,13 +386,7 @@
                 }
             data.Attachments = Param.Attachments;
 
-            return await _client.UpdateNav(data).Include(x => x.Attachments, new UpdateNavOptions()
-            {
-                OneToManyInsertOrUpdate = true,
-            }).Include(x => x.DeliverPlans, new UpdateNavOptions()
-            {
-                OneToManyInsertOrUpdate = true,
-            }).ExecuteCommandAsync();
+            return await _client.UpdateNav(data).Include(x => x.Attachments).ExecuteCommandAsync();
 
 
 
diff --git a/cylsg/cylsg.Core/cylsg.Core.csproj b/cylsg/cylsg.Core/cylsg.Core.csproj
index 30dd678..e399d55 100644
--- a/cylsg/cylsg.Core/cylsg.Core.csproj
+++ b/cylsg/cylsg.Core/cylsg.Core.csproj
@@ -17,7 +17,7 @@
 		<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.3" />
 		<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.3" />
 		<PackageReference Include="Furion.Pure" Version="4.9.5.3" />
-		<PackageReference Include="SqlSugarCore" Version="5.1.4.166" />
+		<PackageReference Include="SqlSugarCore" Version="5.1.4.185" />
 		<PackageReference Include="SugarRedis" Version="1.5.0" />
 	</ItemGroup>
 
diff --git a/cylsg/cylsg.Web.Entry/appsettings.json b/cylsg/cylsg.Web.Entry/appsettings.json
index 7e2e8c1..b74ca7c 100644
--- a/cylsg/cylsg.Web.Entry/appsettings.json
+++ b/cylsg/cylsg.Web.Entry/appsettings.json
@@ -35,7 +35,8 @@
       //"IsAutoCloseConnection": true
 
 
-      "ConnectionString": "Server=192.168.0.31;Database=ECTEST; MultipleActiveResultSets=true;pooling=true;min pool size=5;max pool size=32767;connect timeout=20;Encrypt=True;TrustServerCertificate=True;User Id=SA;Password=123456;",
+       "ConnectionString": "Server=192.168.0.31;Database=ECTEST; MultipleActiveResultSets=true;pooling=true;min pool size=5;max pool size=32767;connect timeout=20;Encrypt=True;TrustServerCertificate=True;User Id=SA;Password=123456;",
+     // "ConnectionString": "Server=118.123.213.60;Database=ECTEST_NEW; MultipleActiveResultSets=true;pooling=true;min pool size=5;max pool size=32767;connect timeout=20;Encrypt=True;TrustServerCertificate=True;User Id=SA;Password=123qwe!@#;",
       "DbType": "SqlServer", // "SqlServer" ,mysql,
       "IsAutoCloseConnection": true,
       "ConfigId": "ECTESTOADB"

--
Gitblit v1.9.1