GroupsController.cs 143 KB

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