| 
					
				 | 
			
			
				@@ -5,6 +5,7 @@ using OASystem.Domain; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using OASystem.Domain.Entities.Groups; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using OASystem.Domain.Entities.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using OASystem.Domain.ViewModels.Groups; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using SqlSugar; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Collections.Generic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Linq; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,6 +32,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 2.op 79 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 3.其他费用-出行物资 98 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 4.保险 82 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 5.机票 85 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="diId">团组Id</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="dataId">数据Id(模块类型主表Id)</param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,22 +43,31 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (diId < 1) { _view.Msg = MsgTips.DiId; return _view; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (dataId < 1) { _view.Msg = MsgTips.Id; return _view; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var groupDetails = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).First(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (groupDetails == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _view.Msg = $"团组信息为空,不可自动审核!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var stids = new List<int>() { 17, 66, 91 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var setData = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && stids.Contains(x.STid)).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            string _teamCurrency = string.Empty; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            decimal _teamRate = 0.00M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var costContents = new List<GroupCostAuditView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (feeType != 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var groupInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(x => x.IsDel == 0 && x.DiId == diId).First(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (groupInfo == null) { _view.Msg = $"团组成本信息未填写!"; return _view; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _teamCurrency = groupInfo.Currency; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _teamRate = groupInfo.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var groupInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(x => x.IsDel == 0 && x.DiId == diId).First(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (groupInfo == null) { _view.Msg = $"团组成本信息未填写!"; return _view; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string _teamCurrency = groupInfo.Currency; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            decimal _teamRate = groupInfo.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //币种验证  统一为currencycode三字码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (int.TryParse(_teamCurrency, out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //币种验证  统一为currencycode三字码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (int.TryParse(_teamCurrency, out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var costContents = new List<GroupCostAuditView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var subFeeTypeIds = new int[] {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                4, // 保险 82 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                5, // 机票 85 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!subFeeTypeIds.Contains(feeType)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 string costContentSql = $"Select * From Grp_GroupCost"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 costContents = _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == diId).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,7 +99,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (feeType == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //1089	对冲账或其他 不在审核范围 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -289,71 +300,71 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //车费 91 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opCarCost = item.FirstOrDefault(x => x.SId == 91); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opCarCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opCarCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opCarCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.CarFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //982 车超时费 -- 暂无 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //92  导游费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opGuideCost = item.FirstOrDefault(x => x.SId == 92); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opGuideCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opGuideCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opGuideCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.GuideFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //94  导游景点费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opGuideScenicCost = item.FirstOrDefault(x => x.SId == 94); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opGuideScenicCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opGuideScenicCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opGuideScenicCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.GuideScenicFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //95  导游小费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opGuideTipCost = item.FirstOrDefault(x => x.SId == 95); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opGuideTipCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opGuideTipCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opGuideTipCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.GuideTipFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //983 导游餐补 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opGuideMealCost = item.FirstOrDefault(x => x.SId == 983); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opGuideMealCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opGuideMealCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opGuideMealCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.GuideMealFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //984 导游房补 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opGuideRoomCost = item.FirstOrDefault(x => x.SId == 984); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opGuideRoomCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opGuideRoomCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opGuideRoomCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.GuideRoomFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //985 导游交通 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opGuideTrafficCost = item.FirstOrDefault(x => x.SId == 985); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opGuideTrafficCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opGuideTrafficCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opGuideTrafficCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.GuideTrafficFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //96  接送机费 -- 暂无 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //97  其他费用 -- 暂无 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //979 司机工资 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opDriverCost = item.FirstOrDefault(x => x.SId == 979); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opDriverCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opDriverCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opDriverCost.Price * _opRate > _teamRate * _opPayPercentage * opCostInfo.Sum(x => x.DriverFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //980 司机小费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opDriverTipCost = item.FirstOrDefault(x => x.SId == 980); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opDriverTipCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opDriverTipCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opDriverTipCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.DriverTipFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //981 司机餐补 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opDriverMealCost = item.FirstOrDefault(x => x.SId == 981); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opDriverMealCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opDriverMealCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opDriverMealCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.DriverMealFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //988 客户早餐费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opClientBreakfastCost = item.FirstOrDefault(x => x.SId == 988); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opClientBreakfastCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opClientBreakfastCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opClientBreakfastCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.ClientBreakfastFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //93  客户午餐费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opClientLunchCost = item.FirstOrDefault(x => x.SId == 93); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opClientLunchCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opClientLunchCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opClientLunchCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.ClientLunchFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //989 客户晚餐费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opClientDinnerCost = item.FirstOrDefault(x => x.SId == 989); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opClientDinnerCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opClientDinnerCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opClientDinnerCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.ClientDinnerFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //990 景点门票费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opScenicTicketCost = item.FirstOrDefault(x => x.SId == 990); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opScenicTicketCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opScenicTicketCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opScenicTicketCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.ScenicTicketFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //991 饮料/零食/水果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opDrinkSnackFruitCost = item.FirstOrDefault(x => x.SId == 991); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opDrinkSnackFruitCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opDrinkSnackFruitCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opDrinkSnackFruitCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.DrinkSnackFruitFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //992 住补费用 -- 暂无 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //994 翻译费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var opTranslatorCost = item.FirstOrDefault(x => x.SId == 994); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (opTranslatorCost != null)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (opTranslatorCost != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (opTranslatorCost.Price * _opRate * _opPayPercentage > _teamRate * opCostInfo.Sum(x => x.TranslatorFee) * _opPayPercentage) isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //1059    导游超时费用 -- 暂无 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //1070    尾款金额 -- 暂无 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -397,9 +408,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var isAutoAudit = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var currModule = 98; //其他款项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                int groupSize = 0; // 团组人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var groupDetails = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).FirstAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (groupDetails != null) groupSize = groupDetails.VisitPNumber; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int groupSize =  groupDetails.VisitPNumber; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 decimal otherSubTotal = costContents.Sum(x => x.TeFee); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 decimal groupCostCNYTotal = costContents.Sum(x => x.TeFee) * _teamRate * groupSize; //团组成本出行物资总金额 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -496,13 +505,6 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #region 保险费用录入自动审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var currModule = 82; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var groupDetails = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).First();  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (groupDetails == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    _view.Msg = $"团组信息为空,不可自动审核!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var insuranceCountryCostData = _sqlSugar.Queryable<Res_BasicInsuranceCost>().Where(x => x.IsDel == 0).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (!insuranceCountryCostData.Any()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -601,11 +603,11 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //自动审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var ccpUpdate = _sqlSugar.Updateable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      .SetColumns(it => it.IsAuditGM == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      .SetColumns(it => it.AuditGMOperate == 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      .SetColumns(it => it.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      .Where(s => s.DIId == diId && s.CTable == currModule && s.CId == dataId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                      .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetColumns(it => it.IsAuditGM == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetColumns(it => it.AuditGMOperate == 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetColumns(it => it.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(s => s.DIId == diId && s.CTable == currModule && s.CId == dataId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (ccpUpdate > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     _view.Code = 200; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -615,6 +617,148 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else if (feeType == 5) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region 机票费用自动审核只处理舱位相关的费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var currModule = 85; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var auditFeeTypeIds = new List<int>() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    457,   //头等舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    458,   //公务舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    459,   //超经舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    460,   //经济舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    1430,  //公务舱(实际经济舱) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    1431,  //头等舱(实际公务舱) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    1432,  //头等舱(实际经济舱) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var airInfo = await _sqlSugar.Queryable<Grp_AirTicketReservations>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .InnerJoin<Grp_CreditCardPayment>((x, y) => x.Id == y.CId && y.CTable == currModule && y.IsDel == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where((x, y) => x.Id == dataId && x.IsDel == 0 && auditFeeTypeIds.Contains(x.CType)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Select((x,y) => new {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        x.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        CcpId = y.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        x.Price, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        x.CType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        x.ClientNum, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        x.DIId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .FirstAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (airInfo == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _view.Msg = $"机票信息为空或费用类型不在自动审核范围内,不可自动审核!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //团组成本 经济舱、头等舱、公务舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int ecoPaxCount = groupInfo.JJCRS,   //经济舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    firstClassCnt = groupInfo.TDCRS, //头等舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    bizClassCnt = groupInfo.GWCRS;   //公务舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal ecoCost = groupInfo.JJCCB,   //经济舱成本费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        firstCost = groupInfo.TDCCB, //头等舱成本费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        bizCost = groupInfo.GWCCB;   //公务舱成本费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal ecoTotalCost = ecoPaxCount * ecoCost,       //经济舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        firstTotalCost = firstClassCnt * firstCost, //头等舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        bizTotalCost = bizClassCnt * bizCost;       //公务舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int currAirType = airInfo.CType; //当前舱位类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int currAirTypeCnt = 0;          //当前舱位人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //decimal currAirFee = 0.00M;      //当前舱位录入费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal currAirCost = 0.00M;     //当前舱位成本费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                switch (airInfo.CType) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //头等舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 457: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.TDCRS; //头等舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.TDCCB; //头等舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //公务舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 458: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.GWCRS; //公务舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.GWCCB; //公务舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 459: //超经舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.JJCRS; //经济舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.JJCCB; //经济舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 460: //经济舱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.JJCRS; //经济舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.JJCCB; //经济舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 1430: //公务舱(实际经济舱) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.GWCRS; //公务舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.GWCCB; //公务舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 1431: //头等舱(实际公务舱) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.TDCRS; //头等舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.TDCCB; //头等舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    case 1432: //头等舱(实际经济舱) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirTypeCnt = groupInfo.TDCRS; //头等舱人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currAirCost = currAirTypeCnt * groupInfo.TDCCB; //头等舱成本费用合计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        _view.Msg = $"机票费用类型不在自动审核范围内,不可自动审核!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var currAirTypeDatas = await _sqlSugar.Queryable<Grp_AirTicketReservations>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(x => x.IsDel == 0 && x.DIId == diId && x.CType == airInfo.CType && x.ClientNum == currAirTypeCnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var airTypeText = airInfo.CType switch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    457 => "头等舱", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    458 => "公务舱", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    459 => "超经舱", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    460 => "经济舱", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    1430 => "公务舱(实际经济舱)", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    1431 => "头等舱(实际公务舱)", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    1432 => "头等舱(实际经济舱)", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _ => "未知舱位" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!currAirTypeDatas.Any()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _view.Msg = $"{airTypeText}机票费用数据未填写,不可自动审核!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //验证费用类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!currAirTypeDatas.Any(x => x.Id == airInfo.CcpId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _view.Msg = $"机票费用({airTypeText})超出团组成本费用"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //验证是否超出头等舱成本费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                decimal currAirTypeFee = currAirTypeDatas.Sum(x => x.Price * x.ClientNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (currAirTypeFee > currAirCost) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _view.Msg = $"机票费用({airTypeText})超出团组成本费用"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    QuashAudit(currModule, diId, currAirTypeDatas.Select(x => x.Id).ToArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //执行自动审核及相关字段更改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var upd = _sqlSugar.Updateable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetColumns(x => x.IsAuditGM == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetColumns(x => x.AuditGMOperate == 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetColumns(x => x.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(x => x.Id == airInfo.CcpId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (upd > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _view.Code = StatusCodes.Status200OK; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _view.Msg = "自动审核执行成功"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _view.Msg = "自动审核执行失败"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return _view; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else _view.Msg = $"请传入有效的feeType参数"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return _view; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -625,7 +769,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="type"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 酒店 76 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /// op   79 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// op 79 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="diId"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="dataId"></param> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -653,7 +797,43 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// air 撤销自动审核的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="type"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 机票 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="diId"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="dataId"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private bool QuashAudit(int type, int diId, int[] dataId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //撤销该条数据的自动审核 --> 该条数据的审核状态是自动审核  3 --> 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var ccpInfos = _sqlSugar.Queryable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where(s => s.DIId == diId && s.CTable == type && dataId.Contains(s.CId) && s.IsAuditGM == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ccpInfos.Any()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ccpInfos.ForEach(x => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    x.IsAuditGM = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    x.AuditGMOperate = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    x.AuditGMDate = string.Empty; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var ccpUpd = _sqlSugar.Updateable(ccpInfos) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .UpdateColumns(x => new { x.IsAuditGM, x.AuditGMOperate, x.AuditGMDate }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (ccpUpd > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 费用自动审核 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 |