GroupsController.cs 119 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819
  1. using Aspose.Cells;
  2. using Aspose.Cells.Drawing.Texts;
  3. using Aspose.Words;
  4. using Aspose.Words.Tables;
  5. using NPOI.Util;
  6. using OASystem.API.OAMethodLib;
  7. using OASystem.API.OAMethodLib.File;
  8. using OASystem.Domain.Dtos.Groups;
  9. using OASystem.Domain.Entities.Groups;
  10. using OASystem.Domain.ViewModels.Groups;
  11. using OASystem.Infrastructure.Repositories.Groups;
  12. using TencentCloud.Ocr.V20181119.Models;
  13. using OASystem.Infrastructure.Tools;
  14. using System.Web;
  15. using System.Data;
  16. using static OASystem.Infrastructure.Repositories.Groups.AirTicketResRepository;
  17. using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
  18. using Cell = Aspose.Words.Tables.Cell;
  19. using Row = Aspose.Words.Tables.Row;
  20. using System.Runtime.Intrinsics.Arm;
  21. using Microsoft.AspNetCore.Mvc.Filters;
  22. using OASystem.Domain.Entities.Customer;
  23. using NPOI.SS.Formula.Functions;
  24. using OASystem.Domain.Dtos.CRM;
  25. using System.Diagnostics;
  26. using MathNet.Numerics.Statistics.Mcmc;
  27. using AlibabaCloud.OpenApiClient.Models;
  28. using System;
  29. using NPOI.HPSF;
  30. using SqlSugar;
  31. namespace OASystem.API.Controllers
  32. {
  33. /// <summary>
  34. /// 团组相关
  35. /// </summary>
  36. //[Authorize]
  37. [Route("api/[controller]/[action]")]
  38. public class GroupsController : ControllerBase
  39. {
  40. private readonly GrpScheduleRepository _grpScheduleRep;
  41. private readonly IMapper _mapper;
  42. private readonly DelegationInfoRepository _groupRepository;
  43. private readonly TaskAssignmentRepository _taskAssignmentRep;
  44. private readonly AirTicketResRepository _airTicketResRep;
  45. private readonly DecreasePaymentsRepository _decreasePaymentsRep;
  46. private readonly InvitationOfficialActivitiesRepository _InvitationOfficialActivitiesRep;
  47. private readonly DelegationEnDataRepository _delegationEnDataRep;
  48. private readonly DelegationVisaRepository _delegationVisaRep;
  49. private readonly MessageRepository _message;
  50. private readonly SqlSugarClient _sqlSugar;
  51. private string url;
  52. private string path;
  53. private readonly EnterExitCostRepository _enterExitCostRep;
  54. public GroupsController(IMapper mapper, SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository,
  55. TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep, DecreasePaymentsRepository decreasePaymentsRep,
  56. InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, DelegationEnDataRepository delegationEnDataRep, EnterExitCostRepository enterExitCostRep
  57. , DelegationVisaRepository delegationVisaRep, MessageRepository message)
  58. {
  59. _mapper = mapper;
  60. _grpScheduleRep = grpScheduleRep;
  61. _groupRepository = groupRepository;
  62. _taskAssignmentRep = taskAssignmentRep;
  63. _airTicketResRep = airTicketResRep;
  64. _sqlSugar = sqlSugar;
  65. url = AppSettingsHelper.Get("ExcelBaseUrl");
  66. path = AppSettingsHelper.Get("ExcelBasePath");
  67. if (!System.IO.Directory.Exists(path))
  68. {
  69. System.IO.Directory.CreateDirectory(path);//不存在就创建文件夹
  70. }
  71. _decreasePaymentsRep = decreasePaymentsRep;
  72. _InvitationOfficialActivitiesRep = InvitationOfficialActivitiesRep;
  73. _delegationEnDataRep = delegationEnDataRep;
  74. _enterExitCostRep = enterExitCostRep;
  75. _delegationVisaRep = delegationVisaRep;
  76. _message = message;
  77. }
  78. #region 流程管控
  79. /// <summary>
  80. /// 获取团组流程管控信息
  81. /// </summary>
  82. /// <param name="paras">参数Json字符串</param>
  83. /// <returns></returns>
  84. [HttpPost]
  85. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  86. public async Task<IActionResult> PostSearchGrpSchedule(JsonDtoBase _jsonDto)
  87. {
  88. if (string.IsNullOrEmpty(_jsonDto.Paras))
  89. {
  90. return Ok(JsonView(false, "参数为空"));
  91. }
  92. Grp_ScheduleDto _ScheduleDto = JsonConvert.DeserializeObject<Grp_ScheduleDto>(_jsonDto.Paras);
  93. if (_ScheduleDto != null)
  94. {
  95. if (_ScheduleDto.SearchType == 2)//获取列表
  96. {
  97. List<Grp_ScheduleView> _grpScheduleViewList = await _grpScheduleRep.GetViewList_GrpSchedule(_ScheduleDto);
  98. return Ok(JsonView(_grpScheduleViewList));
  99. }
  100. else//获取对象
  101. {
  102. Grp_ScheduleCombinView _grpScheduleView = await _grpScheduleRep.GetView_GrpSchedule(_ScheduleDto);
  103. if (_grpScheduleView != null)
  104. {
  105. return Ok(JsonView(_grpScheduleView));
  106. }
  107. }
  108. }
  109. else
  110. {
  111. return Ok(JsonView(false, "参数反序列化失败"));
  112. }
  113. return Ok(JsonView(false, "暂无数据!"));
  114. }
  115. /// <summary>
  116. /// 修改团组流程管控详细表数据
  117. /// </summary>
  118. /// <param name="paras"></param>
  119. /// <returns></returns>
  120. [HttpPost]
  121. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  122. public async Task<IActionResult> PostUpdateGrpScheduleDetail(Grp_ScheduleDetailUpdDto dto)
  123. {
  124. Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
  125. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleDetailInfo>()
  126. .SetColumns(it => it.Duty == _detail.Duty)
  127. .SetColumns(it => it.ExpectBeginDt == _detail.ExpectBeginDt)
  128. .SetColumns(it => it.ExpectEndDt == _detail.ExpectEndDt)
  129. .SetColumns(it => it.JobContent == _detail.JobContent)
  130. .SetColumns(it => it.Remark == _detail.Remark)
  131. .SetColumns(it => it.StepStatus == _detail.StepStatus)
  132. .Where(s => s.Id == dto.Id)
  133. //.UpdateColumns(s => new { s.Duty, s.ExpectBeginDt, s.ExpectEndDt, s.JobContent, s.Remark, s.StepStatus })
  134. .ExecuteCommandAsync();
  135. if (result > 0)
  136. {
  137. return Ok(JsonView(true, "保存成功!"));
  138. }
  139. return Ok(JsonView(false, "保存失败!"));
  140. }
  141. /// <summary>
  142. /// 删除团组流程管控详细表数据,删除人Id请放在Duty
  143. /// </summary>
  144. /// <param name="dto"></param>
  145. /// <returns></returns>
  146. [HttpPost]
  147. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  148. public async Task<ActionResult> PostDeleteGrpScheduleDetail(Grp_ScheduleDetailUpdDto dto)
  149. {
  150. Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
  151. _detail.IsDel = 1;
  152. _detail.DeleteUserId = dto.Duty;
  153. _detail.DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  154. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_ScheduleDetailInfo>()
  155. .SetColumns(it => it.IsDel == _detail.IsDel)
  156. .SetColumns(it => it.DeleteUserId == _detail.DeleteUserId)
  157. .SetColumns(it => it.DeleteTime == _detail.DeleteTime)
  158. .Where(it => it.Id == dto.Id)
  159. //.UpdateColumns(s => new { s.IsDel, s.DeleteUserId, s.DeleteTime })
  160. //.WhereColumns(s => s.Id == dto.Id)
  161. .ExecuteCommandAsync();
  162. if (result > 0)
  163. {
  164. return Ok(JsonView(true, "删除成功!"));
  165. }
  166. return Ok(JsonView(false, "删除失败!"));
  167. }
  168. /// <summary>
  169. /// 增加团组流程管控详细表数据
  170. /// </summary>
  171. /// <param name="dto"></param>
  172. /// <returns></returns>
  173. [HttpPost]
  174. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  175. public async Task<ActionResult> PostInsertGrpScheduleDetail(Grp_ScheduleDetailInsertDto dto)
  176. {
  177. Grp_ScheduleDetailInfo _detail = _mapper.Map<Grp_ScheduleDetailInfo>(dto);
  178. if (DateTime.Now < _detail.ExpectBeginDt)
  179. {
  180. _detail.StepStatus = 0;
  181. }
  182. else
  183. {//若大于设置时间,不考虑设置的预计结束日期,统一视为进行中
  184. _detail.StepStatus = 1;
  185. }
  186. var result = await _grpScheduleRep._sqlSugar.Insertable(_detail).ExecuteReturnIdentityAsync();
  187. if (result > 0)
  188. {
  189. Grp_ScheduleDetailView _result = await _grpScheduleRep.GetInsertBackData(result);
  190. return Ok(JsonView(true, "添加成功!", _result));
  191. }
  192. return Ok(JsonView(false, "添加失败!"));
  193. }
  194. #endregion
  195. #region 团组基本信息
  196. /// <summary>
  197. /// 接团信息列表
  198. /// </summary>
  199. /// <param name="dto">团组列表请求dto</param>
  200. /// <returns></returns>
  201. [HttpPost]
  202. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  203. public async Task<IActionResult> GetGroupList(GroupListDto dto)
  204. {
  205. var groupData = await _groupRepository.GetGroupList(dto);
  206. if (groupData.Code != 0)
  207. {
  208. return Ok(JsonView(false, groupData.Msg));
  209. }
  210. return Ok(JsonView(groupData.Data));
  211. }
  212. /// <summary>
  213. /// 接团信息详情
  214. /// </summary>
  215. /// <param name="dto">团组info请求dto</param>
  216. /// <returns></returns>
  217. [HttpPost]
  218. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  219. public async Task<IActionResult> GetGroupInfo(GroupInfoDto dto)
  220. {
  221. var groupData = await _groupRepository.GetGroupInfo(dto);
  222. if (groupData.Code != 0)
  223. {
  224. return Ok(JsonView(false, groupData.Msg));
  225. }
  226. return Ok(JsonView(groupData.Data));
  227. }
  228. /// <summary>
  229. /// 接团信息 编辑添加
  230. /// 基础信息数据源
  231. /// </summary>
  232. /// <param name="dto"></param>
  233. /// <returns></returns>
  234. [HttpPost]
  235. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  236. public async Task<IActionResult> GroupEditBasicSource(GroupListDto dto)
  237. {
  238. var groupData = await _groupRepository.GroupEditBasicSource(dto);
  239. if (groupData.Code != 0)
  240. {
  241. return Ok(JsonView(false, groupData.Msg));
  242. }
  243. return Ok(JsonView(groupData.Data));
  244. }
  245. /// <summary>
  246. /// 接团信息 操作(增改)
  247. /// </summary>
  248. /// <param name="dto"></param>
  249. /// <returns></returns>
  250. [HttpPost]
  251. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  252. public async Task<IActionResult> GroupOperation(GroupOperationDto dto)
  253. {
  254. try
  255. {
  256. var groupData = await _groupRepository.GroupOperation(dto);
  257. if (groupData.Code != 0)
  258. {
  259. return Ok(JsonView(false, groupData.Msg));
  260. }
  261. return Ok(JsonView(true));
  262. }
  263. catch (Exception ex)
  264. {
  265. Logs("[response]" + JsonConvert.SerializeObject(dto));
  266. Logs(ex.Message);
  267. return Ok(JsonView(false, ex.Message));
  268. }
  269. }
  270. /// <summary>
  271. /// 接团信息 操作(删除)
  272. /// </summary>
  273. /// <param name="dto"></param>
  274. /// <returns></returns>
  275. [HttpPost]
  276. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  277. public async Task<IActionResult> GroupDel(GroupDelDto dto)
  278. {
  279. try
  280. {
  281. var groupData = await _groupRepository.GroupDel(dto);
  282. if (groupData.Code != 0)
  283. {
  284. return Ok(JsonView(false, groupData.Msg));
  285. }
  286. return Ok(JsonView(true));
  287. }
  288. catch (Exception ex)
  289. {
  290. Logs("[response]" + JsonConvert.SerializeObject(dto));
  291. Logs(ex.Message);
  292. return Ok(JsonView(false, ex.Message));
  293. }
  294. }
  295. /// <summary>
  296. /// 获取团组销售报价号
  297. /// 团组添加时 使用
  298. /// </summary>
  299. /// <returns></returns>
  300. [HttpPost]
  301. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  302. public async Task<IActionResult> GetGroupSalesQuoteNo()
  303. {
  304. var groupData = await _groupRepository.GetGroupSalesQuoteNo();
  305. if (groupData.Code != 0)
  306. {
  307. return Ok(JsonView(false, groupData.Msg));
  308. }
  309. object salesQuoteNo = new
  310. {
  311. SalesQuoteNo = groupData.Data
  312. };
  313. return Ok(JsonView(salesQuoteNo));
  314. }
  315. /// <summary>
  316. /// 设置确认出团
  317. /// </summary>
  318. /// <param name="dto"></param>
  319. /// <returns></returns>
  320. [HttpPost]
  321. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  322. public async Task<IActionResult> SetConfirmationGroup(ConfirmationGroupDto dto)
  323. {
  324. var groupData = await _groupRepository.ConfirmationGroup(dto);
  325. if (groupData.Code != 0)
  326. {
  327. return Ok(JsonView(false, groupData.Msg));
  328. }
  329. GroupStepForDelegation.CreateWorkStep(dto.GroupId); //创建管控流程
  330. return Ok(JsonView(groupData.Data));
  331. }
  332. /// <summary>
  333. /// 获取团组名称data And 签证国别Data
  334. /// </summary>
  335. /// <param name="dto"></param>
  336. /// <returns></returns>
  337. [HttpPost]
  338. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  339. public async Task<IActionResult> GetGroupNameAndVisaNationality(GroupNameDto dto)
  340. {
  341. var groupData = await _groupRepository.GetGroupNameAndVisaNationality(dto);
  342. if (groupData.Code != 0)
  343. {
  344. return Ok(JsonView(false, groupData.Msg));
  345. }
  346. return Ok(JsonView(groupData.Data));
  347. }
  348. /// <summary>
  349. /// 根据CTable类型返回对应的团组名称及简单数据(APP端)
  350. /// </summary>
  351. /// <returns></returns>
  352. [HttpPost]
  353. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  354. public async Task<IActionResult> PostGroupNameAndEasy(DecreasePaymentsDto dto)
  355. {
  356. try
  357. {
  358. Result groupData = await _decreasePaymentsRep.PostGroupNameAndEasy(dto);
  359. if (groupData.Code != 0)
  360. {
  361. return Ok(JsonView(false, groupData.Msg));
  362. }
  363. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  364. }
  365. catch (Exception ex)
  366. {
  367. return Ok(JsonView(false, "程序错误!"));
  368. throw;
  369. }
  370. }
  371. #endregion
  372. #region 团组&签证
  373. /// <summary>
  374. /// 根据团组Id获取签证客户信息List
  375. /// </summary>
  376. /// <param name="dto">请求dto</param>
  377. /// <returns></returns>
  378. [HttpPost]
  379. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  380. public async Task<IActionResult> GetCrmByGroupId(ClientByGroupIdDto dto)
  381. {
  382. var groupData = await _groupRepository.GetCrmByGroupId(dto);
  383. if (groupData.Code != 0)
  384. {
  385. return Ok(JsonView(false, groupData.Msg));
  386. }
  387. return Ok(JsonView(groupData.Data));
  388. }
  389. /// <summary>
  390. /// IOS获取团组签证拍照上传进度01(团组列表)
  391. /// </summary>
  392. /// <param name="dto">请求dto</param>
  393. /// <returns></returns>
  394. [HttpPost]
  395. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  396. public async Task<IActionResult> PostIOSVisaProgress(IOS_VisaDto dto)
  397. {
  398. if (dto == null)
  399. {
  400. return Ok(JsonView(false, "参数为空"));
  401. }
  402. DelegationVisaViewList visaList = _delegationVisaRep.GetDelegationList(dto);
  403. return Ok(JsonView(visaList));
  404. }
  405. /// <summary>
  406. /// IOS获取团组签证拍照上传进度02(团组签证详情\人员列表\国家)
  407. /// </summary>
  408. /// <returns></returns>
  409. [HttpPost]
  410. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  411. public async Task<ActionResult> PostIOSVisaProgressContent(IOS_VisaCustomerListDto dto)
  412. {
  413. if (dto == null)
  414. {
  415. return Ok(JsonView(false, "请求错误:"));
  416. }
  417. List<DelegationVisaProgressView> list = _delegationVisaRep.GetDelegationProgressList(dto.diId);
  418. return Ok(JsonView(list));
  419. }
  420. /// <summary>
  421. /// IOS获取团组签证拍照上传进度03(相册)
  422. /// </summary>
  423. /// <returns></returns>
  424. [HttpPost]
  425. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  426. public async Task<ActionResult> PostIOSVisaProgressImageList(IOS_VisaImageListDto dto)
  427. {
  428. if (dto == null)
  429. {
  430. return Ok(JsonView(false, "请求错误:"));
  431. }
  432. List<VisaProgressImageView> list = _delegationVisaRep.GetVisaProgressImageList(dto.visaProgressCustomerId, dto.picType);
  433. string url = AppSettingsHelper.Get("VisaProgressImageBaseUrl") + AppSettingsHelper.Get("VisaProgressImageFtpPath");
  434. list.ForEach(s => s.url = url);
  435. return Ok(JsonView(list));
  436. }
  437. /// <summary>
  438. /// IOS获取团组签证拍照上传进度04(图片上传)
  439. /// </summary>
  440. /// <param name="dto"></param>
  441. /// <returns></returns>
  442. [HttpPost]
  443. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  444. public async Task<ActionResult> PostIOSVisaProgressUploadImage(IOS_VisaUploadImageDto dto)
  445. {
  446. //string result = decodeBase64ToImage(dto.base64DataURL, dto.imageName);
  447. //if (!string.IsNullOrEmpty(result))
  448. //{
  449. //}
  450. //else {
  451. // return Ok(JsonView(false, "上传失败"));
  452. //}
  453. DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
  454. int sucNum = 0;
  455. try
  456. {
  457. foreach (var item in dto.base64DataList)
  458. {
  459. string imageName = dto.imageName + ((DateTime.Now.Ticks - dt1970.Ticks) / 10000).ToString();
  460. string result = decodeBase64ToImage(item, imageName);
  461. if (!string.IsNullOrEmpty(result))
  462. {
  463. Grp_VisaProgressCustomerPicture pic = new Grp_VisaProgressCustomerPicture();
  464. pic.CreateUserId = dto.CreateUserId;
  465. pic.PicName = imageName;
  466. pic.PicPath = result;
  467. pic.VisaProgressCustomerId = dto.visaProgressCustomerId;
  468. int insertResult = await _delegationVisaRep.AddAsync<Grp_VisaProgressCustomerPicture>(pic);
  469. if (insertResult > 0)
  470. {
  471. sucNum++;
  472. }
  473. }
  474. }
  475. }
  476. catch (Exception ex)
  477. {
  478. return Ok(JsonView(false, ex.Message));
  479. }
  480. string msg = string.Format(@"成功上传{0}张", sucNum);
  481. return Ok(JsonView(true, msg));
  482. }
  483. private string decodeBase64ToImage(string base64DataURL, string imgName)
  484. {
  485. string filename = "";//声明一个string类型的相对路径
  486. String base64 = base64DataURL.Substring(base64DataURL.IndexOf(",") + 1); //将‘,’以前的多余字符串删除
  487. System.Drawing.Bitmap bitmap = null;//定义一个Bitmap对象,接收转换完成的图片
  488. try//会有异常抛出,try,catch一下
  489. {
  490. byte[] arr = Convert.FromBase64String(base64);//将纯净资源Base64转换成等效的8位无符号整形数组
  491. System.IO.MemoryStream ms = new System.IO.MemoryStream(arr);//转换成无法调整大小的MemoryStream对象
  492. bitmap = new System.Drawing.Bitmap(ms);//将MemoryStream对象转换成Bitmap对象
  493. var fileDir = AppSettingsHelper.Get("VisaProgressImageBasePath");
  494. //文件名称
  495. filename = "VisaProgress_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + imgName + ".jpeg";//所要保存的相对路径及名字
  496. //上传的文件的路径
  497. string filePath = "";
  498. if (!Directory.Exists(fileDir))
  499. {
  500. Directory.CreateDirectory(fileDir);
  501. }
  502. //上传的文件的路径
  503. filePath = fileDir + filename;
  504. //string url = HttpRuntime.AppDomainAppPath.ToString();
  505. //string tmpRootDir = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString()); //获取程序根目录
  506. //string imagesurl2 = tmpRootDir + filename; //转换成绝对路径
  507. bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);//保存到服务器路径
  508. //bitmap.Save(filePath + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
  509. //bitmap.Save(filePath + ".gif", System.Drawing.Imaging.ImageFormat.Gif);
  510. //bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Png);
  511. ms.Close();//关闭当前流,并释放所有与之关联的资源
  512. bitmap.Dispose();
  513. }
  514. catch (Exception e)
  515. {
  516. string massage = e.Message;
  517. Logs("IOS图片上传Error:" + massage);
  518. //filename = e.Message;
  519. }
  520. return filename;//返回相对路径
  521. }
  522. /// <summary>
  523. /// IOS获取团组签证拍照上传进度05(修改签证状态/通知)
  524. /// </summary>
  525. /// <param name="dto"></param>
  526. /// <returns></returns>
  527. [HttpPost]
  528. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  529. public async Task<ActionResult> PostIOSVisaProgressChangeStatus(IOS_VisaChangeStatusDto dto)
  530. {
  531. if (dto == null)
  532. {
  533. return Ok(JsonView(false, "请求错误:"));
  534. }
  535. string msg = "参数错误";
  536. if (dto.diId > 0 && dto.visaStatus > 0 && dto.visaStatus < 4)
  537. {
  538. try
  539. {
  540. //_delegationVisaRep.BeginTran();
  541. var updCount = await _delegationVisaRep._sqlSugar.Updateable<Grp_VisaProgressCustomer>()
  542. .SetColumns(it => it.WorkStatus == dto.visaStatus)
  543. .Where(s => s.Id == dto.visaProgressCustomerId)
  544. .ExecuteCommandAsync();
  545. if (updCount > 0 && dto.publishCode == 1) {
  546. _delegationVisaRep.ChangeDataBase(DBEnum.OA2014DB); //切换到新OA后删除
  547. GroupInfoDto grpDto = new GroupInfoDto() { Id = dto.diId };
  548. var groupData = await _groupRepository.GetGroupInfo(grpDto);
  549. _delegationVisaRep.ChangeDataBase(DBEnum.OA2023DB); //切换到新OA后删除
  550. if (groupData.Code != 0)
  551. {
  552. _delegationVisaRep.RollbackTran();
  553. }
  554. string title = string.Format(@"[签证进度更新]");
  555. string content = string.Format(@"测试文本");
  556. bool rst = await _message.AddMsg(new MessageDto()
  557. {
  558. Type = 5,
  559. IssuerId = dto.publisher,
  560. Title = title,
  561. Content = content,
  562. ReleaseTime = DateTime.Now,
  563. UIdList = new List<int> {
  564. 234
  565. }
  566. });
  567. if (rst) {
  568. return Ok(JsonView(true, "发送通知成功"));
  569. }
  570. }
  571. //_delegationVisaRep.CommitTran();
  572. }
  573. catch (Exception)
  574. {
  575. //_delegationVisaRep.RollbackTran();
  576. }
  577. }
  578. return Ok(JsonView(true, msg));
  579. }
  580. #endregion
  581. #region 团组任务分配
  582. /// <summary>
  583. /// 团组任务分配初始化
  584. /// </summary>
  585. /// <param name="dto"></param>
  586. /// <returns></returns>
  587. [HttpPost]
  588. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  589. public async Task<IActionResult> GetTaskAssignmen()
  590. {
  591. var groupData = await _taskAssignmentRep.GetTaskAssignmen();
  592. if (groupData.Code != 0)
  593. {
  594. return Ok(JsonView(false, groupData.Msg));
  595. }
  596. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  597. }
  598. /// <summary>
  599. /// 团组任务分配查询
  600. /// </summary>
  601. /// <param name="dto"></param>
  602. /// <returns></returns>
  603. [HttpPost]
  604. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  605. public async Task<IActionResult> TaskAssignmenQuery(TaskAssignmenQueryDto dto)
  606. {
  607. var groupData = await _taskAssignmentRep.TaskAssignmenQuery(dto);
  608. if (groupData.Code != 0)
  609. {
  610. return Ok(JsonView(false, groupData.Msg));
  611. }
  612. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  613. }
  614. /// <summary>
  615. /// 团组任务分配操作
  616. /// </summary>
  617. /// <param name="dto"></param>
  618. /// <returns></returns>
  619. [HttpPost]
  620. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  621. public async Task<IActionResult> GetTaskAssignmenOp(TaskAssignmenDto dto)
  622. {
  623. Result groupData = await _taskAssignmentRep.GetTaskAssignmenOp(dto);
  624. if (groupData.Code != 0)
  625. {
  626. return Ok(JsonView(false, groupData.Msg));
  627. }
  628. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  629. }
  630. #endregion
  631. #region 团组费用审核
  632. /// <summary>
  633. /// 获取团组费用审核
  634. /// </summary>
  635. /// <param name="paras">参数Json字符串</param>
  636. /// <returns></returns>
  637. [HttpPost]
  638. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  639. public async Task<IActionResult> PostSearchGrpCreditCardPayment(Search_GrpCreditCardPaymentDto _dto)
  640. {
  641. if (_dto.DiId < 1)
  642. {
  643. return Ok(JsonView(false, "团组Id为空"));
  644. }
  645. Grp_CreditCardPaymentView _view = new Grp_CreditCardPaymentView();
  646. #region 团组基本信息
  647. Grp_DelegationInfo _delegation = _groupRepository.Query<Grp_DelegationInfo>(s => s.Id == _dto.DiId).First();
  648. if (_delegation != null)
  649. {
  650. _view.ClientName = _delegation.ClientName;
  651. _view.DiId = _dto.DiId;
  652. _view.TeamName = _delegation.TeamName;
  653. _view.VisitCountry = _delegation.VisitCountry;
  654. _view.VisitDate = _delegation.VisitStartDate.ToString("yyyy-MM-dd") + " ~ " + _delegation.VisitEndDate.ToString("yyyy-MM-dd");
  655. _view.VisitDays = _delegation.VisitDays;
  656. _view.VisitPNumber = _delegation.VisitPNumber;
  657. }
  658. else
  659. {
  660. return Ok(JsonView(false, "团组信息为空"));
  661. }
  662. #endregion
  663. #region 费用清单
  664. var exp = Expressionable.Create<Grp_CreditCardPayment>();
  665. exp.AndIF(_dto.AuditStatus != -1, it => it.IsAuditGM == _dto.AuditStatus);
  666. exp.AndIF(_dto.Label != -1, it => it.CTable == _dto.Label);
  667. List<Grp_CreditCardPayment> entityList = _groupRepository
  668. .Query<Grp_CreditCardPayment>(s => s.DIId == _dto.DiId && s.IsDel == 0 && s.CreateUserId > 0)
  669. .Where(exp.ToExpression())
  670. .ToList();
  671. List<Grp_CreditCardPaymentDetailView> detailList = new List<Grp_CreditCardPaymentDetailView>();
  672. decimal CNY = 0;
  673. decimal PayCNY = 0;
  674. decimal BalanceCNY = 0;
  675. decimal YSFYCNY = 0;
  676. decimal USD = 0;
  677. decimal PayUSD = 0;
  678. decimal BalanceUSD = 0;
  679. decimal YSFYUSD = 0;
  680. decimal EUR = 0;
  681. decimal PayEUR = 0;
  682. decimal BalanceEUR = 0;
  683. decimal YSFYEUR = 0;
  684. foreach (var entity in entityList)
  685. {
  686. Grp_CreditCardPaymentDetailView _detail = new Grp_CreditCardPaymentDetailView();
  687. _detail.Id = entity.Id;
  688. /*
  689. * Bus名称
  690. */
  691. _detail.BusName = "";
  692. /*
  693. *费用所属
  694. */
  695. switch (entity.CTable)
  696. {
  697. case 85:
  698. Grp_AirTicketReservations jpRes = _groupRepository.Query<Grp_AirTicketReservations>(s => s.Id == entity.CId).First();
  699. if (jpRes != null)
  700. {
  701. string FlightsDescription = jpRes.FlightsDescription;
  702. string PriceDescription = jpRes.PriceDescription;
  703. _detail.PriceMsgContent = "航班号:" + jpRes.FlightsCode + "<br/>城市A-B:" + jpRes.FlightsCity + "<br/>航班描述:" + FlightsDescription.Replace("\r\n", "<br />") + "<br/>" + "价格描述:" + PriceDescription;
  704. _detail.PriceNameContent = "(" + jpRes.FlightsCode + ")";
  705. }
  706. break;
  707. case 79:
  708. _detail.BusName = "待增加";
  709. break;
  710. case 98:
  711. Grp_DecreasePayments gdpRes = _groupRepository.Query<Grp_DecreasePayments>(s => s.Id == entity.CId).First();
  712. if (gdpRes != null)
  713. {
  714. _detail.PriceMsgContent = "备注:" + gdpRes.Remark;
  715. _detail.PriceNameContent = gdpRes.PriceName;
  716. }
  717. break;
  718. default:
  719. break;
  720. }
  721. /*
  722. * 费用模块
  723. */
  724. Sys_SetData sdPriceName = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.CTable).First();
  725. if (sdPriceName != null)
  726. {
  727. _detail.PriceName = sdPriceName.Name;
  728. }
  729. /*
  730. * 应付款金额
  731. */
  732. Sys_SetData sdPaymentCurrency_WaitPay = _groupRepository.Query<Sys_SetData>(s => s.Id == entity.PaymentCurrency).First();
  733. string PaymentCurrency_WaitPay = "Unknown";
  734. if (sdPaymentCurrency_WaitPay != null)
  735. {
  736. PaymentCurrency_WaitPay = sdPaymentCurrency_WaitPay.Name;
  737. }
  738. _detail.WaitPay = entity.PayMoney.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
  739. /*
  740. * 此次付款金额
  741. */
  742. decimal CurrPayStr = 0;
  743. if (entity.PayPercentage == 0)
  744. {
  745. if (entity.PayThenMoney != 0)
  746. CurrPayStr = entity.PayThenMoney * entity.DayRate;
  747. }
  748. else
  749. {
  750. CurrPayStr = entity.PayMoney * (decimal.Parse(entity.PayPercentage.ToString("#0.00")) / 100 * entity.DayRate);
  751. }
  752. _detail.CurrPay = CurrPayStr.ToString("#0.00") + " CNY";
  753. /*
  754. * 剩余尾款
  755. */
  756. decimal BalanceStr = 0;
  757. if (entity.PayMoney - (CurrPayStr / entity.DayRate) < 0.01M)
  758. BalanceStr = 0;
  759. else
  760. BalanceStr = (entity.PayMoney - CurrPayStr / entity.DayRate);
  761. _detail.Balance = BalanceStr.ToString("#0.00") + " " + PaymentCurrency_WaitPay;
  762. /*
  763. * 申请人
  764. */
  765. string operatorName = "无";
  766. Sys_Users _opUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.CreateUserId).First();
  767. if (_opUser != null)
  768. {
  769. operatorName = _opUser.CnName;
  770. }
  771. _detail.OperatorName = operatorName;
  772. /*
  773. * 审核人
  774. */
  775. string auditOperatorName = "Unknown";
  776. if (entity.AuditGMOperate == 0)
  777. auditOperatorName = "无";
  778. else if (entity.AuditGMOperate == 4)
  779. auditOperatorName = "自动审核";
  780. else
  781. {
  782. Sys_Users _adUser = _groupRepository.Query<Sys_Users>(s => s.Id == entity.AuditGMOperate).First();
  783. if (_adUser != null)
  784. {
  785. auditOperatorName = _adUser.CnName;
  786. }
  787. }
  788. _detail.AuditOperatorName = auditOperatorName;
  789. /*
  790. *
  791. * *超预算比例
  792. */
  793. string overBudgetStr = "";
  794. if (entity.ExceedBudget == -1)
  795. overBudgetStr = sdPriceName.Name + "尚无预算";
  796. else if (entity.ExceedBudget == 0)
  797. overBudgetStr = "未超预算";
  798. else
  799. overBudgetStr = entity.ExceedBudget.ToString("P");
  800. _detail.OverBudget = overBudgetStr;
  801. /*
  802. * 费用总计
  803. */
  804. if (entity.PaymentCurrency == 48)
  805. {
  806. CNY += entity.PayMoney;
  807. PayCNY += CurrPayStr;
  808. BalanceCNY += BalanceStr;
  809. YSFYCNY += CurrPayStr;
  810. }
  811. if (entity.PaymentCurrency == 49)
  812. {
  813. USD += entity.PayMoney;
  814. PayUSD += CurrPayStr;
  815. BalanceUSD += BalanceStr;
  816. YSFYUSD += CurrPayStr;
  817. }
  818. if (entity.PaymentCurrency == 51)
  819. {
  820. EUR += entity.PayMoney;
  821. PayEUR += CurrPayStr;
  822. BalanceEUR += BalanceStr;
  823. YSFYEUR += CurrPayStr;
  824. }
  825. _detail.IsAuditGM = entity.IsAuditGM;
  826. detailList.Add(_detail);
  827. }
  828. #endregion
  829. _view.DetailList = new List<Grp_CreditCardPaymentDetailView>(detailList);
  830. _view.TotalStr1 = string.Format(@"应付款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", CNY, USD, EUR);
  831. _view.TotalStr2 = string.Format(@"此次付款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", PayCNY, PayUSD, PayEUR);
  832. _view.TotalStr3 = string.Format(@"目前剩余尾款总金额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", BalanceCNY, BalanceUSD, BalanceEUR);
  833. _view.TotalStr4 = string.Format(@"已审费用总额:{0}CNY&nbsp;|&nbsp;{1}USD&nbsp;|&nbsp;{2}EUR", YSFYCNY, YSFYUSD, YSFYEUR);
  834. return Ok(JsonView(_view));
  835. }
  836. /// <summary>
  837. /// 修改团组费用审核状态
  838. /// </summary>
  839. /// <param name="paras">参数Json字符串</param>
  840. /// <returns></returns>
  841. [HttpPost]
  842. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  843. public async Task<IActionResult> PostAuditGrpCreditCardPayment(Edit_GrpCreditCardPaymentDto _dto)
  844. {
  845. List<string> idList = _dto.CreditIdStr.Split(',').ToList();
  846. Grp_CreditCardPayment _detail = _mapper.Map<Grp_CreditCardPayment>(_dto);
  847. DateTime dtNow = DateTime.Now;
  848. _groupRepository.BeginTran();
  849. int rst = 0;
  850. foreach (var item in idList)
  851. {
  852. int CreditId = int.Parse(item);
  853. var result = await _grpScheduleRep._sqlSugar.Updateable<Grp_CreditCardPayment>()
  854. .SetColumns(it => it.IsAuditGM == _dto.AuditCode)
  855. .SetColumns(it => it.AuditGMOperate == _dto.User)
  856. .SetColumns(it => it.AuditGMDate == dtNow.ToString())
  857. .Where(s => s.Id == CreditId)
  858. .ExecuteCommandAsync();
  859. if (result < 1)
  860. {
  861. rst = -1;
  862. }
  863. else
  864. {
  865. _groupRepository.RollbackTran();
  866. return Ok(JsonView(false, "保存失败并回滚!"));
  867. }
  868. }
  869. _groupRepository.CommitTran();
  870. if (rst == 0)
  871. {
  872. return Ok(JsonView(true, "保存成功!"));
  873. }
  874. return Ok(JsonView(false, "保存失败!"));
  875. }
  876. #endregion
  877. #region 机票费用录入
  878. /// <summary>
  879. /// 机票录入当前登录人可操作团组
  880. /// </summary>
  881. /// <param name="dto"></param>
  882. /// <returns></returns>
  883. [HttpPost]
  884. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  885. public async Task<IActionResult> AirTicketResSelect(AirTicketResDto dto)
  886. {
  887. try
  888. {
  889. Result groupData = await _airTicketResRep.AirTicketResSelect(dto);
  890. if (groupData.Code != 0)
  891. {
  892. return Ok(JsonView(false, groupData.Msg));
  893. }
  894. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  895. }
  896. catch (Exception ex)
  897. {
  898. return Ok(JsonView(false, "程序错误!"));
  899. throw;
  900. }
  901. }
  902. /// <summary>
  903. /// 机票费用录入列表
  904. /// </summary>
  905. /// <param name="dto"></param>
  906. /// <returns></returns>
  907. [HttpPost]
  908. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  909. public async Task<IActionResult> AirTicketResList(AirTicketResDto dto)
  910. {
  911. try
  912. {
  913. Result groupData = await _airTicketResRep.AirTicketResList(dto);
  914. if (groupData.Code != 0)
  915. {
  916. return Ok(JsonView(false, groupData.Msg));
  917. }
  918. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  919. }
  920. catch (Exception ex)
  921. {
  922. return Ok(JsonView(false, "程序错误!"));
  923. throw;
  924. }
  925. }
  926. /// <summary>
  927. /// 根据id查询费用录入信息
  928. /// </summary>
  929. /// <param name="dto"></param>
  930. /// <returns></returns>
  931. [HttpPost]
  932. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  933. public async Task<IActionResult> AirTicketResById(AirTicketResByIdDto dto)
  934. {
  935. try
  936. {
  937. Result groupData = await _airTicketResRep.AirTicketResById(dto);
  938. if (groupData.Code != 0)
  939. {
  940. return Ok(JsonView(false, groupData.Msg));
  941. }
  942. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  943. }
  944. catch (Exception ex)
  945. {
  946. return Ok(JsonView(false, "程序错误!"));
  947. throw;
  948. }
  949. }
  950. /// <summary>
  951. /// 机票费用录入操作(Status:1.新增,2.修改)
  952. /// </summary>
  953. /// <param name="dto"></param>
  954. /// <returns></returns>
  955. [HttpPost]
  956. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  957. public async Task<IActionResult> OpAirTicketRes(AirTicketResOpDto dto)
  958. {
  959. try
  960. {
  961. Result groupData = await _airTicketResRep.OpAirTicketRes(dto);
  962. if (groupData.Code != 0)
  963. {
  964. return Ok(JsonView(false, groupData.Msg));
  965. }
  966. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  967. }
  968. catch (Exception ex)
  969. {
  970. return Ok(JsonView(false, "程序错误!"));
  971. throw;
  972. }
  973. }
  974. /// <summary>
  975. /// 根据舱位类型查询接团客户名单信息
  976. /// </summary>
  977. /// <param name="dto"></param>
  978. /// <returns></returns>
  979. [HttpPost]
  980. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  981. public async Task<IActionResult> tankType(AirTicketResByIdDto dto)
  982. {
  983. try
  984. {
  985. List<Crm_GroupCustomer> crm_Groups = _sqlSugar.Queryable<Crm_GroupCustomer>().Where(a => a.IsDel == 0 && a.AirType == dto.Id).ToList();
  986. if (crm_Groups.Count != 0)
  987. {
  988. List<dynamic> Customer = new List<dynamic>();
  989. foreach (var item in crm_Groups)
  990. {
  991. var data = new
  992. {
  993. Id = item.Id,
  994. Pinyin = item.Pinyin,
  995. Name = item.LastName + item.FirstName
  996. };
  997. Customer.Add(data);
  998. }
  999. return Ok(JsonView(true, "查询成功!", Customer));
  1000. }
  1001. return Ok(JsonView(true, "暂无数据", crm_Groups));
  1002. }
  1003. catch (Exception ex)
  1004. {
  1005. return Ok(JsonView(false, "程序错误!"));
  1006. throw;
  1007. }
  1008. }
  1009. /// <summary>
  1010. /// 机票费用录入,删除
  1011. /// </summary>
  1012. /// <param name="dto"></param>
  1013. /// <returns></returns>
  1014. [HttpPost]
  1015. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1016. public async Task<IActionResult> DelAirTicketRes(DelBaseDto dto)
  1017. {
  1018. try
  1019. {
  1020. var res = await _airTicketResRep.SoftDeleteByIdAsync<Grp_AirTicketReservations>(dto.Id.ToString(), dto.DeleteUserId);
  1021. if (!res)
  1022. {
  1023. var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 85).SetColumns(a => new Grp_CreditCardPayment()
  1024. {
  1025. IsDel = 1,
  1026. DeleteUserId = dto.DeleteUserId,
  1027. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  1028. }).ExecuteCommandAsync();
  1029. return Ok(JsonView(false, "删除失败"));
  1030. }
  1031. return Ok(JsonView(true, "删除成功!"));
  1032. }
  1033. catch (Exception ex)
  1034. {
  1035. return Ok(JsonView(false, "程序错误!"));
  1036. throw;
  1037. }
  1038. }
  1039. /// <summary>
  1040. /// 导出机票录入报表
  1041. /// </summary>
  1042. /// <param name="dto"></param>
  1043. /// <returns></returns>
  1044. [HttpPost]
  1045. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1046. public async Task<IActionResult> DeriveAirTicketRes(AirTicketResDto dto)
  1047. {
  1048. try
  1049. {
  1050. Result groupData = await _airTicketResRep.DeriveAirTicketRes(dto);
  1051. if (groupData.Code != 0)
  1052. {
  1053. return Ok(JsonView(false, groupData.Msg));
  1054. }
  1055. else
  1056. {
  1057. List<AirTicketReservationsPayView> AirTicketReservations = groupData.Data.GetType().GetProperty("AirTicketRes").GetValue(groupData.Data);
  1058. if (AirTicketReservations.Count != 0)
  1059. {
  1060. Grp_DelegationInfo DelegationInfo = groupData.Data.GetType().GetProperty("Delegation").GetValue(groupData.Data);
  1061. Sys_Users _Users = groupData.Data.GetType().GetProperty("Users").GetValue(groupData.Data);
  1062. string diCode = DelegationInfo != null ? DelegationInfo.TourCode : "XXX";
  1063. string diName = DelegationInfo != null ? DelegationInfo.TeamName : "XXX";
  1064. WorkbookDesigner designer = new WorkbookDesigner();
  1065. designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/机票预订费用报表模板.xlsx");
  1066. decimal countCost = 0;
  1067. foreach (var item in AirTicketReservations)
  1068. {
  1069. if (item.BankType == "其他")
  1070. {
  1071. item.BankNo = "--";
  1072. }
  1073. else
  1074. {
  1075. item.BankNo = item.BankType + ":" + item.BankNo.Substring(0, 3);
  1076. }
  1077. item.PrePrice = System.Decimal.Round(item.PrePrice, 2);
  1078. item.Price = System.Decimal.Round(item.Price, 2);
  1079. countCost += Convert.ToDecimal(item.Price);
  1080. }
  1081. designer.SetDataSource("Export", AirTicketReservations);
  1082. designer.SetDataSource("ExportDiCode", diCode);
  1083. designer.SetDataSource("ExportDiName", diName);
  1084. designer.SetDataSource("ExportOpUserName", _Users.CnName);
  1085. designer.SetDataSource("ExportCountCost", countCost + "(" + AirTicketReservations[0].CurrencyStr);
  1086. designer.Process();
  1087. string fileName = "AirfareStatement/" + diName + "机票费用报表" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
  1088. designer.Workbook.Save(AppSettingsHelper.Get("ExcelBasePath") + fileName);
  1089. string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
  1090. return Ok(JsonView(true, "成功", url = rst));
  1091. }
  1092. else
  1093. {
  1094. return Ok(JsonView(false, "暂无数据!"));
  1095. }
  1096. }
  1097. }
  1098. catch (Exception ex)
  1099. {
  1100. return Ok(JsonView(false, "程序错误!"));
  1101. throw;
  1102. }
  1103. }
  1104. Dictionary<string, string> transDic = new Dictionary<string, string>();
  1105. /// <summary>
  1106. /// 行程单导出
  1107. /// </summary>
  1108. /// <param name="dto"></param>
  1109. /// <returns></returns>
  1110. [HttpPost]
  1111. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1112. public async Task<IActionResult> ItineraryAirTicketRes(ItineraryAirTicketResDto dto)
  1113. {
  1114. try
  1115. {
  1116. Result groupData = await _airTicketResRep.ItineraryAirTicketRes(dto);
  1117. if (groupData.Code != 0)
  1118. {
  1119. return Ok(JsonView(false, groupData.Msg));
  1120. }
  1121. else
  1122. {
  1123. List<AirTicketReservationsView> _AirTicketReservations = groupData.Data;
  1124. if (dto.Language == "CN")
  1125. {
  1126. Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/电子客票行程单模板_CN.docx");
  1127. DocumentBuilder builder = new DocumentBuilder(doc);
  1128. int tableIndex = 0;//表格索引
  1129. //得到文档中的第一个表格
  1130. Table table = (Table)doc.GetChild(NodeType.Table, tableIndex, true);
  1131. foreach (var item in _AirTicketReservations)
  1132. {
  1133. #region 处理固定数据
  1134. string[] FlightsCode = item.FlightsCode.Split('/');
  1135. if (FlightsCode.Length != 0)
  1136. {
  1137. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1138. if (_AirCompany != null)
  1139. {
  1140. table.Range.Bookmarks["AirlineCompany"].Text = _AirCompany.CnName;
  1141. }
  1142. else
  1143. {
  1144. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1145. }
  1146. }
  1147. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1148. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1149. string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1150. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1151. string name = "";
  1152. foreach (string clientName in nameArray)
  1153. {
  1154. if (!name.Contains(clientName))
  1155. {
  1156. name += clientName + ",";
  1157. }
  1158. }
  1159. if (!string.IsNullOrWhiteSpace(name))
  1160. {
  1161. table.Range.Bookmarks["ClientName"].Text = name.Substring(0, name.Length - 1);
  1162. }
  1163. else
  1164. {
  1165. table.Range.Bookmarks["ClientName"].Text = "--";
  1166. }
  1167. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1168. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1169. table.Range.Bookmarks["JointTicket"].Text = "--";
  1170. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1171. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1172. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1173. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1174. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1175. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1176. #endregion
  1177. #region 循环数据处理
  1178. List<AirInfo> airs = new List<AirInfo>();
  1179. string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
  1180. DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
  1181. for (int i = 0; i < FlightsCode.Length; i++)
  1182. {
  1183. AirInfo air = new AirInfo();
  1184. string[] tempstr = DayArray[i]
  1185. .Replace("\r\n", string.Empty)
  1186. .Replace("\\r\\n", string.Empty)
  1187. .TrimStart().TrimEnd()
  1188. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1189. Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
  1190. string starCity = "";
  1191. if (star_Three != null)
  1192. {
  1193. starCity = star_Three.AirPort;
  1194. }
  1195. Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
  1196. string EndCity = "";
  1197. if (End_Three != null)
  1198. {
  1199. EndCity = End_Three.AirPort;
  1200. }
  1201. air.Destination = starCity + "/" + EndCity;
  1202. air.Flight = FlightsCode[i];
  1203. air.SeatingClass = item.CTypeName;
  1204. string dateTime = tempstr[2];
  1205. string DateTemp = dateTime.Substring(2, 5).ToUpper();
  1206. air.FlightDate = DateTemp;
  1207. air.DepartureTime = tempstr[5];
  1208. air.LandingTime = tempstr[6];
  1209. air.ValidityPeriod = DateTemp + "/" + DateTemp;
  1210. air.TicketStatus = "--";
  1211. air.Luggage = "--";
  1212. air.DepartureTerminal = "--";
  1213. air.LandingTerminal = "--";
  1214. airs.Add(air);
  1215. }
  1216. int row = 13;
  1217. for (int i = 0; i < airs.Count; i++)
  1218. {
  1219. if (airs.Count > 2)
  1220. {
  1221. for (int j = 0; j < airs.Count - 2; j++)
  1222. {
  1223. var CopyRow = table.Rows[12].Clone(true);
  1224. table.Rows.Add(CopyRow);
  1225. }
  1226. }
  1227. PropertyInfo[] properties = airs[i].GetType().GetProperties();
  1228. int index = 0;
  1229. foreach (PropertyInfo property in properties)
  1230. {
  1231. string value = property.GetValue(airs[i]).ToString();
  1232. Cell ishcel0 = table.Rows[row].Cells[index];
  1233. Paragraph p = new Paragraph(doc);
  1234. string s = value;
  1235. p.AppendChild(new Run(doc, s));
  1236. p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
  1237. ishcel0.AppendChild(p);
  1238. ishcel0.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;//垂直居中对齐
  1239. index++;
  1240. }
  1241. row++;
  1242. }
  1243. #endregion
  1244. Paragraph lastParagraph = new Paragraph(doc);
  1245. //第一个表格末尾加段落
  1246. table.ParentNode.InsertAfter(lastParagraph, table);
  1247. //复制第一个表格
  1248. Table cloneTable = (Table)table.Clone(true);
  1249. //在文档末尾段落后面加入复制的表格
  1250. table.ParentNode.InsertAfter(cloneTable, lastParagraph);
  1251. if (item != _AirTicketReservations[_AirTicketReservations.Count - 1])
  1252. {
  1253. int rownewsIndex = 13;
  1254. for (int i = 0; i < 2; i++)
  1255. {
  1256. var CopyRow = table.Rows[12].Clone(true);
  1257. table.Rows.RemoveAt(13);
  1258. table.Rows.Add(CopyRow);
  1259. rownewsIndex++;
  1260. }
  1261. }
  1262. else
  1263. {
  1264. table.Rows.RemoveAt(12);
  1265. }
  1266. cloneTable.Rows.RemoveAt(12);
  1267. }
  1268. if (_AirTicketReservations.Count != 0)
  1269. {
  1270. string[] FlightsCode = _AirTicketReservations[0].FlightsCode.Split('/');
  1271. if (FlightsCode.Length != 0)
  1272. {
  1273. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1274. if (_AirCompany != null)
  1275. {
  1276. table.Range.Bookmarks["AirlineCompany"].Text = _AirCompany.CnName;
  1277. }
  1278. else
  1279. {
  1280. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1281. }
  1282. }
  1283. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1284. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1285. string[] nameArray = Regex.Split(_AirTicketReservations[0].ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1286. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1287. string name = "";
  1288. foreach (string clientName in nameArray)
  1289. {
  1290. if (!name.Contains(clientName))
  1291. {
  1292. name += clientName + ",";
  1293. }
  1294. }
  1295. if (!string.IsNullOrWhiteSpace(name))
  1296. {
  1297. table.Range.Bookmarks["ClientName"].Text = name.Substring(0, name.Length - 1);
  1298. }
  1299. else
  1300. {
  1301. table.Range.Bookmarks["ClientName"].Text = "--";
  1302. }
  1303. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1304. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1305. table.Range.Bookmarks["JointTicket"].Text = "--";
  1306. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1307. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1308. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1309. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1310. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1311. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1312. }
  1313. doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
  1314. //保存合并后的文档
  1315. string fileName = "AirItinerary/电子客票中文行程单_CN.docx";
  1316. string rst = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + fileName;
  1317. doc.Save(AppSettingsHelper.Get("WordBasePath") + fileName);
  1318. return Ok(JsonView(true, "成功!", rst));
  1319. }
  1320. else
  1321. {
  1322. Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/电子客票行程单模板_EN.docx");
  1323. DocumentBuilder builder = new DocumentBuilder(doc);
  1324. int tableIndex = 0;//表格索引
  1325. //得到文档中的第一个表格
  1326. Table table = (Table)doc.GetChild(NodeType.Table, tableIndex, true);
  1327. List<string> texts = new List<string>();
  1328. foreach (var item in _AirTicketReservations)
  1329. {
  1330. string[] FlightsCode = item.FlightsCode.Split('/');
  1331. if (FlightsCode.Length != 0)
  1332. {
  1333. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1334. if (_AirCompany != null)
  1335. {
  1336. if (!transDic.ContainsKey(_AirCompany.CnName))
  1337. {
  1338. transDic.Add(_AirCompany.CnName, _AirCompany.EnName);
  1339. }
  1340. }
  1341. else
  1342. {
  1343. if (!transDic.ContainsKey("--"))
  1344. {
  1345. transDic.Add("--", "--");
  1346. }
  1347. }
  1348. }
  1349. string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1350. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1351. string name = "";
  1352. foreach (string clientName in nameArray)
  1353. {
  1354. name += clientName + ",";
  1355. }
  1356. if (!texts.Contains(name))
  1357. {
  1358. texts.Add(name);
  1359. }
  1360. List<AirInfo> airs = new List<AirInfo>();
  1361. string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
  1362. DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
  1363. for (int i = 0; i < FlightsCode.Length; i++)
  1364. {
  1365. AirInfo air = new AirInfo();
  1366. string[] tempstr = DayArray[i]
  1367. .Replace("\r\n", string.Empty)
  1368. .Replace("\\r\\n", string.Empty)
  1369. .TrimStart().TrimEnd()
  1370. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1371. Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
  1372. if (star_Three != null)
  1373. {
  1374. if (!transDic.ContainsKey(star_Three.AirPort))
  1375. {
  1376. transDic.Add(star_Three.AirPort, star_Three.AirPort_En);
  1377. }
  1378. }
  1379. Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
  1380. if (End_Three != null)
  1381. {
  1382. if (!transDic.ContainsKey(End_Three.AirPort))
  1383. {
  1384. transDic.Add(End_Three.AirPort, End_Three.AirPort_En);
  1385. }
  1386. }
  1387. if (!texts.Contains(item.CTypeName))
  1388. {
  1389. texts.Add(item.CTypeName);
  1390. }
  1391. }
  1392. }
  1393. List<TranslateResult> transData = _airTicketResRep.ReTransBatch(texts, "en");
  1394. if (transData.Count > 0)
  1395. {
  1396. foreach (TranslateResult item in transData)
  1397. {
  1398. if (!transDic.ContainsKey(item.Query))
  1399. {
  1400. transDic.Add(item.Query, item.Translation);
  1401. }
  1402. }
  1403. }
  1404. foreach (var item in _AirTicketReservations)
  1405. {
  1406. #region 处理固定数据
  1407. string[] FlightsCode = item.FlightsCode.Split('/');
  1408. if (FlightsCode.Length != 0)
  1409. {
  1410. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1411. if (_AirCompany != null)
  1412. {
  1413. string str = "--";
  1414. string translateResult = transDic.Where(s => s.Key == _AirCompany.CnName).FirstOrDefault().Value;
  1415. if (!string.IsNullOrEmpty(translateResult))
  1416. {
  1417. str = translateResult;
  1418. str = _airTicketResRep.Processing(str);
  1419. }
  1420. table.Range.Bookmarks["AirlineCompany"].Text = str;
  1421. }
  1422. else
  1423. {
  1424. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1425. }
  1426. }
  1427. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1428. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1429. string[] nameArray = Regex.Split(item.ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1430. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1431. string names = "";
  1432. foreach (string clientName in nameArray)
  1433. {
  1434. names += clientName + ",";
  1435. }
  1436. if (!string.IsNullOrWhiteSpace(names))
  1437. {
  1438. string str = "--";
  1439. string translateResult = transDic.Where(s => s.Key == names).FirstOrDefault().Value;
  1440. if (!string.IsNullOrEmpty(translateResult))
  1441. {
  1442. str = translateResult;
  1443. str = _airTicketResRep.Processing(str);
  1444. }
  1445. table.Range.Bookmarks["ClientName"].Text = str;
  1446. }
  1447. else
  1448. {
  1449. table.Range.Bookmarks["ClientName"].Text = "--";
  1450. }
  1451. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1452. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1453. table.Range.Bookmarks["JointTicket"].Text = "--";
  1454. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1455. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1456. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1457. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1458. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1459. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1460. #endregion
  1461. #region 循环数据处理
  1462. List<AirInfo> airs = new List<AirInfo>();
  1463. string[] DayArray = Regex.Split(item.FlightsDescription, "\\d+\\.", RegexOptions.IgnoreCase);
  1464. DayArray = DayArray.Where(s => s != " " && s != "" && !string.IsNullOrEmpty(s)).ToArray();
  1465. for (int i = 0; i < FlightsCode.Length; i++)
  1466. {
  1467. AirInfo air = new AirInfo();
  1468. string[] tempstr = DayArray[i]
  1469. .Replace("\r\n", string.Empty)
  1470. .Replace("\\r\\n", string.Empty)
  1471. .TrimStart().TrimEnd()
  1472. .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1473. Res_ThreeCode star_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(0, 3));
  1474. string starCity = "";
  1475. if (star_Three != null)
  1476. {
  1477. string str2 = "--";
  1478. string translateResult2 = transDic.Where(s => s.Key == star_Three.AirPort).FirstOrDefault().Value;
  1479. if (!string.IsNullOrEmpty(translateResult2))
  1480. {
  1481. str2 = translateResult2;
  1482. str2 = _airTicketResRep.Processing(str2);
  1483. }
  1484. starCity = str2;
  1485. }
  1486. Res_ThreeCode End_Three = _sqlSugar.Queryable<Res_ThreeCode>().First(a => a.Three == tempstr[3].Substring(3, 3));
  1487. string EndCity = "";
  1488. if (End_Three != null)
  1489. {
  1490. string str1 = "--";
  1491. string translateResult1 = transDic.Where(s => s.Key == End_Three.AirPort).FirstOrDefault().Value;
  1492. if (!string.IsNullOrEmpty(translateResult1))
  1493. {
  1494. str1 = translateResult1;
  1495. str1 = _airTicketResRep.Processing(str1);
  1496. }
  1497. EndCity = str1;
  1498. }
  1499. air.Destination = starCity + "/" + EndCity;
  1500. air.Flight = FlightsCode[i];
  1501. string str = "--";
  1502. string translateResult = transDic.Where(s => s.Key == item.CTypeName).FirstOrDefault().Value;
  1503. if (!string.IsNullOrEmpty(translateResult))
  1504. {
  1505. str = translateResult;
  1506. str = _airTicketResRep.Processing(str);
  1507. }
  1508. air.SeatingClass = str;
  1509. string dateTime = tempstr[2];
  1510. string DateTemp = dateTime.Substring(2, 5).ToUpper();
  1511. air.FlightDate = DateTemp;
  1512. air.DepartureTime = tempstr[5];
  1513. air.LandingTime = tempstr[6];
  1514. air.ValidityPeriod = DateTemp + "/" + DateTemp;
  1515. air.TicketStatus = "--";
  1516. air.Luggage = "--";
  1517. air.DepartureTerminal = "--";
  1518. air.LandingTerminal = "--";
  1519. airs.Add(air);
  1520. }
  1521. int row = 13;
  1522. for (int i = 0; i < airs.Count; i++)
  1523. {
  1524. if (airs.Count > 2)
  1525. {
  1526. for (int j = 0; j < airs.Count - 2; j++)
  1527. {
  1528. var CopyRow = table.Rows[12].Clone(true);
  1529. table.Rows.Add(CopyRow);
  1530. }
  1531. }
  1532. PropertyInfo[] properties = airs[i].GetType().GetProperties();
  1533. int index = 0;
  1534. foreach (PropertyInfo property in properties)
  1535. {
  1536. string value = property.GetValue(airs[i]).ToString();
  1537. Cell ishcel0 = table.Rows[row].Cells[index];
  1538. Paragraph p = new Paragraph(doc);
  1539. string s = value;
  1540. p.AppendChild(new Run(doc, s));
  1541. p.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
  1542. ishcel0.AppendChild(p);
  1543. ishcel0.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;//垂直居中对齐
  1544. //ishcel0.CellFormat.VerticalAlignment=
  1545. index++;
  1546. }
  1547. row++;
  1548. }
  1549. #endregion
  1550. Paragraph lastParagraph = new Paragraph(doc);
  1551. //第一个表格末尾加段落
  1552. table.ParentNode.InsertAfter(lastParagraph, table);
  1553. //复制第一个表格
  1554. Table cloneTable = (Table)table.Clone(true);
  1555. //在文档末尾段落后面加入复制的表格
  1556. table.ParentNode.InsertAfter(cloneTable, lastParagraph);
  1557. if (item != _AirTicketReservations[_AirTicketReservations.Count - 1])
  1558. {
  1559. int rownewsIndex = 13;
  1560. for (int i = 0; i < 2; i++)
  1561. {
  1562. var CopyRow = table.Rows[12].Clone(true);
  1563. table.Rows.RemoveAt(13);
  1564. table.Rows.Add(CopyRow);
  1565. rownewsIndex++;
  1566. }
  1567. }
  1568. else
  1569. {
  1570. table.Rows.RemoveAt(12);
  1571. }
  1572. cloneTable.Rows.RemoveAt(12);
  1573. }
  1574. if (_AirTicketReservations.Count != 0)
  1575. {
  1576. string[] FlightsCode = _AirTicketReservations[0].FlightsCode.Split('/');
  1577. if (FlightsCode.Length != 0)
  1578. {
  1579. Res_AirCompany _AirCompany = _sqlSugar.Queryable<Res_AirCompany>().First(a => a.ShortCode == FlightsCode[0].Substring(0, 2));
  1580. if (_AirCompany != null)
  1581. {
  1582. string str = "--";
  1583. string translateResult = transDic.Where(s => s.Key == _AirCompany.CnName).FirstOrDefault().Value;
  1584. if (!string.IsNullOrEmpty(translateResult))
  1585. {
  1586. str = translateResult;
  1587. str = _airTicketResRep.Processing(str);
  1588. }
  1589. table.Range.Bookmarks["AirlineCompany"].Text = str;
  1590. }
  1591. else
  1592. {
  1593. table.Range.Bookmarks["AirlineCompany"].Text = "--";
  1594. }
  1595. }
  1596. table.Range.Bookmarks["AirlineRecordCode"].Text = "--";
  1597. table.Range.Bookmarks["ReservationRecordCode"].Text = "--";
  1598. string[] nameArray = Regex.Split(_AirTicketReservations[0].ClientName, "\\d+\\.", RegexOptions.IgnoreCase);
  1599. nameArray = nameArray.Where(str => str != "" && str != " " && !string.IsNullOrEmpty(str)).ToArray();
  1600. string names = "";
  1601. foreach (string clientName in nameArray)
  1602. {
  1603. names += clientName + ",";
  1604. }
  1605. if (!string.IsNullOrWhiteSpace(names))
  1606. {
  1607. string str = "--";
  1608. string translateResult = transDic.Where(s => s.Key == names).FirstOrDefault().Value;
  1609. if (!string.IsNullOrEmpty(translateResult))
  1610. {
  1611. str = translateResult;
  1612. str = _airTicketResRep.Processing(str);
  1613. }
  1614. table.Range.Bookmarks["ClientName"].Text = str;
  1615. }
  1616. else
  1617. {
  1618. table.Range.Bookmarks["ClientName"].Text = "--";
  1619. }
  1620. table.Range.Bookmarks["TicketNumber"].Text = "--";
  1621. table.Range.Bookmarks["IdentificationCode"].Text = "--";
  1622. table.Range.Bookmarks["JointTicket"].Text = "--";
  1623. table.Range.Bookmarks["TimeIssue"].Text = "--";
  1624. table.Range.Bookmarks["DrawingAgent"].Text = "--";
  1625. table.Range.Bookmarks["NavigationCode"].Text = "--";
  1626. table.Range.Bookmarks["AgentsAddress"].Text = "--";
  1627. table.Range.Bookmarks["AgentPhone"].Text = "--";
  1628. table.Range.Bookmarks["AgentFacsimile"].Text = "--";
  1629. }
  1630. doc.MailMerge.Execute(new[] { "PageCount" }, new object[] { doc.PageCount });
  1631. //保存合并后的文档
  1632. string fileName = "AirItinerary/电子客票英文行程单_EN.docx";
  1633. string rst = AppSettingsHelper.Get("WordBaseUrl") + AppSettingsHelper.Get("WordFtpPath") + fileName;
  1634. doc.Save(AppSettingsHelper.Get("WordBasePath") + fileName);
  1635. return Ok(JsonView(true, "成功!", rst));
  1636. }
  1637. }
  1638. }
  1639. catch (Exception ex)
  1640. {
  1641. return Ok(JsonView(false, "程序错误!"));
  1642. throw;
  1643. }
  1644. }
  1645. #endregion
  1646. #region 团组增减款项
  1647. /// <summary>
  1648. /// 团组增减款项下拉框绑定
  1649. /// </summary>
  1650. /// <param name="dto"></param>
  1651. /// <returns></returns>
  1652. [HttpPost]
  1653. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1654. public async Task<IActionResult> DecreasePaymentsSelect(DecreasePaymentsDto dto)
  1655. {
  1656. try
  1657. {
  1658. Result groupData = await _decreasePaymentsRep.DecreasePaymentsSelect(dto);
  1659. if (groupData.Code != 0)
  1660. {
  1661. return Ok(JsonView(false, groupData.Msg));
  1662. }
  1663. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1664. }
  1665. catch (Exception ex)
  1666. {
  1667. return Ok(JsonView(false, "程序错误!"));
  1668. throw;
  1669. }
  1670. }
  1671. /// <summary>
  1672. /// 根据团组Id查询团组增减款项
  1673. /// </summary>
  1674. /// <param name="dto"></param>
  1675. /// <returns></returns>
  1676. [HttpPost]
  1677. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1678. public async Task<IActionResult> DecreasePaymentsList(DecreasePaymentsListDto dto)
  1679. {
  1680. try
  1681. {
  1682. Result groupData = await _decreasePaymentsRep.DecreasePaymentsList(dto);
  1683. if (groupData.Code != 0)
  1684. {
  1685. return Ok(JsonView(false, groupData.Msg));
  1686. }
  1687. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1688. }
  1689. catch (Exception ex)
  1690. {
  1691. return Ok(JsonView(false, "程序错误!"));
  1692. throw;
  1693. }
  1694. }
  1695. /// <summary>
  1696. /// 团组增减款项操作(Status:1.新增,2.修改)
  1697. /// </summary>
  1698. /// <param name="dto"></param>
  1699. /// <returns></returns>
  1700. [HttpPost]
  1701. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1702. public async Task<IActionResult> OpDecreasePayments(DecreasePaymentsOpDto dto)
  1703. {
  1704. try
  1705. {
  1706. Result groupData = await _decreasePaymentsRep.OpDecreasePayments(dto);
  1707. if (groupData.Code != 0)
  1708. {
  1709. return Ok(JsonView(false, groupData.Msg));
  1710. }
  1711. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1712. }
  1713. catch (Exception ex)
  1714. {
  1715. return Ok(JsonView(false, "程序错误!"));
  1716. throw;
  1717. }
  1718. }
  1719. /// <summary>
  1720. /// 团组增减款项操作 删除
  1721. /// </summary>
  1722. /// <param name="dto"></param>
  1723. /// <returns></returns>
  1724. [HttpPost]
  1725. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1726. public async Task<IActionResult> DelDecreasePayments(DelBaseDto dto)
  1727. {
  1728. try
  1729. {
  1730. var res = await _decreasePaymentsRep.SoftDeleteByIdAsync<Grp_DecreasePayments>(dto.Id.ToString(), dto.DeleteUserId);
  1731. if (!res)
  1732. {
  1733. var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 98).SetColumns(a => new Grp_CreditCardPayment()
  1734. {
  1735. IsDel = 1,
  1736. DeleteUserId = dto.DeleteUserId,
  1737. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  1738. }).ExecuteCommandAsync();
  1739. return Ok(JsonView(false, "删除失败"));
  1740. }
  1741. return Ok(JsonView(true, "删除成功!"));
  1742. }
  1743. catch (Exception ex)
  1744. {
  1745. return Ok(JsonView(false, "程序错误!"));
  1746. throw;
  1747. }
  1748. }
  1749. /// <summary>
  1750. /// 根据团组增减款项Id查询
  1751. /// </summary>
  1752. /// <param name="dto"></param>
  1753. /// <returns></returns>
  1754. [HttpPost]
  1755. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1756. public async Task<IActionResult> QueryDecreasePaymentsById(DecreasePaymentsByIdDto dto)
  1757. {
  1758. try
  1759. {
  1760. Result groupData = await _decreasePaymentsRep.QueryDecreasePaymentsById(dto);
  1761. if (groupData.Code != 0)
  1762. {
  1763. return Ok(JsonView(false, groupData.Msg));
  1764. }
  1765. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1766. }
  1767. catch (Exception ex)
  1768. {
  1769. return Ok(JsonView(false, "程序错误!"));
  1770. throw;
  1771. }
  1772. }
  1773. #endregion
  1774. #region 文件上传、删除
  1775. /// <summary>
  1776. /// region 文件上传 可以带参数
  1777. /// </summary>
  1778. /// <param name="file"></param>
  1779. /// <returns></returns>
  1780. [HttpPost]
  1781. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1782. public async Task<IActionResult> UploadProject(IFormFile file)
  1783. {
  1784. try
  1785. {
  1786. var TypeName = Request.Headers["TypeName"].ToString();
  1787. if (file != null)
  1788. {
  1789. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  1790. //文件名称
  1791. string projectFileName = file.FileName;
  1792. //上传的文件的路径
  1793. string filePath = "";
  1794. if (TypeName == "A")//A代表团组增减款项
  1795. {
  1796. if (!Directory.Exists(fileDir))
  1797. {
  1798. Directory.CreateDirectory(fileDir);
  1799. }
  1800. //上传的文件的路径
  1801. filePath = fileDir + $@"\团组增减款项相关文件\{projectFileName}";
  1802. }
  1803. else if (TypeName == "B")//B代表商邀相关文件
  1804. {
  1805. if (!Directory.Exists(fileDir))
  1806. {
  1807. Directory.CreateDirectory(fileDir);
  1808. }
  1809. //上传的文件的路径
  1810. filePath = fileDir + $@"\商邀相关文件\{projectFileName}";
  1811. }
  1812. using (FileStream fs = System.IO.File.Create(filePath))
  1813. {
  1814. file.CopyTo(fs);
  1815. fs.Flush();
  1816. }
  1817. return Ok(JsonView(true, "上传成功!", projectFileName));
  1818. }
  1819. else
  1820. {
  1821. return Ok(JsonView(false, "上传失败!"));
  1822. }
  1823. }
  1824. catch (Exception ex)
  1825. {
  1826. return Ok(JsonView(false, "程序错误!"));
  1827. throw;
  1828. }
  1829. }
  1830. /// <summary>
  1831. /// 删除指定文件
  1832. /// </summary>
  1833. /// <param name="dto"></param>
  1834. /// <returns></returns>
  1835. [HttpPost]
  1836. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1837. public async Task<IActionResult> DelFile(DelFileDto dto)
  1838. {
  1839. try
  1840. {
  1841. var TypeName = Request.Headers["TypeName"].ToString();
  1842. string filePath = "";
  1843. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  1844. // 返回与指定虚拟路径相对应的物理路径即绝对路径
  1845. int id = 0;
  1846. if (TypeName == "A")
  1847. {
  1848. filePath = fileDir + "/团组增减款项相关文件/" + dto.fileName;
  1849. // 删除该文件
  1850. System.IO.File.Delete(filePath);
  1851. id = await _sqlSugar.Updateable<Grp_DecreasePayments>().Where(a => a.Id == dto.Id).SetColumns(a => new Grp_DecreasePayments { FilePath = "" }).ExecuteCommandAsync();
  1852. }
  1853. else if (TypeName == "B")
  1854. {
  1855. filePath = fileDir + "/商邀相关文件/" + dto.fileName;
  1856. // 删除该文件
  1857. System.IO.File.Delete(filePath);
  1858. id = await _sqlSugar.Updateable<Grp_InvitationOfficialActivities>().Where(a => a.Id == dto.Id).SetColumns(a => new Grp_InvitationOfficialActivities { Attachment = "" }).ExecuteCommandAsync();
  1859. }
  1860. if (id != 0)
  1861. {
  1862. return Ok(JsonView(true, "成功!"));
  1863. }
  1864. else
  1865. {
  1866. return Ok(JsonView(false, "失败!"));
  1867. }
  1868. }
  1869. catch (Exception ex)
  1870. {
  1871. return Ok(JsonView(false, "程序错误!"));
  1872. throw;
  1873. }
  1874. }
  1875. #endregion
  1876. #region 商邀费用录入
  1877. /// <summary>
  1878. /// 根据团组Id查询商邀费用列表
  1879. /// </summary>
  1880. /// <param name="dto"></param>
  1881. /// <returns></returns>
  1882. [HttpPost]
  1883. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1884. public async Task<IActionResult> InvitationOfficialActivitiesList(InvitationOfficialActivitiesListDto dto)
  1885. {
  1886. try
  1887. {
  1888. Result groupData = await _InvitationOfficialActivitiesRep.InvitationOfficialActivitiesList(dto);
  1889. if (groupData.Code != 0)
  1890. {
  1891. return Ok(JsonView(false, groupData.Msg));
  1892. }
  1893. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1894. }
  1895. catch (Exception ex)
  1896. {
  1897. return Ok(JsonView(false, "程序错误!"));
  1898. throw;
  1899. }
  1900. }
  1901. /// <summary>
  1902. /// 根据商邀费用ID查询C表和商邀费用数据
  1903. /// </summary>
  1904. /// <param name="dto"></param>
  1905. /// <returns></returns>
  1906. [HttpPost]
  1907. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1908. public async Task<IActionResult> InvitationOfficialActivitiesById(InvitationOfficialActivitiesByIdDto dto)
  1909. {
  1910. try
  1911. {
  1912. Result groupData = await _InvitationOfficialActivitiesRep.InvitationOfficialActivitiesById(dto);
  1913. if (groupData.Code != 0)
  1914. {
  1915. return Ok(JsonView(false, groupData.Msg));
  1916. }
  1917. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1918. }
  1919. catch (Exception ex)
  1920. {
  1921. return Ok(JsonView(false, "程序错误!"));
  1922. throw;
  1923. }
  1924. }
  1925. /// <summary>
  1926. /// 商邀费用录入操作(Status:1.新增,2.修改)
  1927. /// </summary>
  1928. /// <param name="dto"></param>
  1929. /// <returns></returns>
  1930. [HttpPost]
  1931. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1932. public async Task<IActionResult> OpInvitationOfficialActivities(OpInvitationOfficialActivitiesDto dto)
  1933. {
  1934. try
  1935. {
  1936. Result groupData = await _InvitationOfficialActivitiesRep.OpInvitationOfficialActivities(dto);
  1937. if (groupData.Code != 0)
  1938. {
  1939. return Ok(JsonView(false, groupData.Msg));
  1940. }
  1941. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1942. }
  1943. catch (Exception ex)
  1944. {
  1945. return Ok(JsonView(false, "程序错误!"));
  1946. throw;
  1947. }
  1948. }
  1949. /// <summary>
  1950. /// 商邀删除
  1951. /// </summary>
  1952. /// <param name="dto"></param>
  1953. /// <returns></returns>
  1954. [HttpPost]
  1955. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1956. public async Task<IActionResult> DelInvitationOfficialActivities(DelBaseDto dto)
  1957. {
  1958. try
  1959. {
  1960. var res = await _InvitationOfficialActivitiesRep.SoftDeleteByIdAsync<Grp_InvitationOfficialActivities>(dto.Id.ToString(), dto.DeleteUserId);
  1961. if (!res)
  1962. {
  1963. var result = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.Id && a.CTable == 81).SetColumns(a => new Grp_CreditCardPayment()
  1964. {
  1965. IsDel = 1,
  1966. DeleteUserId = dto.DeleteUserId,
  1967. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  1968. }).ExecuteCommandAsync();
  1969. return Ok(JsonView(false, "删除失败"));
  1970. }
  1971. return Ok(JsonView(true, "删除成功!"));
  1972. }
  1973. catch (Exception ex)
  1974. {
  1975. return Ok(JsonView(false, "程序错误!"));
  1976. throw;
  1977. }
  1978. }
  1979. #endregion
  1980. #region 团组英文资料
  1981. /// <summary>
  1982. /// 查询团组英文所有资料
  1983. /// </summary>
  1984. /// <param name="dto"></param>
  1985. /// <returns></returns>
  1986. [HttpPost]
  1987. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  1988. public async Task<IActionResult> QueryDelegationEnData(QueryDelegationEnDataDto dto)
  1989. {
  1990. try
  1991. {
  1992. Result groupData = await _delegationEnDataRep.QueryDelegationEnData(dto);
  1993. if (groupData.Code != 0)
  1994. {
  1995. return Ok(JsonView(false, groupData.Msg));
  1996. }
  1997. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  1998. }
  1999. catch (Exception ex)
  2000. {
  2001. return Ok(JsonView(false, "程序错误!"));
  2002. throw;
  2003. }
  2004. }
  2005. /// <summary>
  2006. /// 团组英文资料操作(Status:1.新增,2.修改)
  2007. /// </summary>
  2008. /// <param name="dto"></param>
  2009. /// <returns></returns>
  2010. [HttpPost]
  2011. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2012. public async Task<IActionResult> OpDelegationEnData(OpDelegationEnDataDto dto)
  2013. {
  2014. try
  2015. {
  2016. Result groupData = await _delegationEnDataRep.OpDelegationEnData(dto);
  2017. if (groupData.Code != 0)
  2018. {
  2019. return Ok(JsonView(false, groupData.Msg));
  2020. }
  2021. return Ok(JsonView(true, groupData.Msg, groupData.Data));
  2022. }
  2023. catch (Exception ex)
  2024. {
  2025. return Ok(JsonView(false, "程序错误!"));
  2026. throw;
  2027. }
  2028. }
  2029. /// <summary>
  2030. /// 团组英文资料Id查询数据
  2031. /// </summary>
  2032. /// <param name="dto"></param>
  2033. /// <returns></returns>
  2034. [HttpPost]
  2035. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2036. public async Task<IActionResult> QueryDelegationEnDataById(QueryDelegationEnDataByIdDto dto)
  2037. {
  2038. try
  2039. {
  2040. Grp_DelegationEnData _DelegationEnData = await _sqlSugar.Queryable<Grp_DelegationEnData>().FirstAsync(it => it.Id == dto.Id && it.IsDel == 0);
  2041. if (_DelegationEnData != null)
  2042. {
  2043. return Ok(JsonView(true, "查询成功!", _DelegationEnData));
  2044. }
  2045. return Ok(JsonView(true, "暂无数据!", _DelegationEnData));
  2046. }
  2047. catch (Exception ex)
  2048. {
  2049. return Ok(JsonView(false, "程序错误!"));
  2050. throw;
  2051. }
  2052. }
  2053. /// <summary>
  2054. /// 团组英文资料删除
  2055. /// </summary>
  2056. /// <param name="dto"></param>
  2057. /// <returns></returns>
  2058. [HttpPost]
  2059. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2060. public async Task<IActionResult> DelDelegationEnData(DelBaseDto dto)
  2061. {
  2062. try
  2063. {
  2064. var res = await _delegationEnDataRep.SoftDeleteByIdAsync<Grp_DelegationEnData>(dto.Id.ToString(), dto.DeleteUserId);
  2065. if (!res)
  2066. {
  2067. return Ok(JsonView(false, "删除失败"));
  2068. }
  2069. return Ok(JsonView(true, "删除成功!"));
  2070. }
  2071. catch (Exception ex)
  2072. {
  2073. return Ok(JsonView(false, "程序错误!"));
  2074. throw;
  2075. }
  2076. }
  2077. #endregion
  2078. #region 导出邀请函
  2079. /// <summary>
  2080. /// 导出邀请函页面初始化
  2081. /// </summary>
  2082. /// <param name="dto"></param>
  2083. /// <returns></returns>
  2084. [HttpPost]
  2085. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2086. public async Task<IActionResult> QueryinvitationLetter(DecreasePaymentsListDto dto)
  2087. {
  2088. try
  2089. {
  2090. List<Grp_DelegationInfo> grp_Delegations = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).OrderBy(a => a.Id, OrderByType.Desc).ToListAsync();
  2091. List<Crm_DeleClient> crm_Deles = new List<Crm_DeleClient>();
  2092. if (dto.DiId == 0)
  2093. {
  2094. crm_Deles = await _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.DiId == grp_Delegations[0].Id && a.IsDel == 0).ToListAsync();
  2095. }
  2096. else
  2097. {
  2098. crm_Deles = await _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.DiId == dto.DiId && a.IsDel == 0).ToListAsync();
  2099. }
  2100. return Ok(JsonView(true, "查询成功!", new
  2101. {
  2102. deleClient = crm_Deles,
  2103. delegations = grp_Delegations
  2104. }));
  2105. }
  2106. catch (Exception ex)
  2107. {
  2108. return Ok(JsonView(false, "程序错误!"));
  2109. throw;
  2110. }
  2111. }
  2112. /// <summary>
  2113. /// 导出邀请函
  2114. /// </summary>
  2115. /// <param name="dto"></param>
  2116. /// <returns></returns>
  2117. [HttpPost]
  2118. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2119. public async Task<IActionResult> invitationLetter(DecreasePaymentsListDto dto)
  2120. {
  2121. try
  2122. {
  2123. Dictionary<string, string> transDic = new Dictionary<string, string>();
  2124. List<Crm_DeleClient> crm_DeleClients = await _sqlSugar.Queryable<Crm_DeleClient>().Where(a => a.DiId == dto.DiId && a.IsDel == 0).ToListAsync();
  2125. List<string> texts = new List<string>();
  2126. if (crm_DeleClients.Count != 0)
  2127. {
  2128. foreach (Crm_DeleClient item in crm_DeleClients)
  2129. {
  2130. if (!string.IsNullOrWhiteSpace(item.Pinyin))
  2131. {
  2132. transDic.Add(item.LastName + item.FirstName, item.Pinyin);
  2133. }
  2134. else
  2135. {
  2136. string name = item.LastName + item.FirstName;
  2137. texts.Add(name);
  2138. }
  2139. if (!string.IsNullOrEmpty(item.Job) && !texts.Contains(item.Job))
  2140. {
  2141. if (!transDic.ContainsKey(item.Job))
  2142. {
  2143. texts.Add(item.Job);
  2144. }
  2145. }
  2146. if (item.CrmCompanyId != 0)
  2147. {
  2148. Crm_CustomerCompany crm_Customer = await _sqlSugar.Queryable<Crm_CustomerCompany>().FirstAsync(a => a.Id == item.CrmCompanyId && a.IsDel == 0);
  2149. if (!transDic.ContainsKey(crm_Customer.CompanyName))
  2150. {
  2151. texts.Add(crm_Customer.CompanyName);
  2152. }
  2153. }
  2154. }
  2155. List<TranslateResult> transData = _airTicketResRep.ReTransBatch(texts, "en");
  2156. if (transData.Count > 0)
  2157. {
  2158. foreach (TranslateResult item in transData)
  2159. {
  2160. if (!transDic.ContainsKey(item.Query))
  2161. {
  2162. transDic.Add(item.Query, item.Translation);
  2163. }
  2164. }
  2165. }
  2166. List<guestList> list = new List<guestList>();
  2167. foreach (Crm_DeleClient dele in crm_DeleClients)
  2168. {
  2169. guestList guestList = new guestList();
  2170. if (!string.IsNullOrWhiteSpace(dele.Pinyin))
  2171. {
  2172. guestList.Name = dele.Pinyin;
  2173. }
  2174. else
  2175. {
  2176. string Name = transDic.Where(s => s.Key == dele.LastName + dele.FirstName).FirstOrDefault().Value;
  2177. guestList.Name = Name;
  2178. }
  2179. if (dele.Sex == 0)
  2180. {
  2181. guestList.Sex = "Male";
  2182. }
  2183. else if (dele.Sex == 1)
  2184. {
  2185. guestList.Sex = "Female";
  2186. }
  2187. guestList.DOB = dele.BirthDay.Replace('-', '.');
  2188. Crm_CustomerCompany crm_Customer = await _sqlSugar.Queryable<Crm_CustomerCompany>().FirstAsync(a => a.Id == dele.CrmCompanyId && a.IsDel == 0);
  2189. string jobName = transDic.Where(s => s.Key == crm_Customer.CompanyName).FirstOrDefault().Value + " " + transDic.Where(s => s.Key == dele.Job).FirstOrDefault().Value;
  2190. guestList.Job = jobName;
  2191. list.Add(guestList);
  2192. }
  2193. //载入模板
  2194. Document doc = new Document(AppSettingsHelper.Get("WordBasePath") + "Template/邀请函模板0210.docx");
  2195. DocumentBuilder builder = new DocumentBuilder(doc);
  2196. //获取word里所有表格
  2197. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  2198. //获取所填表格的序数
  2199. Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
  2200. var rowStart = tableOne.Rows[0]; //获取第1行
  2201. //循环赋值
  2202. for (int i = 0; i < list.Count; i++)
  2203. {
  2204. builder.MoveToCell(0, i + 1, 0, 0);
  2205. builder.Write(list[i].Name.ToString());
  2206. builder.MoveToCell(0, i + 1, 1, 0);
  2207. builder.Write(list[i].Sex.ToString());
  2208. builder.MoveToCell(0, i + 1, 2, 0);
  2209. builder.Write(list[i].DOB.ToString());
  2210. builder.MoveToCell(0, i + 1, 3, 0);
  2211. builder.Write(list[i].Job.ToString());
  2212. }
  2213. //删除多余行
  2214. while (tableOne.Rows.Count > list.Count + 1)
  2215. {
  2216. tableOne.Rows.RemoveAt(list.Count + 1);
  2217. }
  2218. var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
  2219. string fileName = "邀请函" + DateTime.Now.ToString("yyyy-MM-dd") + ".docx";
  2220. string filePath = fileDir + $@"商邀相关文件/{fileName}";
  2221. doc.Save(filePath);
  2222. string Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/GrpFile/商邀相关文件" + fileName;
  2223. return Ok(JsonView(true, "成功!", Url));
  2224. }
  2225. else
  2226. {
  2227. return Ok(JsonView(false, "失败,该团组没有客户名单!"));
  2228. }
  2229. }
  2230. catch (Exception ex)
  2231. {
  2232. return Ok(JsonView(false, "程序错误!"));
  2233. throw;
  2234. }
  2235. }
  2236. #endregion
  2237. #region 团组经理模块 出入境费用
  2238. ///// <summary>
  2239. ///// 团组模块 - 出入境费用
  2240. ///// </summary>
  2241. ///// <returns></returns>
  2242. //[HttpPost]
  2243. //[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2244. //public async Task<IActionResult> SetEnterExitCostCurrencyChange()
  2245. //{
  2246. // try
  2247. // {
  2248. // var data = await _enterExitCostRep.SetEnterExitCostCurrencyChange();
  2249. // if (data.Code != 0)
  2250. // {
  2251. // return Ok(JsonView(false, data.Msg));
  2252. // }
  2253. // return Ok(JsonView(true, "查询成功!"));
  2254. // }
  2255. // catch (Exception ex)
  2256. // {
  2257. // return Ok(JsonView(false, ex.Message));
  2258. // throw;
  2259. // }
  2260. //}
  2261. /// <summary>
  2262. /// 团组模块 - 出入境费用 - 子项 地区更改为 nationalTravelFee 的id
  2263. /// </summary>
  2264. /// <returns></returns>
  2265. [HttpPost]
  2266. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2267. public async Task<IActionResult> SetDayAndCostAreaChange()
  2268. {
  2269. try
  2270. {
  2271. var nationalTravelFee = await _sqlSugar.Queryable<Grp_NationalTravelFee>().ToListAsync();
  2272. var dayAndCost = await _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0).ToListAsync();
  2273. var unite = dayAndCost.Where(a => nationalTravelFee.Any(b => a.Place.Trim() == b.City)).ToList(); //交集
  2274. var merge = dayAndCost.Where(a => !nationalTravelFee.Any(b => a.Place.Trim() == b.City)).ToList(); //差集
  2275. foreach (var item in unite) //处理交集数据
  2276. {
  2277. dayAndCost.Where(it => it.Id == item.Id).FirstOrDefault().NationalTravelFeeId = nationalTravelFee.Where(it => it.City.Trim() == item.Place.Trim()).FirstOrDefault().Id;
  2278. }
  2279. foreach (var item in merge) //处理差集数据
  2280. {
  2281. int nationalTravelFeeId = 0;
  2282. var cityData = nationalTravelFee.Where(it => it.City.Trim() == item.Place.Trim()).FirstOrDefault();
  2283. if (cityData != null) nationalTravelFeeId = cityData.Id;
  2284. else
  2285. {
  2286. var countryData = nationalTravelFee.Where(it => it.Country.Trim() == item.Place.Trim()).FirstOrDefault();
  2287. if (countryData != null) nationalTravelFeeId = countryData.Id;
  2288. }
  2289. dayAndCost.Where(it => it.Id == item.Id).FirstOrDefault().NationalTravelFeeId = nationalTravelFeeId;
  2290. }
  2291. //只更新dayAndCost 的 nationalTravelFeeId;
  2292. var result = _sqlSugar.Updateable(dayAndCost).UpdateColumns(it => new { it.NationalTravelFeeId }).ExecuteCommand();
  2293. if (result > 0) return Ok(JsonView(true, "nationalTravelFeeId列更新成功!"));
  2294. else return Ok(JsonView(false, "nationalTravelFeeId列更新失败!"));
  2295. }
  2296. catch (Exception ex)
  2297. {
  2298. return Ok(JsonView(false, ex.Message));
  2299. throw;
  2300. }
  2301. }
  2302. /// <summary>
  2303. /// 团组模块 - 出入境费用 - 基础数据源(团组名称/币种类型)
  2304. /// </summary>
  2305. /// <returns></returns>
  2306. [HttpPost]
  2307. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2308. public async Task<IActionResult> GetEnterExitCostDataSource(PortDtoBase dto)
  2309. {
  2310. try
  2311. {
  2312. var groupNameData = await _groupRepository.GetGroupNameList(new GroupNameDto { PortType = dto.PortType });
  2313. string currencySql = string.Format("Select * From Sys_SetData Where STid = 66 And IsDel = 0");
  2314. var currencyData = await _sqlSugar.SqlQueryable<SetDataInfoView>(currencySql).ToListAsync();
  2315. //string nationalTravelFeeSql = string.Format(@"Select ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.* From Grp_NationalTravelFee gntf
  2316. // Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
  2317. // Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id
  2318. // Where gntf.Isdel = 0");
  2319. //var nationalTravelFeeData = await _sqlSugar.SqlQueryable<NationalTravelFeeInfoView>(nationalTravelFeeSql).ToListAsync();
  2320. return Ok(JsonView(true, "查询成功!", new
  2321. {
  2322. GroupNameData = groupNameData.Data,
  2323. CurrencyData = currencyData,
  2324. //NationalTravelFeeData = nationalTravelFeeData
  2325. }));
  2326. }
  2327. catch (Exception ex)
  2328. {
  2329. return Ok(JsonView(false, ex.Message));
  2330. throw;
  2331. }
  2332. }
  2333. /// <summary>
  2334. /// 团组模块 - 出入境费用 - Info
  2335. /// </summary>
  2336. /// <returns></returns>
  2337. [HttpPost]
  2338. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2339. public async Task<IActionResult> GetEnterExitCostInfobyDiId(EnterExitCostInfobyDiIdDto dto)
  2340. {
  2341. try
  2342. {
  2343. var data = await _enterExitCostRep.GetEnterExitCostInfoByDiId(dto);
  2344. if (data.Code != 0)
  2345. {
  2346. return Ok(JsonView(false, data.Msg));
  2347. }
  2348. return Ok(JsonView(true, "查询成功!", data.Data));
  2349. }
  2350. catch (Exception ex)
  2351. {
  2352. return Ok(JsonView(false, ex.Message));
  2353. }
  2354. }
  2355. /// <summary>
  2356. /// 团组模块 - 出入境费用 - Add And Update
  2357. /// </summary>
  2358. /// <returns></returns>
  2359. [HttpPost]
  2360. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2361. public async Task<IActionResult> PostEnterExitCostOperate(EnterExitCostOperateDto dto)
  2362. {
  2363. try
  2364. {
  2365. var data = await _enterExitCostRep.PostEnterExitCostOperate(dto);
  2366. if (data.Code != 0)
  2367. {
  2368. return Ok(JsonView(false, data.Msg));
  2369. }
  2370. return Ok(JsonView(true, data.Msg, data.Data));
  2371. }
  2372. catch (Exception ex)
  2373. {
  2374. return Ok(JsonView(false, ex.Message));
  2375. }
  2376. }
  2377. /// <summary>
  2378. /// 团组模块 - 出入境费用 - 子项删除
  2379. /// </summary>
  2380. /// <returns></returns>
  2381. [HttpPost]
  2382. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2383. public async Task<IActionResult> PostEnterExitCostSubItemDel(EnterExitCostSubItemDelDto dto)
  2384. {
  2385. try
  2386. {
  2387. var data = await _enterExitCostRep.PostEnterExitCostSubItemDel(dto);
  2388. if (data.Code != 0)
  2389. {
  2390. return Ok(JsonView(false, data.Msg));
  2391. }
  2392. return Ok(JsonView(true, "操作成功!", data.Data));
  2393. }
  2394. catch (Exception ex)
  2395. {
  2396. return Ok(JsonView(false, ex.Message));
  2397. }
  2398. }
  2399. /// <summary>
  2400. /// 团组模块 - 出入境国家费用标准 List
  2401. /// </summary>
  2402. /// <returns></returns>
  2403. [HttpPost]
  2404. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2405. public async Task<IActionResult> GetNationalTravelFeeData(PortDtoBase dto)
  2406. {
  2407. try
  2408. {
  2409. Stopwatch sw = new Stopwatch();
  2410. sw.Start();
  2411. string nationalTravelFeeSql = string.Format(@"Select ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.* From Grp_NationalTravelFee gntf
  2412. Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
  2413. Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id
  2414. Where gntf.Isdel = 0");
  2415. var nationalTravelFeeData = await _sqlSugar.SqlQueryable<NationalTravelFeeInfoView>(nationalTravelFeeSql).ToListAsync();
  2416. //var nationalTravel = nationalTravelFeeData.GroupBy(it => it.Country).Select(it1 => it1.FirstOrDefault());
  2417. //List<dynamic> nationalTravelFeeData1 = new List<dynamic>();
  2418. //foreach (var item in nationalTravel)
  2419. //{
  2420. // var cityData = nationalTravelFeeData.Where(it => it.Country == item.Country).ToList();
  2421. // var otherData = cityData.Where(it => it.City.Contains("其他城市")).FirstOrDefault();
  2422. // if (otherData != null)
  2423. // {
  2424. // cityData.Remove(otherData);
  2425. // cityData.Add(otherData);
  2426. // }
  2427. // nationalTravelFeeData1.Add(new
  2428. // {
  2429. // Country = item.Country,
  2430. // CityData = cityData
  2431. // });
  2432. //}
  2433. sw.Stop();
  2434. return Ok(JsonView(true, "查询成功!耗时:" + sw.ElapsedMilliseconds + "ms", nationalTravelFeeData));
  2435. }
  2436. catch (Exception ex)
  2437. {
  2438. return Ok(JsonView(false, ex.Message));
  2439. throw;
  2440. }
  2441. }
  2442. /// <summary>
  2443. /// 团组模块 - 出入境国家费用标准 Page List Data Source
  2444. /// </summary>
  2445. /// <returns></returns>
  2446. [HttpPost]
  2447. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2448. public async Task<IActionResult> GetNationalTravelFeePageDataSource()
  2449. {
  2450. string sql = string.Format(@"Select * From Grp_NationalTravelFee Where Isdel = 0 ");
  2451. var nationalTravelFeeData = await _groupRepository._sqlSugar.SqlQueryable<Grp_NationalTravelFee>(sql).ToListAsync();
  2452. List<string> countryData = new List<string>();
  2453. countryData.AddRange( nationalTravelFeeData.Select(it => it.Country ).ToList());
  2454. countryData = countryData.Distinct().ToList();
  2455. List<dynamic> dataSource = new List<dynamic>();
  2456. foreach (var item in countryData)
  2457. {
  2458. List<string> cityData1 = new List<string>();
  2459. cityData1 = nationalTravelFeeData.Where(it => it.Country == item).Select(it => it.City).ToList();
  2460. var countryData2 = new
  2461. {
  2462. CountryName = item,
  2463. CityData = cityData1
  2464. };
  2465. dataSource.Add(countryData2);
  2466. }
  2467. return Ok(JsonView(true, "查询成功!", dataSource));
  2468. }
  2469. /// <summary>
  2470. /// 团组模块 - 出入境国家费用标准 Page List
  2471. /// </summary>
  2472. /// <returns></returns>
  2473. [HttpPost]
  2474. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2475. public async Task<IActionResult> PostNationalTravelFeePage(NationalTravelFeePageDto dto)
  2476. {
  2477. int portId = dto.PortType;
  2478. if (portId != 1 && portId != 2 && portId != 3) return Ok(JsonView(false, "请输入正确的端口号!\r\n请求端口分类1 Web 2 Android 3 IOS"));
  2479. if (dto.PageIndex == 0) return Ok(JsonView(false, "当前页码数不能为0!"));
  2480. if (dto.PageSize == 0) return Ok(JsonView(false, "每页条数不能0!"));
  2481. string whereSql = string.Empty;
  2482. if (!string.IsNullOrEmpty(dto.Country))
  2483. {
  2484. whereSql += string.Format(@" And gntf.Country ='{0}'", dto.Country);
  2485. }
  2486. if (!string.IsNullOrEmpty(dto.City))
  2487. {
  2488. whereSql += string.Format(@" And gntf.City='{0}'", dto.City);
  2489. }
  2490. string pageSql = string.Format(@"Select * From (
  2491. Select row_number() over(order by gntf.LastUpdateTime Desc) as RowNumber,
  2492. ssd.Name as CurrencyCode, ssd.Remark as CurrencyName,su.CnName as LastUpdateUserName,gntf.*
  2493. From Grp_NationalTravelFee gntf
  2494. Left Join Sys_SetData ssd On ssd.STid = 66 And gntf.Currency = ssd.Id
  2495. Left Join Sys_Users su On gntf.LastUpdateUserId = su.Id
  2496. Where gntf.Isdel = 0 {0} ) temp ", whereSql);
  2497. RefAsync<int> total = 0;
  2498. var nationalTravelFeeData = await _groupRepository._sqlSugar.SqlQueryable<NationalTravelFeePageInfoView>(pageSql).ToPageListAsync(dto.PageIndex, dto.PageSize, total);
  2499. return Ok(JsonView(true, "查询成功!", nationalTravelFeeData, (int)total));
  2500. }
  2501. /// <summary>
  2502. /// 团组模块 - 出入境国家费用标准 - Add Or Update
  2503. /// </summary>
  2504. /// <returns></returns>
  2505. [HttpPost]
  2506. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2507. public async Task<IActionResult> PostNationalTravelFeeOperate(NationalTravelFeeOperateDto dto)
  2508. {
  2509. try
  2510. {
  2511. var data = await _enterExitCostRep.PostNationalTravelFeeOperate(dto);
  2512. if (data.Code != 0)
  2513. {
  2514. return Ok(JsonView(false, data.Msg));
  2515. }
  2516. return Ok(JsonView(true, "操作成功!", data.Data));
  2517. }
  2518. catch (Exception ex)
  2519. {
  2520. return Ok(JsonView(false, ex.Message));
  2521. }
  2522. }
  2523. /// <summary>
  2524. /// 团组模块 - 出入境国家费用标准 - Del
  2525. /// </summary>
  2526. /// <returns></returns>
  2527. [HttpPost]
  2528. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  2529. public async Task<IActionResult> PostNationalTravelFeeDel(NationalTravelFeeDelDto dto)
  2530. {
  2531. try
  2532. {
  2533. Grp_NationalTravelFee _nationalTravelFee = new Grp_NationalTravelFee() {
  2534. Id = dto.Id,
  2535. DeleteUserId = dto.DeleteUserId,
  2536. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd"),
  2537. IsDel = 1
  2538. };
  2539. var delStatus = await _enterExitCostRep._sqlSugar.Updateable<Grp_NationalTravelFee>(_nationalTravelFee)
  2540. .UpdateColumns(it => new { it.DeleteTime, it.DeleteUserId, it.IsDel })
  2541. .WhereColumns(it => new { it.Id })
  2542. .ExecuteCommandAsync();
  2543. if (delStatus <= 0)
  2544. {
  2545. return Ok(JsonView(false, "删除失败!"));
  2546. }
  2547. return Ok(JsonView(true, "操作成功!"));
  2548. }
  2549. catch (Exception ex)
  2550. {
  2551. return Ok(JsonView(false, ex.Message));
  2552. }
  2553. }
  2554. #endregion
  2555. }
  2556. }