From 908027331273ceae9c4c23d087b0cd070948f42c Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期三, 12 二月 2025 13:51:11 +0800
Subject: [PATCH] 增加批量精力审批
---
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs | 117 +++++++++++++++++++++++++++++++++++++++
cylsg/cylsg.Application/CyOS/CyOSStaffController.cs | 6 --
2 files changed, 117 insertions(+), 6 deletions(-)
diff --git a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
index a8e452b..e89b02f 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
@@ -208,6 +208,101 @@
}
/// <summary>
+ /// 鎵归噺瀹℃壒
+ /// </summary>
+ [HttpPost]
+ public async Task<bool> BatchShenPi(BatchShenPiIn param)
+ {
+ if (param.ApprovalStatus == PlanStatusType.unApproval)
+ throw Oops.Oh("涓嶅彲璁剧疆涓烘湭瀹℃壒鐘舵��");
+ if (!param.OA_WorkPlanIds.Any())
+ throw Oops.Oh("鏈�変腑浠讳綍鎶ラ攢鍗�");
+ if (!await CheckRols())
+ {
+ throw Oops.Oh("娌℃湁鏉冮檺");
+ }
+
+ var dataList = await _SugarClient.Queryable<OaWorkPlan>().Includes(x => x.OaWorkPlanShenpis).In(param.OA_WorkPlanIds).ToListAsync();
+ if (dataList == null||dataList.Count==0)
+ throw Oops.Oh("娌℃湁鎵惧埌鎶ラ攢鍗�");
+ try
+ {
+ await _SugarClient.AsTenant().BeginTranAsync();
+ foreach (var item in dataList)
+ {
+ if (item.ApprovalStatus != PlanStatusType.unApproval)
+ {
+ await _SugarClient.AsTenant().RollbackTranAsync();
+ throw Oops.Oh($"{item.SentStaff.Name} 鐨勬姤閿�鍗�:{item.PlanContent}---宸茬粡鎵瑰瀹屾瘯锛岀粓姝㈡湰娆℃搷浣�");
+ }
+ if (item.ApprovalStatus == PlanStatusType.Uncommitted)
+ {
+ await _SugarClient.AsTenant().RollbackTranAsync();
+ throw Oops.Oh($"{item.SentStaff.Name} 鐨勬姤閿�鍗�:{item.PlanContent}---宸茬粡鏈彁浜ゆ垨鑰呮湭瀹屾垚鍓嶇疆瀹℃壒锛岀粓姝㈡湰娆℃搷浣�");
+ }
+ if( item.OaWorkPlanShenpis.Where(x=>x.Buzhou == 1&&x.ApprovalStatus== PlanStatusType.Yes).Count()<2)
+ {
+ await _SugarClient.AsTenant().RollbackTranAsync();
+ throw Oops.Oh($"{item.SentStaff.Name} 鐨勬姤閿�鍗�:{item.PlanContent}---鏈畬鎴愬墠缃鎵癸紝缁堟鏈鎿嶄綔");
+ }
+ OaWorkPlanShenpi shenpi = item.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId == Permissions.MemberId && x.Buzhou == 2).FirstOrDefault();
+ if (shenpi != null)
+ {
+ await _SugarClient.AsTenant().RollbackTranAsync();
+ //宸茬粡鎵瑰
+ throw Oops.Oh($"{item.SentStaff.Name} 鐨勬姤閿�鍗�:{item.PlanContent} ----鎶ラ攢鍗曞凡缁忔壒澶嶅畬姣� 涓嶅彲鏇存敼,鎿嶄綔缁堟");
+
+
+ }
+ else
+ {
+ shenpi = new OaWorkPlanShenpi()
+ {
+ ApprovalStaffId = Permissions.MemberId,
+ ApprovalContent = param.ApprovalContent,
+ ApprovalStatus = param.ApprovalStatus,
+ ApprovalTime = DateTime.Now,
+ //鎬荤粡鐞嗗鎵逛负2
+ Buzhou = 2,
+ CreateTime = DateTime.Now,
+ Operator = Permissions.Name,
+ OA_WorkPlanId = item.Keyid,
+
+ };
+ await _SugarClient.Insertable(shenpi).ExecuteCommandAsync();
+ }
+
+ //瀹℃壒鏃跺彲淇敼鍐呭
+
+
+
+
+
+ item.ApprovalTime = DateTime.Now;
+ item.ApprovalStatus = param.ApprovalStatus;
+ item.ApprovalContent = param.ApprovalContent;
+ item.LastUpdateTime = DateTime.Now;
+
+
+
+
+ await _SugarClient.Updateable(item).ExecuteCommandAsync();
+
+ }
+ await _SugarClient.AsTenant().CommitTranAsync();
+ return true;
+ }
+ catch (Exception)
+ {
+ await _SugarClient.AsTenant().RollbackTranAsync();
+ throw;
+ }
+
+
+
+ }
+
+ /// <summary>
/// 鍒ゆ柇鏄惁鍏锋湁鏉冮檺
/// </summary>
/// <returns></returns>
@@ -227,5 +322,27 @@
return false;
}
}
+ /// <summary>
+ /// 鎵归噺瀹℃壒鍙傛暟
+ /// </summary>
+ public class BatchShenPiIn
+ {
+ /// <summary>
+ /// 宸ヤ綔璁″垝ID 鎶ラ攢鍗旾D
+ /// </summary>
+ [Required]
+ public int[] OA_WorkPlanIds { get; set; }
+
+ /// <summary>
+ /// 瀹℃壒鐘舵��
+ /// </summary>
+ [Required]
+ public PlanStatusType? ApprovalStatus { get; set; }
+
+ /// <summary>
+ /// 瀹℃壒鍐呭
+ /// </summary>
+ public string ApprovalContent { get; set; }
+ }
}
diff --git a/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs b/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
index e4e014e..705d511 100644
--- a/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
+++ b/cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
@@ -196,12 +196,6 @@
pram.RewardMoney = 0;
pram.RewardType = 1;
pram.Keyid = null;
-
-
-
-
-
-
await _SugarClient.InsertNav(pram).Include(x=>x.WorkPlanAttachments).ExecuteCommandAsync();
return true;
--
Gitblit v1.9.1