| 
															
																@@ -23,6 +23,7 @@ using System.Collections.Generic; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System.Linq; 
															 | 
															
															 | 
															
																 using System.Linq; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System.Text; 
															 | 
															
															 | 
															
																 using System.Text; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System.Threading.Tasks; 
															 | 
															
															 | 
															
																 using System.Threading.Tasks; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+using System.Xml.Linq; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
															
															 | 
															
																 namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 { 
															 | 
															
															 | 
															
																 { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -440,7 +441,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //Web Or Android 
															 | 
															
															 | 
															
																             if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //Web Or Android 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             { 
															 | 
															
															 | 
															
																             { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                string sql = string.Format(@"Select Id,SalesQuoteNo,TourCode,JietuanOperator,TeamLevSId,TeamDid,TeamName,ClientName, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                string sql = string.Format(@"Select Id,CityId,SalesQuoteNo,TourCode,JietuanOperator,TeamLevSId,TeamDid,TeamName,ClientName, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	                                                ClientUnit,VisitCountry,VisitDate,VisitDays,VisitPNumber,TontractTime,IsBid, 
															 | 
															
															 | 
															
																 	                                                ClientUnit,VisitCountry,VisitDate,VisitDays,VisitPNumber,TontractTime,IsBid, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	                                                PayDay,PaymentMoney,VisitPurpose,SpecialNeeds,OtherNeeds,CGRWSPBMMC,CGRWSPWH, 
															 | 
															
															 | 
															
																 	                                                PayDay,PaymentMoney,VisitPurpose,SpecialNeeds,OtherNeeds,CGRWSPBMMC,CGRWSPWH, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	                                                ZZSCBMMC,ZZSCSPWH,Remark,TellPhone,WeChatNo,OpRoyaltyLv,OpRoyaltyRemark,Officialneeds 
															 | 
															
															 | 
															
																 	                                                ZZSCBMMC,ZZSCSPWH,Remark,TellPhone,WeChatNo,OpRoyaltyLv,OpRoyaltyRemark,Officialneeds 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -452,12 +453,24 @@ namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     _DelegationInfo.TeamName = FormartTeamName(_DelegationInfo.TeamName); 
															 | 
															
															 | 
															
																                     _DelegationInfo.TeamName = FormartTeamName(_DelegationInfo.TeamName); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     _DelegationInfo.VisitCountry = FormartTeamName(_DelegationInfo.VisitCountry); 
															 | 
															
															 | 
															
																                     _DelegationInfo.VisitCountry = FormartTeamName(_DelegationInfo.VisitCountry); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    //if (_DelegationInfo.TontractTime) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    //{ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    //验证城市值 不存在则设置默认值 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    var cityInfo = await CityInfoById(_DelegationInfo.CityId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    if (cityInfo != null) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        _DelegationInfo.CityName = cityInfo.Name; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    else 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        _DelegationInfo.CityId = 3505; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        _DelegationInfo.CityName = "四川-成都"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    //} 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        //if (_DelegationInfo.TontractTime) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        //{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    result.Code = 0; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        //} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                      result.Code = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     result.Msg = "成功!"; 
															 | 
															
															 | 
															
																                     result.Msg = "成功!"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     result.Data = _DelegationInfo; 
															 | 
															
															 | 
															
																                     result.Data = _DelegationInfo; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -562,6 +575,77 @@ namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             return result; 
															 | 
															
															 | 
															
																             return result; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// 获取接团信息 编辑  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// 城市基础 数据源 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// </summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <param name="dto"></param> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <returns></returns> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        public async Task<GroupCityBasicSourceView[]> CityBasicSource() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var list = new List<GroupCityBasicSourceView>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var data = await _sqlSugar.Queryable<CityTree>().AS("Sys_Cities") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                .Where(x => x.IsDel == 0 && x.CountriesId == 44) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                .ToTreeAsync(it => it.Child, it => it.ParentId, 0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (data.Any()) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                //移动指定数据在最前面 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                data = MoveElementToFront(data, "云南"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                data = MoveElementToFront(data, "贵州"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                data = MoveElementToFront(data, "重庆"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                data = MoveElementToFront(data, "四川"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                foreach (var province in data) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    foreach (var city in province.Child) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        list.Add(new GroupCityBasicSourceView() {  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            Id = city.Id, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            Name = $"{province.Name_CN}-{city.Name_CN}" 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                //四川成都放在最前面 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                var cdInfo = list.FirstOrDefault(x => x.Name.Equals("四川-成都")); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                if (cdInfo != null) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    list.Remove(cdInfo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    list.Insert(0, cdInfo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return list.ToArray(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// 获取接团信息 编辑  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// 基础 数据源 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// </summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <param name="dto"></param> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        /// <returns></returns> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        public async Task<GroupCityBasicSourceView> CityInfoById(int id) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var list = await CityBasicSource(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var info = list.FirstOrDefault(x => x.Id == id); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return info; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        private List<CityTree> MoveElementToFront(List<CityTree> list, string elementName) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var element = list.FirstOrDefault(x => x.Name_CN == elementName); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            if (element != null) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                list.Remove(element); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                list.Insert(0, element); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return list; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /// <summary> 
															 | 
															
															 | 
															
																         /// <summary> 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /// 获取接团信息 编辑  
															 | 
															
															 | 
															
																         /// 获取接团信息 编辑  
															 | 
														
													
												
													
														
															| 
															 | 
															
																         /// 基础 数据源 
															 | 
															
															 | 
															
																         /// 基础 数据源 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -641,7 +725,8 @@ namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     userData = userData1, 
															 | 
															
															 | 
															
																                     userData = userData1, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     clientData = clientData1, 
															 | 
															
															 | 
															
																                     clientData = clientData1, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     depData = userDepDatas, 
															 | 
															
															 | 
															
																                     depData = userDepDatas, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    rankData = rankDatas 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    rankData = rankDatas, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    cityData = await CityBasicSource() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 }; 
															 | 
															
															 | 
															
																                 }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             } 
															 | 
															
															 | 
															
																             } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -724,6 +809,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     Grp_DelegationInfo delegationInfo = new Grp_DelegationInfo() 
															 | 
															
															 | 
															
																                     Grp_DelegationInfo delegationInfo = new Grp_DelegationInfo() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     { 
															 | 
															
															 | 
															
																                     { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        CityId = dto.CityId, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         SalesQuoteNo = dto.SalesQuoteNo, 
															 | 
															
															 | 
															
																                         SalesQuoteNo = dto.SalesQuoteNo, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         TeamLevSId = dto.TeamLevSId, 
															 | 
															
															 | 
															
																                         TeamLevSId = dto.TeamLevSId, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         ClientName = dto.ClientName, 
															 | 
															
															 | 
															
																                         ClientName = dto.ClientName, 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -791,6 +877,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 { 
															 | 
															
															 | 
															
																                 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     var updateStatus = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_DelegationInfo 
															 | 
															
															 | 
															
																                     var updateStatus = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_DelegationInfo 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     { 
															 | 
															
															 | 
															
																                     { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        CityId = dto.CityId, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         SalesQuoteNo = dto.SalesQuoteNo, 
															 | 
															
															 | 
															
																                         SalesQuoteNo = dto.SalesQuoteNo, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         TeamLevSId = dto.TeamLevSId, 
															 | 
															
															 | 
															
																                         TeamLevSId = dto.TeamLevSId, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         ClientName = dto.ClientName, 
															 | 
															
															 | 
															
																                         ClientName = dto.ClientName, 
															 |