From 595df5dac0a782bfdadab766b4dd62d326b0a383 Mon Sep 17 00:00:00 2001
From: 小飞侠 <8277136+liaoxujun@user.noreply.gitee.com>
Date: 星期二, 21 十月 2025 14:53:04 +0800
Subject: [PATCH] 增加川印设备维修回写
---
cylsg/cylsg.Application/CyOS/CyOSSDriver.cs | 47 +++++++++++++++++++++++++++++++++--------------
1 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs b/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
index ddd0db6..a31037f 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSSDriver.cs
@@ -47,7 +47,7 @@
Expression<Func<OA_DeliverPlanPaiche, bool>> SearchList = (x) => true;
SearchList = SearchList.And(x => x.FirmId == _oAServices.firmId);
SearchList = SearchList.And(x => x.DriverId == Permissions.KeyId);//鍙湅鑷繁
- SearchList = SearchList.And(x => x.ShifouDelivery != 2);//杩囨护鏈夋晥
+ SearchList = SearchList.And(x => x.ShifouDelivery != 2 && x.ShifouDelivery != 0);//杩囨护鏈夋晥
if (Param.DeliverKeyID != null)
{
SearchList = SearchList.And(x => x.DriverId == Param.DeliverKeyID);
@@ -121,11 +121,19 @@
public async Task<int > StartDeliverPlan(Guid KeyId)
{
+
if (!await CheckRols())
{
throw Oops.Oh("娌℃湁鏉冮檺");
}
- var a= await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.DriverId == Permissions.KeyId && x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync();
+ DateTime specificDateTime = new DateTime(2025, 4, 9, 23, 59, 59);//2025骞�4鏈�10 鏃ヤ箣鍚庣殑锛屽繀椤讳竴鍗曚竴鍗曠偣鍑诲畬鎴愬悗鎵嶈兘閫佽揣
+ var count = await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.DriverId == Permissions.KeyId && x.Keyid != KeyId && x.ShifouDelivery != 2 && x.Deliveredstatus == DeliveredType.Deliver&&x.DeliverTime> specificDateTime).CountAsync();
+ if(count > 0)
+ {
+ throw Oops.Oh($"浣犺繕鏈墈count}閫佽揣浠诲姟娌℃湁纭瀹屾垚锛屼笉鑳藉紑濮嬫柊鐨勪换鍔�");
+ }
+
+ var a= await _client.Queryable<OA_DeliverPlanPaiche>().Where(x => x.DriverId == Permissions.KeyId && x.Keyid == KeyId && x.ShifouDelivery != 2).FirstAsync();
if(a==null)
throw Oops.Oh("娌℃湁鏉冮檺");
if(a.Deliveredstatus!= DeliveredType.Undeliver)
@@ -209,14 +217,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 +479,7 @@
//{
// OneToManyInsertOrUpdate = true,
//})
- .Include(x => x.CarConditionAttachments,new UpdateNavOptions
- {
- OneToManyInsertOrUpdate = true,
- }).ExecuteCommandAsync();
+ .Include(x => x.CarConditionAttachments).ExecuteCommandAsync();
}
--
Gitblit v1.9.1