|
@@ -1,12 +1,22 @@
|
|
|
-using Microsoft.AspNetCore.Mvc;
|
|
|
-using Newtonsoft.Json.Serialization;
|
|
|
+using Aspose.Cells;
|
|
|
+using Aspose.Cells.Drawing.Texts;
|
|
|
+using Aspose.Words;
|
|
|
+using Aspose.Words.Tables;
|
|
|
+using NPOI.Util;
|
|
|
using OASystem.API.OAMethodLib;
|
|
|
+using OASystem.API.OAMethodLib.File;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
-using OASystem.Domain.Entities.Business;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
|
+using TencentCloud.Ocr.V20181119.Models;
|
|
|
+using OASystem.Infrastructure.Tools;
|
|
|
+using System.Web;
|
|
|
+using System.Data;
|
|
|
+using static OASystem.Infrastructure.Repositories.Resource.AirTicketResRepository;
|
|
|
using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
+using Cell = Aspose.Words.Tables.Cell;
|
|
|
+using Row = Aspose.Words.Tables.Row;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -22,14 +32,23 @@ namespace OASystem.API.Controllers
|
|
|
private readonly DelegationInfoRepository _groupRepository;
|
|
|
private readonly TaskAssignmentRepository _taskAssignmentRep;
|
|
|
private readonly AirTicketResRepository _airTicketResRep;
|
|
|
-
|
|
|
- public GroupsController(IMapper mapper, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository, TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep)
|
|
|
+ private readonly SqlSugarClient _sqlSugar;
|
|
|
+ private string url;
|
|
|
+ private string path;
|
|
|
+ public GroupsController(IMapper mapper,SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository, TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_grpScheduleRep = grpScheduleRep;
|
|
|
_groupRepository = groupRepository;
|
|
|
_taskAssignmentRep = taskAssignmentRep;
|
|
|
_airTicketResRep = airTicketResRep;
|
|
|
+ _sqlSugar = sqlSugar;
|
|
|
+ url = AppSettingsHelper.Get("ExcelBaseUrl");
|
|
|
+ path = AppSettingsHelper.Get("ExcelBasePath");
|
|
|
+ if (!System.IO.Directory.Exists(path))
|
|
|
+ {
|
|
|
+ System.IO.Directory.CreateDirectory(path);//不存在就创建文件夹
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#region 流程管控
|
|
@@ -456,7 +475,7 @@ namespace OASystem.API.Controllers
|
|
|
#region 团组基本信息
|
|
|
|
|
|
Grp_DelegationInfo _delegation = _groupRepository.Query<Grp_DelegationInfo>(s => s.Id == _dto.DiId).First();
|
|
|
- if (_delegation == null)
|
|
|
+ if (_delegation != null)
|
|
|
{
|
|
|
_view.ClientName = _delegation.ClientName;
|
|
|
_view.DiId = _dto.DiId;
|
|
@@ -468,16 +487,21 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return Ok(JsonView(false, "团组Id为空"));
|
|
|
+ return Ok(JsonView(false, "团组信息为空"));
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 费用清单
|
|
|
+ var exp = Expressionable.Create<Grp_CreditCardPayment>();
|
|
|
+ exp.AndIF(_dto.AuditStatus != -1, it => it.IsAuditGM == _dto.AuditStatus);
|
|
|
+ exp.AndIF(_dto.Label != -1, it => it.CTable == _dto.Label);
|
|
|
+
|
|
|
|
|
|
//缺少IF的语法糖 CTable
|
|
|
List<Grp_CreditCardPayment> entityList = _groupRepository
|
|
|
- .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.CTable == _dto.Label && s.IsAuditGM == _dto.AuditStatus && s.IsDel == 0 && s.CreateUserId > 0)
|
|
|
+ .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.IsDel == 0 && s.CreateUserId > 0)
|
|
|
+ .Where(exp.ToExpression())
|
|
|
.ToList();
|
|
|
|
|
|
List<Grp_CreditCardPaymentDetailView> detailList = new List<Grp_CreditCardPaymentDetailView>();
|
|
@@ -500,7 +524,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
|
|
|
|
|
|
- if (entity.CTable != 85) continue;
|
|
|
+ _detail.Id = entity.Id;
|
|
|
|
|
|
/*
|
|
|
* Bus名称
|
|
@@ -580,7 +604,7 @@ namespace OASystem.API.Controllers
|
|
|
* 申请人
|
|
|
*/
|
|
|
string operatorName = "无";
|
|
|
- Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.CreateUserId == entity.CreateUserId).First();
|
|
|
+ Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.CreateUserId).First();
|
|
|
if (_opUser != null)
|
|
|
{
|
|
|
operatorName = _opUser.CnName;
|
|
@@ -597,7 +621,7 @@ namespace OASystem.API.Controllers
|
|
|
auditOperatorName = "自动审核";
|
|
|
else
|
|
|
{
|
|
|
- Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.CreateUserId == entity.AuditGMOperate).First();
|
|
|
+ Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.AuditGMOperate).First();
|
|
|
if (_adUser != null)
|
|
|
{
|
|
|
auditOperatorName = _adUser.CnName;
|
|
@@ -647,11 +671,7 @@ namespace OASystem.API.Controllers
|
|
|
YSFYEUR += CurrPayStr;
|
|
|
}
|
|
|
|
|
|
- _detail.TotalStr1 = string.Format(@"应付款总金额:{0}CNY | {1}USD | {2}EUR", CNY, USD, EUR);
|
|
|
- _detail.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY | {1}USD | {2}EUR", PayCNY, PayUSD, PayEUR);
|
|
|
- _detail.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY | {1}USD | {2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
|
|
|
- _detail.TotalStr4 = string.Format(@"已审费用总额:{0}CNY | {1}USD | {2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
|
|
|
-
|
|
|
+ _detail.IsAuditGM = entity.IsAuditGM;
|
|
|
|
|
|
detailList.Add(_detail);
|
|
|
|
|
@@ -659,13 +679,18 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
#endregion
|
|
|
_view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
|
|
|
+ _view.TotalStr1 = string.Format(@"应付款总金额:{0}CNY | {1}USD | {2}EUR", CNY, USD, EUR);
|
|
|
+ _view.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY | {1}USD | {2}EUR", PayCNY, PayUSD, PayEUR);
|
|
|
+ _view.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY | {1}USD | {2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
|
|
|
+ _view.TotalStr4 = string.Format(@"已审费用总额:{0}CNY | {1}USD | {2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
|
|
|
+
|
|
|
|
|
|
return Ok(JsonView(_view));
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 获取团组费用审核
|
|
|
+ /// 修改团组费用审核状态
|
|
|
/// </summary>
|
|
|
/// <param name="paras">参数Json字符串</param>
|
|
|
/// <returns></returns>
|
|
@@ -673,15 +698,32 @@ namespace OASystem.API.Controllers
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> PostAuditGrpCreditCardPayment(Edit_GrpCreditCardPaymentDto _dto)
|
|
|
{
|
|
|
+ List<string> idList = _dto.CreditIdStr.Split(',').ToList();
|
|
|
Grp_CreditCardPayment _detail = _mapper.Map<Grp_CreditCardPayment>(_dto);
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
- var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ _groupRepository.BeginTran();
|
|
|
+ int rst = 0;
|
|
|
+ foreach (var item in idList)
|
|
|
+ {
|
|
|
+ int CreditId = int.Parse(item);
|
|
|
+ var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
.SetColumns(it => it.IsAuditGM == _dto.AuditCode)
|
|
|
.SetColumns(it => it.AuditGMOperate == _dto.User)
|
|
|
.SetColumns(it => it.AuditGMDate == dtNow)
|
|
|
- .Where(s => s.Id == _dto.CreditId)
|
|
|
+ .Where(s => s.Id == CreditId)
|
|
|
.ExecuteCommandAsync();
|
|
|
- if (result > 0)
|
|
|
+ if (result < 1)
|
|
|
+ {
|
|
|
+ rst = -1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _groupRepository.RollbackTran();
|
|
|
+ return Ok(JsonView(false, "保存失败并回滚!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _groupRepository.CommitTran();
|
|
|
+ if (rst == 0)
|
|
|
{
|
|
|
return Ok(JsonView(true, "保存成功!"));
|
|
|
}
|
|
@@ -723,7 +765,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> AirTicketResList(AirTicketResListDto dto)
|
|
|
+ public async Task<IActionResult> AirTicketResList(AirTicketResDto dto)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -740,7 +782,710 @@ namespace OASystem.API.Controllers
|
|
|
throw;
|
|
|
}
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 根据id查询费用录入信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> AirTicketResById(AirTicketResByIdDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Result groupData = await _airTicketResRep.AirTicketResById(dto);
|
|
|
+ if (groupData.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, groupData.Msg));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 机票费用录入操作(Status:1.新增,2.修改)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> OpAirTicketRes(AirTicketResOpDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Result groupData = await _airTicketResRep.OpAirTicketRes(dto);
|
|
|
+ if (groupData.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, groupData.Msg));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 机票费用录入,删除
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> DelAirTicketRes(DelBaseDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var res = await _airTicketResRep.SoftDeleteByIdAsync<Grp_AirTicketReservations>(dto.Id.ToString(), dto.DeleteUserId);
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "删除失败"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "删除成功!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 导出机票录入报表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> DeriveAirTicketRes(AirTicketResDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Result groupData = await _airTicketResRep.DeriveAirTicketRes(dto);
|
|
|
+ if (groupData.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, groupData.Msg));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<AirTicketReservationsPayView> AirTicketReservations = groupData.Data.GetType().GetProperty("AirTicketRes").GetValue(groupData.Data);
|
|
|
+ if (AirTicketReservations.Count != 0)
|
|
|
+ {
|
|
|
+ Grp_DelegationInfo DelegationInfo = groupData.Data.GetType().GetProperty("Delegation").GetValue(groupData.Data);
|
|
|
+ Sys_Users _Users = groupData.Data.GetType().GetProperty("Users").GetValue(groupData.Data);
|
|
|
+ string diCode = DelegationInfo != null ? DelegationInfo.TourCode : "XXX";
|
|
|
+ string diName = DelegationInfo != null ? DelegationInfo.TeamName : "XXX";
|
|
|
+ WorkbookDesigner designer = new WorkbookDesigner();
|
|
|
+ designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/机票预订费用报表模板.xlsx");
|
|
|
+ decimal countCost = 0;
|
|
|
+ foreach (var item in AirTicketReservations)
|
|
|
+ {
|
|
|
+ if (item.BankType == "其他")
|
|
|
+ {
|
|
|
+ item.BankNo = "--";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.BankNo = item.BankType + ":" + item.BankNo.Substring(0, 3);
|
|
|
+ }
|
|
|
+ item.PrePrice = System.Decimal.Round(item.PrePrice, 2);
|
|
|
+ item.Price = System.Decimal.Round(item.Price, 2);
|
|
|
+ countCost += Convert.ToDecimal(item.Price);
|
|
|
+ }
|
|
|
+ designer.SetDataSource("Export", AirTicketReservations);
|
|
|
+ designer.SetDataSource("ExportDiCode", diCode);
|
|
|
+ designer.SetDataSource("ExportDiName", diName);
|
|
|
+ designer.SetDataSource("ExportOpUserName", _Users.CnName);
|
|
|
+
|
|
|
+ designer.SetDataSource("ExportCountCost", countCost + "(" + AirTicketReservations[0].CurrencyStr);
|
|
|
+ designer.Process();
|
|
|
+ string fileName = "AirfareStatement/" + diName + "机票费用报表" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
|
|
|
+ designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName);
|
|
|
+ string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
|
|
|
+ return Ok(JsonView(true, "成功", url = rst));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Dictionary<string, string> transDic = new Dictionary<string, string>();
|
|
|
+ /// <summary>
|
|
|
+ /// 行程单导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> ItineraryAirTicketRes(ItineraryAirTicketResDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Result groupData = await _airTicketResRep.ItineraryAirTicketRes(dto);
|
|
|
+ if (groupData.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, groupData.Msg));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<AirTicketReservationsView> _AirTicketReservations = groupData.Data;
|
|
|
+ if (dto.Language=="CN")
|
|
|
+ {
|
|
|
+ Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/电子客票行程单模板_CN.docx");
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+ int tableIndex = 0;//表格索引
|
|
|
+ //得到文档中的第一个表格
|
|
|
+ Table table = (Table)doc.GetChild(NodeType.Table, tableIndex, true);
|
|
|
+
|
|
|
+ foreach (var item in _AirTicketReservations)
|
|
|
+ {
|
|
|
+ #region 处理固定数据
|
|
|
+ string[] FlightsCode = item.FlightsCode.Split('/');
|
|
|
+ if (FlightsCode.Length != 0)
|
|
|
+ {
|
|
|
+ Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
|
|
|
+ if (_AirCompany != null)
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = _AirCompany.CnName;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = "--";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
|
|
|
+ string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
|
|
|
+ string name = "";
|
|
|
+ foreach (string clientName in nameArray)
|
|
|
+ {
|
|
|
+ if (!name.Contains(clientName))
|
|
|
+ {
|
|
|
+ name += clientName + ",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(name))
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = name.Substring(0, name.Length - 1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = "--";
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["TicketNumber"].Text = "--";
|
|
|
+ table.Range.Bookmarks["IdentificationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["JointTicket"].Text = "--";
|
|
|
+ table.Range.Bookmarks["TimeIssue"].Text = "--";
|
|
|
+ table.Range.Bookmarks["DrawingAgent"].Text = "--";
|
|
|
+ table.Range.Bookmarks["NavigationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentsAddress"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentPhone"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentFacsimile"].Text = "--";
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ #region 循环数据处理
|
|
|
+ List<AirInfo> airs = new List<AirInfo>();
|
|
|
+ string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
|
|
|
+ for (int i = 0; i < FlightsCode.Length; i++)
|
|
|
+ {
|
|
|
+ AirInfo air = new AirInfo();
|
|
|
+ string[] tempstr = DayArray[i]
|
|
|
+ .Replace("\r\n", string.Empty)
|
|
|
+ .Replace("\\r\\n", string.Empty)
|
|
|
+ .TrimStart().TrimEnd()
|
|
|
+ .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
+
|
|
|
+ Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
|
|
|
+ string starCity = "";
|
|
|
+ if (star_Three != null)
|
|
|
+ {
|
|
|
+ starCity = star_Three.AirPort;
|
|
|
+ }
|
|
|
+ Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
|
|
|
+ string EndCity = "";
|
|
|
+ if (End_Three != null)
|
|
|
+ {
|
|
|
+ EndCity = End_Three.AirPort;
|
|
|
+ }
|
|
|
+ air.Destination = starCity + "/" + EndCity;
|
|
|
+ air.Flight = FlightsCode[i];
|
|
|
+ air.SeatingClass = item.CTypeName;
|
|
|
+ string dateTime = tempstr[2];
|
|
|
+ string DateTemp = dateTime.Substring(2, 5).ToUpper();
|
|
|
+ air.FlightDate = DateTemp;
|
|
|
+ air.DepartureTime = tempstr[5];
|
|
|
+ air.LandingTime = tempstr[6];
|
|
|
+ air.ValidityPeriod = DateTemp + "/" + DateTemp;
|
|
|
+ air.TicketStatus = "--";
|
|
|
+ air.Luggage = "--";
|
|
|
+ air.DepartureTerminal = "--";
|
|
|
+ air.LandingTerminal = "--";
|
|
|
+ airs.Add(air);
|
|
|
+ }
|
|
|
+ int row = 13;
|
|
|
+ for (int i = 0; i < airs.Count; i++)
|
|
|
+ {
|
|
|
+ if (airs.Count > 2)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < airs.Count - 2; j++)
|
|
|
+ {
|
|
|
+ var CopyRow = table.Rows[12].Clone(true);
|
|
|
+ table.Rows.Add(CopyRow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PropertyInfo[] properties = airs[i].GetType().GetProperties();
|
|
|
+ int index = 0;
|
|
|
+ foreach (PropertyInfo property in properties)
|
|
|
+ {
|
|
|
+ string value = property.GetValue(airs[i]).ToString();
|
|
|
+ Cell ishcel0 = table.Rows[row].Cells[index];
|
|
|
+ Paragraph p = new Paragraph(doc);
|
|
|
+ string s = value;
|
|
|
+ p.AppendChild(new Run(doc, s));
|
|
|
+ ishcel0.AppendChild(p);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ row++;
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ Paragraph lastParagraph = new Paragraph(doc);
|
|
|
+ //第一个表格末尾加段落
|
|
|
+ table.ParentNode.InsertAfter(lastParagraph, table);
|
|
|
+ //复制第一个表格
|
|
|
+ Table cloneTable = (Table)table.Clone(true);
|
|
|
+ //在文档末尾段落后面加入复制的表格
|
|
|
+ table.ParentNode.InsertAfter(cloneTable, lastParagraph);
|
|
|
+
|
|
|
+ if (item != _AirTicketReservations[_AirTicketReservations.Count - 1])
|
|
|
+ {
|
|
|
+ int rownewsIndex = 13;
|
|
|
+ for (int i = 0; i < 2; i++)
|
|
|
+ {
|
|
|
+ var CopyRow = table.Rows[12].Clone(true);
|
|
|
+ table.Rows.RemoveAt(13);
|
|
|
+ table.Rows.Add(CopyRow);
|
|
|
+ rownewsIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Rows.RemoveAt(12);
|
|
|
+ }
|
|
|
+ cloneTable.Rows.RemoveAt(12);
|
|
|
+ }
|
|
|
+ if (_AirTicketReservations.Count != 0)
|
|
|
+ {
|
|
|
+ string[] FlightsCode = _AirTicketReservations[0].FlightsCode.Split('/');
|
|
|
+ if (FlightsCode.Length != 0)
|
|
|
+ {
|
|
|
+ Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
|
|
|
+ if (_AirCompany != null)
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = _AirCompany.CnName;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = "--";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
|
|
|
+ string[] nameArray = Regex.Split(_AirTicketReservations[0].ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
|
|
|
+ string name = "";
|
|
|
+ foreach (string clientName in nameArray)
|
|
|
+ {
|
|
|
+ if (!name.Contains(clientName))
|
|
|
+ {
|
|
|
+ name = name + "," + clientName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(name))
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = name;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = "--";
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["TicketNumber"].Text = "--";
|
|
|
+ table.Range.Bookmarks["IdentificationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["JointTicket"].Text = "--";
|
|
|
+ table.Range.Bookmarks["TimeIssue"].Text = "--";
|
|
|
+ table.Range.Bookmarks["DrawingAgent"].Text = "--";
|
|
|
+ table.Range.Bookmarks["NavigationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentsAddress"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentPhone"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentFacsimile"].Text = "--";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
|
|
|
+ //保存合并后的文档
|
|
|
+ string fileName = "AirItinerary/电子客票中文行程单_CN.docx";
|
|
|
+ string rst = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + fileName;
|
|
|
+ doc.Save(AppSettingsHelper.Get("WordBasePath") + fileName);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "成功!", rst));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/电子客票行程单模板_EN.docx");
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(doc);
|
|
|
+ int tableIndex = 0;//表格索引
|
|
|
+ //得到文档中的第一个表格
|
|
|
+ Table table = (Table)doc.GetChild(NodeType.Table, tableIndex, true);
|
|
|
+
|
|
|
+ List<string> texts = new List<string>();
|
|
|
+ foreach (var item in _AirTicketReservations)
|
|
|
+ {
|
|
|
+ string[] FlightsCode = item.FlightsCode.Split('/');
|
|
|
+ if (FlightsCode.Length != 0)
|
|
|
+ {
|
|
|
+ Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
|
|
|
+ if (_AirCompany != null)
|
|
|
+ {
|
|
|
+ if (!transDic.ContainsKey(_AirCompany.CnName))
|
|
|
+ {
|
|
|
+ transDic.Add(_AirCompany.CnName, _AirCompany.EnName);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (!transDic.ContainsKey("--"))
|
|
|
+ {
|
|
|
+ transDic.Add("--", "--");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
|
|
|
+ string name = "";
|
|
|
+ foreach (string clientName in nameArray)
|
|
|
+ {
|
|
|
+ name += clientName+",";
|
|
|
+ }
|
|
|
+ if (!texts.Contains(name))
|
|
|
+ {
|
|
|
+ texts.Add(name);
|
|
|
+ }
|
|
|
+ List<AirInfo> airs = new List<AirInfo>();
|
|
|
+ string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
|
|
|
+ for (int i = 0; i < FlightsCode.Length; i++)
|
|
|
+ {
|
|
|
+ AirInfo air = new AirInfo();
|
|
|
+ string[] tempstr = DayArray[i]
|
|
|
+ .Replace("\r\n", string.Empty)
|
|
|
+ .Replace("\\r\\n", string.Empty)
|
|
|
+ .TrimStart().TrimEnd()
|
|
|
+ .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
+
|
|
|
+ Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
|
|
|
+ if (star_Three != null)
|
|
|
+ {
|
|
|
+ if (!transDic.ContainsKey(star_Three.AirPort))
|
|
|
+ {
|
|
|
+ transDic.Add(star_Three.AirPort, star_Three.AirPort_En);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
|
|
|
+
|
|
|
+ if (End_Three != null)
|
|
|
+ {
|
|
|
+ if (!transDic.ContainsKey(End_Three.AirPort))
|
|
|
+ {
|
|
|
+ transDic.Add(End_Three.AirPort, End_Three.AirPort_En);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (!texts.Contains(item.CTypeName))
|
|
|
+ {
|
|
|
+ texts.Add(item.CTypeName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<TranslateResult> transData = _airTicketResRep.ReTransBatch(texts, "en");
|
|
|
+ if (transData.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (TranslateResult item in transData)
|
|
|
+ {
|
|
|
+ if (!transDic.ContainsKey(item.Query))
|
|
|
+ {
|
|
|
+
|
|
|
+ transDic.Add(item.Query, item.Translation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach (var item in _AirTicketReservations)
|
|
|
+ {
|
|
|
+ #region 处理固定数据
|
|
|
+ string[] FlightsCode = item.FlightsCode.Split('/');
|
|
|
+ if (FlightsCode.Length != 0)
|
|
|
+ {
|
|
|
+ Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
|
|
|
+ if (_AirCompany != null)
|
|
|
+ {
|
|
|
+ string str = "--";
|
|
|
+ string translateResult = transDic.Where(s => s.Key == _AirCompany.CnName).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult))
|
|
|
+ {
|
|
|
+ str = translateResult;
|
|
|
+ str =_airTicketResRep.Processing(str);
|
|
|
+ }
|
|
|
+
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = str;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = "--";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
|
|
|
+ string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
|
|
|
+ string names = "";
|
|
|
+ foreach (string clientName in nameArray)
|
|
|
+ {
|
|
|
+ names += clientName + ",";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(names))
|
|
|
+ {
|
|
|
+ string str = "--";
|
|
|
+ string translateResult = transDic.Where(s => s.Key == names).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult))
|
|
|
+ {
|
|
|
+ str = translateResult;
|
|
|
+ str = _airTicketResRep.Processing(str);
|
|
|
+ }
|
|
|
+
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = str;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = "--";
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["TicketNumber"].Text = "--";
|
|
|
+ table.Range.Bookmarks["IdentificationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["JointTicket"].Text = "--";
|
|
|
+ table.Range.Bookmarks["TimeIssue"].Text = "--";
|
|
|
+ table.Range.Bookmarks["DrawingAgent"].Text = "--";
|
|
|
+ table.Range.Bookmarks["NavigationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentsAddress"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentPhone"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentFacsimile"].Text = "--";
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ #region 循环数据处理
|
|
|
+ List<AirInfo> airs = new List<AirInfo>();
|
|
|
+ string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
|
|
|
+ for (int i = 0; i < FlightsCode.Length; i++)
|
|
|
+ {
|
|
|
+ AirInfo air = new AirInfo();
|
|
|
+ string[] tempstr = DayArray[i]
|
|
|
+ .Replace("\r\n", string.Empty)
|
|
|
+ .Replace("\\r\\n", string.Empty)
|
|
|
+ .TrimStart().TrimEnd()
|
|
|
+ .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
+
|
|
|
+ Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
|
|
|
+ string starCity = "";
|
|
|
+ if (star_Three != null)
|
|
|
+ {
|
|
|
+ string str2 = "--";
|
|
|
+ string translateResult2 = transDic.Where(s => s.Key == star_Three.AirPort).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult2))
|
|
|
+ {
|
|
|
+ str2 = translateResult2;
|
|
|
+ str2 = _airTicketResRep.Processing(str2);
|
|
|
+ }
|
|
|
+ starCity = str2;
|
|
|
+ }
|
|
|
+ Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
|
|
|
+ string EndCity = "";
|
|
|
+ if (End_Three != null)
|
|
|
+ {
|
|
|
+ string str1 = "--";
|
|
|
+ string translateResult1 = transDic.Where(s => s.Key == End_Three.AirPort).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult1))
|
|
|
+ {
|
|
|
+ str1 = translateResult1;
|
|
|
+ str1= _airTicketResRep.Processing(str1);
|
|
|
+ }
|
|
|
+ EndCity = str1;
|
|
|
+ }
|
|
|
+ air.Destination = starCity + "/" + EndCity;
|
|
|
+ air.Flight = FlightsCode[i];
|
|
|
+ string str = "--";
|
|
|
+ string translateResult = transDic.Where(s => s.Key == item.CTypeName).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult))
|
|
|
+ {
|
|
|
+ str = translateResult;
|
|
|
+ str = _airTicketResRep.Processing(str);
|
|
|
+ }
|
|
|
+ air.SeatingClass = str;
|
|
|
+ string dateTime = tempstr[2];
|
|
|
+ string DateTemp = dateTime.Substring(2, 5).ToUpper();
|
|
|
+ air.FlightDate = DateTemp;
|
|
|
+ air.DepartureTime = tempstr[5];
|
|
|
+ air.LandingTime = tempstr[6];
|
|
|
+ air.ValidityPeriod = DateTemp + "/" + DateTemp;
|
|
|
+ air.TicketStatus = "--";
|
|
|
+ air.Luggage = "--";
|
|
|
+ air.DepartureTerminal = "--";
|
|
|
+ air.LandingTerminal = "--";
|
|
|
+ airs.Add(air);
|
|
|
+ }
|
|
|
+ int row = 13;
|
|
|
+ for (int i = 0; i < airs.Count; i++)
|
|
|
+ {
|
|
|
+ if (airs.Count > 2)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < airs.Count - 2; j++)
|
|
|
+ {
|
|
|
+ var CopyRow = table.Rows[12].Clone(true);
|
|
|
+ table.Rows.Add(CopyRow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PropertyInfo[] properties = airs[i].GetType().GetProperties();
|
|
|
+ int index = 0;
|
|
|
+ foreach (PropertyInfo property in properties)
|
|
|
+ {
|
|
|
+ string value = property.GetValue(airs[i]).ToString();
|
|
|
+ Cell ishcel0 = table.Rows[row].Cells[index];
|
|
|
+ Paragraph p = new Paragraph(doc);
|
|
|
+ string s = value;
|
|
|
+ p.AppendChild(new Run(doc, s));
|
|
|
+ ishcel0.AppendChild(p);
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ row++;
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ Paragraph lastParagraph = new Paragraph(doc);
|
|
|
+ //第一个表格末尾加段落
|
|
|
+ table.ParentNode.InsertAfter(lastParagraph, table);
|
|
|
+ //复制第一个表格
|
|
|
+ Table cloneTable = (Table)table.Clone(true);
|
|
|
+ //在文档末尾段落后面加入复制的表格
|
|
|
+ table.ParentNode.InsertAfter(cloneTable, lastParagraph);
|
|
|
+
|
|
|
+ if (item != _AirTicketReservations[_AirTicketReservations.Count - 1])
|
|
|
+ {
|
|
|
+ int rownewsIndex = 13;
|
|
|
+ for (int i = 0; i < 2; i++)
|
|
|
+ {
|
|
|
+ var CopyRow = table.Rows[12].Clone(true);
|
|
|
+ table.Rows.RemoveAt(13);
|
|
|
+ table.Rows.Add(CopyRow);
|
|
|
+ rownewsIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Rows.RemoveAt(12);
|
|
|
+ }
|
|
|
+ cloneTable.Rows.RemoveAt(12);
|
|
|
+ }
|
|
|
+ if (_AirTicketReservations.Count != 0)
|
|
|
+ {
|
|
|
+ string[] FlightsCode = _AirTicketReservations[0].FlightsCode.Split('/');
|
|
|
+ if (FlightsCode.Length != 0)
|
|
|
+ {
|
|
|
+ Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
|
|
|
+ if (_AirCompany != null)
|
|
|
+ {
|
|
|
+ string str = "--";
|
|
|
+ string translateResult = transDic.Where(s => s.Key == _AirCompany.CnName).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult))
|
|
|
+ {
|
|
|
+ str = translateResult;
|
|
|
+ str = _airTicketResRep.Processing(str);
|
|
|
+ }
|
|
|
+
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = str;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["AirlineCompany"].Text = "--";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
|
|
|
+ string[] nameArray = Regex.Split(_AirTicketReservations[0].ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
|
|
|
+ nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
|
|
|
+ string names = "";
|
|
|
+ foreach (string clientName in nameArray)
|
|
|
+ {
|
|
|
+ names += clientName + ",";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(names))
|
|
|
+ {
|
|
|
+ string str = "--";
|
|
|
+ string translateResult = transDic.Where(s => s.Key == names).FirstOrDefault().Value;
|
|
|
+ if (!string.IsNullOrEmpty(translateResult))
|
|
|
+ {
|
|
|
+ str = translateResult;
|
|
|
+ str = _airTicketResRep.Processing(str);
|
|
|
+ }
|
|
|
+
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = str;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ table.Range.Bookmarks["ClientName"].Text = "--";
|
|
|
+ }
|
|
|
+ table.Range.Bookmarks["TicketNumber"].Text = "--";
|
|
|
+ table.Range.Bookmarks["IdentificationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["JointTicket"].Text = "--";
|
|
|
+ table.Range.Bookmarks["TimeIssue"].Text = "--";
|
|
|
+ table.Range.Bookmarks["DrawingAgent"].Text = "--";
|
|
|
+ table.Range.Bookmarks["NavigationCode"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentsAddress"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentPhone"].Text = "--";
|
|
|
+ table.Range.Bookmarks["AgentFacsimile"].Text = "--";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
|
|
|
+ //保存合并后的文档
|
|
|
+ string fileName = "AirItinerary/电子客票英文行程单_EN.docx";
|
|
|
+ string rst = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + fileName;
|
|
|
+ doc.Save(AppSettingsHelper.Get("WordBasePath") + fileName);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "成功!", rst));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
}
|
|
|
}
|