|
@@ -1,6 +1,7 @@
|
|
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
using Microsoft.International.Converters.PinYinConverter;
|
|
|
+using Microsoft.VisualBasic;
|
|
|
using NPOI.HSSF.Util;
|
|
|
using OASystem.API.OAMethodLib.Hub.HubClients;
|
|
|
using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
@@ -34,13 +35,13 @@ namespace OASystem.API.OAMethodLib
|
|
|
private readonly static TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
|
|
|
private readonly static MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
|
|
|
private readonly static IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
|
|
|
-
|
|
|
+ private readonly static string[] weekdays = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
|
|
#region 员工注册默认添加基础页面
|
|
|
|
|
|
/// <summary>
|
|
|
/// 默认职位权限
|
|
|
/// </summary>
|
|
|
- public static bool DefaultPostAuth(int depId,int postId, int userId,int createUserId)
|
|
|
+ public static bool DefaultPostAuth(int depId, int postId, int userId, int createUserId)
|
|
|
{
|
|
|
if (depId < 1) return false;
|
|
|
if (postId < 1) return false;
|
|
@@ -67,7 +68,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
if (depId == 7) //国交部特殊处理
|
|
|
{
|
|
|
- List<string> postNames = new List<string>() { "主管","经理" };
|
|
|
+ List<string> postNames = new List<string>() { "主管", "经理" };
|
|
|
//岗位页面
|
|
|
if (jobPublicPageData != null)
|
|
|
{
|
|
@@ -91,9 +92,9 @@ namespace OASystem.API.OAMethodLib
|
|
|
if (pageData.Count > 0)
|
|
|
{
|
|
|
//页面操作权限数据(添加修改等...)
|
|
|
- var pageFunctionData = _dirRep._sqlSugar.Queryable<Sys_SystemMenuAndFunction>().Where(it => pageData.Contains(it.SmId) && it.IsDel == 0 ).ToList();
|
|
|
+ var pageFunctionData = _dirRep._sqlSugar.Queryable<Sys_SystemMenuAndFunction>().Where(it => pageData.Contains(it.SmId) && it.IsDel == 0).ToList();
|
|
|
|
|
|
- var defaultPageData = pageFunctionData.Select(it => new Sys_UserAuthority() {
|
|
|
+ var defaultPageData = pageFunctionData.Select(it => new Sys_UserAuthority() {
|
|
|
UId = userId,
|
|
|
SmId = it.SmId,
|
|
|
FId = it.FId,
|
|
@@ -438,7 +439,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
string sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber
|
|
|
From Grp_DelegationInfo Where Id In({0}) And IsDel = 0 Order By Id Desc", diIds);
|
|
|
_ShareGroupInfoViews = await _dirRep._sqlSugar.SqlQueryable<Web_ShareGroupInfoView>(sql).ToListAsync();
|
|
|
-
|
|
|
+
|
|
|
return _ShareGroupInfoViews;
|
|
|
}
|
|
|
|
|
@@ -515,7 +516,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
{
|
|
|
currRate = Convert.ToDecimal(MSellPri) / 100M;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
rateInit += $@"|{currencyName}({code}):{currRate.ToString("#0.0000")}";
|
|
|
}
|
|
|
}
|
|
@@ -587,10 +588,10 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
var userDatas = await _teamRateRep._sqlSugar
|
|
|
.Queryable<Sys_Users>()
|
|
|
- .LeftJoin<Sys_Department>((su,sd) => su.DepId == sd.Id && sd.IsDel == 0)
|
|
|
- .LeftJoin<Sys_JobPost>((su,sd,sjp) => su.JobPostId == sjp.Id && sjp.IsDel == 0)
|
|
|
+ .LeftJoin<Sys_Department>((su, sd) => su.DepId == sd.Id && sd.IsDel == 0)
|
|
|
+ .LeftJoin<Sys_JobPost>((su, sd, sjp) => su.JobPostId == sjp.Id && sjp.IsDel == 0)
|
|
|
.Where(su => su.IsDel == 0)
|
|
|
- .Select((su,sd,sjp) => new {
|
|
|
+ .Select((su, sd, sjp) => new {
|
|
|
su.DepId,
|
|
|
sd.DepName,
|
|
|
su.JobPostId,
|
|
@@ -664,7 +665,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
CreateUserId = userId
|
|
|
}).ToList()
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
//80 签证 --> 国交部门(7) 签证(26) 岗位
|
|
|
_GroupsTaskAssignments.AddRange(
|
|
|
userDatas
|
|
@@ -707,18 +708,18 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
|
|
|
//98 其他款项 --> 总经办部门(1) 总经理(1) 岗位/国交部门(7)(ALL) 岗位/财务部门(3)(ALL) 岗位/策划部门(5)(ALL) 岗位/人事部门(4) 采购(74) 岗位
|
|
|
- List<int> depIds = new List<int>() { 7,3,5 };
|
|
|
- List<int> jobIds = new List<int>() { 1,74};
|
|
|
+ List<int> depIds = new List<int>() { 7, 3, 5 };
|
|
|
+ List<int> jobIds = new List<int>() { 1, 74 };
|
|
|
_GroupsTaskAssignments.AddRange(
|
|
|
userDatas
|
|
|
.Where(it => depIds.Contains(it.DepId) || jobIds.Contains(it.JobPostId))
|
|
|
.Select(it => new Grp_GroupsTaskAssignment()
|
|
|
- {
|
|
|
- DIId = diId,
|
|
|
- CTId = 98,
|
|
|
- UId = it.Id,
|
|
|
- CreateUserId = userId
|
|
|
- }).ToList()
|
|
|
+ {
|
|
|
+ DIId = diId,
|
|
|
+ CTId = 98,
|
|
|
+ UId = it.Id,
|
|
|
+ CreateUserId = userId
|
|
|
+ }).ToList()
|
|
|
);
|
|
|
|
|
|
//1015 超支费用,285 收款退还 --> 财务部门(ALL)岗位
|
|
@@ -761,7 +762,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
if (_GroupsTaskAssignments.Count > 0)
|
|
|
{
|
|
|
- var addId =_teamRateRep._sqlSugar.Insertable(_GroupsTaskAssignments).ExecuteCommand();
|
|
|
+ var addId = _teamRateRep._sqlSugar.Insertable(_GroupsTaskAssignments).ExecuteCommand();
|
|
|
}
|
|
|
|
|
|
result.Code = 0;
|
|
@@ -849,7 +850,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// </summary>
|
|
|
/// <param name="rateRemark"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<List<TeamRateDescAddCurrencyIdView>> SplitExchangeRate(this string rateRemark)
|
|
|
+ public static async Task<List<TeamRateDescAddCurrencyIdView>> SplitExchangeRate(this string rateRemark)
|
|
|
{
|
|
|
List<TeamRateDescAddCurrencyIdView> _view = new List<TeamRateDescAddCurrencyIdView>();
|
|
|
|
|
@@ -1399,7 +1400,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
return months;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取季度对应的起始天数
|
|
|
/// </summary>
|
|
@@ -1409,7 +1410,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
{
|
|
|
List<MonthInfo> months = new List<MonthInfo>();
|
|
|
|
|
|
- months.Add(new MonthInfo() { Month = 1, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 }}); //1.1 - 3.31
|
|
|
+ months.Add(new MonthInfo() { Month = 1, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //1.1 - 3.31
|
|
|
months.Add(new MonthInfo() { Month = 2, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //4.1 - 6.30
|
|
|
months.Add(new MonthInfo() { Month = 3, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //7.1 - 9.31
|
|
|
months.Add(new MonthInfo() { Month = 4, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //10.1 - 12.31
|
|
@@ -1434,12 +1435,12 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
#region op行程单,黑屏幕代码
|
|
|
|
|
|
- public static string GetCountryStandingTime(int diId)
|
|
|
+ public static string GetCountryStandingTime(int diId)
|
|
|
{
|
|
|
- DataTable datas = GetTableByBlackCode(diId);
|
|
|
+ DataTable datas = GetTableByBlackCode(diId);
|
|
|
|
|
|
string countryStr = "[黑屏代码未录入].";
|
|
|
- if (datas.Rows.Count > 0 )
|
|
|
+ if (datas.Rows.Count > 0)
|
|
|
{
|
|
|
var airDatas = from row in datas.AsEnumerable()
|
|
|
select new
|
|
@@ -1456,7 +1457,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
int index = 0;
|
|
|
List<string> cityCodes = new List<string>();
|
|
|
//去掉开始和结束城市
|
|
|
- foreach (var row in airDatas)
|
|
|
+ foreach (var row in airDatas)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(row.Three))
|
|
|
{
|
|
@@ -1498,7 +1499,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// </summary>
|
|
|
/// <param name="diid"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static DataTable GetTableByBlackCode(int diid)
|
|
|
+ public static DataTable GetTableByBlackCode1(int diid)
|
|
|
{
|
|
|
//黑屏代码信息
|
|
|
List<Air_TicketBlackCode> listcode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.DiId == diid && x.IsDel == 0).ToList();
|
|
@@ -1727,6 +1728,135 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
return dt;
|
|
|
}
|
|
|
+
|
|
|
+ private readonly static string[] excludeArr = new string[] { "[中转]", };
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///根据机票黑屏代码整理DataTable
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="diid"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static DataTable GetTableByBlackCode(int diid)
|
|
|
+ {
|
|
|
+ //黑屏代码信息
|
|
|
+ List<Air_TicketBlackCode> listcode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.DiId == diid && x.IsDel == 0).ToList();
|
|
|
+
|
|
|
+ //测试数据为序号,航班号,起飞日期,三字码,起飞时刻,到达时刻,出发航站楼,到达航站楼,机型,飞行时间
|
|
|
+ //1.3U8391 TU17NOV CTUCAI 0220 0715 T1 T2 330 10H55M
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ dt.Columns.Add("Fliagtcode", typeof(string)); //航班号
|
|
|
+ dt.Columns.Add("Date", typeof(string));//起飞日期
|
|
|
+ dt.Columns.Add("Three", typeof(string));//三字码
|
|
|
+ dt.Columns.Add("StartTime", typeof(string));//起飞时刻
|
|
|
+ dt.Columns.Add("EndTime", typeof(string));//到达时刻
|
|
|
+ dt.Columns.Add("StartBuilding", typeof(string));//出发航站楼
|
|
|
+ dt.Columns.Add("EndBuilding", typeof(string));//到达航站楼
|
|
|
+ dt.Columns.Add("AirModel", typeof(string)); //机型
|
|
|
+ dt.Columns.Add("FlightTime", typeof(string));//飞行时间
|
|
|
+ dt.Columns.Add("Day", typeof(string));//整理的起飞日期;作为排序依据
|
|
|
+ dt.Columns.Add("ArrivedDate", typeof(string));//整理的到达日期
|
|
|
+ dt.Columns.Add("Error", typeof(string));//整理的到达日期
|
|
|
+ dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
|
|
|
+
|
|
|
+ //添加转机标识
|
|
|
+ dt.Columns.Add("isTransitShipment", typeof(bool));
|
|
|
+
|
|
|
+ //判断是否录入黑屏代码
|
|
|
+ if (listcode.Count() == 0 || listcode == null)
|
|
|
+ {
|
|
|
+ dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "黑屏代码未录入!", null, false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //读取单段黑屏代码
|
|
|
+ for (int i = 0; i < listcode.Count; i++)
|
|
|
+ {
|
|
|
+ //去除序号
|
|
|
+ string[] CodeList = Regex.Split(listcode[i].BlackCode, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ //去除多余空格,方法一Linq扩展方法
|
|
|
+ CodeList = CodeList.Where(str => !string.IsNullOrWhiteSpace(str)).ToArray();
|
|
|
+
|
|
|
+ //读取单条黑屏代码
|
|
|
+ for (int j = 0; j < CodeList.Count(); j++)
|
|
|
+ {
|
|
|
+ //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
|
|
|
+ CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();
|
|
|
+ string[] Info = CodeList[j].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
+
|
|
|
+ //去除多余空格
|
|
|
+ Info = Info.Where(str => !string.IsNullOrWhiteSpace(str)).ToArray();
|
|
|
+
|
|
|
+ //判断黑屏代码是否正确拆分; 理应拆成9段
|
|
|
+ if (Info.TakeWhile((x) =>
|
|
|
+ {
|
|
|
+ return !excludeArr.Contains(x);
|
|
|
+ }).Count() != 9)
|
|
|
+ {
|
|
|
+ dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "本团组第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误,请联系机票同事核对", null, false);
|
|
|
+ //MessageBoxEx.Show("第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误, 请联系机票同事核对");
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var monthEn = Info[1].Substring(4, 3);
|
|
|
+
|
|
|
+ //月
|
|
|
+ int month = Convert.ToInt32(GetLonger(monthEn));
|
|
|
+ //日
|
|
|
+ int day = Convert.ToInt32(Info[1].Substring(2, 2));
|
|
|
+
|
|
|
+ var time = new DateTime(2023, month, day); //
|
|
|
+
|
|
|
+ var isExist = Info.Contains("[中转]");
|
|
|
+
|
|
|
+ //dt.Columns.Add("Fliagtcode", typeof(string)); //航班号
|
|
|
+ //dt.Columns.Add("Date", typeof(string));//起飞日期
|
|
|
+ //dt.Columns.Add("Three", typeof(string));//三字码
|
|
|
+ //dt.Columns.Add("StartTime", typeof(string));//起飞时刻
|
|
|
+ //dt.Columns.Add("EndTime", typeof(string));//到达时刻
|
|
|
+ //dt.Columns.Add("StartBuilding", typeof(string));//出发航站楼
|
|
|
+ //dt.Columns.Add("EndBuilding", typeof(string));//到达航站楼
|
|
|
+ //dt.Columns.Add("AirModel", typeof(string)); //机型
|
|
|
+ //dt.Columns.Add("FlightTime", typeof(string));//飞行时间
|
|
|
+ //dt.Columns.Add("Day", typeof(string));//整理的起飞日期;作为排序依据
|
|
|
+ //dt.Columns.Add("ArrivedDate", typeof(string));//整理的到达日期
|
|
|
+ //dt.Columns.Add("Error", typeof(string));//整理的到达日期
|
|
|
+ //dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
|
|
|
+ dt.Rows.Add(Info[0],
|
|
|
+ Info[1],
|
|
|
+ Info[2],
|
|
|
+ Info[3],
|
|
|
+ Info[4],
|
|
|
+ Info[5],
|
|
|
+ Info[6],
|
|
|
+ Info[7],
|
|
|
+ Info[8],
|
|
|
+ time.ToString("yyyy-MM-dd"),
|
|
|
+ time.ToString("yyyy-MM-dd"),
|
|
|
+ "",
|
|
|
+ "0",
|
|
|
+ isExist
|
|
|
+ );
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ string exstr = ex.Message.ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //排序
|
|
|
+ dt.DefaultView.Sort = "Day asc";
|
|
|
+ dt = dt.DefaultView.ToTable();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据星期,月份的缩写,转换成数字或者全称
|
|
@@ -2059,7 +2189,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="diid">团组Id</param>
|
|
|
/// <param name="separator">分隔符</param>
|
|
|
/// <returns></returns>
|
|
|
- public static string GetGroupCityLine(int diid,string separator)
|
|
|
+ public static string GetGroupCityLine(int diid, string separator)
|
|
|
{
|
|
|
string city = string.Empty;
|
|
|
var blackCode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.IsDel == 0 && x.DiId == diid).ToList();
|
|
@@ -2131,6 +2261,428 @@ namespace OASystem.API.OAMethodLib
|
|
|
return city;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取黑屏代码日期列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dt"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static List<string> GetTimeListByDataTable(DataTable dt)
|
|
|
+ {
|
|
|
+ DateTime datestart = Convert.ToDateTime(dt.Rows[0]["Day"].ToString());
|
|
|
+ DateTime dateend = Convert.ToDateTime(dt.Rows[dt.Rows.Count - 1]["ArrivedDate"].ToString());
|
|
|
+
|
|
|
+ List<string> timeList = new List<string>();
|
|
|
+ while (datestart <= dateend)
|
|
|
+ {
|
|
|
+ timeList.Add(datestart.ToString("yyyy-MM-dd"));
|
|
|
+ datestart = datestart.AddDays(1);
|
|
|
+ }
|
|
|
+ return timeList;
|
|
|
+ }
|
|
|
+
|
|
|
+ const decimal conversion = 1.61M;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 简要行程
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="diid"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static Result GetBriefStroke (int diid)
|
|
|
+ {
|
|
|
+ DataTable resultTable = GetTableByBlackCode(diid);
|
|
|
+
|
|
|
+ if (resultTable == null)
|
|
|
+ {
|
|
|
+ return new Result { Code = -1, Msg = "黑屏代码有误或黑屏代码未录入" };
|
|
|
+ }
|
|
|
+
|
|
|
+ if (resultTable.Rows.Count == 0 || string.IsNullOrWhiteSpace(resultTable.Rows[0][1].ToString()))
|
|
|
+ {
|
|
|
+ string msg = string.Empty;
|
|
|
+ if (resultTable.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ msg = resultTable.Rows[0]["Error"].ToString();
|
|
|
+ }
|
|
|
+ return new Result { Code = -1, Msg = $"黑屏代码有误;{msg}" };
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var timeArr = GetTimeListByDataTable(resultTable);
|
|
|
+ var threeCodes = _dirRep._sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList(); //三字码
|
|
|
+ var airCompanys = _dirRep._sqlSugar.Queryable<Res_AirCompany>().Where(it => it.IsDel == 0).ToList(); //航司公司
|
|
|
+ var obDatas = _dirRep._sqlSugar.Queryable<Res_OfficialActivities>().Where(it => it.IsDel == 0 && it.DiId == diid).ToList(); //公务信息
|
|
|
+
|
|
|
+ var NewListTravel = new List<Grp_TravelList>();
|
|
|
+ var index = 0;
|
|
|
+ var stopCity = string.Empty;
|
|
|
+
|
|
|
+ foreach (var item in timeArr)
|
|
|
+ {
|
|
|
+ string trip = string.Empty;
|
|
|
+ string weekDay = string.Empty;
|
|
|
+ DateTime time = DateTime.Now;
|
|
|
+ if (DateTime.TryParse(item, out time))
|
|
|
+ {
|
|
|
+ weekDay = weekdays[(int)time.DayOfWeek];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ weekDay = "日期格式不正确!";
|
|
|
+ }
|
|
|
+
|
|
|
+ var empty = "【未收入该三字码!请机票同事录入】";
|
|
|
+ var tabSelect = resultTable.Select(string.Format("Day = '{0}'", item));
|
|
|
+ var isMoreTraffic = false;
|
|
|
+ if (tabSelect.Length > 0)
|
|
|
+ {
|
|
|
+ isMoreTraffic = true;
|
|
|
+ var takeOffTime = DateTime.Parse(item);
|
|
|
+ var fallToTime = DateTime.Parse(item);
|
|
|
+
|
|
|
+ Res_ThreeCode start_Object = null;
|
|
|
+ Res_ThreeCode end_Object = null;
|
|
|
+
|
|
|
+ bool isTrade = false;
|
|
|
+
|
|
|
+ //air 处理
|
|
|
+ foreach (var tabRow in tabSelect)
|
|
|
+ {
|
|
|
+
|
|
|
+ takeOffTime = DateTime.Parse(item);
|
|
|
+ fallToTime = DateTime.Parse(item);
|
|
|
+
|
|
|
+ var takeOff = tabRow["StartTime"].ToString();
|
|
|
+ var fallTo = tabRow["EndTime"].ToString();
|
|
|
+
|
|
|
+ takeOffTime = takeOffTime.AddHours(int.Parse(takeOff.Substring(0, 2)));
|
|
|
+ takeOffTime = takeOffTime.AddMinutes(int.Parse(takeOff.Substring(2, 2)));
|
|
|
+
|
|
|
+ fallToTime = fallToTime.AddHours(int.Parse(fallTo.Substring(0, 2)));
|
|
|
+ fallToTime = fallToTime.AddMinutes(int.Parse(fallTo.Substring(2, 2)));
|
|
|
+
|
|
|
+ var threeCode = tabRow["Three"].ToString();
|
|
|
+ var start = threeCode.Substring(0, 3);
|
|
|
+ var end = threeCode.Substring(3, 3);
|
|
|
+ stopCity = end;
|
|
|
+ start_Object = threeCodes.Find(x => x.Three.ToUpper() == start.ToUpper());
|
|
|
+ end_Object = threeCodes.Find(x => x.Three.ToUpper() == end.ToUpper());
|
|
|
+ if (start_Object == null)
|
|
|
+ {
|
|
|
+ start_Object = new Res_ThreeCode()
|
|
|
+ {
|
|
|
+ AirPort = empty,
|
|
|
+ AirPort_En = empty,
|
|
|
+ City = empty,
|
|
|
+ Country = empty,
|
|
|
+ Four = empty,
|
|
|
+ Three = empty,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (end_Object == null)
|
|
|
+ {
|
|
|
+ end_Object = new Res_ThreeCode()
|
|
|
+ {
|
|
|
+ AirPort = empty,
|
|
|
+ AirPort_En = empty,
|
|
|
+ City = empty,
|
|
|
+ Country = empty,
|
|
|
+ Four = empty,
|
|
|
+ Three = empty,
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ //航班号
|
|
|
+ string flightcode = tabRow["Fliagtcode"].ToString();
|
|
|
+ trip += $"{takeOffTime.ToString("HH:mm")}—{fallToTime.ToString("HH:mm")} {start_Object.City}—{end_Object.City} 航班号:{flightcode}\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ //var airArrive = fallToTime; //航班落地时间
|
|
|
+ time = fallToTime.AddHours(1.5); //出机场一个半小时
|
|
|
+
|
|
|
+ string Time = string.Empty;
|
|
|
+ string Distance = string.Empty;
|
|
|
+ int GetGoogleResult = 0;
|
|
|
+ int GetDistResult = 0;
|
|
|
+ JObject Result = null;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Time = Result["routes"][0]["legs"][0]["duration"]["text"].ToString().Replace(" ", "").Trim();
|
|
|
+ Distance = Result["routes"][0]["legs"][0]["distance"]["text"].ToString().Replace(" ", "").Trim();
|
|
|
+
|
|
|
+ if (Time.Contains("hours"))
|
|
|
+ {
|
|
|
+ Time = Time.Replace("hours", "小时");
|
|
|
+ }
|
|
|
+ if (Time.Contains("hour"))
|
|
|
+ {
|
|
|
+ Time = Time.Replace("hour", "小时");
|
|
|
+ }
|
|
|
+ Time = Time.Replace("mins", "分钟");
|
|
|
+
|
|
|
+ if (Distance.Contains("mi"))
|
|
|
+ {
|
|
|
+ var distSp = Regex.Split(Distance, "mi");
|
|
|
+ if (distSp.Length > 0)
|
|
|
+ {
|
|
|
+ Distance = (decimal.Parse(distSp[0]) * conversion).ToString("#0.00") + " 公里";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Distance.Contains("km"))
|
|
|
+ {
|
|
|
+ Distance = Distance.Replace("km", "公里");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Time.Contains("小时"))
|
|
|
+ {
|
|
|
+ var xs = Regex.Split(Time, "小时");
|
|
|
+ var xsValue = int.Parse(xs[0]);
|
|
|
+ var fz = Regex.Split(xs[1], "分钟");
|
|
|
+ var fzValue = int.Parse(fz[0]);
|
|
|
+ GetGoogleResult = xsValue * 60;
|
|
|
+ GetGoogleResult += fzValue;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (Time.Contains("分钟"))
|
|
|
+ {
|
|
|
+ GetGoogleResult = int.Parse(Regex.Split(Time, "分钟")[0]);
|
|
|
+ }
|
|
|
+ if (Distance.Contains("公里"))
|
|
|
+ {
|
|
|
+ GetDistResult = (int)decimal.Parse(Regex.Split(Distance, "公里")[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (GetGoogleResult > 0 && GetGoogleResult % 5 != 0)
|
|
|
+ {
|
|
|
+ while (GetGoogleResult % 5 != 0)
|
|
|
+ {
|
|
|
+ GetGoogleResult++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (GetDistResult % 5 != 0 && GetDistResult > 0)
|
|
|
+ {
|
|
|
+ while (GetDistResult % 5 != 0)
|
|
|
+ {
|
|
|
+ GetDistResult++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int H = (GetGoogleResult / 60);
|
|
|
+ int m = (GetGoogleResult % 60);
|
|
|
+ string TimeStr = string.Empty;
|
|
|
+ if (H != 0)
|
|
|
+ {
|
|
|
+ if (H < 10)
|
|
|
+ {
|
|
|
+ TimeStr += "0" + H + "小时";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TimeStr += H + "小时";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (m < 10)
|
|
|
+ {
|
|
|
+ TimeStr += "0" + m + "分钟";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TimeStr += m + "分钟";
|
|
|
+ }
|
|
|
+
|
|
|
+ Time = TimeStr;
|
|
|
+ Distance = GetDistResult.ToString() + "公里";
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Time = "未知!";
|
|
|
+ Distance = "未知!";
|
|
|
+ }
|
|
|
+
|
|
|
+ //trip += $"{time.ToString("HH:mm")} 搭乘专车前往市区({end_Object.AirPort} - {end_Object.City}市区 路程{Distance},耗时{Time})";
|
|
|
+ //trip += $"{time.ToString("HH:mm")} 搭乘专车前往市区({end_Object.AirPort} - {end_Object.City}市区)";
|
|
|
+
|
|
|
+ time = time.AddMinutes(GetGoogleResult); //到达市区时间
|
|
|
+
|
|
|
+ string tripDate = Convert.ToDateTime(item).ToString("M月d日");
|
|
|
+ if (index == timeArr.Count - 1)
|
|
|
+ {
|
|
|
+ NewListTravel.Add(new Grp_TravelList
|
|
|
+ {
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = 0,
|
|
|
+ Diid = diid,
|
|
|
+ Date = tripDate,
|
|
|
+ Trip = trip,
|
|
|
+ WeekDay = weekDay,
|
|
|
+ Days = index + 1,
|
|
|
+ Traffic_First = "飞机",
|
|
|
+ Traffic_Second = "汽车",
|
|
|
+ Diffgroup = 1,
|
|
|
+ Issel = 1,
|
|
|
+ IsDel = 0,
|
|
|
+ });
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (time.Day != fallToTime.Day) //超出一天
|
|
|
+ {
|
|
|
+ NewListTravel.Add(new Grp_TravelList
|
|
|
+ {
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = 0,
|
|
|
+ Diid = diid,
|
|
|
+ Date = tripDate,
|
|
|
+ Trip = trip,
|
|
|
+ WeekDay = weekDay,
|
|
|
+ Days = index + 1,
|
|
|
+ Traffic_First = "飞机",
|
|
|
+ Traffic_Second = "汽车",
|
|
|
+ Diffgroup = 1,
|
|
|
+ Issel = 1,
|
|
|
+ IsDel = 0,
|
|
|
+ });
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ var obInfo = obDatas.Find(it => Convert.ToDateTime(it.Date).ToString("M月d日").Equals(tripDate));
|
|
|
+ string obtime = "";
|
|
|
+ string obcontent = "";
|
|
|
+
|
|
|
+ if (obInfo != null)
|
|
|
+ {
|
|
|
+ obtime = obInfo.Time;
|
|
|
+ obcontent = $"拜访{obInfo.Client ?? "公务出访单位未录入"}{obInfo.Job ?? "公务出访联系人职务未录入"}{obInfo.Contact ?? "公务出访联系人职务未录入"}";
|
|
|
+ }
|
|
|
+
|
|
|
+ bool obTime_bool = DateTime.TryParse(obtime, out DateTime obTimeDt);
|
|
|
+
|
|
|
+ if (time.Hour < 9) // && (airArrive < new DateTime(airArrive.Year,airArrive.Month,airArrive.Day,6, 30, 0))
|
|
|
+ {
|
|
|
+ if (obTime_bool)
|
|
|
+ {
|
|
|
+ if (obTimeDt.Hour < 9)
|
|
|
+ {
|
|
|
+ trip += $"{obTimeDt.ToString("HH:mm")}—10:30 {obcontent};\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ trip += "09:00—10:30 公务活动;\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (time.Hour < 10)
|
|
|
+ {
|
|
|
+ if (obTime_bool)
|
|
|
+ {
|
|
|
+ if (obTimeDt.Hour < 10)
|
|
|
+ {
|
|
|
+ trip += $"{obTimeDt.ToString("HH:mm")}—12:00 {obcontent};\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ trip += "10:30—12:00 公务活动;\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (time.Hour < 13)
|
|
|
+ {
|
|
|
+ //trip += $"\r\n{time.ToString("HH:mm")} 午餐于当地餐厅;";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (time < new DateTime(time.Year, time.Month, time.Day, 14, 30, 0))
|
|
|
+ {
|
|
|
+ if (obTime_bool)
|
|
|
+ {
|
|
|
+ if (obTimeDt < new DateTime(time.Year, time.Month, time.Day, 14, 30, 0))
|
|
|
+ {
|
|
|
+ trip += $"{obTimeDt.ToString("HH:mm")}—16:00 {obcontent};\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ trip += "14:00—16:00 公务活动;\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (time.Hour < 16)
|
|
|
+ {
|
|
|
+ if (obTime_bool)
|
|
|
+ {
|
|
|
+ if (obTimeDt.Hour < 16)
|
|
|
+ {
|
|
|
+ trip += $"{obTimeDt.ToString("HH:mm")}—17:30 {obcontent};\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ trip += "16:00—17:30 公务活动;\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //if (time.Hour < 18)
|
|
|
+ //{
|
|
|
+ // trip += $"\r\n18:00 晚餐于当地餐厅;";
|
|
|
+ //}
|
|
|
+
|
|
|
+ //time = time.AddHours(1);
|
|
|
+ //trip += $"\r\n{time.ToString("HH:mm")} 搭乘专车前往酒店,抵达后办理入住;";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var end_Object = threeCodes.Find(x => x.Three.ToUpper() == stopCity.ToUpper());
|
|
|
+ if (end_Object == null)
|
|
|
+ {
|
|
|
+ end_Object = new Res_ThreeCode()
|
|
|
+ {
|
|
|
+ AirPort = empty,
|
|
|
+ AirPort_En = empty,
|
|
|
+ City = empty,
|
|
|
+ Country = empty,
|
|
|
+ Four = empty,
|
|
|
+ Three = empty,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ //trip += $"{end_Object.City}\r\n";
|
|
|
+// trip += @"08:00 早餐于酒店;
|
|
|
+//09:00—10:30 公务活动;
|
|
|
+//12:00 午餐于当地餐厅;
|
|
|
+//14:00—16:00 公务活动;
|
|
|
+//18:00 晚餐于当地餐厅;
|
|
|
+//19:00 入住酒店休息;";
|
|
|
+ trip += "09:00—10:30 公务活动;\r\n14:00—16:00 公务活动;\r\n";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ string[] traffic = new string[] { "飞机", "汽车" };
|
|
|
+ if (!isMoreTraffic)
|
|
|
+ {
|
|
|
+ traffic = new string[] { "汽车", "" };
|
|
|
+ }
|
|
|
+
|
|
|
+ NewListTravel.Add(new Grp_TravelList
|
|
|
+ {
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = 0,
|
|
|
+ Diid = diid,
|
|
|
+ Date = Convert.ToDateTime(item).ToString("M月d日"),
|
|
|
+ Trip = trip,
|
|
|
+ WeekDay = weekDay,
|
|
|
+ Days = index + 1,
|
|
|
+ Traffic_First = traffic[0],
|
|
|
+ Traffic_Second = traffic[1],
|
|
|
+ Diffgroup = 1,
|
|
|
+ Issel = 1,
|
|
|
+ IsDel = 0,
|
|
|
+ });
|
|
|
+
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Result() { Code = 0, Msg = "获取成功!", Data = NewListTravel };
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
}
|