GeneralMethod.cs 246 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138
  1. 
  2. using Aspose.Cells;
  3. using Aspose.Words;
  4. using Aspose.Words.Layout;
  5. using Aspose.Words.Saving;
  6. using Microsoft.AspNetCore.SignalR;
  7. using Microsoft.International.Converters.PinYinConverter;
  8. using NodaTime.TimeZones;
  9. using NodaTime;
  10. using OASystem.API.OAMethodLib.APNs;
  11. using OASystem.API.OAMethodLib.File;
  12. using OASystem.API.OAMethodLib.Hub.HubClients;
  13. using OASystem.API.OAMethodLib.Hub.Hubs;
  14. using OASystem.API.OAMethodLib.JuHeAPI;
  15. using OASystem.API.OAMethodLib.SignalR.Hubs;
  16. using OASystem.Domain.Dtos.Groups;
  17. using OASystem.Domain.Entities.Customer;
  18. using OASystem.Domain.Entities.Financial;
  19. using OASystem.Domain.Entities.Groups;
  20. using OASystem.Domain.ViewModels.Financial;
  21. using OASystem.Domain.ViewModels.Groups;
  22. using OASystem.Domain.ViewModels.JuHeExchangeRate;
  23. using OASystem.Infrastructure.Repositories.CRM;
  24. using OASystem.Infrastructure.Repositories.Groups;
  25. using OASystem.Infrastructure.Repositories.Login;
  26. using OfficeOpenXml;
  27. using System.Data;
  28. using System.IdentityModel.Tokens.Jwt;
  29. using System.Security.Claims;
  30. using NodaTime.Extensions;
  31. using OASystem.Domain.AesEncryption;
  32. namespace OASystem.API.OAMethodLib
  33. {
  34. public static class GeneralMethod
  35. {
  36. //团组信息
  37. private static readonly SqlSugarClient _sqlSugar = AutofacIocManager.Instance.GetService<SqlSugarClient>();
  38. private static readonly DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
  39. private static readonly TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
  40. private static readonly IJuHeApiService _juHeApi = AutofacIocManager.Instance.GetService<IJuHeApiService>();
  41. private static readonly SetDataRepository _setDataRep = AutofacIocManager.Instance.GetService<SetDataRepository>();
  42. private static readonly TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
  43. private static readonly MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
  44. private static readonly IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
  45. private readonly static string[] weekdays = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
  46. #region 员工注册默认添加基础页面
  47. /// <summary>
  48. /// 默认职位权限
  49. /// </summary>
  50. public static bool DefaultPostAuth(int depId, int postId, int userId, int createUserId)
  51. {
  52. if (depId < 1) return false;
  53. if (postId < 1) return false;
  54. if (userId < 1) return false;
  55. if (userId < 1) return false;
  56. List<DefaultPostPageAuthView> _defaultData = AppSettingsHelper.Get<DefaultPostPageAuthView>("DefaultPostPageData");
  57. if (_defaultData.Count < 1) return false;
  58. var postJobDatas = _dirRep._sqlSugar.Queryable<Sys_JobPost>().Where(it => it.IsDel == 0).ToList();
  59. List<int> pageData = new List<int>();
  60. //添加公司公共页面
  61. pageData.AddRange(_defaultData.Find(it => it.DepId == -1)?.PostPageAuths[0].PageIds ?? new List<int>());
  62. //添加部门页面
  63. var depPublicPageData = _defaultData.Find(it => it.DepId == depId);
  64. var jobPublicPageData = postJobDatas.Find(it => it.DepId == depId && it.Id == postId);
  65. if (depPublicPageData != null) //特殊部门
  66. {
  67. //公共页面
  68. pageData.AddRange(depPublicPageData.PostPageAuths.Find(it => it.PostId == -1)?.PageIds ?? new List<int>());
  69. if (depId == 7) //国交部特殊处理
  70. {
  71. List<string> postNames = new List<string>() { "主管", "经理" };
  72. //岗位页面
  73. if (jobPublicPageData != null)
  74. {
  75. if (postNames.Contains(jobPublicPageData.JobName))
  76. {
  77. pageData.AddRange(depPublicPageData.PostPageAuths.Find(it => it.PostId == 0)?.PageIds ?? new List<int>());
  78. }
  79. else
  80. {
  81. pageData.AddRange(depPublicPageData.PostPageAuths.Find(it => it.PostId == postId)?.PageIds ?? new List<int>());
  82. }
  83. }
  84. }
  85. }
  86. else //通用部门
  87. {
  88. pageData.AddRange(_defaultData.Find(it => it.DepId == 0)?.PostPageAuths[0].PageIds ?? new List<int>());
  89. }
  90. if (pageData.Count > 0)
  91. {
  92. //页面操作权限数据(添加修改等...)
  93. var pageFunctionData = _dirRep._sqlSugar.Queryable<Sys_SystemMenuAndFunction>().Where(it => pageData.Contains(it.SmId) && it.IsDel == 0).ToList();
  94. var defaultPageData = pageFunctionData.Select(it => new Sys_UserAuthority()
  95. {
  96. UId = userId,
  97. SmId = it.SmId,
  98. FId = it.FId,
  99. CreateUserId = createUserId, //管理员
  100. CreateTime = DateTime.Now,
  101. IsDel = 0,
  102. IsTemp = 1
  103. }).ToList();
  104. if (defaultPageData.Count > 0)
  105. {
  106. //移除每个页面的审核权限,审核权限需要单独开启
  107. defaultPageData = defaultPageData.Where(it => it.FId != 12).ToList();
  108. //添加页面操作权限
  109. var s = _dirRep._sqlSugar.Fastest<Sys_UserAuthority>().PageSize(100000).BulkCopy(defaultPageData);
  110. if (s > 0)
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. #endregion
  119. #region 消息
  120. /// <summary>
  121. /// 消息 发布And 通知
  122. /// </summary>
  123. /// <param name="msgTypeEnum">
  124. /// 消息类型
  125. /// 1 公告通知
  126. /// 2 团组流程管控通知
  127. /// 3 团组业务操作通知
  128. /// 4 团组费用审核消息
  129. /// 5 团组签证进度通知
  130. /// 6 团组任务进度通知
  131. /// 7 日付申请通知
  132. /// </param>
  133. /// <param name="title">消息标题</param>
  134. /// <param name="content">消息内容</param>
  135. /// <param name="userIds"></param>
  136. /// <param name="diId">团组id</param>
  137. /// <param name="param">团组id</param>
  138. /// <returns></returns>
  139. public static async Task<bool> MessageIssueAndNotification(MessageTypeEnum msgTypeEnum, string title, string content, List<int> userIds, int diId = 0, string param = "")
  140. {
  141. MessageDto messageDto = new()
  142. {
  143. Type = msgTypeEnum,
  144. IssuerId = 4,//管理员
  145. DiId = diId,
  146. Title = title,
  147. Content = content,
  148. ReleaseTime = DateTime.Now,
  149. UIdList = userIds,
  150. Param = param
  151. };
  152. var status = await _messageRep.AddMsg(messageDto);//添加消息
  153. if (status)
  154. {
  155. //给在线在用户发送消息
  156. var connIds = UserStore.OnlineUser.Where(it => userIds.Contains(it.UserId)).Select(it => it.ConnectionId).ToList();
  157. var notificationTypeStr1 = GetMsgNotificationType(msgTypeEnum);
  158. var notificationTypeStr = JsonConvert.SerializeObject(
  159. new
  160. {
  161. UserIds = userIds,
  162. Msg = $"您有一条{notificationTypeStr1}相关的消息!"
  163. }
  164. );
  165. await _hubContext.Clients.Clients(connIds).ReceiveMessage($"您有一条{notificationTypeStr1}相关的消息!");
  166. return true;
  167. }
  168. return false;
  169. }
  170. /// <summary>
  171. /// 根据消息类型 获取 消息通知类型
  172. /// </summary>
  173. /// <returns></returns>
  174. public static string GetMsgNotificationType(MessageTypeEnum msgTypeEnum)
  175. {
  176. int notificationType = 0;
  177. string notificationStr = "";
  178. List<NotificationTypeView> notificationTypeViews = AppSettingsHelper.Get<NotificationTypeView>("MessageNotificationType");
  179. notificationType = notificationTypeViews.Where(it => it.MsgTypeIds.Contains((int)msgTypeEnum)).Select(it => it.TypeId).FirstOrDefault();
  180. if (notificationType == 1021) notificationStr = "操作";
  181. else if (notificationType == 1020) notificationStr = "任务";
  182. return notificationStr;
  183. }
  184. #endregion
  185. #region md5 加密
  186. /// <summary>
  187. /// MD5加密,和动网上的16/32位MD5加密结果相同,
  188. /// 使用的UTF8编码
  189. /// </summary>
  190. /// <param name="source">待加密字串</param>
  191. /// <param name="length">16或32值之一,其它则采用.net默认MD5加密算法</param>
  192. /// <returns>加密后的字串</returns>
  193. public static string Encrypt(string source, int length = 32)
  194. {
  195. if (string.IsNullOrWhiteSpace(source))
  196. return string.Empty;
  197. HashAlgorithm hashAlgorithm = CryptoConfig.CreateFromName("MD5") as HashAlgorithm;
  198. byte[] bytes = Encoding.UTF8.GetBytes(source);
  199. byte[] hashValue = hashAlgorithm.ComputeHash(bytes);
  200. StringBuilder sb = new StringBuilder();
  201. switch (length)
  202. {
  203. case 16://16位密文是32位密文的9到24位字符
  204. for (int i = 4; i < 12; i++)
  205. {
  206. sb.Append(hashValue[i].ToString("x2"));
  207. }
  208. break;
  209. case 32:
  210. for (int i = 0; i < 16; i++)
  211. {
  212. sb.Append(hashValue[i].ToString("x2"));
  213. }
  214. break;
  215. default:
  216. for (int i = 0; i < hashValue.Length; i++)
  217. {
  218. sb.Append(hashValue[i].ToString("x2"));
  219. }
  220. break;
  221. }
  222. return sb.ToString();
  223. }
  224. #endregion
  225. #region jwt
  226. /// <summary>
  227. /// 获取token
  228. /// </summary>
  229. /// <param name="_config"></param>
  230. /// <param name="Number"></param>
  231. /// <param name="exp"></param>
  232. /// <returns></returns>
  233. public static async Task<string> GetToken(IConfiguration _config, string Number, int uId, string uName, DateTime exp)
  234. {
  235. string userId = Guid.NewGuid().ToString().Replace("-", "");
  236. var claims = new[] {
  237. new Claim(ClaimTypes.NameIdentifier, uName),
  238. new Claim(ClaimTypes.NameIdentifier, uId.ToString()),
  239. new Claim(ClaimTypes.NameIdentifier, userId),
  240. new Claim("Number",Number)
  241. };
  242. var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["JwtSecurityKey"]));
  243. var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
  244. var token = new JwtSecurityToken(
  245. issuer: "OASystem.com",
  246. audience: "OASystem.com",
  247. claims: claims,
  248. expires: exp,
  249. signingCredentials: creds);
  250. var identity = new ClaimsIdentity(claims, "login");
  251. var principal = new ClaimsPrincipal(identity);
  252. // await _httpContext.SignInAsync (CookieAuthenticationDefaults.AuthenticationScheme, principal);
  253. return new JwtSecurityTokenHandler().WriteToken(token);
  254. }
  255. #endregion
  256. #region 数据类型转换
  257. /// <summary>
  258. /// object 转 Int
  259. /// </summary>
  260. /// <param name="obj"></param>
  261. /// <returns></returns>
  262. public static int GetInt(this object obj)
  263. {
  264. if (obj == null)
  265. return 0;
  266. var number = 0;
  267. var reslut = Int32.TryParse(obj.ToString(), out number);
  268. return number;
  269. }
  270. private static DateTime _dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
  271. private static long _longTime = 621355968000000000;
  272. private static int _samllTime = 10000000;
  273. /// <summary>
  274. /// 时间戳 转 datetime
  275. /// </summary>
  276. /// <param name="timeStamp"></param>
  277. /// <returns></returns>
  278. public static DateTime GetTimeSpmpToDate(this object timeStamp)
  279. {
  280. if (timeStamp == null) return _dateStart;
  281. DateTime dateTime = new DateTime(_longTime + Convert.ToInt64(timeStamp) * _samllTime, DateTimeKind.Utc).ToLocalTime();
  282. return dateTime;
  283. }
  284. #endregion
  285. #region 用户页面操作功能 权限
  286. /// <summary>
  287. /// 用户页面操作功能(可使用)
  288. /// </summary>
  289. /// <param name="userId">用户Id</param>
  290. /// <param name="PageId">页面Id</param>
  291. /// <returns></returns>
  292. public static async Task<PageFunAuthViewBase> PostUserPageFuncDatas(int userId, int PageId)
  293. {
  294. PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
  295. List<UserPageFuncView> userPageFuncDatas = new List<UserPageFuncView>();
  296. string sql = string.Format(@"Select ua.UId As UserId, u.CnName As UserName, pa.ModuleId,pa.ModuleName,pa.PageId,pa.PageName,pa.PageIsEnable,
  297. pa.PagePhoneIsEnable,pa.FuncId,pa.FuncName,pa.FuncIsEnable
  298. From Sys_UserAuthority ua
  299. Left Join Sys_Users u On ua.UId = u.Id
  300. Left Join (
  301. Select sd.Id As ModuleId,sd.Name As ModuleName, smp.Id As PageId,smp.Name As PageName,smp.IsEnable As PageIsEnable,
  302. smp.phoneIsEnable As PagePhoneIsEnable,pfp.Id As FuncId,pfp.FunctionName As FuncName,pfp.IsEnable As FuncIsEnable
  303. From Sys_SystemMenuAndFunction smaf
  304. Left Join Sys_SystemMenuPermission smp On smaf.SmId = smp.Id
  305. Left Join Sys_SetData sd On sd.STid = 5 And smp.Mid = sd.Id
  306. Left Join Sys_PageFunctionPermission pfp On smaf.FId = pfp.Id
  307. Where smaf.IsDel = 0 And smp.IsDel = 0 And pfp.IsDel = 0 And sd.IsDel = 0 And smp.IsEnable = 1
  308. ) As pa On ua.SmId = pa.PageId And ua.FId = pa.FuncId
  309. Where ua.IsDel = 0 And ua.UId = {0} And pa.PageId = {1}
  310. Order By ModuleId,PageId,FuncId Asc", userId, PageId);
  311. userPageFuncDatas = await _dirRep._sqlSugar.SqlQueryable<UserPageFuncView>(sql).ToListAsync();
  312. if (userPageFuncDatas.Count <= 0)
  313. {
  314. return pageFunAuth;
  315. }
  316. UserPageFuncView userPageFunc = new UserPageFuncView();
  317. //查询 1
  318. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 1).FirstOrDefault();
  319. if (userPageFunc != null) pageFunAuth.CheckAuth = 1;
  320. //删除 2
  321. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 2).FirstOrDefault();
  322. if (userPageFunc != null) pageFunAuth.DeleteAuth = 1;
  323. //编辑 3
  324. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 3).FirstOrDefault();
  325. if (userPageFunc != null) pageFunAuth.EditAuth = 1;
  326. //下载 4
  327. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 4).FirstOrDefault();
  328. if (userPageFunc != null) pageFunAuth.FilesDownloadAuth = 1;
  329. //上传 5
  330. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 5).FirstOrDefault();
  331. if (userPageFunc != null) pageFunAuth.FilesUploadAuth = 1;
  332. //添加 11
  333. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 11).FirstOrDefault();
  334. if (userPageFunc != null) pageFunAuth.AddAuth = 1;
  335. //审核 12
  336. userPageFunc = userPageFuncDatas.Where(it => it.FuncId == 12).FirstOrDefault();
  337. if (userPageFunc != null) pageFunAuth.AuditAuth = 1;
  338. return pageFunAuth;
  339. }
  340. #endregion
  341. #region 业务模块 团组权限
  342. /// <summary>
  343. /// 业务模块 团组操作权限
  344. /// 验证 并返回可操作的团
  345. /// </summary>
  346. /// <param name="diId">团组Id</param>
  347. /// <param name="userId">用户Id</param>
  348. /// <param name="CTable">业务模块Id</param>
  349. /// <returns></returns>
  350. public static async Task<Result> PostGroupOperationAuth(int diId, int userId, int CTable)
  351. {
  352. Result _result = new Result { Code = -1, Msg = "No Operation Authorty!" };
  353. if (CTable < 1)
  354. {
  355. _result.Msg = "请填写正确的用户Id!";
  356. return _result;
  357. }
  358. var data = _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(it => it.DIId == diId && it.UId == userId && it.CTId == CTable && it.IsDel == 0).First();
  359. if (data == null)
  360. {
  361. _result.Msg = "你没有本团下的该业务模块操作,请联系主管分配操作权限!";
  362. }
  363. else
  364. {
  365. _result.Code = 0;
  366. }
  367. return _result;
  368. }
  369. /// <summary>
  370. /// 业务模块 团组操作权限
  371. /// 返回可操作的团
  372. /// </summary>
  373. /// <param name="diId">团组Id</param>
  374. /// <param name="userId">用户Id</param>
  375. /// <param name="CTable">业务模块Id</param>
  376. /// <returns></returns>
  377. public static async Task<List<Web_ShareGroupInfoView>> PostOperationAuthReturnGroupInfosAsync(int userId, int CTable)
  378. {
  379. var shareGroupInfoViews = new List<Web_ShareGroupInfoView>();
  380. var taskData = _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(it => it.UId == userId && it.CTId == CTable && it.IsDel == 0).ToList();
  381. if (taskData.Count < 1) return shareGroupInfoViews;
  382. var diIds = string.Join(",", taskData.Select(it => it.DIId).ToList());
  383. var sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber
  384. From Grp_DelegationInfo Where Id In({0}) And IsDel = 0 Order By Id Desc", diIds);
  385. shareGroupInfoViews = await _dirRep._sqlSugar.SqlQueryable<Web_ShareGroupInfoView>(sql).ToListAsync();
  386. return shareGroupInfoViews;
  387. }
  388. #endregion
  389. #region 团组相关
  390. #region 建团按国家默认添加汇率 / 默认权限分配
  391. /// <summary>
  392. /// 团组汇率
  393. /// 建团时 添加基础汇率 CNY
  394. /// 按国家 添加 默认币种
  395. /// </summary>
  396. /// <param name="userId"></param>
  397. /// <param name="diId"></param>
  398. /// <returns></returns>
  399. public static async Task<Result> PostGroupRateAddInit(int userId, int diId)
  400. {
  401. Result result = new() { Code = -2 };
  402. if (userId < 1)
  403. {
  404. result.Msg = string.Format(@"请传入正确的userId");
  405. return result;
  406. }
  407. if (diId < 1)
  408. {
  409. result.Msg = string.Format(@"请传入正确的DiId");
  410. return result;
  411. }
  412. //美元(USD):1.0000|欧元(EUR):1.0000|墨西哥比索(MXN):1.0000
  413. string rateInit = string.Format(@"人民币(CNY):1.0000");
  414. //var gropInfo = _dirRep._sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == diId).First();
  415. //if (gropInfo == null)
  416. //{
  417. // result.Msg = $@"未查询到团组信息!";
  418. // return result;
  419. //}
  420. var juheRateData = await _juHeApi.GetExchangeRateAsync();
  421. if (juheRateData.Error_code != 0)
  422. {
  423. result.Msg = juheRateData.Reason;
  424. return result;
  425. }
  426. List<ExchangeRateModel> exchangeRateModels = (List<ExchangeRateModel>)juheRateData.Result;
  427. if (exchangeRateModels.Count <= 0)
  428. {
  429. result.Msg = $@"未查询到聚合接口汇率信息!";
  430. return result;
  431. }
  432. if (exchangeRateModels.Count > 0)
  433. {
  434. var codes = _dirRep._sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
  435. for (int i = 0; i < exchangeRateModels.Count; i++)
  436. {
  437. string currencyName = exchangeRateModels[i].Name;
  438. string code = "";
  439. var currencyData = codes.Where(it => it.Remark == currencyName).FirstOrDefault();
  440. if (currencyData != null)
  441. {
  442. code = currencyData.Name;
  443. decimal currRate = 0.00M;
  444. string MSellPri = exchangeRateModels[i].MSellPri;
  445. if (!string.IsNullOrEmpty(MSellPri))
  446. {
  447. currRate = Convert.ToDecimal(MSellPri) / 100M;
  448. }
  449. rateInit += $@"|{currencyName}({code}):{currRate.ToString("#0.0000")}";
  450. }
  451. }
  452. }
  453. var cTableIds = _dirRep._sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 16).ToList();
  454. if (cTableIds.Count < 1)
  455. {
  456. result.Msg = $@"未查询到操作模块信息!";
  457. return result;
  458. }
  459. List<Grp_TeamRate> grp_TeamRates = new List<Grp_TeamRate>();
  460. foreach (var item in cTableIds)
  461. {
  462. grp_TeamRates.Add(
  463. new Grp_TeamRate() { DiId = diId, CTable = item.Id, Remark = rateInit, CreateUserId = userId }
  464. );
  465. }
  466. if (grp_TeamRates.Count > 0)
  467. {
  468. var addId = _teamRateRep._sqlSugar.Insertable(grp_TeamRates).ExecuteCommand();
  469. if (addId < 1)
  470. {
  471. result.Msg = string.Format(@"添加失败!");
  472. return result;
  473. }
  474. }
  475. result.Code = 0;
  476. result.Msg = string.Format(@"操作成功!");
  477. return result;
  478. }
  479. /// <summary>
  480. /// 团组任务分配
  481. /// 建团时 默认按照岗位分配权限
  482. /// </summary>
  483. /// <param name="userId"></param>
  484. /// <param name="diId"></param>
  485. /// <param name="companyId"></param>
  486. /// <returns></returns>
  487. public static async Task<Result> PostGroupAuthAddInit(int userId, int diId, int companyId = 2)
  488. {
  489. Result result = new() { Code = -2 };
  490. if (userId < 0)
  491. {
  492. result.Msg = string.Format(@"请传入正确的userId");
  493. return result;
  494. }
  495. if (companyId < 0)
  496. {
  497. result.Msg = string.Format(@"请传入正确的companyId");
  498. return result;
  499. }
  500. if (diId < 0)
  501. {
  502. result.Msg = string.Format(@"请传入正确的DiId");
  503. return result;
  504. }
  505. var usersData = await _teamRateRep._sqlSugar
  506. .Queryable<Sys_Users>()
  507. .LeftJoin<Sys_Department>((su, sd) => su.DepId == sd.Id && sd.IsDel == 0)
  508. .LeftJoin<Sys_JobPost>((su, sd, sjp) => su.JobPostId == sjp.Id && sjp.IsDel == 0)
  509. .Where(su => su.IsDel == 0)
  510. .Select((su, sd, sjp) => new
  511. {
  512. su.DepId,
  513. sd.DepName,
  514. su.JobPostId,
  515. sjp.JobName,
  516. su.Id,
  517. su.CnName
  518. })
  519. .ToListAsync();
  520. /*
  521. * 76 酒店预订 --> 国交部门 酒店,主管 岗位
  522. * 77 行程 --> 国交部门 经理,主管 岗位
  523. * 79 车/导游地接 --> 国交部门 OP,主管 岗位
  524. * 80 签证 --> 国交部门 签证 岗位
  525. * 81 邀请/公务活动 --> 国交部门 商邀 岗位
  526. * 82 团组客户保险 --> 国交部 经理,主管 岗位
  527. * 85 机票预订 --> 国交部门 机票 岗位
  528. * 98 其他款项 --> 总经办部门 总经理 岗位/国交部门(ALL) 岗位/财务部门(ALL) 岗位/策划部门(ALL) 岗位/人事部门 采购 岗位
  529. * 1015 超支费用,69 收款退还 --> 财务部门(ALL)岗位
  530. * 1015 超支费用 --> 国交部(ALL)岗位
  531. * 1081 文档下载 --> 国交部门 酒店,主管 岗位
  532. */
  533. var groupsTaskAssignments = new List<Grp_GroupsTaskAssignment>();
  534. // 76 酒店预订 --> 国交部门(7) 酒店(25)、主管(22) 岗位
  535. groupsTaskAssignments.AddRange(
  536. usersData
  537. .Where(it => it.DepId == 7 && (it.JobPostId == 25 || it.JobPostId == 22))
  538. .Select(it => new Grp_GroupsTaskAssignment()
  539. {
  540. DIId = diId,
  541. CTId = 76,
  542. UId = it.Id,
  543. CreateUserId = userId
  544. }).ToList()
  545. );
  546. // 77 行程 --> 国交部门(7) 经理(32),主管(22) 岗位
  547. groupsTaskAssignments.AddRange(
  548. usersData
  549. .Where(it => it.DepId == 7 && (it.JobPostId == 22 || it.JobPostId == 32))
  550. .Select(it => new Grp_GroupsTaskAssignment()
  551. {
  552. DIId = diId,
  553. CTId = 77,
  554. UId = it.Id,
  555. CreateUserId = userId
  556. }).ToList()
  557. );
  558. //79 车/导游地接 --> 国交部门(7) OP(28)、主管(22) 岗位
  559. groupsTaskAssignments.AddRange(
  560. usersData.Where(it => it.DepId == 7 && (it.JobPostId == 22 || it.JobPostId == 28))
  561. .Select(it => new Grp_GroupsTaskAssignment()
  562. {
  563. DIId = diId,
  564. CTId = 79,
  565. UId = it.Id,
  566. CreateUserId = userId
  567. }).ToList()
  568. );
  569. //81 邀请/公务活动 --> 国交部门(7) 商邀(27) 岗位
  570. groupsTaskAssignments.AddRange(
  571. usersData.Where(it => it.DepId == 7 && it.JobPostId == 27)
  572. .Select(it => new Grp_GroupsTaskAssignment()
  573. {
  574. DIId = diId,
  575. CTId = 81,
  576. UId = it.Id,
  577. CreateUserId = userId
  578. }).ToList()
  579. );
  580. //2024年8月26日16点27分 “邀请公务活动分配给王鸽(UserID:149)”
  581. groupsTaskAssignments.Add(
  582. new Grp_GroupsTaskAssignment()
  583. {
  584. DIId = diId,
  585. CTId = 81,
  586. UId = 149,
  587. CreateUserId = userId
  588. }
  589. );
  590. //80 签证 --> 国交部门(7) 签证(26) 岗位
  591. groupsTaskAssignments.AddRange(
  592. usersData
  593. .Where(it => it.DepId == 7 && it.JobPostId == 26)
  594. .Select(it => new Grp_GroupsTaskAssignment()
  595. {
  596. DIId = diId,
  597. CTId = 80,
  598. UId = it.Id,
  599. CreateUserId = userId
  600. }).ToList()
  601. );
  602. //82 团组客户保险 --> 国交部(7) 经理(32),主管(22) 岗位
  603. //2024-06-25 默认将保险权限分配给签证岗。 签证(26) 岗位
  604. List<int> insurancePositions = new List<int>() { 32, 22, 26 };
  605. groupsTaskAssignments.AddRange(
  606. usersData
  607. .Where(it => it.DepId == 7 && insurancePositions.Contains(it.JobPostId))
  608. .Select(it => new Grp_GroupsTaskAssignment()
  609. {
  610. DIId = diId,
  611. CTId = 82,
  612. UId = it.Id,
  613. CreateUserId = userId
  614. }).ToList()
  615. );
  616. //85 机票预订 --> 国交部门(7) 机票(24),主管(22) 岗位
  617. groupsTaskAssignments.AddRange(
  618. usersData
  619. .Where(it => it.DepId == 7 && (it.JobPostId == 22 || it.JobPostId == 24))
  620. .Select(it => new Grp_GroupsTaskAssignment()
  621. {
  622. DIId = diId,
  623. CTId = 85,
  624. UId = it.Id,
  625. CreateUserId = userId
  626. }).ToList()
  627. );
  628. //98 其他款项 --> 总经办部门(1) 总经理(1) 岗位/国交部门(7)(ALL) 岗位/财务部门(3)(ALL) 岗位/策划部门(5)(ALL) 岗位/人事部门(4) 采购(74) 岗位
  629. var depIds = new List<int>() { 7, 3, 5 };
  630. var jobIds = new List<int>() { 1, 74 };
  631. groupsTaskAssignments.AddRange(
  632. usersData
  633. .Where(it => depIds.Contains(it.DepId) || jobIds.Contains(it.JobPostId))
  634. .Select(it => new Grp_GroupsTaskAssignment()
  635. {
  636. DIId = diId,
  637. CTId = 98,
  638. UId = it.Id,
  639. CreateUserId = userId
  640. }).ToList()
  641. );
  642. //2024年8月26日16点27分 “其他款项分配给王鸽(UserID:149)”
  643. groupsTaskAssignments.Add(new Grp_GroupsTaskAssignment()
  644. {
  645. DIId = diId,
  646. CTId = 98,
  647. UId = 149,
  648. CreateUserId = userId
  649. }
  650. );
  651. //1015 超支费用,285 收款退还 --> 财务部门(ALL)岗位
  652. groupsTaskAssignments.AddRange(
  653. usersData
  654. .Where(it => it.DepId == 3)
  655. .Select(it => new Grp_GroupsTaskAssignment()
  656. {
  657. DIId = diId,
  658. CTId = 1015,
  659. UId = it.Id,
  660. CreateUserId = userId
  661. }).ToList()
  662. );
  663. groupsTaskAssignments.AddRange(
  664. usersData
  665. .Where(it => it.DepId == 3)
  666. .Select(it => new Grp_GroupsTaskAssignment()
  667. {
  668. DIId = diId,
  669. CTId = 285,
  670. UId = it.Id,
  671. CreateUserId = userId
  672. }).ToList()
  673. );
  674. //1015 超支费用 --> 国交部(ALL)岗位
  675. groupsTaskAssignments.AddRange(
  676. usersData
  677. .Where(it => it.DepId == 7)
  678. .Select(it => new Grp_GroupsTaskAssignment()
  679. {
  680. DIId = diId,
  681. CTId = 1015,
  682. UId = it.Id,
  683. CreateUserId = userId
  684. }).ToList()
  685. );
  686. if (groupsTaskAssignments.Count > 0)
  687. {
  688. var addId = await _teamRateRep._sqlSugar.Insertable(groupsTaskAssignments).ExecuteCommandAsync();
  689. }
  690. result.Code = 0;
  691. result.Msg = string.Format(@"操作成功!");
  692. return result;
  693. }
  694. #endregion
  695. #region 员工是否是市场部人员
  696. /// <summary>
  697. /// 验证市场部客户人员
  698. /// </summary>
  699. /// <param name="userId"></param>
  700. /// <returns></returns>
  701. public static async Task<bool> IsMarketingStaff(int userId)
  702. {
  703. var userInfos = await _dirRep._sqlSugar
  704. .Queryable<Sys_Users>()
  705. .InnerJoin<Sys_Department>((u, d) => u.DepId == d.Id)
  706. .Where((u, d) => u.IsDel == 0 && u.Id == userId && d.DepName.Contains("市场部"))
  707. .ToListAsync();
  708. if (userInfos.Count > 0) return true;
  709. return false;
  710. }
  711. #endregion
  712. #region 三公费用相关
  713. /// <summary>
  714. /// 保存操作前汇率
  715. /// </summary>
  716. /// <param name="currUserId"></param>
  717. /// <returns></returns>
  718. public static async Task<bool> RateRecordSave(int currUserId, int diId, string linkModule)
  719. {
  720. //var selectData = await _enterExitCostRep._sqlSugar.Queryable<Sys_ExchangeRateRecord>()
  721. // .Where(x => Convert.ToDateTime(x.RateDateTime).ToString("yyyy-MM-dd").Equals(DateTime.Now.ToString("yyyy-MM-dd")))
  722. // .FirstAsync();
  723. //if (selectData != null) return false;
  724. var _currencyRate = await _juHeApi.PostItemRateAsync(new string[] { });
  725. string rateInfoStr = string.Empty;
  726. var oaCurrencyData = await _sqlSugar.Queryable<Sys_SetData>()
  727. .Where(x => x.IsDel == 0 && x.STid == 66)
  728. .ToListAsync();
  729. foreach (var rate in _currencyRate)
  730. {
  731. var oaCurrncy = oaCurrencyData.Find(x => x.Remark.Equals(rate.Name));
  732. if (oaCurrncy == null) continue;
  733. //美元(USD):7.5|
  734. rateInfoStr += $"{rate.Name}({oaCurrncy.Name}):{rate.FSellPri}|";
  735. }
  736. if (string.IsNullOrEmpty(rateInfoStr)) return false;
  737. var add = await _sqlSugar
  738. .Insertable<Sys_ExchangeRateRecord>(new Sys_ExchangeRateRecord()
  739. {
  740. DiId = diId,
  741. LinkModule = linkModule,
  742. RateDateTime = DateTime.Now,
  743. RateInfo = rateInfoStr,
  744. CreateUserId = currUserId,
  745. IsDel = 0
  746. })
  747. .ExecuteCommandAsync();
  748. return add > 0 ? true : false;
  749. }
  750. /// <summary>
  751. /// 三公费用导入收款账单数据
  752. /// </summary>
  753. /// <param name="groupId"></param>
  754. /// <returns></returns>
  755. public static async Task<List<Fin_ForeignReceivables>> ReceivablesImportFeeAsync(int groupId)
  756. {
  757. var data = new List<Fin_ForeignReceivables>();
  758. var enterExitCosts = await _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == groupId).FirstAsync();
  759. var dayAndCosts = await _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == groupId).ToListAsync();
  760. var dayOtherCosts = await _sqlSugar.Queryable<Grp_DayOtherPrice>().Where(x => x.IsDel == 0 && x.Diid == groupId).ToListAsync(); //其他款项
  761. if (enterExitCosts == null) return data;
  762. //数据源
  763. var stayData = dayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
  764. var mealData = dayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
  765. var miscellaneousData = dayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
  766. var trainData = dayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
  767. //筛选 陪同人员 = 1
  768. var groupClientList = await _sqlSugar.Queryable<Grp_TourClientList>()
  769. .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id)
  770. .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id)
  771. .LeftJoin<Sys_SetData>((tcl, dc, cc, sd) => tcl.ShippingSpaceTypeId == sd.Id)
  772. .Where(tcl => tcl.IsDel == 0 &&
  773. tcl.DiId == groupId &&
  774. tcl.IsAccompany == 1
  775. )
  776. .Select((tcl, dc, cc, sd) => new
  777. {
  778. DiId = tcl.DiId,
  779. CompanyId = cc.Id,
  780. CompanyName = cc.CompanyFullName,
  781. ClienId = dc.Id,
  782. ClientName = dc.FirstName + dc.LastName,
  783. SpaceId = tcl.ShippingSpaceTypeId,
  784. SpaceName = sd.Name
  785. })
  786. .ToListAsync();
  787. if (!groupClientList.Any()) return data;
  788. decimal domesticFeeTotal = 0.00M, //境内费用
  789. economyClassFeeTotal = 0.00M, //经济舱费用
  790. businessClassFeeTotal = 0.00M, //公务舱费用
  791. firstClassFeeTotal = 0.00M, //头等舱费用
  792. stayFeeTotal = 0.00M, //住宿费
  793. mealsFeeTotal = 0.00M, //餐食费
  794. miscellaneousFeeTotal = 0.00M, //公杂费
  795. trainFeeTotal = 0.00M, //培训费
  796. otherPriceTotal = 0.00M; //其他款项
  797. //境内费用(其他费用)
  798. if (enterExitCosts.ChoiceOne == 1) domesticFeeTotal = enterExitCosts.InsidePay;
  799. //住宿费
  800. if (enterExitCosts.ChoiceThree == 1) stayFeeTotal = stayData.Sum(x => x.SubTotal);
  801. //伙食费
  802. if (enterExitCosts.ChoiceFour == 1) mealsFeeTotal = mealData.Sum(x => x.SubTotal);
  803. //公杂费
  804. if (enterExitCosts.ChoiceFive == 1) miscellaneousFeeTotal = miscellaneousData.Sum(x => x.SubTotal);
  805. //培训费
  806. if (enterExitCosts.ChoiceSix == 1) trainFeeTotal = trainData.Sum(x => x.SubTotal);
  807. //其他款项
  808. if (enterExitCosts.OtherExpenses_Checked == 1) otherPriceTotal = dayOtherCosts.Sum(x => x.SubTotal);
  809. decimal otherFeeTotal = domesticFeeTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + trainFeeTotal + otherPriceTotal;
  810. //国际旅费合计
  811. //经济舱
  812. if (enterExitCosts.SumJJC == 1) economyClassFeeTotal = enterExitCosts.OutsideJJPay + otherFeeTotal;
  813. //公务舱
  814. if (enterExitCosts.SumGWC == 1) businessClassFeeTotal = enterExitCosts.OutsideGWPay + otherFeeTotal;
  815. //头等舱
  816. if (enterExitCosts.SumTDC == 1) firstClassFeeTotal = enterExitCosts.OutsideTDPay + otherFeeTotal;
  817. var groupClientListGroup = groupClientList.GroupBy(x => x.CompanyId);
  818. foreach (var item in groupClientListGroup)
  819. {
  820. var companyName = AesEncryptionHelper.Decrypt(item.FirstOrDefault().CompanyName);
  821. var airTicketGroup = item.GroupBy(x => x.SpaceId);
  822. foreach (var airTicket in airTicketGroup)
  823. {
  824. int quantity = airTicket.Count();
  825. if (quantity > 0)
  826. {
  827. var price = 0.00M;
  828. var spaceName = airTicket.FirstOrDefault()?.SpaceName ?? string.Empty;
  829. if (spaceName.Equals("经济舱")) price = economyClassFeeTotal;
  830. else if (spaceName.Equals("公务舱")) price = businessClassFeeTotal;
  831. else if (spaceName.Equals("头等舱")) price = firstClassFeeTotal;
  832. if (price > 0)
  833. {
  834. decimal itemTotal = price * quantity;
  835. data.Add(new Fin_ForeignReceivables()
  836. {
  837. Id = 0,
  838. CreateTime = DateTime.Now,
  839. Diid = groupId,
  840. PriceName = $"{companyName}-{spaceName}",
  841. Price = price,
  842. Count = quantity,
  843. Unit = "人",
  844. ItemSumPrice = itemTotal,
  845. Currency = 836,
  846. Rate = 1.0000M,
  847. AddingWay = 2,
  848. Remark = "由出入境费用导入费用",
  849. });
  850. }
  851. }
  852. }
  853. }
  854. return data;
  855. }
  856. #endregion
  857. #endregion
  858. #region 团组汇率
  859. /// <summary>
  860. /// 团组汇率
  861. /// 获取板块 币种 及 汇率
  862. /// 76 酒店预订 77 行程 79 车/导游地接
  863. /// 80 签证 82 团组客户保险 85 机票预订
  864. /// 98 其他款项 285 收款退还
  865. /// </summary>
  866. /// <param name="teamRateModels"></param>
  867. /// <param name="cTable"></param>
  868. /// <param name="currencyCode"></param>
  869. /// <returns>
  870. /// string
  871. /// eg: CNY 1.0000
  872. /// </returns>
  873. public static async Task<string> PostGroupRateByCTableAndCurrency(List<TeamRateModelView> teamRateModels, int cTable, List<string> currencyCodes)
  874. {
  875. string str = "";
  876. List<string> currencyRates = new List<string>();
  877. TeamRateModelView hotelRateData = teamRateModels.Where(it => it.CTableId == cTable).FirstOrDefault();
  878. if (hotelRateData != null)
  879. {
  880. var hotelRates = hotelRateData.TeamRates;
  881. foreach (var item in currencyCodes)
  882. {
  883. if (!string.IsNullOrEmpty(item))
  884. {
  885. var hotelRateInfo = hotelRates.Where(it => it.CurrencyCode.Equals(item)).FirstOrDefault();
  886. if (hotelRateInfo != null)
  887. {
  888. string str1 = string.Format("{0} {1}\r\n", hotelRateInfo.CurrencyCode, hotelRateInfo.Rate.ToString("#0.0000"));
  889. currencyRates.Add(str1);
  890. }
  891. }
  892. }
  893. if (currencyRates != null || currencyRates.Count > 0)
  894. {
  895. currencyRates = currencyRates.Distinct().ToList();
  896. foreach (var item in currencyRates)
  897. {
  898. str += item;
  899. }
  900. }
  901. }
  902. return str;
  903. }
  904. /// <summary>
  905. /// 团组汇率 币种 Item (来源:团组汇率)
  906. /// 根据 团组Id And 业务类型(CTable)Id
  907. /// api处理CTable = 285,默认返回CNY
  908. /// </summary>
  909. /// <param name="portType"></param>
  910. /// <param name="diId"></param>
  911. /// <param name="cTable"></param>
  912. /// <returns></returns>
  913. public static async Task<TeamRateModelGeneralView> PostGroupTeamRateByDiIdAndCTableId(int portType, int diId, int cTable)
  914. {
  915. TeamRateModelGeneralView _view = new TeamRateModelGeneralView();
  916. _view = await _teamRateRep.PostGroupTeamRateByDiIdAndCTableId(portType, diId, cTable);
  917. return _view;
  918. }
  919. /// <summary>
  920. /// 汇率备注拆分
  921. /// (美元(USD):7.2370|日元(JPY):0.0499|欧元(EUR):8.3000|英镑(GBP):9.1996|港币(HKD):0.9291)
  922. /// </summary>
  923. /// <param name="rateRemark"></param>
  924. /// <returns></returns>
  925. public static async Task<List<TeamRateDescAddCurrencyIdView>> SplitExchangeRate(this string rateRemark)
  926. {
  927. List<TeamRateDescAddCurrencyIdView> _view = new List<TeamRateDescAddCurrencyIdView>();
  928. List<SetDataInfoView> currencyDatas = new List<SetDataInfoView>();
  929. #region 获取所有币种
  930. string sql = string.Format(@"select * from Sys_SetData where STid = {0} and isdel = 0", 66);
  931. var DBdata = _setDataRep.GetListBySqlWithNolock(sql);
  932. if (DBdata == null || DBdata.Count == 0)
  933. {
  934. return _view;
  935. }
  936. currencyDatas = DBdata.Select(x => new SetDataInfoView
  937. {
  938. Name = x.Name,
  939. Id = x.Id,
  940. Remark = x.Remark,
  941. }).ToList();
  942. #endregion
  943. #region 拆分remark里的汇率
  944. if (string.IsNullOrEmpty(rateRemark))
  945. {
  946. return _view;
  947. }
  948. if (rateRemark.Contains("|"))
  949. {
  950. string[] currencyArr = rateRemark.Split("|");
  951. foreach (string currency in currencyArr)
  952. {
  953. string[] currency1 = currency.Split(":");
  954. string[] currency2 = currency1[0].Split("(");
  955. string currencyCode = currency2[1].Replace(")", "").TrimEnd();
  956. TeamRateDescAddCurrencyIdView rateDescView = new TeamRateDescAddCurrencyIdView()
  957. {
  958. CurrencyId = currencyDatas.Find(it => it.Name == currencyCode).Id,
  959. CurrencyCode = currencyCode,
  960. CurrencyName = currency2[0],
  961. Rate = decimal.Parse(currency1[1]),
  962. };
  963. _view.Add(rateDescView);
  964. }
  965. }
  966. else
  967. {
  968. try
  969. {
  970. string[] currency1 = rateRemark.Split(":");
  971. string[] currency2 = currency1[0].Split("(");
  972. string currencyCode = currency2[1].Replace(")", "").TrimEnd();
  973. TeamRateDescAddCurrencyIdView rateDescView = new TeamRateDescAddCurrencyIdView()
  974. {
  975. CurrencyId = currencyDatas.Find(it => it.Name == currencyCode).Id,
  976. CurrencyCode = currencyCode,
  977. CurrencyName = currency2[0],
  978. Rate = decimal.Parse(currency1[1]),
  979. };
  980. _view.Add(rateDescView);
  981. }
  982. catch (Exception)
  983. {
  984. return _view;
  985. }
  986. }
  987. #endregion
  988. return _view;
  989. }
  990. #endregion
  991. #region 汉字转换拼音
  992. private static Dictionary<int, List<string>> GetTotalPingYinDictionary(string text)
  993. {
  994. var chs = text.ToCharArray();
  995. //记录每个汉字的全拼
  996. Dictionary<int, List<string>> totalPingYinList = new Dictionary<int, List<string>>();
  997. for (int i = 0; i < chs.Length; i++)
  998. {
  999. var pinyinList = new List<string>();
  1000. //是否是有效的汉字
  1001. if (ChineseChar.IsValidChar(chs[i]))
  1002. {
  1003. ChineseChar cc = new ChineseChar(chs[i]);
  1004. pinyinList = cc.Pinyins.Where(p => !string.IsNullOrWhiteSpace(p)).ToList();
  1005. }
  1006. else
  1007. {
  1008. pinyinList.Add(chs[i].ToString());
  1009. }
  1010. //去除声调,转小写
  1011. pinyinList = pinyinList.ConvertAll(p => Regex.Replace(p, @"\d", "").ToLower());
  1012. //去重
  1013. pinyinList = pinyinList.Where(p => !string.IsNullOrWhiteSpace(p)).Distinct().ToList();
  1014. if (pinyinList.Any())
  1015. {
  1016. totalPingYinList[i] = pinyinList;
  1017. }
  1018. }
  1019. return totalPingYinList;
  1020. }
  1021. /// <summary>
  1022. /// 获取汉语拼音全拼
  1023. /// </summary>
  1024. /// <param name="text">The string.</param>
  1025. /// <returns></returns>
  1026. public static List<string> GetTotalPingYin(this string text)
  1027. {
  1028. var result = new List<string>();
  1029. foreach (var pys in GetTotalPingYinDictionary(text))
  1030. {
  1031. var items = pys.Value;
  1032. if (result.Count <= 0)
  1033. {
  1034. result = items;
  1035. }
  1036. else
  1037. {
  1038. //全拼循环匹配
  1039. var newTotalPingYinList = new List<string>();
  1040. foreach (var totalPingYin in result)
  1041. {
  1042. newTotalPingYinList.AddRange(items.Select(item => totalPingYin + item));
  1043. }
  1044. newTotalPingYinList = newTotalPingYinList.Distinct().ToList();
  1045. result = newTotalPingYinList;
  1046. }
  1047. }
  1048. return result;
  1049. }
  1050. /// <summary>
  1051. /// 获取中文第一个拼音
  1052. /// </summary>
  1053. /// <param name="text"></param>
  1054. /// <param name="isUp"></param>
  1055. /// <returns></returns>
  1056. public static string GetTotalPingYinFirst(this string text, bool isUp = true)
  1057. {
  1058. var returnstr = string.Empty;
  1059. var enResult = text.GetTotalPingYin();
  1060. if (enResult.Count == 0)
  1061. {
  1062. returnstr = text;
  1063. }
  1064. else if (isUp)
  1065. {
  1066. returnstr = enResult[0].ToUpper();
  1067. }
  1068. else
  1069. {
  1070. returnstr = enResult[0].ToLower();
  1071. }
  1072. return returnstr;
  1073. }
  1074. /// <summary>
  1075. /// 获取汉语拼音首字母
  1076. /// </summary>
  1077. /// <param name="text"></param>
  1078. /// <returns></returns>
  1079. public static List<string> GetFirstPingYin(this string text)
  1080. {
  1081. var result = new List<string>();
  1082. foreach (var pys in GetTotalPingYinDictionary(text))
  1083. {
  1084. var items = pys.Value;
  1085. if (result.Count <= 0)
  1086. {
  1087. result = items.ConvertAll(p => p.Substring(0, 1)).Distinct().ToList();
  1088. }
  1089. else
  1090. {
  1091. //首字母循环匹配
  1092. var newFirstPingYinList = new List<string>();
  1093. foreach (var firstPingYin in result)
  1094. {
  1095. newFirstPingYinList.AddRange(items.Select(item => firstPingYin + item.Substring(0, 1)));
  1096. }
  1097. newFirstPingYinList = newFirstPingYinList.Distinct().ToList();
  1098. result = newFirstPingYinList;
  1099. }
  1100. }
  1101. return result;
  1102. }
  1103. #endregion
  1104. #region 新客户资料表 操作记录
  1105. /// <summary>
  1106. /// 新客户资料表
  1107. /// 操作记录添加
  1108. /// </summary>
  1109. /// <param name="portType"></param>
  1110. /// <param name="operationEnum"></param>
  1111. /// <param name="userId"></param>
  1112. /// <param name="dataId"></param>
  1113. /// <param name="remark"></param>
  1114. /// <returns></returns>
  1115. public static async Task<bool> NewClientOperationRecord(int portType, OperationEnum operationEnum, int userId, int dataId, string remark)
  1116. {
  1117. Crm_TableOperationRecord _TableOperationRecord = new Crm_TableOperationRecord()
  1118. {
  1119. TableName = "Crm_NewClientData",
  1120. PortType = portType,
  1121. OperationItem = operationEnum,
  1122. DataId = dataId,
  1123. CreateUserId = userId,
  1124. CreateTime = DateTime.Now,
  1125. Remark = remark
  1126. };
  1127. bool add = await _tableOperationRecordRep._Add(_TableOperationRecord);
  1128. if (add) return false;
  1129. return false;
  1130. }
  1131. #endregion
  1132. #region 金额转大写
  1133. /// <summary>
  1134. /// 金额转换为大写数字
  1135. /// <para>1、支持的最大数字:999999999999.99(玖仟玖佰玖拾玖亿玖仟玖佰玖拾玖万玖仟玖佰玖拾玖元玖角玖分)</para>
  1136. /// <para>2、小数点后最多支持两位</para>
  1137. /// </summary>
  1138. /// <param name="num">数值</param>
  1139. /// <returns></returns>
  1140. public static string ConvertCNYUpper(this decimal num)
  1141. {
  1142. if (num == 0)
  1143. {
  1144. return "零元";
  1145. }
  1146. // 解决327000000转换后缺少单位万的问题
  1147. return ConvertToChinese(num);
  1148. }
  1149. #region 实例
  1150. /// <summary>
  1151. /// 要转换的数字
  1152. /// </summary>
  1153. private static decimal j;
  1154. /// <summary>
  1155. ///
  1156. /// </summary>
  1157. private static string[] NumChineseCharacter = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
  1158. /// <summary>
  1159. /// 判断输入的数字是否大于double类型
  1160. /// </summary>
  1161. private static bool IsNumber
  1162. {
  1163. get
  1164. {
  1165. if (j > decimal.MaxValue || j <= 0)
  1166. return false;
  1167. else
  1168. return true;
  1169. }
  1170. }
  1171. /// <summary>
  1172. /// 数字转换成大写汉字主函数
  1173. /// </summary>
  1174. /// <returns>返回转换后的大写汉字</returns>
  1175. public static string ConvertToChinese(decimal m)
  1176. {
  1177. j = m;
  1178. string bb = "";
  1179. if (IsNumber)
  1180. {
  1181. string str = j.ToString();
  1182. string[] Num = str.Split('.');
  1183. if (Num.Length == 1)
  1184. {
  1185. bb = NumberString(Num[0]) + "元整";
  1186. bb = bb.Replace("零零", "零");
  1187. }
  1188. else
  1189. {
  1190. bb = NumberString(Num[0]) + "元";
  1191. bb += FloatString(Num[1]);
  1192. bb = bb.Replace("零零", "零");
  1193. }
  1194. }
  1195. else
  1196. {
  1197. throw new FormatException("你输入的数字格式不正确或不是数字!");
  1198. }
  1199. return bb;
  1200. }
  1201. /// <summary>
  1202. /// 小数位转换只支持两位的小数
  1203. /// </summary>
  1204. /// <param name="Num">转换的小数</param>
  1205. /// <returns>小数转换成汉字</returns>
  1206. private static string FloatString(string Num)
  1207. {
  1208. string cc = "";
  1209. if (Num.Length > 2)
  1210. {
  1211. throw new FormatException("小数位数过多.");
  1212. }
  1213. else
  1214. {
  1215. string bb = ConvertString(Num);
  1216. int len = bb.IndexOf("零");
  1217. if (len != 0)
  1218. {
  1219. bb = bb.Replace("零", "");
  1220. if (bb.Length == 1)
  1221. {
  1222. cc = bb.Substring(0, 1) + "角";
  1223. }
  1224. else
  1225. {
  1226. cc = bb.Substring(0, 1) + "角";
  1227. cc += bb.Substring(1, 1) + "分";
  1228. }
  1229. }
  1230. else
  1231. cc = bb + "分";
  1232. }
  1233. return cc;
  1234. }
  1235. /// <summary>
  1236. /// 判断数字位数以进行拆分转换
  1237. /// </summary>
  1238. /// <param name="Num">要进行拆分的数字</param>
  1239. /// <returns>转换成的汉字</returns>
  1240. private static string NumberString(string Num)
  1241. {
  1242. string bb = "";
  1243. if (Num.Length <= 4)
  1244. {
  1245. bb = Convert4(Num);
  1246. }
  1247. else if (Num.Length > 4 && Num.Length <= 8)
  1248. {
  1249. bb = Convert4(Num.Substring(0, Num.Length - 4)) + "万";
  1250. bb += Convert4(Num.Substring(Num.Length - 4, 4));
  1251. }
  1252. else if (Num.Length > 8 && Num.Length <= 12)
  1253. {
  1254. bb = Convert4(Num.Substring(0, Num.Length - 8)) + "亿";
  1255. if (Convert4(Num.Substring(Num.Length - 8, 4)) == "")
  1256. if (Convert4(Num.Substring(Num.Length - 4, 4)) != "")
  1257. bb += "零";
  1258. else
  1259. bb += "";
  1260. else
  1261. bb += Convert4(Num.Substring(Num.Length - 8, 4)) + "万";
  1262. bb += Convert4(Num.Substring(Num.Length - 4, 4));
  1263. }
  1264. else
  1265. {
  1266. throw new Exception("整数部分最多支持12位");
  1267. }
  1268. return bb;
  1269. }
  1270. /// <summary>
  1271. /// 四位数字的转换
  1272. /// </summary>
  1273. /// <param name="Num">准备转换的四位数字</param>
  1274. /// <returns>转换以后的汉字</returns>
  1275. private static string Convert4(string Num)
  1276. {
  1277. string bb = "";
  1278. if (Num.Length == 1)
  1279. {
  1280. bb = ConvertString(Num);
  1281. }
  1282. else if (Num.Length == 2)
  1283. {
  1284. bb = ConvertString(Num);
  1285. bb = Convert2(bb);
  1286. }
  1287. else if (Num.Length == 3)
  1288. {
  1289. bb = ConvertString(Num);
  1290. bb = Convert3(bb);
  1291. }
  1292. else
  1293. {
  1294. bb = ConvertString(Num);
  1295. string cc = "";
  1296. string len = bb.Substring(0, 4);
  1297. if (len != "零零零零")
  1298. {
  1299. len = bb.Substring(0, 3);
  1300. if (len != "零零零")
  1301. {
  1302. bb = bb.Replace("零零零", "");
  1303. if (bb.Length == 1)
  1304. {
  1305. bb = bb.Substring(0, 1) + "仟";
  1306. }
  1307. else
  1308. {
  1309. if (bb.Substring(0, 1) != "零" && bb.Substring(0, 2) != "零")
  1310. cc = bb.Substring(0, 1) + "仟";
  1311. else
  1312. cc = bb.Substring(0, 1);
  1313. bb = cc + Convert3(bb.Substring(1, 3));
  1314. }
  1315. }
  1316. else
  1317. {
  1318. bb = bb.Replace("零零零", "零");
  1319. }
  1320. }
  1321. else
  1322. {
  1323. bb = bb.Replace("零零零零", "");
  1324. }
  1325. }
  1326. return bb;
  1327. }
  1328. /// <summary>
  1329. /// 将数字转换成汉字
  1330. /// </summary>
  1331. /// <param name="Num">需要转换的数字</param>
  1332. /// <returns>转换后的汉字</returns>
  1333. private static string ConvertString(string Num)
  1334. {
  1335. string bb = "";
  1336. for (int i = 0; i < Num.Length; i++)
  1337. {
  1338. bb += NumChineseCharacter[int.Parse(Num.Substring(i, 1))];
  1339. }
  1340. return bb;
  1341. }
  1342. /// <summary>
  1343. /// 两位数字的转换
  1344. /// </summary>
  1345. /// <param name="Num">两位数字</param>
  1346. /// <returns>转换后的汉字</returns>
  1347. private static string Convert2(string Num)
  1348. {
  1349. string bb = ""; string cc = "";
  1350. string len = Num.Substring(0, 1);
  1351. if (len != "零")
  1352. {
  1353. bb = Num.Replace("零", "");
  1354. if (bb.Length == 1)
  1355. {
  1356. cc = bb.Substring(0, 1) + "拾";
  1357. }
  1358. else
  1359. {
  1360. cc = bb.Substring(0, 1) + "拾";
  1361. cc += bb.Substring(1, 1);
  1362. }
  1363. }
  1364. else
  1365. cc = Num;
  1366. return cc;
  1367. }
  1368. /// <summary>
  1369. /// 三位数字的转换
  1370. /// </summary>
  1371. /// <param name="Num">三位数字</param>
  1372. /// <returns>转换后的汉字</returns>
  1373. private static string Convert3(string Num)
  1374. {
  1375. string bb = ""; string cc = "";
  1376. string len = Num.Substring(0, 2);
  1377. if (len != "零零")
  1378. {
  1379. bb = Num.Replace("零零", "");
  1380. if (bb.Length == 1)
  1381. {
  1382. bb = bb.Substring(0, 1) + "佰";
  1383. }
  1384. else
  1385. {
  1386. if (bb.Substring(0, 1) != "零")
  1387. cc = bb.Substring(0, 1) + "佰";
  1388. else
  1389. cc = bb.Substring(0, 1);
  1390. bb = cc + Convert2(bb.Substring(1, 2));
  1391. }
  1392. }
  1393. else
  1394. {
  1395. bb = Num.Replace("零零", "零");
  1396. }
  1397. return bb;
  1398. }
  1399. #endregion
  1400. #endregion
  1401. #region 数字验证
  1402. /// <summary>
  1403. /// 验证数字字符串
  1404. /// </summary>
  1405. /// <param name="num"></param>
  1406. /// <returns></returns>
  1407. public static bool IsNumeric(this string numStr)
  1408. {
  1409. bool isNumeric = Regex.IsMatch(numStr, @"^\d+$");
  1410. if (isNumeric)
  1411. {
  1412. return true;
  1413. }
  1414. return false;
  1415. }
  1416. #endregion
  1417. #region 日期 格式转换
  1418. /// <summary>
  1419. /// 验证数字字符串
  1420. /// </summary>
  1421. /// <param name="str"></param>
  1422. /// <returns></returns>
  1423. public static string ConvertToDatetime(this string str)
  1424. {
  1425. if (!string.IsNullOrEmpty(str))
  1426. {
  1427. DateTime currentDate = Convert.ToDateTime(str);
  1428. return $"{currentDate.Year}年{currentDate.Month}月{currentDate.Day}日";
  1429. }
  1430. return "";
  1431. }
  1432. #endregion
  1433. #region 月份/季度
  1434. /// <summary>
  1435. /// 获取月份对应的起始天数
  1436. /// </summary>
  1437. /// <param name="year"></param>
  1438. /// <returns></returns>
  1439. public static List<MonthInfo> GetMonthInfos(int year)
  1440. {
  1441. List<MonthInfo> months = new List<MonthInfo>();
  1442. if (year > 1)
  1443. {
  1444. for (int i = 1; i < 13; i++)
  1445. {
  1446. months.Add(new MonthInfo()
  1447. {
  1448. Month = i,
  1449. Days = new DaysInfo() { BeginDays = 1, EndDays = DateTime.DaysInMonth(year, i) }
  1450. });
  1451. }
  1452. }
  1453. return months;
  1454. }
  1455. /// <summary>
  1456. /// 获取季度对应的起始天数
  1457. /// </summary>
  1458. /// <param name="year"></param>
  1459. /// <returns></returns>
  1460. public static List<MonthInfo> GetQuarter(int year)
  1461. {
  1462. List<MonthInfo> months = new List<MonthInfo>();
  1463. months.Add(new MonthInfo() { Month = 1, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //1.1 - 3.31
  1464. months.Add(new MonthInfo() { Month = 2, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //4.1 - 6.30
  1465. months.Add(new MonthInfo() { Month = 3, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //7.1 - 9.31
  1466. months.Add(new MonthInfo() { Month = 4, Days = new DaysInfo() { BeginDays = 1, EndDays = 31 } }); //10.1 - 12.31
  1467. return months;
  1468. }
  1469. public class MonthInfo
  1470. {
  1471. public int Month { get; set; }
  1472. public DaysInfo Days { get; set; }
  1473. }
  1474. public class DaysInfo
  1475. {
  1476. public int BeginDays { get; set; }
  1477. public int EndDays { get; set; }
  1478. }
  1479. #endregion
  1480. #region op行程单,黑屏幕代码
  1481. public static string GetCountryStandingTime(int diId)
  1482. {
  1483. DataTable datas = GetTableByBlackCode(diId);
  1484. string countryStr = "[黑屏代码未录入].";
  1485. if (datas.Rows.Count > 0)
  1486. {
  1487. var airDatas = from row in datas.AsEnumerable()
  1488. select new
  1489. {
  1490. Three = row.Field<string>("Three"),
  1491. Day = row.Field<string>("Day"),
  1492. ArrivedDate = row.Field<string>("ArrivedDate"),
  1493. };
  1494. //三字码信息
  1495. List<Res_ThreeCode> listcode = _dirRep._sqlSugar.Queryable<Res_ThreeCode>().Where(x => x.IsDel == 0).ToList();
  1496. //string countryStr = "";
  1497. int index = 0;
  1498. List<string> cityCodes = new List<string>();
  1499. //去掉开始和结束城市
  1500. foreach (var row in airDatas)
  1501. {
  1502. if (!string.IsNullOrEmpty(row.Three))
  1503. {
  1504. if (index == 0) cityCodes.Add(row.Three.Substring(3, 3)); //到达国家
  1505. else if (airDatas.Count() - 1 == index) cityCodes.Add(row.Three.Substring(0, 3)); //到达国家
  1506. else cityCodes.Add(row.Three.Substring(0, 3)); //到达国家
  1507. }
  1508. index++;
  1509. }
  1510. cityCodes = cityCodes.Distinct().ToList();
  1511. if (cityCodes.Count > 0) countryStr = "";
  1512. foreach (var item in cityCodes)
  1513. {
  1514. var airData = airDatas.Where(it => it.Three.Contains(item)).ToList();
  1515. string country = listcode.Find(it => it.Three.Equals(item))?.Country ?? "Unknown";
  1516. if (country.Equals("中国"))
  1517. {
  1518. country = listcode.Find(it => it.Three.Equals(item))?.City ?? "Unknown";
  1519. }
  1520. int days = 0;
  1521. if (airData.Count == 2)
  1522. {
  1523. DateTime arr_dt = Convert.ToDateTime(airData[0].ArrivedDate); //抵达时间
  1524. DateTime dep_dt = Convert.ToDateTime(airData[1].Day); //离开时间
  1525. //days = (dep_dt - arr_dt).Days;
  1526. //countryStr += $@"{country}停留{days}日、";
  1527. countryStr += $@"{country}停留 日、";
  1528. }
  1529. }
  1530. if (countryStr.Length > 0) countryStr = countryStr.Substring(0, countryStr.Length - 1);
  1531. }
  1532. return countryStr;
  1533. }
  1534. /// <summary>
  1535. ///根据机票黑屏代码整理DataTable
  1536. /// </summary>
  1537. /// <param name="diid"></param>
  1538. /// <returns></returns>
  1539. public static DataTable GetTableByBlackCode1(int diid)
  1540. {
  1541. //黑屏代码信息
  1542. List<Air_TicketBlackCode> listcode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.DiId == diid && x.IsDel == 0).ToList();
  1543. //测试数据为序号,航班号,起飞日期,三字码,起飞时刻,到达时刻,出发航站楼,到达航站楼,机型,飞行时间
  1544. //1.3U8391 TU17NOV CTUCAI 0220 0715 T1 T2 330 10H55M
  1545. DataTable dt = new DataTable();
  1546. dt.Columns.Add("Fliagtcode", typeof(string)); //航班号
  1547. dt.Columns.Add("Date", typeof(string));//起飞日期
  1548. dt.Columns.Add("Three", typeof(string));//三字码
  1549. dt.Columns.Add("StartTime", typeof(string));//起飞时刻
  1550. dt.Columns.Add("EndTime", typeof(string));//到达时刻
  1551. dt.Columns.Add("StartBuilding", typeof(string));//出发航站楼
  1552. dt.Columns.Add("EndBuilding", typeof(string));//到达航站楼
  1553. dt.Columns.Add("AirModel", typeof(string)); //机型
  1554. dt.Columns.Add("FlightTime", typeof(string));//飞行时间
  1555. dt.Columns.Add("Day", typeof(string));//整理的起飞日期;作为排序依据
  1556. dt.Columns.Add("ArrivedDate", typeof(string));//整理的到达日期
  1557. dt.Columns.Add("Error", typeof(string));//整理的到达日期
  1558. dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
  1559. //判断是否录入黑屏代码
  1560. if (listcode.Count() == 0 || listcode == null)
  1561. {
  1562. dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "黑屏代码未录入!", null);
  1563. }
  1564. else
  1565. {
  1566. //读取单段黑屏代码
  1567. for (int i = 0; i < listcode.Count; i++)
  1568. {
  1569. //去除序号
  1570. string[] CodeList = Regex.Split(listcode[i].BlackCode, "\\d+\\.", RegexOptions.IgnoreCase);
  1571. //去除多余空格,方法一Linq扩展方法
  1572. CodeList = CodeList.Where(str => str != "").ToArray();
  1573. CodeList = CodeList.Where(str => str != " ").ToArray();
  1574. //年
  1575. int year = Convert.ToInt32(DateTime.Now.Year.ToString());
  1576. //读取单条黑屏代码
  1577. for (int j = 0; j < CodeList.Count(); j++)
  1578. {
  1579. //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
  1580. CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();
  1581. string[] Info = CodeList[j].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1582. //string[] Info = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty)
  1583. // .TrimStart().TrimEnd().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1584. //去除多余空格
  1585. Info = Info.Where(str => str != "").ToArray();
  1586. Info = Info.Where(str => str != " ").ToArray();
  1587. //判断黑屏代码是否正确拆分; 理应拆成9段
  1588. if (Info.Count() < 9)
  1589. {
  1590. dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "本团组第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误,请联系机票同事核对", null);
  1591. }
  1592. else
  1593. {
  1594. try
  1595. {
  1596. //月
  1597. int month = Convert.ToInt32(GetLonger(Info[1].Substring(4, 3)));
  1598. //日
  1599. int day = Convert.ToInt32(Info[1].Substring(2, 2));
  1600. #region 逐一比较月份,判断是否翻年;逐一比较三字码顶真,判断是否跑错机场
  1601. if (j > 0)
  1602. {
  1603. string[] Temp = CodeList[j - 1].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty)
  1604. .TrimStart().TrimEnd().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1605. Temp = Temp.Where(str => str != "").ToArray();
  1606. Temp = Temp.Where(str => str != " ").ToArray();
  1607. int monthTemp = Convert.ToInt32(GetLonger(Temp[1].Substring(4, 3)));
  1608. // 如果相邻月份之差小于0,则证明次一条年份需+1
  1609. if (month - monthTemp < 0)
  1610. {
  1611. year = year + 1;
  1612. }
  1613. //如果相邻代码三字码不顶真,提醒
  1614. string FootThree = Temp[2].Substring(3, 3);
  1615. string HeadThree = Info[2].Substring(0, 3);
  1616. if (FootThree != HeadThree)
  1617. {
  1618. //DelegationInfoService s = new DelegationInfoService();
  1619. //UsersService us = new UsersService();
  1620. //GroupsTaskAssignmentService gts = new GroupsTaskAssignmentService();
  1621. //77 行程
  1622. List<Grp_GroupsTaskAssignment> list2 = _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(x => x.CTId == 77 && x.DIId == diid && x.IsDel == 0).ToList();
  1623. foreach (var temp in list2)
  1624. {
  1625. //if (temp.UId != 21)
  1626. //SendAndReturn(us.GetUsersByID(temp.UId).Email,
  1627. // "黑屏代码提醒",
  1628. // s.GetDelegationInfoByID(diid).TeamName + "的机票黑屏代码中,相邻航段的三字码不连续,请查看!");
  1629. }
  1630. //85 机票预订
  1631. List<Grp_GroupsTaskAssignment> list6 = _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(x => x.CTId == 85 && x.DIId == diid && x.IsDel == 0).ToList();
  1632. foreach (var temp in list6)
  1633. {
  1634. //if (temp.UId != 21)
  1635. //SendAndReturn(us.GetUsersByID(temp.UId).Email,
  1636. // "黑屏代码提醒",
  1637. // s.GetDelegationInfoByID(diid).TeamName + "的机票黑屏代码中,相邻航段的三字码不连续,请查看!");
  1638. }
  1639. }
  1640. }
  1641. #endregion
  1642. #region 判断到达日期是否需要加1
  1643. if (Info[4].Contains("+"))
  1644. {
  1645. //日期+1
  1646. day = day + 1;
  1647. //判断是否进入下一月
  1648. if (day > Convert.ToInt32(GetDaysByMonth(Info[1].Substring(4, 3), year)))
  1649. {
  1650. day = day - Convert.ToInt32(GetDaysByMonth(Info[1].Substring(4, 3), year));
  1651. month = month + 1;
  1652. //判断是否进入下一年
  1653. if (month > 12)
  1654. {
  1655. month = month - 12;
  1656. year = year + 1;
  1657. }
  1658. }
  1659. //月份整理格式
  1660. string monthTemp = month.ToString();
  1661. if (month < 10)
  1662. {
  1663. monthTemp = "0" + monthTemp;
  1664. }
  1665. //日期整理格式
  1666. string daytemp = day.ToString();
  1667. if (day < 10)
  1668. {
  1669. daytemp = "0" + daytemp;
  1670. }
  1671. string temp = Info[4].Split('+')[0];
  1672. //添加起飞数据
  1673. dt.Rows.Add(Info[0],
  1674. Info[1],
  1675. Info[2],
  1676. Info[3],
  1677. temp,
  1678. Info[5],
  1679. Info[6],
  1680. Info[7],
  1681. Info[8],
  1682. year + "-" + GetLonger(Info[1].Substring(4, 3)) + "-" + Info[1].Substring(2, 2),
  1683. year + "-" + monthTemp + "-" + daytemp,
  1684. "",
  1685. "0");
  1686. //加1天,添加到达数据
  1687. dt.Rows.Add(Info[0],
  1688. Info[1].Replace(Info[1].Substring(2, 2), daytemp),
  1689. Info[2],
  1690. Info[3],
  1691. temp,
  1692. Info[5],
  1693. Info[6],
  1694. Info[7],
  1695. Info[8],
  1696. year + "-" + monthTemp + "-" + daytemp,
  1697. year + "-" + monthTemp + "-" + daytemp,
  1698. "",
  1699. "1");
  1700. }
  1701. else
  1702. {
  1703. //月份整理格式
  1704. string monthTemp = month.ToString();
  1705. if (month < 10)
  1706. {
  1707. monthTemp = "0" + monthTemp;
  1708. }
  1709. //日期整理格式
  1710. string daytemp = day.ToString();
  1711. if (day < 10)
  1712. {
  1713. daytemp = "0" + daytemp;
  1714. }
  1715. dt.Rows.Add(Info[0],
  1716. Info[1],
  1717. Info[2],
  1718. Info[3],
  1719. Info[4],
  1720. Info[5],
  1721. Info[6],
  1722. Info[7],
  1723. Info[8],
  1724. year + "-" + monthTemp + "-" + daytemp,
  1725. year + "-" + monthTemp + "-" + daytemp,
  1726. "",
  1727. "0");
  1728. }
  1729. #endregion
  1730. }
  1731. catch (Exception ex)
  1732. {
  1733. string exstr = ex.Message.ToString();
  1734. }
  1735. }
  1736. }
  1737. //排序
  1738. dt.DefaultView.Sort = "Day asc";
  1739. dt = dt.DefaultView.ToTable();
  1740. }
  1741. }
  1742. return dt;
  1743. }
  1744. private readonly static string[] excludeArr = new string[] { "[中转]", "[转机]" };
  1745. /// <summary>
  1746. ///根据机票黑屏代码整理DataTable
  1747. /// </summary>
  1748. /// <param name="diid"></param>
  1749. /// <returns></returns>
  1750. public static DataTable GetTableByBlackCode(int diid)
  1751. {
  1752. //黑屏代码信息
  1753. List<Air_TicketBlackCode> listcode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.DiId == diid && x.IsDel == 0).ToList();
  1754. //测试数据为序号,航班号,起飞日期,三字码,起飞时刻,到达时刻,出发航站楼,到达航站楼,机型,飞行时间
  1755. //1.3U8391 TU17NOV CTUCAI 0220 0715 T1 T2 330 10H55M
  1756. DataTable dt = new DataTable();
  1757. dt.Columns.Add("Fliagtcode", typeof(string)); //航班号
  1758. dt.Columns.Add("Date", typeof(string));//起飞日期
  1759. dt.Columns.Add("Three", typeof(string));//三字码
  1760. dt.Columns.Add("StartTime", typeof(string));//起飞时刻
  1761. dt.Columns.Add("EndTime", typeof(string));//到达时刻
  1762. dt.Columns.Add("StartBuilding", typeof(string));//出发航站楼
  1763. dt.Columns.Add("EndBuilding", typeof(string));//到达航站楼
  1764. dt.Columns.Add("AirModel", typeof(string)); //机型
  1765. dt.Columns.Add("FlightTime", typeof(string));//飞行时间
  1766. dt.Columns.Add("Day", typeof(string));//整理的起飞日期;作为排序依据
  1767. dt.Columns.Add("ArrivedDate", typeof(string));//整理的到达日期
  1768. dt.Columns.Add("Error", typeof(string));//整理的到达日期
  1769. dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
  1770. //添加转机标识
  1771. dt.Columns.Add("isTransitShipment", typeof(bool));
  1772. //判断是否录入黑屏代码
  1773. if (listcode.Count() == 0 || listcode == null)
  1774. {
  1775. dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "黑屏代码未录入!", null, false);
  1776. }
  1777. else
  1778. {
  1779. //读取单段黑屏代码
  1780. for (int i = 0; i < listcode.Count; i++)
  1781. {
  1782. //去除序号
  1783. string[] CodeList = Regex.Split(listcode[i].BlackCode, "\\d+\\.", RegexOptions.IgnoreCase);
  1784. //去除多余空格,方法一Linq扩展方法
  1785. CodeList = CodeList.Where(str => !string.IsNullOrWhiteSpace(str)).ToArray();
  1786. //读取单条黑屏代码
  1787. for (int j = 0; j < CodeList.Count(); j++)
  1788. {
  1789. //去除多余空格,方法二使用Split()方法进行分割,分割有一个选项是RemoveEmptyEntries
  1790. CodeList[j] = CodeList[j].Replace("\r\n", string.Empty).Replace("\\r\\n", string.Empty).TrimStart().TrimEnd();
  1791. string[] Info = CodeList[j].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  1792. //去除多余空格
  1793. Info = Info.Where(str => !string.IsNullOrWhiteSpace(str)).ToArray();
  1794. //判断黑屏代码是否正确拆分; 理应拆成9段
  1795. if (Info.TakeWhile((x) =>
  1796. {
  1797. return !excludeArr.Contains(x);
  1798. }).Count() != 9)
  1799. {
  1800. dt.Rows.Add(null, null, null, null, null, null, null, null, null, null, null, "本团组第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误,请联系机票同事核对", null, false);
  1801. //MessageBoxEx.Show("第" + (i + 1) + "段黑屏代码中第" + (j + 1) + " 条有误, 请联系机票同事核对");
  1802. return dt;
  1803. }
  1804. else
  1805. {
  1806. try
  1807. {
  1808. var monthEn = Info[1].Substring(4, 3);
  1809. //月
  1810. int month = Convert.ToInt32(GetLonger(monthEn));
  1811. //日
  1812. int day = Convert.ToInt32(Info[1].Substring(2, 2));
  1813. var time = new DateTime(DateTime.Now.Year, month, day); //
  1814. var isExist = Info.Contains("[中转]");
  1815. //dt.Columns.Add("Fliagtcode", typeof(string)); //航班号
  1816. //dt.Columns.Add("Date", typeof(string));//起飞日期
  1817. //dt.Columns.Add("Three", typeof(string));//三字码
  1818. //dt.Columns.Add("StartTime", typeof(string));//起飞时刻
  1819. //dt.Columns.Add("EndTime", typeof(string));//到达时刻
  1820. //dt.Columns.Add("StartBuilding", typeof(string));//出发航站楼
  1821. //dt.Columns.Add("EndBuilding", typeof(string));//到达航站楼
  1822. //dt.Columns.Add("AirModel", typeof(string)); //机型
  1823. //dt.Columns.Add("FlightTime", typeof(string));//飞行时间
  1824. //dt.Columns.Add("Day", typeof(string));//整理的起飞日期;作为排序依据
  1825. //dt.Columns.Add("ArrivedDate", typeof(string));//整理的到达日期
  1826. //dt.Columns.Add("Error", typeof(string));//整理的到达日期
  1827. //dt.Columns.Add("Sign", typeof(string));//标识:0表示为原生黑屏代码、1表示“+1”新增的黑屏代码
  1828. dt.Rows.Add(Info[0],
  1829. Info[1],
  1830. Info[2],
  1831. Info[3],
  1832. Info[4],
  1833. Info[5],
  1834. Info[6],
  1835. Info[7],
  1836. Info[8],
  1837. time.ToString("yyyy-MM-dd"),
  1838. time.ToString("yyyy-MM-dd"),
  1839. "",
  1840. "0",
  1841. isExist
  1842. );
  1843. }
  1844. catch (Exception ex)
  1845. {
  1846. string exstr = ex.Message.ToString();
  1847. }
  1848. }
  1849. }
  1850. //排序
  1851. dt.DefaultView.Sort = "Day asc";
  1852. dt = dt.DefaultView.ToTable();
  1853. }
  1854. }
  1855. return dt;
  1856. }
  1857. /// <summary>
  1858. /// 根据星期,月份的缩写,转换成数字或者全称
  1859. /// 根据币种中文名称返回币种代码
  1860. /// 根据数字返回机型型号【2、3开头的就是空客,比如空客320,7开头的就是波音,比如波音777】
  1861. /// 20210903贾文滔
  1862. /// </summary>
  1863. /// <param name="startDate"></param>
  1864. /// <param name="endDate"></param>
  1865. /// <returns></returns>
  1866. public static string GetLonger(string temp)
  1867. {
  1868. string str = "";
  1869. switch (temp.ToUpper())
  1870. {
  1871. case "美元":
  1872. str = "USD";
  1873. break;
  1874. case "日元":
  1875. str = "JPY";
  1876. break;
  1877. case "英镑":
  1878. str = "GBP";
  1879. break;
  1880. case "欧元":
  1881. str = "EUR";
  1882. break;
  1883. case "港币":
  1884. str = "HKD";
  1885. break;
  1886. case "MO":
  1887. str = "星期一";
  1888. break;
  1889. case "TU":
  1890. str = "星期二";
  1891. break;
  1892. case "WE":
  1893. str = "星期三";
  1894. break;
  1895. case "TH":
  1896. str = "星期四";
  1897. break;
  1898. case "FR":
  1899. str = "星期五";
  1900. break;
  1901. case "SA":
  1902. str = "星期六";
  1903. break;
  1904. case "SU":
  1905. str = "星期天";
  1906. break;
  1907. case "JAN":
  1908. str = "01";
  1909. break;
  1910. case "FEB":
  1911. str = "02";
  1912. break;
  1913. case "MAR":
  1914. str = "03";
  1915. break;
  1916. case "APR":
  1917. str = "04";
  1918. break;
  1919. case "MAY":
  1920. str = "05";
  1921. break;
  1922. case "JUN":
  1923. str = "06";
  1924. break;
  1925. case "JUL":
  1926. str = "07";
  1927. break;
  1928. case "AUG":
  1929. str = "08";
  1930. break;
  1931. case "SEP":
  1932. str = "09";
  1933. break;
  1934. case "OCT":
  1935. str = "10";
  1936. break;
  1937. case "NOV":
  1938. str = "11";
  1939. break;
  1940. case "DEC":
  1941. str = "12";
  1942. break;
  1943. case "MONDAY":
  1944. str = "星期一";
  1945. break;
  1946. case "TUESDAY":
  1947. str = "星期二";
  1948. break;
  1949. case "WEDNESDAY":
  1950. str = "星期三";
  1951. break;
  1952. case "THURSDAY":
  1953. str = "星期四";
  1954. break;
  1955. case "FRIDAY":
  1956. str = "星期五";
  1957. break;
  1958. case "SATURDAY":
  1959. str = "星期六";
  1960. break;
  1961. case "SUNDAY":
  1962. str = "星期日";
  1963. break;
  1964. case "01":
  1965. str = "JAN";
  1966. break;
  1967. case "02":
  1968. str = "FEB";
  1969. break;
  1970. case "03":
  1971. str = "MAR";
  1972. break;
  1973. case "04":
  1974. str = "APR";
  1975. break;
  1976. case "05":
  1977. str = "MAY";
  1978. break;
  1979. case "06":
  1980. str = "JUN";
  1981. break;
  1982. case "07":
  1983. str = "JUL";
  1984. break;
  1985. case "08":
  1986. str = "AUG";
  1987. break;
  1988. case "09":
  1989. str = "SEP";
  1990. break;
  1991. case "10":
  1992. str = "OCT";
  1993. break;
  1994. case "11":
  1995. str = "NOV";
  1996. break;
  1997. case "12":
  1998. str = "DEC";
  1999. break;
  2000. case "2":
  2001. str = "空客A";
  2002. break;
  2003. case "3":
  2004. str = "空客A";
  2005. break;
  2006. case "7":
  2007. str = "波音";
  2008. break;
  2009. }
  2010. return str;
  2011. }
  2012. /// <summary>
  2013. /// 根据月份返回天数
  2014. /// </summary>
  2015. /// <param name="temp"></param>
  2016. /// <returns></returns>
  2017. public static string GetDaysByMonth(string Month, int year)
  2018. {
  2019. string str = "";
  2020. //判断是否是闰年
  2021. if (DateTime.IsLeapYear(year) == false)
  2022. {
  2023. switch (Month.ToUpper())
  2024. {
  2025. case "JAN":
  2026. str = "31";
  2027. break;
  2028. case "FEB":
  2029. str = "28";
  2030. break;
  2031. case "MAR":
  2032. str = "31";
  2033. break;
  2034. case "APR":
  2035. str = "30";
  2036. break;
  2037. case "MAY":
  2038. str = "31";
  2039. break;
  2040. case "JUN":
  2041. str = "30";
  2042. break;
  2043. case "JUL":
  2044. str = "31";
  2045. break;
  2046. case "AUG":
  2047. str = "31";
  2048. break;
  2049. case "SEP":
  2050. str = "30";
  2051. break;
  2052. case "OCT":
  2053. str = "31";
  2054. break;
  2055. case "NOV":
  2056. str = "30";
  2057. break;
  2058. case "DEC":
  2059. str = "31";
  2060. break;
  2061. case "01":
  2062. str = "31";
  2063. break;
  2064. case "02":
  2065. str = "28";
  2066. break;
  2067. case "03":
  2068. str = "31";
  2069. break;
  2070. case "04":
  2071. str = "30";
  2072. break;
  2073. case "05":
  2074. str = "31";
  2075. break;
  2076. case "06":
  2077. str = "30";
  2078. break;
  2079. case "07":
  2080. str = "31";
  2081. break;
  2082. case "08":
  2083. str = "31";
  2084. break;
  2085. case "09":
  2086. str = "30";
  2087. break;
  2088. case "10":
  2089. str = "31";
  2090. break;
  2091. case "11":
  2092. str = "30";
  2093. break;
  2094. case "12":
  2095. str = "31";
  2096. break;
  2097. }
  2098. }
  2099. else
  2100. {
  2101. switch (Month.ToUpper())
  2102. {
  2103. case "JAN":
  2104. str = "31";
  2105. break;
  2106. case "FEB":
  2107. str = "29";
  2108. break;
  2109. case "MAR":
  2110. str = "31";
  2111. break;
  2112. case "APR":
  2113. str = "30";
  2114. break;
  2115. case "MAY":
  2116. str = "31";
  2117. break;
  2118. case "JUN":
  2119. str = "30";
  2120. break;
  2121. case "JUL":
  2122. str = "31";
  2123. break;
  2124. case "AUG":
  2125. str = "31";
  2126. break;
  2127. case "SEP":
  2128. str = "30";
  2129. break;
  2130. case "OCT":
  2131. str = "31";
  2132. break;
  2133. case "NOV":
  2134. str = "30";
  2135. break;
  2136. case "DEC":
  2137. str = "31";
  2138. break;
  2139. case "01":
  2140. str = "31";
  2141. break;
  2142. case "02":
  2143. str = "29";
  2144. break;
  2145. case "03":
  2146. str = "31";
  2147. break;
  2148. case "04":
  2149. str = "30";
  2150. break;
  2151. case "05":
  2152. str = "31";
  2153. break;
  2154. case "06":
  2155. str = "30";
  2156. break;
  2157. case "07":
  2158. str = "31";
  2159. break;
  2160. case "08":
  2161. str = "31";
  2162. break;
  2163. case "09":
  2164. str = "30";
  2165. break;
  2166. case "10":
  2167. str = "31";
  2168. break;
  2169. case "11":
  2170. str = "30";
  2171. break;
  2172. case "12":
  2173. str = "31";
  2174. break;
  2175. }
  2176. }
  2177. return str;
  2178. }
  2179. /// <summary>
  2180. /// op行程单 团组 城市路径
  2181. /// </summary>
  2182. /// <param name="diid">团组Id</param>
  2183. /// <param name="separator">分隔符</param>
  2184. /// <returns></returns>
  2185. public static string GetGroupCityLine(int diid, string separator)
  2186. {
  2187. string city = string.Empty;
  2188. var blackCode = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.IsDel == 0 && x.DiId == diid).ToList();
  2189. if (blackCode.Count > 0)
  2190. {
  2191. var black = blackCode.First();
  2192. black.BlackCode = black.BlackCode == null ? "" : black.BlackCode;
  2193. var blackSp = Regex.Split(black.BlackCode, "\\d+\\.", RegexOptions.IgnoreCase).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
  2194. if (blackSp.Length > 0)
  2195. {
  2196. try
  2197. {
  2198. var cityArrCode = new List<string>(20);
  2199. foreach (var item in blackSp)
  2200. {
  2201. var itemSp = item.Split(' ').Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
  2202. var IndexSelect = itemSp[2];
  2203. var cityArrCodeLength = cityArrCode.Count - 1;
  2204. var startCity = IndexSelect.Substring(0, 3);
  2205. if (cityArrCodeLength > 0)
  2206. {
  2207. var arrEndCity = cityArrCode[cityArrCodeLength];
  2208. if (arrEndCity != startCity)
  2209. {
  2210. cityArrCode.Add(startCity.ToUpper());
  2211. }
  2212. }
  2213. else
  2214. {
  2215. cityArrCode.Add(startCity.ToUpper());
  2216. }
  2217. var endCity = IndexSelect.Substring(3, 3);
  2218. cityArrCode.Add(endCity.ToUpper());
  2219. }
  2220. var cityThree = string.Empty;
  2221. cityArrCode.ForEach(x => cityThree += "'" + x + "',");
  2222. cityThree = cityThree.TrimEnd(',');
  2223. if (string.IsNullOrWhiteSpace(cityThree))
  2224. {
  2225. throw new Exception("error");
  2226. }
  2227. string sql = $"SELECT * FROM Res_ThreeCode rtc WHERE UPPER(rtc.Three) in ({cityThree}) ";
  2228. var cityArr = _dirRep._sqlSugar.SqlQueryable<Res_ThreeCode>(sql).ToList();
  2229. foreach (var item in cityArrCode)
  2230. {
  2231. var find = cityArr.Find(x => x.Three.ToUpper() == item.ToUpper());
  2232. if (find != null)
  2233. {
  2234. city += find.City + separator;
  2235. }
  2236. else
  2237. {
  2238. city += item + "[三字码未收录]" + separator;
  2239. }
  2240. }
  2241. city = city.TrimEnd(char.Parse(separator));
  2242. }
  2243. catch (Exception e)
  2244. {
  2245. city = "[黑屏代码格式不正确!]";
  2246. }
  2247. }
  2248. }
  2249. else city = "[未录入黑屏代码]";
  2250. return city;
  2251. }
  2252. /// <summary>
  2253. /// op行程单 团组 城市路径
  2254. /// </summary>
  2255. /// <param name="diid">团组Id</param>
  2256. /// <param name="separator">分隔符</param>
  2257. /// <returns></returns>
  2258. public static Dictionary<int, string> GetGroupCityLineItem(List<int> diids, string separator)
  2259. {
  2260. Dictionary<int, string> dicCitys = new Dictionary<int, string>();
  2261. var cityCodes = _dirRep._sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList();
  2262. var blackCodes = _dirRep._sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.IsDel == 0 && diids.Contains(x.DiId)).ToList();
  2263. foreach (var diid in diids)
  2264. {
  2265. string city = string.Empty;
  2266. var blackCode = blackCodes.Where(it => it.DiId == diid).ToList();
  2267. if (blackCode.Count > 0)
  2268. {
  2269. var black = blackCode.First();
  2270. black.BlackCode = black.BlackCode == null ? "" : black.BlackCode;
  2271. var blackSp = Regex.Split(black.BlackCode, "\\d+\\.", RegexOptions.IgnoreCase).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
  2272. if (blackSp.Length > 0)
  2273. {
  2274. try
  2275. {
  2276. var cityArrCode = new List<string>(20);
  2277. foreach (var item in blackSp)
  2278. {
  2279. var itemSp = item.Split(' ').Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
  2280. var IndexSelect = itemSp[2];
  2281. var cityArrCodeLength = cityArrCode.Count - 1;
  2282. var startCity = IndexSelect.Substring(0, 3);
  2283. if (cityArrCodeLength > 0)
  2284. {
  2285. var arrEndCity = cityArrCode[cityArrCodeLength];
  2286. if (arrEndCity != startCity)
  2287. {
  2288. cityArrCode.Add(startCity.ToUpper());
  2289. }
  2290. }
  2291. else
  2292. {
  2293. cityArrCode.Add(startCity.ToUpper());
  2294. }
  2295. var endCity = IndexSelect.Substring(3, 3);
  2296. cityArrCode.Add(endCity.ToUpper());
  2297. }
  2298. var cityThree = string.Empty;
  2299. cityArrCode.ForEach(x => cityThree += "'" + x + "',");
  2300. cityThree = cityThree.TrimEnd(',');
  2301. if (string.IsNullOrWhiteSpace(cityThree))
  2302. {
  2303. throw new Exception("error");
  2304. }
  2305. var cityArr = cityCodes.Where(it => cityThree.Contains(it.Three.ToUpper())).ToList();
  2306. foreach (var item in cityArrCode)
  2307. {
  2308. var find = cityArr.Find(x => x.Three.ToUpper() == item.ToUpper());
  2309. if (find != null)
  2310. {
  2311. city += find.City + separator;
  2312. }
  2313. else
  2314. {
  2315. city += item + "[三字码未收录]" + separator;
  2316. }
  2317. }
  2318. city = city.TrimEnd(char.Parse(separator));
  2319. }
  2320. catch (Exception e)
  2321. {
  2322. city = "[黑屏代码格式不正确!]";
  2323. }
  2324. }
  2325. }
  2326. else city = "[未录入黑屏代码]";
  2327. dicCitys.Add(diid, city);
  2328. }
  2329. return dicCitys;
  2330. }
  2331. /// <summary>
  2332. /// op行程单相关团组信息 含途径城市
  2333. /// </summary>
  2334. /// <returns></returns>
  2335. public static async Task<List<MateOpGroupPageListView>> MateOpGroupPageListRedis()
  2336. {
  2337. List<MateOpGroupPageListView> _views = new List<MateOpGroupPageListView>();
  2338. string viewStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("MateOpGroupPageList");//string 取
  2339. if (!string.IsNullOrEmpty(viewStr))
  2340. {
  2341. _views = JsonConvert.DeserializeObject<List<MateOpGroupPageListView>>(viewStr);
  2342. }
  2343. else
  2344. {
  2345. string sql = string.Format($@"Select Row_Number,Id,SalesQuoteNo,TourCode,TeamTypeId, TeamType,
  2346. TeamLevId,TeamLev,TeamName,ClientName,ClientUnit,
  2347. VisitDate,VisitDays,VisitPNumber,JietuanOperatorId,
  2348. JietuanOperator,IsSure,CreateTime,VisitCountry
  2349. From (
  2350. Select row_number() over(order by gdi.CreateTime Desc) as Row_Number,
  2351. gdi.Id,SalesQuoteNo,TourCode,ssd.Id TeamTypeId, ssd.Name TeamType,
  2352. ssd1.Id TeamLevId,ssd1.Name TeamLev,TeamName,ClientName,ClientUnit,
  2353. VisitDate,VisitDays,VisitPNumber,JietuanOperator JietuanOperatorId,
  2354. su.CnName JietuanOperator,IsSure,gdi.CreateTime,gdi.VisitCountry
  2355. From Grp_DelegationInfo gdi
  2356. Left Join Sys_SetData ssd On gdi.TeamDid = ssd.Id
  2357. Left Join Sys_SetData ssd1 On gdi.TeamLevSId = ssd1.Id
  2358. Left Join Sys_Users su On gdi.JietuanOperator = su.Id
  2359. Where gdi.IsDel = 0
  2360. ) temp");
  2361. _views = _dirRep._sqlSugar.SqlQueryable<MateOpGroupPageListView>(sql).ToList();
  2362. #region 处理所属部门
  2363. /*
  2364. * 1.sq 和 gyy 等显示 市场部
  2365. * 2.王鸽和主管及张总还有管理员号统一国交部
  2366. * 2-1. 4 管理员 ,21 张海麟
  2367. */
  2368. List<int> userIds = _views.Select(it => it.JietuanOperatorId).ToList();
  2369. List<int> userIds1 = new List<int>() { 4, 21 };
  2370. var UserDepDatas = _dirRep._sqlSugar.Queryable<Sys_Users>()
  2371. .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
  2372. .Where(u => u.IsDel == 0 && userIds.Contains(u.Id))
  2373. .Select((u, d) => new { UserId = u.Id, DepName = userIds1.Contains(u.Id) ? "国交部" : d.DepName })
  2374. .ToList();
  2375. #endregion
  2376. _views.ForEach(it =>
  2377. {
  2378. it.RouteCity = GetGroupCityLine(it.Id, @"/");
  2379. it.Department = UserDepDatas.Find(it1 => it.JietuanOperatorId == it1.UserId)?.DepName ?? "Unknown";
  2380. });
  2381. TimeSpan ts = DateTime.Now.AddHours(2).TimeOfDay;
  2382. await RedisRepository.RedisFactory.CreateRedisRepository().StringSetAsync<string>("MateOpGroupPageList", JsonConvert.SerializeObject(_views), ts);//string 存
  2383. }
  2384. return _views;
  2385. }
  2386. /// <summary>
  2387. /// 获取黑屏代码日期列表
  2388. /// </summary>
  2389. /// <param name="dt"></param>
  2390. /// <returns></returns>
  2391. public static List<string> GetTimeListByDataTable(DataTable dt)
  2392. {
  2393. DateTime datestart = Convert.ToDateTime(dt.Rows[0]["Day"].ToString());
  2394. DateTime dateend = Convert.ToDateTime(dt.Rows[dt.Rows.Count - 1]["ArrivedDate"].ToString());
  2395. List<string> timeList = new List<string>();
  2396. while (datestart <= dateend)
  2397. {
  2398. timeList.Add(datestart.ToString("yyyy-MM-dd"));
  2399. datestart = datestart.AddDays(1);
  2400. }
  2401. return timeList;
  2402. }
  2403. const decimal conversion = 1.61M;
  2404. /// <summary>
  2405. /// 简要行程
  2406. /// </summary>
  2407. /// <param name="diid"></param>
  2408. /// <returns></returns>
  2409. public static Result GetBriefStroke(int diid)
  2410. {
  2411. DataTable resultTable = GetTableByBlackCode(diid);
  2412. if (resultTable == null)
  2413. {
  2414. return new Result { Code = -1, Msg = "黑屏代码有误或黑屏代码未录入" };
  2415. }
  2416. if (resultTable.Rows.Count == 0 || string.IsNullOrWhiteSpace(resultTable.Rows[0][1].ToString()))
  2417. {
  2418. string msg = string.Empty;
  2419. if (resultTable.Rows.Count > 0)
  2420. {
  2421. msg = resultTable.Rows[0]["Error"].ToString();
  2422. }
  2423. return new Result { Code = -1, Msg = $"黑屏代码有误;{msg}" };
  2424. }
  2425. var timeArr = GetTimeListByDataTable(resultTable);
  2426. var threeCodes = _dirRep._sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList(); //三字码
  2427. var airCompanys = _dirRep._sqlSugar.Queryable<Res_AirCompany>().Where(it => it.IsDel == 0).ToList(); //航司公司
  2428. var obDatas = _dirRep._sqlSugar.Queryable<Res_OfficialActivities>().Where(it => it.IsDel == 0 && it.DiId == diid).ToList(); //公务信息
  2429. var NewListTravel = new List<Grp_TravelList>();
  2430. var index = 0;
  2431. var stopCity = string.Empty;
  2432. foreach (var item in timeArr)
  2433. {
  2434. string trip = string.Empty;
  2435. string weekDay = string.Empty;
  2436. DateTime time = DateTime.Now;
  2437. if (DateTime.TryParse(item, out time))
  2438. {
  2439. weekDay = weekdays[(int)time.DayOfWeek];
  2440. }
  2441. else
  2442. {
  2443. weekDay = "日期格式不正确!";
  2444. }
  2445. var empty = "【未收入该三字码!请机票同事录入】";
  2446. var tabSelect = resultTable.Select(string.Format("Day = '{0}'", item));
  2447. var isMoreTraffic = false;
  2448. if (tabSelect.Length > 0)
  2449. {
  2450. isMoreTraffic = true;
  2451. var takeOffTime = DateTime.Parse(item);
  2452. var fallToTime = DateTime.Parse(item);
  2453. Res_ThreeCode start_Object = null;
  2454. Res_ThreeCode end_Object = null;
  2455. bool isTrade = false;
  2456. //air 处理
  2457. foreach (var tabRow in tabSelect)
  2458. {
  2459. takeOffTime = DateTime.Parse(item);
  2460. fallToTime = DateTime.Parse(item);
  2461. var takeOff = tabRow["StartTime"].ToString();
  2462. var fallTo = tabRow["EndTime"].ToString();
  2463. takeOffTime = takeOffTime.AddHours(int.Parse(takeOff.Substring(0, 2)));
  2464. takeOffTime = takeOffTime.AddMinutes(int.Parse(takeOff.Substring(2, 2)));
  2465. fallToTime = fallToTime.AddHours(int.Parse(fallTo.Substring(0, 2)));
  2466. fallToTime = fallToTime.AddMinutes(int.Parse(fallTo.Substring(2, 2)));
  2467. var threeCode = tabRow["Three"].ToString();
  2468. var start = threeCode.Substring(0, 3);
  2469. var end = threeCode.Substring(3, 3);
  2470. stopCity = end;
  2471. start_Object = threeCodes.Find(x => x.Three.ToUpper() == start.ToUpper());
  2472. end_Object = threeCodes.Find(x => x.Three.ToUpper() == end.ToUpper());
  2473. if (start_Object == null)
  2474. {
  2475. start_Object = new Res_ThreeCode()
  2476. {
  2477. AirPort = empty,
  2478. AirPort_En = empty,
  2479. City = empty,
  2480. Country = empty,
  2481. Four = empty,
  2482. Three = empty,
  2483. };
  2484. }
  2485. if (end_Object == null)
  2486. {
  2487. end_Object = new Res_ThreeCode()
  2488. {
  2489. AirPort = empty,
  2490. AirPort_En = empty,
  2491. City = empty,
  2492. Country = empty,
  2493. Four = empty,
  2494. Three = empty,
  2495. };
  2496. }
  2497. //航班号
  2498. string flightcode = tabRow["Fliagtcode"].ToString();
  2499. trip += $"{takeOffTime.ToString("HH:mm")}—{fallToTime.ToString("HH:mm")} {start_Object.City}—{end_Object.City} 航班号:{flightcode}\r\n";
  2500. }
  2501. //var airArrive = fallToTime; //航班落地时间
  2502. time = fallToTime.AddHours(1.5); //出机场一个半小时
  2503. string Time = string.Empty;
  2504. string Distance = string.Empty;
  2505. int GetGoogleResult = 0;
  2506. int GetDistResult = 0;
  2507. JObject Result = null;
  2508. try
  2509. {
  2510. Time = Result["routes"][0]["legs"][0]["duration"]["text"].ToString().Replace(" ", "").Trim();
  2511. Distance = Result["routes"][0]["legs"][0]["distance"]["text"].ToString().Replace(" ", "").Trim();
  2512. if (Time.Contains("hours"))
  2513. {
  2514. Time = Time.Replace("hours", "小时");
  2515. }
  2516. if (Time.Contains("hour"))
  2517. {
  2518. Time = Time.Replace("hour", "小时");
  2519. }
  2520. Time = Time.Replace("mins", "分钟");
  2521. if (Distance.Contains("mi"))
  2522. {
  2523. var distSp = Regex.Split(Distance, "mi");
  2524. if (distSp.Length > 0)
  2525. {
  2526. Distance = (decimal.Parse(distSp[0]) * conversion).ToString("#0.00") + " 公里";
  2527. }
  2528. }
  2529. if (Distance.Contains("km"))
  2530. {
  2531. Distance = Distance.Replace("km", "公里");
  2532. }
  2533. if (Time.Contains("小时"))
  2534. {
  2535. var xs = Regex.Split(Time, "小时");
  2536. var xsValue = int.Parse(xs[0]);
  2537. var fz = Regex.Split(xs[1], "分钟");
  2538. var fzValue = int.Parse(fz[0]);
  2539. GetGoogleResult = xsValue * 60;
  2540. GetGoogleResult += fzValue;
  2541. }
  2542. else if (Time.Contains("分钟"))
  2543. {
  2544. GetGoogleResult = int.Parse(Regex.Split(Time, "分钟")[0]);
  2545. }
  2546. if (Distance.Contains("公里"))
  2547. {
  2548. GetDistResult = (int)decimal.Parse(Regex.Split(Distance, "公里")[0]);
  2549. }
  2550. if (GetGoogleResult > 0 && GetGoogleResult % 5 != 0)
  2551. {
  2552. while (GetGoogleResult % 5 != 0)
  2553. {
  2554. GetGoogleResult++;
  2555. }
  2556. }
  2557. if (GetDistResult % 5 != 0 && GetDistResult > 0)
  2558. {
  2559. while (GetDistResult % 5 != 0)
  2560. {
  2561. GetDistResult++;
  2562. }
  2563. }
  2564. int H = (GetGoogleResult / 60);
  2565. int m = (GetGoogleResult % 60);
  2566. string TimeStr = string.Empty;
  2567. if (H != 0)
  2568. {
  2569. if (H < 10)
  2570. {
  2571. TimeStr += "0" + H + "小时";
  2572. }
  2573. else
  2574. {
  2575. TimeStr += H + "小时";
  2576. }
  2577. }
  2578. if (m < 10)
  2579. {
  2580. TimeStr += "0" + m + "分钟";
  2581. }
  2582. else
  2583. {
  2584. TimeStr += m + "分钟";
  2585. }
  2586. Time = TimeStr;
  2587. Distance = GetDistResult.ToString() + "公里";
  2588. }
  2589. catch (Exception ex)
  2590. {
  2591. Time = "未知!";
  2592. Distance = "未知!";
  2593. }
  2594. //trip += $"{time.ToString("HH:mm")} 搭乘专车前往市区({end_Object.AirPort} - {end_Object.City}市区 路程{Distance},耗时{Time})";
  2595. //trip += $"{time.ToString("HH:mm")} 搭乘专车前往市区({end_Object.AirPort} - {end_Object.City}市区)";
  2596. time = time.AddMinutes(GetGoogleResult); //到达市区时间
  2597. string tripDate = Convert.ToDateTime(item).ToString("M月d日");
  2598. if (index == timeArr.Count - 1)
  2599. {
  2600. NewListTravel.Add(new Grp_TravelList
  2601. {
  2602. CreateTime = DateTime.Now,
  2603. CreateUserId = 0,
  2604. Diid = diid,
  2605. Date = tripDate,
  2606. Trip = trip,
  2607. WeekDay = weekDay,
  2608. Days = index + 1,
  2609. Traffic_First = "飞机",
  2610. Traffic_Second = "汽车",
  2611. Diffgroup = 1,
  2612. Issel = 1,
  2613. IsDel = 0,
  2614. });
  2615. continue;
  2616. }
  2617. if (time.Day != fallToTime.Day) //超出一天
  2618. {
  2619. NewListTravel.Add(new Grp_TravelList
  2620. {
  2621. CreateTime = DateTime.Now,
  2622. CreateUserId = 0,
  2623. Diid = diid,
  2624. Date = tripDate,
  2625. Trip = trip,
  2626. WeekDay = weekDay,
  2627. Days = index + 1,
  2628. Traffic_First = "飞机",
  2629. Traffic_Second = "汽车",
  2630. Diffgroup = 1,
  2631. Issel = 1,
  2632. IsDel = 0,
  2633. });
  2634. continue;
  2635. }
  2636. var obInfo = obDatas.Find(it => Convert.ToDateTime(it.Date).ToString("M月d日").Equals(tripDate));
  2637. string obtime = "";
  2638. string obcontent = "";
  2639. if (obInfo != null)
  2640. {
  2641. obtime = obInfo.Time;
  2642. obcontent = $"拜访{obInfo.Client ?? "公务出访单位未录入"}{obInfo.Job ?? "公务出访联系人职务未录入"}{obInfo.Contact ?? "公务出访联系人职务未录入"}";
  2643. }
  2644. bool obTime_bool = DateTime.TryParse(obtime, out DateTime obTimeDt);
  2645. if (time.Hour < 9) // && (airArrive < new DateTime(airArrive.Year,airArrive.Month,airArrive.Day,6, 30, 0))
  2646. {
  2647. if (obTime_bool)
  2648. {
  2649. if (obTimeDt.Hour < 9)
  2650. {
  2651. trip += $"{obTimeDt.ToString("HH:mm")}—10:30 {obcontent};\r\n";
  2652. }
  2653. }
  2654. else
  2655. {
  2656. trip += "09:00—10:30 公务活动;\r\n";
  2657. }
  2658. }
  2659. else if (time.Hour < 10)
  2660. {
  2661. if (obTime_bool)
  2662. {
  2663. if (obTimeDt.Hour < 10)
  2664. {
  2665. trip += $"{obTimeDt.ToString("HH:mm")}—12:00 {obcontent};\r\n";
  2666. }
  2667. }
  2668. else
  2669. {
  2670. trip += "10:30—12:00 公务活动;\r\n";
  2671. }
  2672. }
  2673. if (time.Hour < 13)
  2674. {
  2675. //trip += $"\r\n{time.ToString("HH:mm")} 午餐于当地餐厅;";
  2676. }
  2677. if (time < new DateTime(time.Year, time.Month, time.Day, 14, 30, 0))
  2678. {
  2679. if (obTime_bool)
  2680. {
  2681. if (obTimeDt < new DateTime(time.Year, time.Month, time.Day, 14, 30, 0))
  2682. {
  2683. trip += $"{obTimeDt.ToString("HH:mm")}—16:00 {obcontent};\r\n";
  2684. }
  2685. }
  2686. else
  2687. {
  2688. trip += "14:00—16:00 公务活动;\r\n";
  2689. }
  2690. }
  2691. else if (time.Hour < 16)
  2692. {
  2693. if (obTime_bool)
  2694. {
  2695. if (obTimeDt.Hour < 16)
  2696. {
  2697. trip += $"{obTimeDt.ToString("HH:mm")}—17:30 {obcontent};\r\n";
  2698. }
  2699. }
  2700. else
  2701. {
  2702. trip += "16:00—17:30 公务活动;\r\n";
  2703. }
  2704. }
  2705. //if (time.Hour < 18)
  2706. //{
  2707. // trip += $"\r\n18:00 晚餐于当地餐厅;";
  2708. //}
  2709. //time = time.AddHours(1);
  2710. //trip += $"\r\n{time.ToString("HH:mm")} 搭乘专车前往酒店,抵达后办理入住;";
  2711. }
  2712. else
  2713. {
  2714. var end_Object = threeCodes.Find(x => x.Three.ToUpper() == stopCity.ToUpper());
  2715. if (end_Object == null)
  2716. {
  2717. end_Object = new Res_ThreeCode()
  2718. {
  2719. AirPort = empty,
  2720. AirPort_En = empty,
  2721. City = empty,
  2722. Country = empty,
  2723. Four = empty,
  2724. Three = empty,
  2725. };
  2726. }
  2727. //trip += $"{end_Object.City}\r\n";
  2728. // trip += @"08:00 早餐于酒店;
  2729. //09:00—10:30 公务活动;
  2730. //12:00 午餐于当地餐厅;
  2731. //14:00—16:00 公务活动;
  2732. //18:00 晚餐于当地餐厅;
  2733. //19:00 入住酒店休息;";
  2734. trip += "09:00—10:30 公务活动;\r\n14:00—16:00 公务活动;\r\n";
  2735. }
  2736. string[] traffic = new string[] { "飞机", "汽车" };
  2737. if (!isMoreTraffic)
  2738. {
  2739. traffic = new string[] { "汽车", "" };
  2740. }
  2741. NewListTravel.Add(new Grp_TravelList
  2742. {
  2743. CreateTime = DateTime.Now,
  2744. CreateUserId = 0,
  2745. Diid = diid,
  2746. Date = Convert.ToDateTime(item).ToString("M月d日"),
  2747. Trip = trip,
  2748. WeekDay = weekDay,
  2749. Days = index + 1,
  2750. Traffic_First = traffic[0],
  2751. Traffic_Second = traffic[1],
  2752. Diffgroup = 1,
  2753. Issel = 1,
  2754. IsDel = 0,
  2755. });
  2756. index++;
  2757. }
  2758. return new Result() { Code = 0, Msg = "获取成功!", Data = NewListTravel };
  2759. }
  2760. /// <summary>
  2761. /// 根据日期获取星期
  2762. /// </summary>
  2763. /// <param name="dt"></param>
  2764. /// <returns></returns>
  2765. public static string GetWeek(this string dtStr)
  2766. {
  2767. string week = "";
  2768. bool isDt = DateTime.TryParse(dtStr, out DateTime dt);
  2769. if (isDt)
  2770. {
  2771. week = weekdays[(int)dt.DayOfWeek];
  2772. }
  2773. return week;
  2774. }
  2775. #endregion
  2776. #region 三公费用明细 文件下载
  2777. /// <summary>
  2778. /// 获取三公费用标准city
  2779. /// </summary>
  2780. /// <param name="placeData"></param>
  2781. /// <param name="nationalTravelFeeId"></param>
  2782. /// <returns></returns>
  2783. private static string GetEnterExitCostExportCity(List<Grp_NationalTravelFee> placeData, int nationalTravelFeeId)
  2784. {
  2785. string _city = string.Empty;
  2786. if (placeData.Count < 1) return _city;
  2787. var data = placeData.Find(it => it.Id == nationalTravelFeeId);
  2788. if (data == null) return _city;
  2789. string country = data.Country;
  2790. string city = data.City;
  2791. if (city.Contains("其他城市") || city.Contains("所有城市")) _city = $"{country}-{city}";
  2792. else _city = city;
  2793. return _city;
  2794. }
  2795. /// <summary>
  2796. /// 三公费用明细 文件下载
  2797. /// </summary>
  2798. /// <param name="diId"></param>
  2799. /// <param name="userId"></param>
  2800. /// <param name="CTable"></param>
  2801. /// <returns></returns>
  2802. public static async Task<JsonView> EnterExitCostDownload(EnterExitCostDownloadDto dto, string fileFormat = "pdf")
  2803. {
  2804. var _view = new JsonView() { Code = StatusCodes.Status204NoContent };
  2805. if (dto.DiId < 1)
  2806. {
  2807. _view.Msg = "请传入有效的DiId参数;";
  2808. return _view;
  2809. }
  2810. if (dto.ExportType < 1)
  2811. {
  2812. _view.Msg = MsgTips.Port;
  2813. return _view;
  2814. }
  2815. if (dto.SubTypeId < 1)
  2816. {
  2817. _view.Msg = @"请传入有效的SubTypeId参数;
  2818. 1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)
  2819. 2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)
  2820. 3 团组成员名单 1 团组成员名单";
  2821. return _view;
  2822. }
  2823. try
  2824. {
  2825. var enterExitCosts = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
  2826. var dayAndCosts = _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
  2827. if (enterExitCosts == null)
  2828. {
  2829. _view.Msg = @"该团组未填写出入境费用;";
  2830. return _view;
  2831. }
  2832. //数据源
  2833. List<Grp_DayAndCost> dac1 = dayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
  2834. List<Grp_DayAndCost> dac2 = dayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
  2835. List<Grp_DayAndCost> dac3 = dayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
  2836. List<Grp_DayAndCost> dac4 = dayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
  2837. var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
  2838. var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
  2839. var DeleClientList = _sqlSugar.Queryable<Grp_TourClientList>()
  2840. .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id && dc.IsDel == 0)
  2841. .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id && dc.IsDel == 0)
  2842. .Where((tcl, dc, cc) => tcl.IsDel == 0 && tcl.DiId == dto.DiId)
  2843. .Select((tcl, dc, cc) => new
  2844. {
  2845. Name = dc.LastName + dc.FirstName,
  2846. Sex = dc.Sex,
  2847. Birthday = dc.BirthDay,
  2848. Company = cc.CompanyFullName,
  2849. Job = dc.Job
  2850. })
  2851. .ToList();
  2852. var blackCode = _sqlSugar.Queryable<Air_TicketBlackCode>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
  2853. var threeCodes = _sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList();
  2854. var placeData = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0).ToList();
  2855. var rateDatas = await enterExitCosts.CurrencyRemark.SplitExchangeRate();
  2856. _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
  2857. if (dto.ExportType == 1) //明细表
  2858. {
  2859. if (dto.SubTypeId == 1005) //1005(默认明细表)
  2860. {
  2861. if (!fileFormat.Equals("pdf")) fileFormat = "docx";
  2862. //获取模板
  2863. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/出入境费用表模板.docx");
  2864. //载入模板
  2865. Document doc = new Document(tempPath);
  2866. DocumentBuilder builder = new DocumentBuilder(doc);
  2867. //利用键值对存放数据
  2868. Dictionary<string, string> dic = new Dictionary<string, string>();
  2869. decimal stayFeeTotal = dayAndCosts.Where(it => it.Type == 1).Sum(it => it.SubTotal); // 住宿费
  2870. decimal mealsFeeTotal = dayAndCosts.Where(it => it.Type == 2).Sum(it => it.SubTotal); // 伙食费费
  2871. decimal miscellaneousFeeTotal = dayAndCosts.Where(it => it.Type == 3).Sum(it => it.SubTotal); // 公杂费
  2872. decimal tainFeeTotal = dayAndCosts.Where(it => it.Type == 4).Sum(it => it.SubTotal); // 培训费
  2873. decimal insidePayTotal = enterExitCosts.InsidePay;
  2874. string row1_1 = "";
  2875. if (enterExitCosts.Visa > 0)
  2876. {
  2877. //insidePayTotal += enterExitCosts.Visa;
  2878. row1_1 = $"签证费: {enterExitCosts.Visa.ToString("#0.00")} 人民币/人";
  2879. if (!string.IsNullOrEmpty(enterExitCosts.VisaRemark))
  2880. {
  2881. row1_1 += $"\t签证费用描述: {enterExitCosts.VisaRemark}";
  2882. }
  2883. }
  2884. string row1_2 = "";
  2885. if (enterExitCosts.YiMiao > 0)
  2886. {
  2887. //insidePayTotal += enterExitCosts.YiMiao;
  2888. row1_2 += $"疫苗费:{enterExitCosts.YiMiao.ToString("#0.00")} 人民币/人";
  2889. }
  2890. if (enterExitCosts.HeSuan > 0)
  2891. {
  2892. //insidePayTotal += enterExitCosts.HeSuan;
  2893. row1_2 += $"核酸检测费:{enterExitCosts.HeSuan.ToString("#0.00")} 人民币/人";
  2894. }
  2895. if (enterExitCosts.Service > 0)
  2896. {
  2897. //insidePayTotal += enterExitCosts.Service;
  2898. row1_2 += $"服务费:{enterExitCosts.Service.ToString("#0.00")} 人民币/人";
  2899. }
  2900. string row1_3 = "";
  2901. if (enterExitCosts.Safe > 0)
  2902. {
  2903. //insidePayTotal += enterExitCosts.Safe;
  2904. row1_3 += $"保险费:{enterExitCosts.Safe.ToString("#0.00")} 人民币/人";
  2905. }
  2906. if (enterExitCosts.Ticket > 0)
  2907. {
  2908. //insidePayTotal += enterExitCosts.Ticket;
  2909. row1_3 += $"参展门票:{enterExitCosts.Ticket.ToString("#0.00")} 人民币/人";
  2910. }
  2911. string row1 = "";
  2912. if (!string.IsNullOrEmpty(row1_1)) row1 += $"{row1_1}\r\n";
  2913. if (!string.IsNullOrEmpty(row1_2)) row1 += $"{row1_2}\r\n";
  2914. if (!string.IsNullOrEmpty(row1_3)) row1 += $"{row1_3}";
  2915. dic.Add("InsidePay", insidePayTotal.ToString("#0.00"));
  2916. dic.Add("Row1Str", row1);
  2917. dic.Add("OutsideJJ", enterExitCosts.OutsideJJPay.ToString("#0.00"));
  2918. dic.Add("OutsaideGW", enterExitCosts.OutsideGWPay.ToString("#0.00"));
  2919. dic.Add("AirJJ", enterExitCosts.AirJJ.ToString("#0.00"));
  2920. dic.Add("AirGW", enterExitCosts.AirGW.ToString("#0.00"));
  2921. dic.Add("CityTranffic", enterExitCosts.CityTranffic.ToString("#0.00"));
  2922. dic.Add("SubZS", stayFeeTotal.ToString("#0.00"));
  2923. dic.Add("SubHS", mealsFeeTotal.ToString("#0.00"));
  2924. string miscellaneousFeeTotalStr = miscellaneousFeeTotal.ToString("#0.00");
  2925. dic.Add("SubGZF", miscellaneousFeeTotalStr);
  2926. //dic.Add("SubPX", tainFeeTotal.ToString("#0.00"));
  2927. decimal subJJC = insidePayTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + enterExitCosts.OutsideJJPay;
  2928. decimal subGWC = insidePayTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + enterExitCosts.OutsideGWPay;
  2929. dic.Add("SubJJC", subJJC.ToString("#0.00"));
  2930. dic.Add("SubGWC", subGWC.ToString("#0.00"));
  2931. #region 填充word模板书签内容
  2932. foreach (var key in dic.Keys)
  2933. {
  2934. builder.MoveToBookmark(key);
  2935. builder.Write(dic[key]);
  2936. }
  2937. #endregion
  2938. #region 填充word表格内容
  2939. ////获读取指定表格方法二
  2940. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  2941. Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
  2942. for (int i = 0; i < dac1.Count; i++)
  2943. {
  2944. Grp_DayAndCost dac = dac1[i];
  2945. if (dac == null) continue;
  2946. builder.MoveToCell(0, i, 0, 0);
  2947. builder.Write("第" + dac.Days.ToString() + "晚:");
  2948. builder.MoveToCell(0, i, 1, 0);
  2949. //builder.Write(placeData.Find(it => it.Id == dac.NationalTravelFeeId)?.Country ?? "Unknown");
  2950. //builder.Write(dac.Place == null ? "" : dac.Place);
  2951. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
  2952. builder.MoveToCell(0, i, 2, 0);
  2953. builder.Write("费用标准:");
  2954. string curr = "";
  2955. var currData = _CurrDatas.Where(it => it.Id == dac.Currency).FirstOrDefault();
  2956. if (currData != null)
  2957. {
  2958. curr = currData.Name;
  2959. }
  2960. builder.MoveToCell(0, i, 3, 0);
  2961. builder.Write(dac.Cost.ToString("#0.00") + curr);
  2962. builder.MoveToCell(0, i, 4, 0);
  2963. builder.Write("费用小计:");
  2964. builder.MoveToCell(0, i, 5, 0);
  2965. builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
  2966. }
  2967. //删除多余行
  2968. while (table1.Rows.Count > dac1.Count)
  2969. {
  2970. table1.Rows.RemoveAt(dac1.Count);
  2971. }
  2972. Aspose.Words.Tables.Table table2 = allTables[1] as Aspose.Words.Tables.Table;
  2973. for (int i = 0; i < dac2.Count; i++)
  2974. {
  2975. Grp_DayAndCost dac = dac2[i];
  2976. if (dac == null) continue;
  2977. builder.MoveToCell(1, i, 0, 0);
  2978. builder.Write("第" + dac.Days.ToString() + "天:");
  2979. builder.MoveToCell(1, i, 1, 0);
  2980. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
  2981. builder.MoveToCell(1, i, 2, 0);
  2982. builder.Write("费用标准:");
  2983. string curr = "";
  2984. var currData = _CurrDatas.Where(it => it.Id == dac.Currency).FirstOrDefault();
  2985. if (currData != null)
  2986. {
  2987. curr = currData.Name;
  2988. }
  2989. builder.MoveToCell(1, i, 3, 0);
  2990. builder.Write(dac.Cost.ToString("#0.00") + curr);
  2991. builder.MoveToCell(1, i, 4, 0);
  2992. builder.Write("费用小计:");
  2993. builder.MoveToCell(1, i, 5, 0);
  2994. builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
  2995. }
  2996. //删除多余行
  2997. while (table2.Rows.Count > dac2.Count)
  2998. {
  2999. table2.Rows.RemoveAt(dac2.Count);
  3000. }
  3001. Aspose.Words.Tables.Table table3 = allTables[2] as Aspose.Words.Tables.Table;
  3002. for (int i = 0; i < dac3.Count; i++)
  3003. {
  3004. Grp_DayAndCost dac = dac3[i];
  3005. if (dac == null) continue;
  3006. builder.MoveToCell(2, i, 0, 0);
  3007. builder.Write("第" + dac.Days.ToString() + "天:");
  3008. builder.MoveToCell(2, i, 1, 0);
  3009. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
  3010. builder.MoveToCell(2, i, 2, 0);
  3011. builder.Write("费用标准:");
  3012. string curr = "";
  3013. var currData = _CurrDatas.Where(it => it.Id == dac.Currency).FirstOrDefault();
  3014. if (currData != null)
  3015. {
  3016. curr = currData.Name;
  3017. }
  3018. builder.MoveToCell(2, i, 3, 0);
  3019. builder.Write(dac.Cost.ToString("#0.00") + curr);
  3020. builder.MoveToCell(2, i, 4, 0);
  3021. builder.Write("费用小计:");
  3022. builder.MoveToCell(2, i, 5, 0);
  3023. builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
  3024. }
  3025. //删除多余行
  3026. while (table3.Rows.Count > dac3.Count)
  3027. {
  3028. table3.Rows.RemoveAt(dac3.Count);
  3029. }
  3030. #endregion
  3031. //文件名
  3032. //string strFileName = $"{_DelegationInfo.TeamName}出入境费用{Guid.NewGuid().ToString()}.{fileFormat}";
  3033. //string strFileName = $"{_DelegationInfo.TeamName}-出入境费用{Guid.NewGuid().ToString()}.{fileFormat}";
  3034. string strFileName = $"{_DelegationInfo.TeamName}{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.{fileFormat}";
  3035. AsposeHelper.removewatermark_v2180();
  3036. //doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3037. var saveFormat = Aspose.Words.SaveFormat.Docx;
  3038. if (fileFormat.Equals("pdf"))
  3039. {
  3040. //doc.LayoutOptions.IsShowComments = false;
  3041. doc.LayoutOptions.IsShowHiddenText = false;
  3042. doc.LayoutOptions.IsShowParagraphMarks = false;
  3043. doc.LayoutOptions.RevisionOptions.DeletedTextEffect = RevisionTextEffect.None;
  3044. doc.AcceptAllRevisions();
  3045. Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
  3046. options.Compliance = PdfCompliance.PdfA1a;
  3047. options.CreateNoteHyperlinks = true;
  3048. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName, options);
  3049. //_view.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName };
  3050. _view.Data = new { Url = strFileName };
  3051. _view.Msg = "成功";
  3052. return _view;
  3053. }
  3054. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName, saveFormat);
  3055. _view.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName };
  3056. _view.Msg = "成功";
  3057. return _view;
  3058. }
  3059. else if (dto.SubTypeId == 1006)//1006(因公出国(境)经费测算明细表)
  3060. {
  3061. //获取模板
  3062. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/因公出国(境)经费测算明细表.docx");
  3063. //载入模板
  3064. Document doc = new Document(tempPath);
  3065. DocumentBuilder builder = new DocumentBuilder(doc);
  3066. Dictionary<string, string> dic = new Dictionary<string, string>();
  3067. if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
  3068. {
  3069. List<string> list = new List<string>();
  3070. try
  3071. {
  3072. var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
  3073. foreach (var item in spilitArr)
  3074. {
  3075. var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
  3076. var depCode = spDotandEmpty[2].Substring(0, 3);
  3077. var arrCode = spDotandEmpty[2].Substring(3, 3);
  3078. string depName = threeCodes.Find(it => it.Three.Equals(depCode)).City,
  3079. arrName = threeCodes.Find(it => it.Three.Equals(arrCode)).City;
  3080. list.Add(depName);
  3081. list.Add(arrName);
  3082. }
  3083. list = list.Distinct().ToList();
  3084. dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
  3085. }
  3086. catch (Exception)
  3087. {
  3088. dic.Add("ReturnCode", "行程录入不正确!");
  3089. }
  3090. }
  3091. else
  3092. {
  3093. dic.Add("ReturnCode", "未录入行程!");
  3094. }
  3095. dic.Add("ReturnCodeAir", dic["ReturnCode"]);
  3096. dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
  3097. dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
  3098. if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
  3099. {
  3100. TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
  3101. dic.Add("Day", sp.Days.ToString());
  3102. }
  3103. dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
  3104. dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
  3105. //var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
  3106. //dic.Add("Names", Names);
  3107. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  3108. Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
  3109. decimal dac1totalPrice = 0.00M;
  3110. int accommodationStartIndex = 6, foodandotherStartIndex = 22;
  3111. foreach (var dac in dac1)
  3112. {
  3113. if (dac.SubTotal == 0.00M)
  3114. {
  3115. continue;
  3116. }
  3117. //builder.MoveToCell(0, accommodationStartIndex, 0, 0);
  3118. //builder.Write(DeleClientList[i].LastName + DeleClientList[i].Name);
  3119. builder.MoveToCell(0, accommodationStartIndex, 1, 0);
  3120. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
  3121. builder.MoveToCell(0, accommodationStartIndex, 2, 0);
  3122. string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknown";
  3123. builder.Write(currency);//币种
  3124. builder.MoveToCell(0, accommodationStartIndex, 3, 0);
  3125. builder.Write(dac.Cost.ToString("#0.00"));//标准
  3126. builder.MoveToCell(0, accommodationStartIndex, 4, 0);
  3127. builder.Write("");//人数
  3128. builder.MoveToCell(0, accommodationStartIndex, 5, 0);
  3129. builder.Write("");//天数
  3130. builder.MoveToCell(0, accommodationStartIndex, 6, 0);
  3131. builder.Write(dac.SubTotal.ToString("#0.00"));//小计
  3132. builder.MoveToCell(0, accommodationStartIndex, 7, 0);
  3133. decimal rate = 0.00M;
  3134. rate = rateDatas.Find(it => it.CurrencyName.Equals(currency))?.Rate ?? 0.00M;
  3135. builder.Write(rate.ToString("#0.0000"));//汇率
  3136. builder.MoveToCell(0, accommodationStartIndex, 8, 0);
  3137. decimal rbmPrice = dac.SubTotal;
  3138. builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
  3139. accommodationStartIndex++;
  3140. dac1totalPrice += Convert.ToDecimal(rbmPrice.ToString("#0.00"));
  3141. }
  3142. dic.Add("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
  3143. for (int i = 21; i > (dac1.Count == 0 ? 1 : dac1.Count) + 6; i--)
  3144. {
  3145. table1.Rows.RemoveAt(i - 1);
  3146. foodandotherStartIndex--;
  3147. }
  3148. if (dac2.Count == dac3.Count)//国家 币种 金额
  3149. {
  3150. for (int i = 0; i < dac2.Count; i++)
  3151. {
  3152. dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
  3153. dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
  3154. }
  3155. }
  3156. decimal dac2totalPrice = 0.00M;
  3157. foreach (var dac in dac2)
  3158. {
  3159. if (dac.SubTotal == 0)
  3160. {
  3161. continue;
  3162. }
  3163. builder.MoveToCell(0, foodandotherStartIndex, 1, 0);
  3164. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
  3165. builder.MoveToCell(0, foodandotherStartIndex, 2, 0);
  3166. string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknown";
  3167. builder.Write(currency);//币种
  3168. builder.MoveToCell(0, foodandotherStartIndex, 3, 0);
  3169. builder.Write(dac.Cost.ToString("#0.00"));//标准
  3170. builder.MoveToCell(0, foodandotherStartIndex, 4, 0);
  3171. builder.Write("");//人数
  3172. builder.MoveToCell(0, foodandotherStartIndex, 5, 0);
  3173. builder.Write("");//天数
  3174. builder.MoveToCell(0, foodandotherStartIndex, 6, 0);
  3175. builder.Write(dac.SubTotal.ToString("#0.00"));//小计
  3176. builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
  3177. decimal rate = 0.00M;
  3178. rate = rateDatas.Find(it => it.CurrencyName.Equals(currency))?.Rate ?? 0.00M;
  3179. builder.Write(rate.ToString("#0.0000"));//汇率
  3180. builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
  3181. decimal rbmPrice = dac.SubTotal;
  3182. builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
  3183. foodandotherStartIndex++;
  3184. dac2totalPrice += Convert.ToDecimal(rbmPrice.ToString("#0.00"));
  3185. }
  3186. dic.Add("dac2totalPrice", dac2totalPrice.ToString("#0.00"));
  3187. for (int i = foodandotherStartIndex + (15 - dac2.Count); i > (dac2.Count == 0 ? 1 : 0) + foodandotherStartIndex; i--)
  3188. {
  3189. table1.Rows.RemoveAt(i - 1);
  3190. }
  3191. dic.Add("CityTranffic", enterExitCosts.CityTranffic.ToString("#0.00"));
  3192. string otherFeeStr = "";
  3193. if (enterExitCosts.Visa > 0) otherFeeStr += $"签证费: {enterExitCosts.Visa.ToString("#0.00")} 元,";
  3194. if (enterExitCosts.Safe > 0) otherFeeStr += $"保险费: {enterExitCosts.Safe.ToString("#0.00")} 元,";
  3195. if (enterExitCosts.Ticket > 0) otherFeeStr += $"参展门票费: {enterExitCosts.Ticket.ToString("#0.00")} 元,";
  3196. if (otherFeeStr.Length > 0)
  3197. {
  3198. otherFeeStr = otherFeeStr.Substring(0, otherFeeStr.Length - 1);
  3199. otherFeeStr = $"({otherFeeStr})";
  3200. dic.Add("OtherFeeStr", otherFeeStr);
  3201. }
  3202. //总计
  3203. decimal allPrice = dac1totalPrice + dac2totalPrice + enterExitCosts.Visa + enterExitCosts.Safe + enterExitCosts.Ticket;
  3204. //国际旅费
  3205. string outsideJJ = "";
  3206. string allPriceJJ = "";
  3207. if (enterExitCosts.SumJJC == 1)
  3208. {
  3209. outsideJJ = string.Format(@"经济舱:{0} 元/人", enterExitCosts.AirJJ.ToString("#0.00"));
  3210. allPriceJJ = string.Format(@"经济舱:{0} 元/人", (allPrice + enterExitCosts.OutsideJJPay).ToString("#0.00"));
  3211. }
  3212. string outsideGW = "";
  3213. string allPriceGW = "";
  3214. if (enterExitCosts.SumGWC == 1)
  3215. {
  3216. outsideGW = string.Format(@"公务舱:{0} 元/人", enterExitCosts.AirGW.ToString("#0.00"));
  3217. allPriceGW = string.Format(@"公务舱:{0} 元/人", (allPrice + enterExitCosts.OutsideGWPay).ToString("#0.00"));
  3218. }
  3219. if (enterExitCosts.SumJJC == 1 || enterExitCosts.SumGWC == 1)
  3220. {
  3221. string InTravelPriceStr = string.Format(@" ({0} {1})", outsideJJ, outsideGW);
  3222. dic.Add("InTravelPrice", InTravelPriceStr);
  3223. string FinalSumPriceStr = string.Format(@" ({0} {1})", allPriceJJ, allPriceGW);
  3224. dic.Add("FinalSumPrice", FinalSumPriceStr);
  3225. }
  3226. //dic.Add("VisaPay", enterExitCosts.Visa.ToString("#0.00"));
  3227. //dic.Add("SafePay", enterExitCosts.Safe.ToString("#0.00"));
  3228. //dic.Add("YiMiao", enterExitCosts.YiMiao.ToString("#0.00"));
  3229. foreach (var key in dic.Keys)
  3230. {
  3231. builder.MoveToBookmark(key);
  3232. builder.Write(dic[key]);
  3233. }
  3234. //模板文件名
  3235. string strFileName = $"{_DelegationInfo.TeamName}因公出国(境)经费测算明细表.docx";
  3236. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3237. string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
  3238. _view.Data = new { Url = url };
  3239. _view.Msg = "成功";
  3240. return _view;
  3241. }
  3242. else if (dto.SubTypeId == 1007) //1007(四川省商务厅出国经费财政先行审核表)
  3243. {
  3244. //获取模板
  3245. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/四川省商务厅出国经费财政先行审核表.xls");
  3246. //载入模板
  3247. WorkbookDesigner designer = new WorkbookDesigner();
  3248. designer.Workbook = new Workbook(tempPath);
  3249. Dictionary<string, string> dic = new Dictionary<string, string>();
  3250. if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
  3251. {
  3252. List<string> list = new List<string>();
  3253. try
  3254. {
  3255. var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
  3256. foreach (var item in spilitArr)
  3257. {
  3258. var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
  3259. var depCode = spDotandEmpty[2].Substring(0, 3);
  3260. var arrCode = spDotandEmpty[2].Substring(3, 3);
  3261. string depName = threeCodes.Find(it => it.Three.Equals(depCode))?.City ?? "Unknwon",
  3262. arrName = threeCodes.Find(it => it.Three.Equals(arrCode))?.City ?? "Unknown";
  3263. list.Add(depName);
  3264. list.Add(arrName);
  3265. }
  3266. list = list.Distinct().ToList();
  3267. dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
  3268. }
  3269. catch (Exception)
  3270. {
  3271. dic.Add("ReturnCode", "行程录入不正确!");
  3272. }
  3273. }
  3274. else
  3275. {
  3276. dic.Add("ReturnCode", "未录入行程!");
  3277. }
  3278. dic.Add("ReturnCodeAir", dic["ReturnCode"]);
  3279. dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
  3280. dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
  3281. if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
  3282. {
  3283. TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
  3284. dic.Add("Day", sp.Days.ToString());
  3285. }
  3286. dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
  3287. dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
  3288. var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
  3289. designer.SetDataSource("ClientUnit", _DelegationInfo.ClientUnit);
  3290. designer.SetDataSource("VisitCountry", _DelegationInfo.VisitCountry);
  3291. designer.SetDataSource("Group", _DelegationInfo.TeamName);
  3292. designer.SetDataSource("ClientUnitTitle", _DelegationInfo.TeamName);
  3293. designer.SetDataSource("Name", Names);
  3294. designer.SetDataSource("VisitStartDate", dic["VisitStartDate"] + "-" + dic["VisitEndDate"]);
  3295. designer.SetDataSource("Day", dic["Day"] + "天");
  3296. designer.SetDataSource("ReturnCode", dic["ReturnCode"]);
  3297. designer.SetDataSource("ReturnCodeAir", dic["ReturnCodeAir"]);
  3298. int startIndex = 10;
  3299. const int startIndexcopy = 10;
  3300. if (dac2.Count == dac3.Count)//国家 币种 金额
  3301. {
  3302. for (int i = 0; i < dac2.Count; i++)
  3303. {
  3304. dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
  3305. dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
  3306. }
  3307. }
  3308. DataTable dtdac1 = new DataTable();
  3309. List<string> place = new List<string>();
  3310. dtdac1.Columns.AddRange(new DataColumn[] {
  3311. new DataColumn(){ ColumnName = "city"},
  3312. new DataColumn(){ ColumnName = "curr"},
  3313. new DataColumn(){ ColumnName = "criterion"},
  3314. new DataColumn(){ ColumnName = "number",DataType = typeof(int)},
  3315. new DataColumn(){ ColumnName = "day",DataType = typeof(int)},
  3316. new DataColumn(){ ColumnName = "cost", DataType = typeof(decimal)},
  3317. new DataColumn(){ ColumnName = "rate", DataType = typeof(decimal) },
  3318. new DataColumn(){ ColumnName = "costRMB", DataType = typeof(decimal) },
  3319. });
  3320. DataTable dtdac2 = new DataTable();
  3321. dtdac2.Columns.AddRange(new DataColumn[] {
  3322. new DataColumn(){ ColumnName = "city"},
  3323. new DataColumn(){ ColumnName = "curr"},
  3324. new DataColumn(){ ColumnName = "criterion"},
  3325. new DataColumn(){ ColumnName = "number",DataType = typeof(int)},
  3326. new DataColumn(){ ColumnName = "day",DataType = typeof(int)},
  3327. new DataColumn(){ ColumnName = "cost", DataType = typeof(decimal)},
  3328. new DataColumn(){ ColumnName = "rate", DataType = typeof(decimal) },
  3329. new DataColumn(){ ColumnName = "costRMB",DataType = typeof(decimal)},
  3330. });
  3331. dtdac1.TableName = "tb1";
  3332. dtdac2.TableName = "tb2";
  3333. decimal dac1totalPrice = 0.00M, dac2totalPrice = 0.00M;
  3334. foreach (var item in dac1)
  3335. {
  3336. item.Place = GetEnterExitCostExportCity(placeData, item.NationalTravelFeeId);
  3337. if (place.Contains(item.Place))
  3338. {
  3339. continue;
  3340. }
  3341. DataRow row = dtdac1.NewRow();
  3342. row["city"] = item.Place;
  3343. string currency = _CurrDatas.Find(it => it.Id == item.Currency)?.Remark ?? "Unknwon";
  3344. decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
  3345. row["curr"] = currency;
  3346. row["rate"] = rate.ToString("#0.0000");
  3347. row["criterion"] = item.Cost.ToString("#0.00");
  3348. row["number"] = 1;
  3349. row["day"] = dac1.FindAll(x => x.NationalTravelFeeId == item.NationalTravelFeeId).Count;
  3350. //row["costRMB"] = rbmPrice;
  3351. dtdac1.Rows.Add(row);
  3352. place.Add(item.Place);
  3353. }
  3354. place = new List<string>();
  3355. foreach (var item in dac2)
  3356. {
  3357. item.Place = GetEnterExitCostExportCity(placeData, item.NationalTravelFeeId);
  3358. if (place.Contains(item.Place))
  3359. {
  3360. continue;
  3361. }
  3362. DataRow row = dtdac2.NewRow();
  3363. row["city"] = item.Place;
  3364. string currency = _CurrDatas.Find(it => it.Id == item.Currency)?.Remark ?? "Unknwon";
  3365. decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
  3366. row["curr"] = currency;
  3367. row["rate"] = rate.ToString("#0.0000");
  3368. row["criterion"] = item.Cost.ToString("#0.00");
  3369. row["number"] = 1;
  3370. row["day"] = dac2.FindAll(x => x.NationalTravelFeeId == item.NationalTravelFeeId).Count;
  3371. //row["cost"] = item.SubTotal;
  3372. //row["costRMB"] = rbmPrice;
  3373. dtdac2.Rows.Add(row);
  3374. place.Add(item.Place);
  3375. //dac2totalPrice += rbmPrice;
  3376. }
  3377. dac1totalPrice = dac1.Sum(it => it.SubTotal);
  3378. dac2totalPrice = dac2.Sum(it => it.SubTotal);
  3379. designer.SetDataSource("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
  3380. designer.SetDataSource("dac2totalPrice", dac2totalPrice);
  3381. designer.SetDataSource("cityTranffic", @$"其中:国外城市间机票费: {enterExitCosts.CityTranffic.ToString("#0.00")} 元");
  3382. designer.SetDataSource("sumCityTranffic", @$"{enterExitCosts.CityTranffic.ToString("#0.00")} ");
  3383. string cell4Str = $" 4.国际旅费:经济舱:{enterExitCosts.AirJJ.ToString("#0.00")} 元/人,公务舱:{enterExitCosts.AirGW.ToString("#0.00")} 元/人";
  3384. string cellStr = $" 5.其他费用(";
  3385. if (enterExitCosts.Visa > 0) cellStr += $"签证费:{enterExitCosts.Visa.ToString("#0.00")}元,";
  3386. if (enterExitCosts.YiMiao > 0) cellStr += $"疫苗费:{enterExitCosts.YiMiao.ToString("#0.00")}元,";
  3387. if (enterExitCosts.HeSuan > 0) cellStr += $"核酸费:{enterExitCosts.HeSuan.ToString("#0.00")}元,";
  3388. if (enterExitCosts.Safe > 0) cellStr += $"保险费:{enterExitCosts.Safe.ToString("#0.00")}元,";
  3389. if (enterExitCosts.Ticket > 0) cellStr += $"参展门票费:{enterExitCosts.Ticket.ToString("#0.00")}元,";
  3390. if (enterExitCosts.Service > 0) cellStr += $"服务费:{enterExitCosts.Service.ToString("#0.00")}元,";
  3391. if (cellStr.Length > 8)
  3392. {
  3393. cellStr = cellStr.Substring(0, cellStr.Length - 1);
  3394. }
  3395. cellStr += ")";
  3396. decimal otherFee = enterExitCosts.Visa + enterExitCosts.YiMiao + enterExitCosts.HeSuan + enterExitCosts.Safe + enterExitCosts.Ticket + enterExitCosts.Service;
  3397. decimal s = dac1totalPrice + dac2totalPrice + enterExitCosts.OutsideJJPay + enterExitCosts.OutsideGWPay + otherFee;
  3398. decimal pxFee = dac4.Sum(it => it.Cost);
  3399. decimal glvFee = enterExitCosts.OutsideJJPay + enterExitCosts.OutsideGWPay;
  3400. string celllastStr1 = "";
  3401. if (dac1totalPrice > 0) celllastStr1 += $"住宿费 {dac1totalPrice.ToString("#0.00")} 元";
  3402. if (dac2totalPrice > 0) celllastStr1 += $",伙食费和公杂费 {dac2totalPrice.ToString("#0.00")} 元";
  3403. if (pxFee > 0) celllastStr1 += $",培训费 {pxFee.ToString("#0.00")} 元";
  3404. celllastStr1 += $",国际旅费 元";
  3405. if (otherFee > 0) celllastStr1 += $",其他费用 {otherFee.ToString("#0.00")} 元";
  3406. string celllastStr = $" 经审核,{celllastStr1},本次出国经费预算合计为 元。其中:市本级安排 。";
  3407. designer.SetDataSource("cell4Str", cell4Str);
  3408. designer.SetDataSource("cellStr", cellStr);
  3409. designer.SetDataSource("cellSum", (enterExitCosts.Visa + enterExitCosts.Safe).ToString("#0.00"));
  3410. designer.SetDataSource("cellSum4", (enterExitCosts.OutsideJJPay + enterExitCosts.OutsideGWPay).ToString("#0.00"));
  3411. designer.SetDataSource("celllastStr", celllastStr);
  3412. Workbook wb = designer.Workbook;
  3413. var sheet = wb.Worksheets[0];
  3414. //绑定datatable数据集
  3415. designer.SetDataSource(dtdac1);
  3416. designer.SetDataSource(dtdac2);
  3417. designer.Process();
  3418. var rowStart = dtdac1.Rows.Count;
  3419. while (rowStart > 0)
  3420. {
  3421. sheet.Cells[startIndex, 8].Formula = $"=G{startIndex + 1} * H{startIndex + 1}";
  3422. sheet.Cells[startIndex, 6].Formula = $"=E{startIndex + 1} * F{startIndex + 1} * D{startIndex + 1}";
  3423. startIndex++;
  3424. rowStart--;
  3425. }
  3426. sheet.Cells[startIndex, 8].Formula = $"=SUM(I{startIndexcopy + 1}: I{startIndex})";
  3427. startIndex += 1; //总计行
  3428. rowStart = dtdac2.Rows.Count;
  3429. while (rowStart > 0)
  3430. {
  3431. sheet.Cells[startIndex, 8].Formula = $"= G{startIndex + 1} * H{startIndex + 1}";
  3432. sheet.Cells[startIndex, 6].Formula = $"= E{startIndex + 1} * F{startIndex + 1} * D{startIndex + 1}";
  3433. startIndex++;
  3434. rowStart--;
  3435. }
  3436. sheet.Cells[startIndex, 8].Formula = $"=SUM(I{startIndexcopy + dtdac1.Rows.Count + 2}: I{startIndex})";
  3437. wb.CalculateFormula(true);
  3438. //模板文件名
  3439. string strFileName = $"{_DelegationInfo.TeamName}-四川省商务厅出国经费财政先行审核表{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls"; ;//$".xls";
  3440. designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3441. string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
  3442. _view.Data = new { Url = url };
  3443. _view.Msg = "成功";
  3444. return _view;
  3445. }
  3446. else if (dto.SubTypeId == 1066) //成都市因公临时出国任务和预算审批意见表(外专培训团专用)
  3447. {
  3448. //获取模板
  3449. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/成都市因公临时出国任务和预算审批意见表.docx");
  3450. //载入模板
  3451. Document doc = new Document(tempPath);
  3452. DocumentBuilder builder = new DocumentBuilder(doc);
  3453. Dictionary<string, string> dic = new Dictionary<string, string>();
  3454. dic.Add("GroupName", _DelegationInfo.TeamName);
  3455. dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
  3456. string missionLeader = ""; //团负责人默认接团客户名单第一个人
  3457. string missionLeaderJob = "";//负责人job
  3458. int groupNumber = 0; //团人数
  3459. if (DeleClientList.Count > 0)
  3460. {
  3461. missionLeader = DeleClientList[0]?.Name ?? "";
  3462. missionLeaderJob = DeleClientList[0]?.Job ?? "";
  3463. }
  3464. dic.Add("MissionLeader", missionLeader); //团负责人
  3465. dic.Add("MissionLeaderJob", missionLeaderJob); //团负责人job
  3466. dic.Add("GroupNumber", _DelegationInfo.VisitPNumber.ToString()); //团人数
  3467. #region MyRegion
  3468. //if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
  3469. //{
  3470. // List<string> list = new List<string>();
  3471. // try
  3472. // {
  3473. // var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
  3474. // foreach (var item in spilitArr)
  3475. // {
  3476. // var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
  3477. // var depCode = spDotandEmpty[2].Substring(0, 3);
  3478. // var arrCode = spDotandEmpty[2].Substring(3, 3);
  3479. // string depName = threeCodes.Find(it => it.Three.Equals(depCode)).City,
  3480. // arrName = threeCodes.Find(it => it.Three.Equals(arrCode)).City;
  3481. // list.Add(depName);
  3482. // list.Add(arrName);
  3483. // }
  3484. // list = list.Distinct().ToList();
  3485. // dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
  3486. // }
  3487. // catch (Exception)
  3488. // {
  3489. // dic.Add("ReturnCode", "行程录入不正确!");
  3490. // }
  3491. //}
  3492. //else
  3493. //{
  3494. // dic.Add("ReturnCode", "未录入行程!");
  3495. //}
  3496. List<string> countrys = _dirRep.GroupSplitCountry(_DelegationInfo.VisitCountry);
  3497. dic.Add("ReturnCode", string.Join("、", countrys));
  3498. #endregion
  3499. //dic.Add("ReturnCodeAir", dic["ReturnCode"]);
  3500. //dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
  3501. //dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
  3502. //if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
  3503. //{
  3504. // TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
  3505. // dic.Add("Day", sp.Days.ToString());
  3506. //}
  3507. dic.Add("Day", _DelegationInfo.VisitDays.ToString());
  3508. dic.Add("CultivateDay", dac4.Count.ToString()); //培训天数
  3509. // dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
  3510. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  3511. Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
  3512. //培训人员名单
  3513. int cultivateRowIndex = 7;
  3514. foreach (var item in DeleClientList)
  3515. {
  3516. builder.MoveToCell(0, cultivateRowIndex, 0, 0);
  3517. builder.Write(item.Name);
  3518. builder.MoveToCell(0, cultivateRowIndex, 1, 0);
  3519. builder.Write(item.Sex == 0 ? "男" : item.Sex == 1 ? "女" : "");
  3520. builder.MoveToCell(0, cultivateRowIndex, 2, 0);
  3521. string birthDay = "";
  3522. if (item.Birthday != null)
  3523. {
  3524. DateTime dt = Convert.ToDateTime(item.Birthday);
  3525. birthDay = $"{dt.Year}.{dt.Month}";
  3526. }
  3527. builder.Write(birthDay);
  3528. builder.MoveToCell(0, cultivateRowIndex, 3, 0);
  3529. builder.Write(item.Company);
  3530. builder.MoveToCell(0, cultivateRowIndex, 4, 0);
  3531. builder.Write(item.Job);
  3532. cultivateRowIndex++;
  3533. }
  3534. //删除多余行
  3535. //cultivateRowIndex -= 2;
  3536. int delRows = 10 + 7 - cultivateRowIndex;
  3537. if (delRows > 0)
  3538. {
  3539. for (int i = 0; i < delRows; i++)
  3540. {
  3541. table1.Rows.RemoveAt(cultivateRowIndex);
  3542. //cultivateRowIndex++;
  3543. }
  3544. }
  3545. decimal hotelFeeTotal = dac1.Sum(it => it.SubTotal);//住宿费
  3546. dic.Add("HotelFeeTotal", hotelFeeTotal.ToString("#0.00"));
  3547. decimal mealsFeeTotal = dac2.Sum(it => it.SubTotal);//伙食费
  3548. dic.Add("MealsFeeTotal", mealsFeeTotal.ToString("#0.00"));
  3549. decimal miscellaneousFeeTotal = dac3.Sum(it => it.SubTotal);//公杂费
  3550. dic.Add("MiscellaneousFeeTotal", miscellaneousFeeTotal.ToString("#0.00"));
  3551. decimal trainingFeeTotal = dac4.Sum(it => it.SubTotal);//培训费
  3552. dic.Add("TrainingFeeTotal", trainingFeeTotal.ToString("#0.00"));
  3553. decimal cityTranfficFeeToatal = enterExitCosts.CityTranffic; //城市区间交通费
  3554. dic.Add("CityTranfficFeeToatal", cityTranfficFeeToatal.ToString("#0.00"));//
  3555. //其他费用
  3556. decimal otherFeeTotal = enterExitCosts.Visa + enterExitCosts.Safe + enterExitCosts.Ticket + enterExitCosts.YiMiao + enterExitCosts.HeSuan + enterExitCosts.Service;
  3557. dic.Add("OtherFeeTotal", otherFeeTotal.ToString("#0.00"));
  3558. //其他费用合计
  3559. decimal _otherFeeTotal = hotelFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + trainingFeeTotal + cityTranfficFeeToatal + otherFeeTotal;
  3560. decimal _jjcFeeToatal = enterExitCosts.AirJJ + _otherFeeTotal; //经济舱
  3561. decimal _gwcFeeToatal = enterExitCosts.AirGW + _otherFeeTotal; //公务舱
  3562. //公务舱合计
  3563. //国际旅费
  3564. string outsideJJ = "";
  3565. string allPriceJJ = "";
  3566. if (enterExitCosts.SumJJC == 1 && enterExitCosts.SumGWC == 0)
  3567. {
  3568. dic.Add("AirFeeTotal", enterExitCosts.AirJJ.ToString("#0.00"));
  3569. dic.Add("FeeTotal", _jjcFeeToatal.ToString("#0.00"));
  3570. }
  3571. if (enterExitCosts.SumGWC == 1 && enterExitCosts.SumJJC == 0)
  3572. {
  3573. dic.Add("AirFeeTotal", enterExitCosts.AirGW.ToString("#0.00"));
  3574. dic.Add("FeeTotal", _gwcFeeToatal.ToString("#0.00"));
  3575. }
  3576. if (enterExitCosts.SumJJC == 1 && enterExitCosts.SumGWC == 1)
  3577. {
  3578. string airFeeTotalStr = string.Format(@$"经济舱:{enterExitCosts.AirJJ.ToString("#0.00")} 公务舱:{enterExitCosts.AirGW.ToString("#0.00")}");
  3579. dic.Add("AirFeeTotal", airFeeTotalStr);
  3580. string feeTotalStr = string.Format(@$"经济舱:{_jjcFeeToatal.ToString("#0.00")} 公务舱:{_gwcFeeToatal.ToString("#0.00")}");
  3581. dic.Add("FeeTotal", feeTotalStr);
  3582. }
  3583. foreach (var key in dic.Keys)
  3584. {
  3585. builder.MoveToBookmark(key);
  3586. builder.Write(dic[key]);
  3587. }
  3588. //模板文件名
  3589. string strFileName = $"{_DelegationInfo.TeamName}-成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
  3590. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3591. string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
  3592. _view.Data = new { Url = url };
  3593. _view.Msg = "成功";
  3594. return _view;
  3595. }
  3596. }
  3597. else if (dto.ExportType == 2) //表格
  3598. {
  3599. //利用键值对存放数据
  3600. Dictionary<string, string> dic = new Dictionary<string, string>();
  3601. dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
  3602. dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
  3603. TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
  3604. dic.Add("Day", sp.Days.ToString());
  3605. dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
  3606. if (dto.SubTypeId == 1008) //1008(派员单位出(境)任务和预算审批意见表)
  3607. {
  3608. //获取模板
  3609. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/派员单位出(境)任务和预算审批意见表.docx");
  3610. //载入模板
  3611. Document doc = new Document(tempPath);
  3612. DocumentBuilder builder = new DocumentBuilder(doc);
  3613. dic.Add("TeamName", _DelegationInfo.TeamName);
  3614. dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
  3615. //dic.Add("TellPhone", _DelegationInfo.TellPhone);
  3616. string missionLeaderName = "",
  3617. missionLeaderJob = "";
  3618. if (DeleClientList.Count > 0)
  3619. {
  3620. missionLeaderName = DeleClientList[0].Name;
  3621. missionLeaderJob = DeleClientList[0].Job;
  3622. }
  3623. dic.Add("MissionLeaderName", missionLeaderName);
  3624. dic.Add("MissionLeaderJob", missionLeaderJob);
  3625. dic.Add("VisitPNumber", _DelegationInfo.VisitPNumber.ToString());
  3626. dic.Add("VisitPurpose", _DelegationInfo.VisitPurpose);
  3627. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  3628. Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
  3629. int rowCount = 10;//总人数行
  3630. int startRowIndex = 7; //起始行
  3631. for (int i = 0; i < DeleClientList.Count; i++)
  3632. {
  3633. builder.MoveToCell(0, startRowIndex, 0, 0);
  3634. builder.Write(DeleClientList[i].Name); //出国人员姓名
  3635. builder.MoveToCell(0, startRowIndex, 1, 0);
  3636. string sex = DeleClientList[i].Sex == 0 ? "男" : DeleClientList[i].Sex == 1 ? "女" : "";
  3637. builder.Write(sex);//性别
  3638. builder.MoveToCell(0, startRowIndex, 2, 0);
  3639. builder.Write(Convert.ToDateTime(DeleClientList[i].Birthday).ToString("yyyy年MM月dd日"));//出生年月
  3640. builder.MoveToCell(0, startRowIndex, 3, 0);
  3641. builder.Write(DeleClientList[i].Company);//工作单位
  3642. builder.MoveToCell(0, startRowIndex, 4, 0);
  3643. builder.Write(DeleClientList[i].Job);//职务及级别
  3644. builder.MoveToCell(0, startRowIndex, 5, 0);
  3645. builder.Write("");//人员属性
  3646. builder.MoveToCell(0, startRowIndex, 6, 0);
  3647. builder.Write("");//上次出国时间
  3648. startRowIndex++;
  3649. }
  3650. int nullRow = rowCount - DeleClientList.Count;//空行
  3651. for (int i = 0; i < nullRow; i++)
  3652. {
  3653. table1.Rows.Remove(table1.Rows[startRowIndex]);
  3654. }
  3655. foreach (var key in dic.Keys)
  3656. {
  3657. builder.MoveToBookmark(key);
  3658. builder.Write(dic[key]);
  3659. }
  3660. //模板文件名
  3661. string strFileName = $"派员单位出(境)任务和预算审批意见表.docx";
  3662. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3663. string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
  3664. _view.Data = new { Url = url };
  3665. _view.Msg = "成功";
  3666. return _view;
  3667. }
  3668. else if (dto.SubTypeId == 1009)//1009(省级单位出(境)经费报销单)
  3669. {
  3670. //获取模板
  3671. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/省级单位出(境)经费报销单.docx");
  3672. //载入模板
  3673. Document doc = new Document(tempPath);
  3674. DocumentBuilder builder = new DocumentBuilder(doc);
  3675. dic.Add("GroupClient", _DelegationInfo.ClientUnit);
  3676. var Names = string.Join("、", DeleClientList.Select(x => x.Name)).TrimEnd('、');
  3677. dic.Add("Names", Names);
  3678. int accommodationRows = 12, foodandotherRows = 12;
  3679. var Dac1currCn = dac1.GroupBy(x => x.Currency).Select(x => x.Key).ToList();
  3680. var Dac2currCn = dac2.GroupBy(x => x.Currency).Select(x => x.Key).ToList();
  3681. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  3682. Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
  3683. int accommodationStartIndex = 6;
  3684. decimal dac1totalPrice = 0.00M;
  3685. foreach (var dac in dac1)
  3686. {
  3687. if (dac.SubTotal == 0)
  3688. {
  3689. continue;
  3690. }
  3691. //builder.MoveToCell(0, accommodationStartIndex, 0, 0);
  3692. //builder.Write(DeleClientList[i].LastName + DeleClientList[i].Name);
  3693. builder.MoveToCell(0, accommodationStartIndex, 1, 0);
  3694. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));//城市
  3695. builder.MoveToCell(0, accommodationStartIndex, 2, 0);
  3696. string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknwon";
  3697. builder.Write(currency);//币种
  3698. builder.MoveToCell(0, accommodationStartIndex, 3, 0);
  3699. builder.Write(dac.Cost.ToString("#0.00"));//标准
  3700. builder.MoveToCell(0, accommodationStartIndex, 4, 0);
  3701. builder.Write("");//人数
  3702. builder.MoveToCell(0, accommodationStartIndex, 5, 0);
  3703. builder.Write("");//天数
  3704. builder.MoveToCell(0, accommodationStartIndex, 6, 0);
  3705. builder.Write(dac.SubTotal.ToString("#0.00"));//小计
  3706. builder.MoveToCell(0, accommodationStartIndex, 7, 0);
  3707. decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
  3708. builder.Write(rate.ToString("#0.0000"));//汇率
  3709. builder.MoveToCell(0, accommodationStartIndex, 8, 0);
  3710. decimal rbmPrice = rate * dac.SubTotal;
  3711. builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
  3712. accommodationStartIndex++;
  3713. dac1totalPrice += rbmPrice;
  3714. }
  3715. dic.Add("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
  3716. builder.MoveToCell(0, accommodationStartIndex, 1, 0);
  3717. builder.Write("小计");
  3718. builder.MoveToCell(0, accommodationStartIndex, 8, 0);
  3719. builder.Write(dac1totalPrice.ToString("#0.00"));
  3720. accommodationStartIndex++;
  3721. int nullRow = accommodationRows - dac1.Count;
  3722. //删除空行
  3723. //if (nullRow > 0)
  3724. //{
  3725. // int rowIndex = accommodationStartIndex;
  3726. // for (int i = 0; i < nullRow; i++)
  3727. // {
  3728. // Row row = table1.Rows[rowIndex];
  3729. // row.Remove();
  3730. // rowIndex++;
  3731. // }
  3732. //}
  3733. if (dac2.Count == dac3.Count)//国家 币种 金额
  3734. {
  3735. for (int i = 0; i < dac2.Count; i++)
  3736. {
  3737. dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
  3738. dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
  3739. }
  3740. }
  3741. int foodandotherStartIndex = 19;//
  3742. decimal dac2totalPrice = 0.00M;
  3743. foreach (var dac in dac2)
  3744. {
  3745. if (dac.SubTotal == 0)
  3746. {
  3747. continue;
  3748. }
  3749. //foodandotherStartIndex = 12;
  3750. builder.MoveToCell(0, foodandotherStartIndex, 1, 0);
  3751. builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));//城市
  3752. builder.MoveToCell(0, foodandotherStartIndex, 2, 0);
  3753. string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknwon";
  3754. builder.Write(currency);//币种
  3755. builder.MoveToCell(0, foodandotherStartIndex, 3, 0);
  3756. builder.Write(dac.Cost.ToString("#0.00"));//标准
  3757. builder.MoveToCell(0, foodandotherStartIndex, 4, 0);
  3758. builder.Write("");//人数
  3759. builder.MoveToCell(0, foodandotherStartIndex, 5, 0);
  3760. builder.Write("");//天数
  3761. builder.MoveToCell(0, foodandotherStartIndex, 6, 0);
  3762. builder.Write(dac.SubTotal.ToString("#0.00"));//小计
  3763. builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
  3764. decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
  3765. builder.Write(rate.ToString("#0.0000"));//汇率
  3766. builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
  3767. decimal rbmPrice = rate * dac.SubTotal;
  3768. builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
  3769. foodandotherStartIndex++;
  3770. dac2totalPrice += rbmPrice;
  3771. }
  3772. dic.Add("dac2totalPrice", dac2totalPrice.ToString("#0.00"));
  3773. //删除空行
  3774. if (dac2.Count < foodandotherRows)
  3775. {
  3776. //int nullRow = accommodationRows - dac2.Count;
  3777. //while (table2.Rows.Count > dac2.Count)
  3778. //{
  3779. // table2.Rows.RemoveAt(dac2.Count);
  3780. //}
  3781. }
  3782. dic.Add("CityTranffic", enterExitCosts.CityTranffic.ToString("#0.00"));
  3783. string otherFeeStr = "";
  3784. if (enterExitCosts.Visa > 0) otherFeeStr += $"签证费: {enterExitCosts.Visa.ToString("#0.00")} 元,";
  3785. if (enterExitCosts.Safe > 0) otherFeeStr += $"保险费: {enterExitCosts.Safe.ToString("#0.00")} 元,";
  3786. if (enterExitCosts.Ticket > 0) otherFeeStr += $"参展门票费: {enterExitCosts.Ticket.ToString("#0.00")} 元,";
  3787. if (otherFeeStr.Length > 0)
  3788. {
  3789. otherFeeStr = otherFeeStr.Substring(0, otherFeeStr.Length - 1);
  3790. otherFeeStr = $"({otherFeeStr})";
  3791. dic.Add("OtherFeeStr", otherFeeStr);
  3792. }
  3793. foreach (var key in dic.Keys)
  3794. {
  3795. builder.MoveToBookmark(key);
  3796. builder.Write(dic[key]);
  3797. }
  3798. //模板文件名
  3799. string strFileName = $"省级单位出(境)经费报销单.docx";
  3800. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3801. string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
  3802. _view.Data = new { Url = url };
  3803. _view.Msg = "成功";
  3804. return _view;
  3805. }
  3806. }
  3807. else if (dto.ExportType == 3)
  3808. {
  3809. if (dto.SubTypeId == 1) //团组成员名单
  3810. {
  3811. if (DeleClientList.Count < 1)
  3812. {
  3813. _view.Msg = "团组成员暂未录入!!!";
  3814. return _view;
  3815. }
  3816. //获取模板
  3817. string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/dwon_团组人员列表模板.doc");
  3818. //载入模板
  3819. Document doc = new Document(tempPath);
  3820. DocumentBuilder builder = new DocumentBuilder(doc);
  3821. //获取word里所有表格
  3822. NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
  3823. //获取所填表格的序数
  3824. Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
  3825. var rowStart = tableOne.Rows[0]; //获取第1行
  3826. //循环赋值
  3827. for (int i = 0; i < DeleClientList.Count; i++)
  3828. {
  3829. builder.MoveToCell(0, i + 1, 0, 0);
  3830. builder.Write(DeleClientList[i].Name);
  3831. builder.MoveToCell(0, i + 1, 1, 0);
  3832. string sex = DeleClientList[i].Sex == 0 ? "男" : DeleClientList[i].Sex == 1 ? "女" : "";
  3833. builder.Write(sex);
  3834. builder.MoveToCell(0, i + 1, 2, 0);
  3835. builder.Write(Convert.ToDateTime(DeleClientList[i].Birthday).ToString("yyyy年MM月dd日"));
  3836. builder.MoveToCell(0, i + 1, 3, 0);
  3837. builder.Write(DeleClientList[i].Company);
  3838. builder.MoveToCell(0, i + 1, 4, 0);
  3839. builder.Write(DeleClientList[i].Job);
  3840. }
  3841. //删除多余行
  3842. while (tableOne.Rows.Count > DeleClientList.Count + 1)
  3843. {
  3844. tableOne.Rows.RemoveAt(DeleClientList.Count + 1);
  3845. }
  3846. string strFileName = $"{_DelegationInfo.TeamName}组团人员名单({DateTime.Now.ToString("yyyyMMddHHmmss")}).doc";
  3847. //C:/Server/File/OA2023/Office/Word/EnterExitCost/File/
  3848. //C:\Server\File\OA2023\Office\Word\EnterExitCost\File\
  3849. doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
  3850. string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
  3851. _view.Data = new { Url = url };
  3852. _view.Msg = "成功";
  3853. return _view;
  3854. }
  3855. }
  3856. }
  3857. catch (Exception ex)
  3858. {
  3859. _view.Code = StatusCodes.Status500InternalServerError;
  3860. _view.Msg = ex.Message;
  3861. return _view;
  3862. }
  3863. return _view;
  3864. }
  3865. #endregion
  3866. #region iOS推送通知
  3867. #endregion
  3868. #region 计算国家城市当时时间
  3869. /// <summary>
  3870. /// 中文城市名称映射
  3871. /// </summary>
  3872. private static readonly Dictionary<string, string> _timeZoneCityMappings = new Dictionary<string, string>
  3873. {
  3874. {"Africa/Abidjan","非洲/阿比让"} ,
  3875. {"Africa/Accra","非洲/阿克拉"} ,
  3876. {"Africa/Addis_Ababa","非洲/亚的斯亚贝巴"} ,
  3877. {"Africa/Algiers","非洲/阿尔及尔"} ,
  3878. {"Africa/Asmara","非洲/阿斯马拉"} ,
  3879. {"Africa/Asmera","非洲/阿斯梅拉"} ,
  3880. {"Africa/Bamako","非洲/巴马科"} ,
  3881. {"Africa/Bangui","非洲/班吉"} ,
  3882. {"Africa/Banjul","非洲/班珠尔"} ,
  3883. {"Africa/Bissau","非洲/比绍"} ,
  3884. {"Africa/Blantyre","非洲/布兰太尔"} ,
  3885. {"Africa/Brazzaville","非洲/布拉柴维尔"} ,
  3886. {"Africa/Bujumbura","非洲/布琼布拉"} ,
  3887. {"Africa/Cairo","非洲/开罗"} ,
  3888. {"Africa/Casablanca","非洲/卡萨布兰卡"} ,
  3889. {"Africa/Ceuta","非洲/休达"} ,
  3890. {"Africa/Conakry","非洲/科纳克里"} ,
  3891. {"Africa/Dakar","非洲/达喀尔"} ,
  3892. {"Africa/Dar_es_Salaam","非洲/达累斯萨拉姆"} ,
  3893. {"Africa/Djibouti","非洲/吉布提"} ,
  3894. {"Africa/Douala","非洲/杜阿拉"} ,
  3895. {"Africa/El_Aaiun","非洲/阿尤恩"} ,
  3896. {"Africa/Freetown","非洲/弗里敦"} ,
  3897. {"Africa/Gaborone","非洲/哈博罗内"} ,
  3898. {"Africa/Harare","非洲/哈拉雷"} ,
  3899. {"Africa/Johannesburg","非洲/约翰内斯堡"} ,
  3900. {"Africa/Juba","非洲/朱巴"} ,
  3901. {"Africa/Kampala","非洲/坎帕拉"} ,
  3902. {"Africa/Khartoum","非洲/喀土穆"} ,
  3903. {"Africa/Kigali","非洲/基加利"} ,
  3904. {"Africa/Kinshasa","非洲/金沙萨"} ,
  3905. {"Africa/Lagos","非洲/拉各斯"} ,
  3906. {"Africa/Libreville","非洲/利伯维尔"} ,
  3907. {"Africa/Lome","非洲/洛美"} ,
  3908. {"Africa/Luanda","非洲/罗安达"} ,
  3909. {"Africa/Lubumbashi","非洲/卢本巴希"} ,
  3910. {"Africa/Lusaka","非洲/卢萨卡"} ,
  3911. {"Africa/Malabo","非洲/马拉博"} ,
  3912. {"Africa/Maputo","非洲/马普托"} ,
  3913. {"Africa/Maseru","非洲/马塞卢"} ,
  3914. {"Africa/Mbabane","非洲/姆巴巴内"} ,
  3915. {"Africa/Mogadishu","非洲/摩加迪沙"} ,
  3916. {"Africa/Monrovia","非洲/蒙罗维亚"} ,
  3917. {"Africa/Nairobi","非洲/内罗毕"} ,
  3918. {"Africa/Ndjamena","非洲/恩贾梅纳"} ,
  3919. {"Africa/Niamey","非洲/尼亚美"} ,
  3920. {"Africa/Nouakchott","非洲/努瓦克肖特"} ,
  3921. {"Africa/Ouagadougou","非洲/瓦加杜古"} ,
  3922. {"Africa/Porto-Novo","非洲/波多诺伏"} ,
  3923. {"Africa/Sao_Tome","非洲/圣多美"} ,
  3924. {"Africa/Timbuktu","非洲/廷巴克图"} ,
  3925. {"Africa/Tripoli","非洲/的黎波里"} ,
  3926. {"Africa/Tunis","非洲/突尼斯"} ,
  3927. {"Africa/Windhoek","非洲/温得和克"} ,
  3928. {"America/Adak","美洲/埃达克"} ,
  3929. {"America/Anchorage","美洲/安克雷奇"} ,
  3930. {"America/Anguilla","美洲/安圭拉"} ,
  3931. {"America/Antigua","美洲/安提瓜岛"} ,
  3932. {"America/Araguaina","美洲/阿拉瓜纳"} ,
  3933. {"America/Argentina/Buenos_Aires","美洲/阿根廷/布宜诺斯艾利斯"} ,
  3934. {"America/Argentina/Catamarca","美洲/阿根廷/卡塔马卡"} ,
  3935. {"America/Argentina/ComodRivadavia","美洲/阿根廷/科莫德里瓦达维亚"} ,
  3936. {"America/Argentina/Cordoba","美洲/阿根廷/科尔多瓦"} ,
  3937. {"America/Argentina/Jujuy","美洲/阿根廷/胡胡伊省"} ,
  3938. {"America/Argentina/La_Rioja","美洲/阿根廷/拉里奥哈"} ,
  3939. {"America/Argentina/Mendoza","美洲/阿根廷/门多萨"} ,
  3940. {"America/Argentina/Rio_Gallegos","美洲/阿根廷/里奥加耶戈斯"} ,
  3941. {"America/Argentina/Salta","美洲/阿根廷/萨尔塔"} ,
  3942. {"America/Argentina/San_Juan","美洲/阿根廷/San_Juan"} ,
  3943. {"America/Argentina/San_Luis","美洲/阿根廷/圣路易斯"} ,
  3944. {"America/Argentina/Tucuman","美洲/阿根廷/图库曼"} ,
  3945. {"America/Argentina/Ushuaia","美洲/阿根廷/乌斯怀亚"} ,
  3946. {"America/Aruba","美洲/阿鲁巴岛"} ,
  3947. {"America/Asuncion","美洲/亚松森"} ,
  3948. {"America/Atikokan","美洲/阿蒂科坎"} ,
  3949. {"America/Atka","美洲/阿特卡"} ,
  3950. {"America/Bahia","美洲/巴伊亚"} ,
  3951. {"America/Bahia_Banderas","美洲/巴伊亚_班德拉斯"} ,
  3952. {"America/Barbados","美洲/巴巴多斯"} ,
  3953. {"America/Belem","美洲/贝伦"} ,
  3954. {"America/Belize","美洲/伯利兹"} ,
  3955. {"America/Blanc-Sablon","America/Blanc-Sablon"} ,
  3956. {"America/Boa_Vista","美洲/博阿维斯塔"} ,
  3957. {"America/Bogota","美洲/波哥大"} ,
  3958. {"America/Boise","美洲/博伊西"} ,
  3959. {"America/Buenos_Aires","美洲/布宜诺斯艾利斯"} ,
  3960. {"America/Cambridge_Bay","美洲/剑桥湾"} ,
  3961. {"America/Campo_Grande","美洲/大坎普"} ,
  3962. {"America/Cancun","美洲/坎昆"} ,
  3963. {"America/Caracas","美洲/加拉加斯"} ,
  3964. {"America/Catamarca","美洲/卡塔马卡"} ,
  3965. {"America/Cayenne","美洲/卡宴"} ,
  3966. {"America/Cayman","美洲/开曼"} ,
  3967. {"America/Chicago","美洲/芝加哥"} ,
  3968. {"America/Chihuahua","美洲/奇瓦瓦州"} ,
  3969. {"America/Ciudad_Juarez","美洲/华雷斯城"} ,
  3970. {"America/Coral_Harbour","美洲/珊瑚港"} ,
  3971. {"America/Cordoba","美洲/科尔多瓦"} ,
  3972. {"America/Costa_Rica","美洲/哥斯达黎加"} ,
  3973. {"America/Creston","美洲/克雷斯顿"} ,
  3974. {"America/Cuiaba","美洲/库艾巴"} ,
  3975. {"America/Curacao","美洲/库拉索岛"} ,
  3976. {"America/Danmarkshavn","美洲/丹麦港"} ,
  3977. {"America/Dawson","美洲/道森"} ,
  3978. {"America/Dawson_Creek","美洲/道森克里克"} ,
  3979. {"America/Denver","美洲/丹佛"} ,
  3980. {"America/Detroit","美洲/底特律"} ,
  3981. {"America/Dominica","美洲/多米尼克"} ,
  3982. {"America/Edmonton","美洲/埃德蒙顿"} ,
  3983. {"America/Eirunepe","美洲/埃鲁内佩"} ,
  3984. {"America/El_Salvador","美洲/萨尔瓦多"} ,
  3985. {"America/Ensenada","美洲/恩塞纳达"} ,
  3986. {"America/Fort_Nelson","美洲/纳尔逊堡"} ,
  3987. {"America/Fort_Wayne","美洲/韦恩堡"} ,
  3988. {"America/Fortaleza","美洲/福塔莱萨"} ,
  3989. {"America/Glace_Bay","America/Glace_Bay"} ,
  3990. {"America/Godthab","美洲/戈德哈布"} ,
  3991. {"America/Goose_Bay","America/Goose_Bay"} ,
  3992. {"America/Grand_Turk","美洲/大特克岛"} ,
  3993. {"America/Grenada","美洲/格林纳达"} ,
  3994. {"America/Guadeloupe","美洲/瓜德罗普岛"} ,
  3995. {"America/Guatemala","美洲/危地马拉"} ,
  3996. {"America/Guayaquil","美洲/瓜亚基尔"} ,
  3997. {"America/Guyana","美洲/圭亚那"} ,
  3998. {"America/Halifax","美洲/哈利法克斯"} ,
  3999. {"America/Havana","美洲/哈瓦那"} ,
  4000. {"America/Hermosillo","美洲/埃莫西约"} ,
  4001. {"America/Indiana/Indianapolis","美洲/印第安纳州/印第安纳波利斯"} ,
  4002. {"America/Indiana/Knox","美洲/印第安纳州/诺克斯"} ,
  4003. {"America/Indiana/Marengo","美洲/印第安纳州/马伦戈"} ,
  4004. {"America/Indiana/Petersburg","美洲/印第安纳州/彼得斯堡"} ,
  4005. {"America/Indiana/Tell_City","美洲/印第安纳州/Tell_City"} ,
  4006. {"America/Indiana/Vevay","美洲/印第安纳州/沃韦"} ,
  4007. {"America/Indiana/Vincennes","美洲/印第安纳州/文森斯"} ,
  4008. {"America/Indiana/Winamac","美洲/印第安纳州/威纳马克"} ,
  4009. {"America/Indianapolis","美洲/印第安纳波利斯"} ,
  4010. {"America/Inuvik","美洲/伊努维克人"} ,
  4011. {"America/Iqaluit","美洲/伊魁特"} ,
  4012. {"America/Jamaica","美洲/牙买加"} ,
  4013. {"America/Jujuy","美洲/胡胡伊省"} ,
  4014. {"America/Juneau","美洲/朱诺"} ,
  4015. {"America/Kentucky/Louisville","美洲/肯塔基州/路易斯维尔"} ,
  4016. {"America/Kentucky/Monticello","美洲/肯塔基州/蒙蒂塞洛"} ,
  4017. {"America/Knox_IN","美洲/Knox_IN"} ,
  4018. {"America/Kralendijk","美洲/克拉伦代克"} ,
  4019. {"America/La_Paz","美洲/拉巴斯"} ,
  4020. {"America/Lima","美洲/利马"} ,
  4021. {"America/Los_Angeles","美洲/洛杉矶"} ,
  4022. {"America/Louisville","美洲/路易斯维尔"} ,
  4023. {"America/Lower_Princes","美洲/下王子郡"} ,
  4024. {"America/Maceio","美洲/马塞约"} ,
  4025. {"America/Managua","美洲/马那瓜"} ,
  4026. {"America/Manaus","美洲/马瑙斯"} ,
  4027. {"America/Marigot","美洲/马里戈特"} ,
  4028. {"America/Martinique","美洲/马提尼克岛"} ,
  4029. {"America/Matamoros","美洲/马塔莫罗斯"} ,
  4030. {"America/Mazatlan","美洲/马萨特兰"} ,
  4031. {"America/Mendoza","美洲/门多萨"} ,
  4032. {"America/Menominee","美国/梅诺米尼"} ,
  4033. {"America/Merida","美洲/梅里达"} ,
  4034. {"America/Metlakatla","美洲/梅特拉卡特拉"} ,
  4035. {"America/Mexico_City","美洲/墨西哥_城市"} ,
  4036. {"America/Miquelon","美洲/密克隆群岛"} ,
  4037. {"America/Moncton","美洲/蒙克顿"} ,
  4038. {"America/Monterrey","美洲/蒙特雷"} ,
  4039. {"America/Montevideo","美洲/蒙得维的亚"} ,
  4040. {"America/Montreal","美洲/蒙特利尔"} ,
  4041. {"America/Montserrat","美洲/蒙特塞拉特"} ,
  4042. {"America/Nassau","美洲/拿骚"} ,
  4043. {"America/New_York","美洲/纽约"} ,
  4044. {"America/Nipigon","美洲/尼皮贡"} ,
  4045. {"America/Nome","美国/名称"} ,
  4046. {"America/Noronha","美国/某地"} ,
  4047. {"America/North_Dakota/Beulah","美洲/北达科他州/比尤拉"} ,
  4048. {"America/North_Dakota/Center","美洲/北达科他州/中部"} ,
  4049. {"America/North_Dakota/New_Salem","美洲/北达科他州/新塞勒姆"} ,
  4050. {"America/Nuuk","美洲/努克"} ,
  4051. {"America/Ojinaga","美洲/奥吉纳加"} ,
  4052. {"America/Panama","美洲/巴拿马"} ,
  4053. {"America/Pangnirtung","美洲/庞纳通"} ,
  4054. {"America/Paramaribo","美洲/帕拉马里博"} ,
  4055. {"America/Phoenix","美洲/菲尼克斯"} ,
  4056. {"America/Port-au-Prince","美洲/太子港"} ,
  4057. {"America/Port_of_Spain","美洲/西班牙港"} ,
  4058. {"America/Porto_Acre","美洲/阿卡港"} ,
  4059. {"America/Porto_Velho","美洲/旧波尔图"} ,
  4060. {"America/Puerto_Rico","美洲/波多黎各"} ,
  4061. {"America/Punta_Arenas","美洲/蓬塔阿雷纳斯"} ,
  4062. {"America/Rainy_River","美洲/雷尼河"} ,
  4063. {"America/Rankin_Inlet","兰金因莱特"} ,
  4064. {"America/Recife","美洲/累西腓"} ,
  4065. {"America/Regina","美洲/里贾纳"} ,
  4066. {"America/Resolute","美国/坚决"} ,
  4067. {"America/Rio_Branco","美洲/里奥布兰科"} ,
  4068. {"America/Rosario","美洲/罗萨里奥"} ,
  4069. {"America/Santa_Isabel","美洲/圣伊莎贝尔"} ,
  4070. {"America/Santarem","美洲/圣塔伦"} ,
  4071. {"America/Santiago","美洲/圣地亚哥"} ,
  4072. {"America/Santo_Domingo","美洲/圣多明各"} ,
  4073. {"America/Sao_Paulo","美洲/圣保罗"} ,
  4074. {"America/Scoresbysund","美洲/斯科斯比松"} ,
  4075. {"America/Shiprock","美洲/希普洛克"} ,
  4076. {"America/Sitka","美洲/锡特卡"} ,
  4077. {"America/St_Barthelemy","美洲/圣巴泰勒米"} ,
  4078. {"America/St_Johns","美洲/圣约翰斯"} ,
  4079. {"America/St_Kitts","美洲/圣基茨"} ,
  4080. {"America/St_Lucia","美洲/圣卢西亚"} ,
  4081. {"America/St_Thomas","美洲/圣托马斯"} ,
  4082. {"America/St_Vincent","美洲/圣文森特"} ,
  4083. {"America/Swift_Current","America/Swift_Current"} ,
  4084. {"America/Tegucigalpa","美洲/特古西加尔巴"} ,
  4085. {"America/Thule","美洲/图勒"} ,
  4086. {"America/Thunder_Bay","美洲/雷湾"} ,
  4087. {"America/Tijuana","美洲/蒂华纳"} ,
  4088. {"America/Toronto","美洲/多伦多"} ,
  4089. {"America/Tortola","美洲/托尔托拉岛"} ,
  4090. {"America/Vancouver","美洲/温哥华"} ,
  4091. {"America/Virgin","美国/维珍"} ,
  4092. {"America/Whitehorse","美洲/怀特霍斯"} ,
  4093. {"America/Winnipeg","美洲/温尼伯"} ,
  4094. {"America/Yakutat","美洲/雅库塔特"} ,
  4095. {"America/Yellowknife","美洲/黄刀镇"} ,
  4096. {"Antarctica/Casey","南极洲/凯西"} ,
  4097. {"Antarctica/Davis","南极洲/戴维斯"} ,
  4098. {"Antarctica/DumontDUrville","南极洲/杜蒙杜维尔"} ,
  4099. {"Antarctica/Macquarie","南极洲/麦格理"} ,
  4100. {"Antarctica/Mawson","南极洲/莫森"} ,
  4101. {"Antarctica/McMurdo","南极洲/麦克默多"} ,
  4102. {"Antarctica/Palmer","南极洲/帕尔默"} ,
  4103. {"Antarctica/Rothera","南极洲/罗塞拉岛"} ,
  4104. {"Antarctica/South_Pole","南极洲/南极点"} ,
  4105. {"Antarctica/Syowa","南极洲/昭和"} ,
  4106. {"Antarctica/Troll","南极洲/巨魔"} ,
  4107. {"Antarctica/Vostok","南极洲/东方"} ,
  4108. {"Arctic/Longyearbyen","北极/朗伊尔城"} ,
  4109. {"Asia/Aden","亚洲/亚丁"} ,
  4110. {"Asia/Almaty","亚洲/阿拉木图"} ,
  4111. {"Asia/Amman","亚洲/安曼"} ,
  4112. {"Asia/Anadyr","亚洲/阿纳德尔"} ,
  4113. {"Asia/Aqtau","亚洲/阿克套"} ,
  4114. {"Asia/Aqtobe","亚洲/阿克托比"} ,
  4115. {"Asia/Ashgabat","亚洲/阿什哈巴德"} ,
  4116. {"Asia/Ashkhabad","亚洲/阿什哈巴德"} ,
  4117. {"Asia/Atyrau","亚洲/阿特劳"} ,
  4118. {"Asia/Baghdad","亚洲/巴格达"} ,
  4119. {"Asia/Bahrain","亚洲/巴林"} ,
  4120. {"Asia/Baku","亚洲/巴库"} ,
  4121. {"Asia/Bangkok","亚洲/曼谷"} ,
  4122. {"Asia/Barnaul","亚洲/巴尔瑙尔"} ,
  4123. {"Asia/Beirut","亚洲/贝鲁特"} ,
  4124. {"Asia/Bishkek","亚洲/比什凯克"} ,
  4125. {"Asia/Brunei","亚洲/文莱"} ,
  4126. {"Asia/Calcutta","亚洲/加尔各答"} ,
  4127. {"Asia/Chita","亚洲/赤塔"} ,
  4128. {"Asia/Choibalsan","亚洲/乔巴山"} ,
  4129. {"Asia/Chongqing","亚洲/重庆"} ,
  4130. {"Asia/Chungking","亚洲/重庆"} ,
  4131. {"Asia/Colombo","亚洲/科伦坡"} ,
  4132. {"Asia/Dacca","亚洲/达卡"} ,
  4133. {"Asia/Damascus","亚洲/大马士革"} ,
  4134. {"Asia/Dhaka","亚洲/达卡"} ,
  4135. {"Asia/Dili","亚洲/帝力"} ,
  4136. {"Asia/Dubai","亚洲/迪拜"} ,
  4137. {"Asia/Dushanbe","亚洲/杜尚别"} ,
  4138. {"Asia/Famagusta","亚洲/法马古斯塔"} ,
  4139. {"Asia/Gaza","亚洲/加沙"} ,
  4140. {"Asia/Harbin","亚洲/哈尔滨"} ,
  4141. {"Asia/Hebron","亚洲/希伯伦"} ,
  4142. {"Asia/Ho_Chi_Minh","亚洲/胡志明市"} ,
  4143. {"Asia/Hong_Kong","亚洲/香港"} ,
  4144. {"Asia/Hovd","亚洲/霍布德"} ,
  4145. {"Asia/Irkutsk","亚洲/伊尔库茨克"} ,
  4146. {"Asia/Istanbul","亚洲/伊斯坦布尔"} ,
  4147. {"Asia/Jakarta","亚洲/雅加达"} ,
  4148. {"Asia/Jayapura","亚洲/查亚普拉"} ,
  4149. {"Asia/Jerusalem","亚洲/耶路撒冷"} ,
  4150. {"Asia/Kabul","亚洲/喀布尔"} ,
  4151. {"Asia/Kamchatka","亚洲/堪察加半岛"} ,
  4152. {"Asia/Karachi","亚洲/卡拉奇"} ,
  4153. {"Asia/Kashgar","亚洲/喀什"} ,
  4154. {"Asia/Kathmandu","亚洲/加德满都"} ,
  4155. {"Asia/Katmandu","亚洲/加德满都"} ,
  4156. {"Asia/Khandyga","亚洲/坎迪加"} ,
  4157. {"Asia/Kolkata","亚洲/加尔各答"} ,
  4158. {"Asia/Krasnoyarsk","亚洲/克拉斯诺亚尔斯克"} ,
  4159. {"Asia/Kuala_Lumpur","亚洲/吉隆坡_吉隆坡"} ,
  4160. {"Asia/Kuching","亚洲/古晋"} ,
  4161. {"Asia/Kuwait","亚洲/科威特"} ,
  4162. {"Asia/Macao","亚洲/澳门"} ,
  4163. {"Asia/Macau","亚洲/澳门"} ,
  4164. {"Asia/Magadan","亚洲/马加丹"} ,
  4165. {"Asia/Makassar","亚洲/望加锡"} ,
  4166. {"Asia/Manila","亚洲/马尼拉"} ,
  4167. {"Asia/Muscat","亚洲/马斯喀特"} ,
  4168. {"Asia/Nicosia","亚洲/尼科西亚"} ,
  4169. {"Asia/Novokuznetsk","亚洲/新库兹涅茨克"} ,
  4170. {"Asia/Novosibirsk","亚洲/新西伯利亚"} ,
  4171. {"Asia/Omsk","亚洲/鄂木斯克"} ,
  4172. {"Asia/Oral","亚洲/口头"} ,
  4173. {"Asia/Phnom_Penh","亚洲/金边"} ,
  4174. {"Asia/Pontianak","亚洲/笨珍"} ,
  4175. {"Asia/Pyongyang","亚洲/平壤"} ,
  4176. {"Asia/Qatar","亚洲/卡塔尔"} ,
  4177. {"Asia/Qostanay","亚洲/库斯塔奈"} ,
  4178. {"Asia/Qyzylorda","亚洲/克孜勒奥尔达"} ,
  4179. {"Asia/Rangoon","亚洲/仰光"} ,
  4180. {"Asia/Riyadh","亚洲/利雅得"} ,
  4181. {"Asia/Saigon","亚洲/西贡"} ,
  4182. {"Asia/Sakhalin","亚洲/萨哈林岛"} ,
  4183. {"Asia/Samarkand","亚洲/撒马尔罕"} ,
  4184. {"Asia/Seoul","亚洲/首尔"} ,
  4185. {"Asia/Shanghai","亚洲/上海"} ,
  4186. {"Asia/Singapore","亚洲/新加坡"} ,
  4187. {"Asia/Srednekolymsk","亚洲/中科雷姆斯克"} ,
  4188. {"Asia/Taipei","亚洲/台北"} ,
  4189. {"Asia/Tashkent","亚洲/塔什干"} ,
  4190. {"Asia/Tbilisi","亚洲/第比利斯"} ,
  4191. {"Asia/Tehran","亚洲/德黑兰"} ,
  4192. {"Asia/Tel_Aviv","亚洲/特拉维夫"} ,
  4193. {"Asia/Thimbu","亚洲/廷布"} ,
  4194. {"Asia/Thimphu","亚洲/廷布"} ,
  4195. {"Asia/Tokyo","亚洲/东京"} ,
  4196. {"Asia/Tomsk","亚洲/托木斯克"} ,
  4197. {"Asia/Ujung_Pandang","亚洲/乌戎_潘当"} ,
  4198. {"Asia/Ulaanbaatar","亚洲/乌兰巴托"} ,
  4199. {"Asia/Ulan_Bator","亚洲/乌兰巴托"} ,
  4200. {"Asia/Urumqi","亚洲/乌鲁木齐"} ,
  4201. {"Asia/Ust-Nera","亚洲/乌斯季-内拉"} ,
  4202. {"Asia/Vientiane","亚洲/万象"} ,
  4203. {"Asia/Vladivostok","亚洲/符拉迪沃斯托克"} ,
  4204. {"Asia/Yakutsk","亚洲/雅库茨克"} ,
  4205. {"Asia/Yangon","亚洲/仰光"} ,
  4206. {"Asia/Yekaterinburg","亚洲/叶卡捷琳堡"} ,
  4207. {"Asia/Yerevan","亚洲/埃里温"} ,
  4208. {"Atlantic/Azores","大西洋/亚速尔群岛"} ,
  4209. {"Atlantic/Bermuda","大西洋/百慕大"} ,
  4210. {"Atlantic/Canary","大西洋/加那利"} ,
  4211. {"Atlantic/Cape_Verde","大西洋/佛得角"} ,
  4212. {"Atlantic/Faeroe","大西洋/法罗"} ,
  4213. {"Atlantic/Faroe","大西洋/法罗"} ,
  4214. {"Atlantic/Jan_Mayen","大西洋/扬马延"} ,
  4215. {"Atlantic/Madeira","大西洋/马德拉"} ,
  4216. {"Atlantic/Reykjavik","大西洋/雷克雅未克"} ,
  4217. {"Atlantic/South_Georgia","大西洋/南乔治亚州"} ,
  4218. {"Atlantic/St_Helena","大西洋/圣赫勒拿岛"} ,
  4219. {"Atlantic/Stanley","大西洋/斯坦利"} ,
  4220. {"Australia/ACT","澳大利亚/澳大利亚首都地区"} ,
  4221. {"Australia/Adelaide","澳大利亚/阿德莱德"} ,
  4222. {"Australia/Brisbane","澳大利亚/布里斯班"} ,
  4223. {"Australia/Broken_Hill","澳大利亚/布罗肯希尔"} ,
  4224. {"Australia/Canberra","澳大利亚/堪培拉"} ,
  4225. {"Australia/Currie","澳大利亚/柯里"} ,
  4226. {"Australia/Darwin","澳大利亚/达尔文"} ,
  4227. {"Australia/Eucla","澳大利亚/尤克拉拉"} ,
  4228. {"Australia/Hobart","澳大利亚/霍巴特"} ,
  4229. {"Australia/LHI","澳大利亚/LHI"} ,
  4230. {"Australia/Lindeman","澳大利亚/林德曼"} ,
  4231. {"Australia/Lord_Howe","澳大利亚/豪勋爵"} ,
  4232. {"Australia/Melbourne","澳大利亚/墨尔本"} ,
  4233. {"Australia/NSW","澳大利亚/新南威尔士州"} ,
  4234. {"Australia/North","澳大利亚/北部"} ,
  4235. {"Australia/Perth","澳大利亚/珀斯"} ,
  4236. {"Australia/Queensland","澳大利亚/昆士兰"} ,
  4237. {"Australia/South","澳大利亚/南部"} ,
  4238. {"Australia/Sydney","澳大利亚/悉尼"} ,
  4239. {"Australia/Tasmania","澳大利亚/塔斯马尼亚"} ,
  4240. {"Australia/Victoria","澳大利亚/维多利亚"} ,
  4241. {"Australia/West","澳大利亚/西部"} ,
  4242. {"Australia/Yancowinna","澳大利亚/扬科温纳"} ,
  4243. {"Brazil/Acre","巴西/阿卡"} ,
  4244. {"Brazil/DeNoronha","巴西/迪诺罗尼亚群岛"} ,
  4245. {"Brazil/East","巴西/东部"} ,
  4246. {"Brazil/West","巴西/西部"} ,
  4247. {"CET","CET"} ,
  4248. {"CST6CDT","CST6CDT"} ,
  4249. {"Canada/Atlantic","加拿大/大西洋"} ,
  4250. {"Canada/Central","加拿大/中部"} ,
  4251. {"Canada/Eastern","加拿大/东部"} ,
  4252. {"Canada/Mountain","加拿大/山区"} ,
  4253. {"Canada/Newfoundland","加拿大/纽芬兰"} ,
  4254. {"Canada/Pacific","加拿大/太平洋地区"} ,
  4255. {"Canada/Saskatchewan","加拿大/萨斯喀彻温省"} ,
  4256. {"Canada/Yukon","加拿大/育空地区"} ,
  4257. {"Chile/Continental","智利/大陆航空"} ,
  4258. {"Chile/EasterIsland","智利/复活节岛"} ,
  4259. {"Cuba","古巴"} ,
  4260. {"EET","欧洲东部时间"} ,
  4261. {"EST","东部时间"} ,
  4262. {"EST5EDT","EST5EDT"} ,
  4263. {"Egypt","埃及"} ,
  4264. {"Eire","爱尔兰"} ,
  4265. {"Etc/GMT","Etc/GMT"} ,
  4266. {"Etc/GMT+0","Etc/GMT+0"} ,
  4267. {"Etc/GMT+1","Etc/GMT+1"} ,
  4268. {"Etc/GMT+10","Etc/GMT+10"} ,
  4269. {"Etc/GMT+11","Etc/GMT+11"} ,
  4270. {"Etc/GMT+12","Etc/GMT+12"} ,
  4271. {"Etc/GMT+2","Etc/GMT+2"} ,
  4272. {"Etc/GMT+3","Etc/GMT+3"} ,
  4273. {"Etc/GMT+4","Etc/GMT+4"} ,
  4274. {"Etc/GMT+5","Etc/GMT+5"} ,
  4275. {"Etc/GMT+6","Etc/GMT+6"} ,
  4276. {"Etc/GMT+7","Etc/GMT+7"} ,
  4277. {"Etc/GMT+8","Etc/GMT+8"} ,
  4278. {"Etc/GMT+9","Etc/GMT+9"} ,
  4279. {"Etc/GMT-0","Etc/GMT-0"} ,
  4280. {"Etc/GMT-1","Etc/GMT-1"} ,
  4281. {"Etc/GMT-10","Etc/GMT-10"} ,
  4282. {"Etc/GMT-11","Etc/GMT-11"} ,
  4283. {"Etc/GMT-12","Etc/GMT-12"} ,
  4284. {"Etc/GMT-13","Etc/GMT-13"} ,
  4285. {"Etc/GMT-14","Etc/GMT-14"} ,
  4286. {"Etc/GMT-2","Etc/GMT-2"} ,
  4287. {"Etc/GMT-3","Etc/GMT-3"} ,
  4288. {"Etc/GMT-4","Etc/GMT-4"} ,
  4289. {"Etc/GMT-5","Etc/GMT-5"} ,
  4290. {"Etc/GMT-6","Etc/GMT-6"} ,
  4291. {"Etc/GMT-7","Etc/GMT-7"} ,
  4292. {"Etc/GMT-8","Etc/GMT-8"} ,
  4293. {"Etc/GMT-9","Etc/GMT-9"} ,
  4294. {"Etc/GMT0","Etc/GMT0"} ,
  4295. {"Etc/Greenwich","Etc/格林威治"} ,
  4296. {"Etc/UCT","Etc/UCT"} ,
  4297. {"Etc/UTC","Etc/UTC"} ,
  4298. {"Etc/Universal","Etc/通用"} ,
  4299. {"Etc/Zulu","Etc/祖鲁语"} ,
  4300. {"Europe/Amsterdam","欧洲/阿姆斯特丹"} ,
  4301. {"Europe/Andorra","欧洲/安道尔"} ,
  4302. {"Europe/Astrakhan","欧洲/阿斯特拉罕"} ,
  4303. {"Europe/Athens","欧洲/雅典"} ,
  4304. {"Europe/Belfast","欧洲/贝尔法斯特"} ,
  4305. {"Europe/Belgrade","欧洲/贝尔格莱德"} ,
  4306. {"Europe/Berlin","欧洲/柏林"} ,
  4307. {"Europe/Bratislava","欧洲/布拉迪斯拉发"} ,
  4308. {"Europe/Brussels","欧洲/布鲁塞尔"} ,
  4309. {"Europe/Bucharest","欧洲/布加勒斯特"} ,
  4310. {"Europe/Budapest","欧洲/布达佩斯"} ,
  4311. {"Europe/Busingen","欧洲/布辛根"} ,
  4312. {"Europe/Chisinau","欧洲/基希讷乌"} ,
  4313. {"Europe/Copenhagen","欧洲/哥本哈根"} ,
  4314. {"Europe/Dublin","欧洲/都柏林"} ,
  4315. {"Europe/Gibraltar","欧洲/直布罗陀"} ,
  4316. {"Europe/Guernsey","欧洲/根西岛"} ,
  4317. {"Europe/Helsinki","欧洲/赫尔辛基"} ,
  4318. {"Europe/Isle_of_Man","欧洲/马恩岛"} ,
  4319. {"Europe/Istanbul","欧洲/伊斯坦布尔"} ,
  4320. {"Europe/Jersey","欧洲/泽西岛"} ,
  4321. {"Europe/Kaliningrad","欧洲/加里宁格勒"} ,
  4322. {"Europe/Kiev","欧洲/基辅"} ,
  4323. {"Europe/Kirov","欧洲/基洛夫"} ,
  4324. {"Europe/Kyiv","欧洲/基辅"} ,
  4325. {"Europe/Lisbon","欧洲/里斯本"} ,
  4326. {"Europe/Ljubljana","欧洲/卢布尔雅那"} ,
  4327. {"Europe/London","欧洲/伦敦"} ,
  4328. {"Europe/Luxembourg","欧洲/卢森堡"} ,
  4329. {"Europe/Madrid","欧洲/马德里"} ,
  4330. {"Europe/Malta","欧洲/马耳他"} ,
  4331. {"Europe/Mariehamn","欧洲/玛丽港"} ,
  4332. {"Europe/Minsk","欧洲/明斯克"} ,
  4333. {"Europe/Monaco","欧洲/摩纳哥"} ,
  4334. {"Europe/Moscow","欧洲/莫斯科"} ,
  4335. {"Europe/Nicosia","欧洲/尼科西亚"} ,
  4336. {"Europe/Oslo","欧洲/奥斯陆"} ,
  4337. {"Europe/Paris","欧洲/巴黎"} ,
  4338. {"Europe/Podgorica","欧洲/波德戈里察"} ,
  4339. {"Europe/Prague","欧洲/布拉格"} ,
  4340. {"Europe/Riga","欧洲/里加"} ,
  4341. {"Europe/Rome","欧洲/罗马"} ,
  4342. {"Europe/Samara","欧洲/萨马拉"} ,
  4343. {"Europe/San_Marino","欧洲/圣马力诺"} ,
  4344. {"Europe/Sarajevo","欧洲/萨拉热窝"} ,
  4345. {"Europe/Saratov","欧洲/萨拉托夫"} ,
  4346. {"Europe/Simferopol","欧洲/辛菲罗波尔"} ,
  4347. {"Europe/Skopje","欧洲/斯科普里"} ,
  4348. {"Europe/Sofia","欧洲/索非亚"} ,
  4349. {"Europe/Stockholm","欧洲/斯德哥尔摩"} ,
  4350. {"Europe/Tallinn","欧洲/塔林"} ,
  4351. {"Europe/Tirane","欧洲/地拉那"} ,
  4352. {"Europe/Tiraspol","欧洲/蒂拉斯波尔"} ,
  4353. {"Europe/Ulyanovsk","欧洲/乌里扬诺夫斯克"} ,
  4354. {"Europe/Uzhgorod","欧洲/乌日哥罗德"} ,
  4355. {"Europe/Vaduz","欧洲/瓦杜兹"} ,
  4356. {"Europe/Vatican","欧洲/梵蒂冈"} ,
  4357. {"Europe/Vienna","欧洲/维也纳"} ,
  4358. {"Europe/Vilnius","欧洲/维尔纽斯"} ,
  4359. {"Europe/Volgograd","欧洲/伏尔加格勒"} ,
  4360. {"Europe/Warsaw","欧洲/华沙"} ,
  4361. {"Europe/Zagreb","欧洲/萨格勒布"} ,
  4362. {"Europe/Zaporozhye","欧洲/扎波罗热"} ,
  4363. {"Europe/Zurich","欧洲/苏黎世"} ,
  4364. {"GB","国标"} ,
  4365. {"GB-Eire","英国-爱尔兰"} ,
  4366. {"GMT","格林威治标准时间"} ,
  4367. {"GMT+0","格林威治标准时间+0"} ,
  4368. {"GMT-0","GMT-0"} ,
  4369. {"GMT0","格林威治标准时间0"} ,
  4370. {"Greenwich","格林威治"} ,
  4371. {"HST","高温试验"} ,
  4372. {"Hongkong","香港"} ,
  4373. {"Iceland","冰岛"} ,
  4374. {"Indian/Antananarivo","印度/塔那那利佛"} ,
  4375. {"Indian/Chagos","印第安人/查戈斯人"} ,
  4376. {"Indian/Christmas","印度/圣诞节"} ,
  4377. {"Indian/Cocos","印度/科科斯"} ,
  4378. {"Indian/Comoro","印度/科摩罗"} ,
  4379. {"Indian/Kerguelen","印度/凯尔盖朗"} ,
  4380. {"Indian/Mahe","印度/马埃岛"} ,
  4381. {"Indian/Maldives","印度/马尔代夫"} ,
  4382. {"Indian/Mauritius","印度/毛里求斯"} ,
  4383. {"Indian/Mayotte","印度/马约特岛"} ,
  4384. {"Indian/Reunion","印度/留尼汪岛"} ,
  4385. {"Iran","伊朗"} ,
  4386. {"Israel","以色列"} ,
  4387. {"Jamaica","牙买加"} ,
  4388. {"Japan","日本"} ,
  4389. {"Kwajalein","夸贾林环礁"} ,
  4390. {"Libya","利比亚"} ,
  4391. {"MET","梅特"} ,
  4392. {"MST","MST"} ,
  4393. {"MST7MDT","MST7MDT"} ,
  4394. {"Mexico/BajaNorte","墨西哥/北下巴"} ,
  4395. {"Mexico/BajaSur","墨西哥/巴哈苏尔"} ,
  4396. {"Mexico/General","墨西哥/一般"} ,
  4397. {"NZ","新西兰"} ,
  4398. {"NZ-CHAT","新西兰聊天室"} ,
  4399. {"Navajo","纳瓦霍语"} ,
  4400. {"PRC","中国"} ,
  4401. {"PST8PDT","PST8PDT"} ,
  4402. {"Pacific/Apia","太平洋/阿皮亚"} ,
  4403. {"Pacific/Auckland","太平洋/奥克兰"} ,
  4404. {"Pacific/Bougainville","太平洋/布干维尔岛"} ,
  4405. {"Pacific/Chatham","太平洋/查塔姆"} ,
  4406. {"Pacific/Chuuk","太平洋/楚克"} ,
  4407. {"Pacific/Easter","太平洋/复活节"} ,
  4408. {"Pacific/Efate","太平洋/埃法特"} ,
  4409. {"Pacific/Enderbury","太平洋/恩德伯里"} ,
  4410. {"Pacific/Fakaofo","太平洋/法考福"} ,
  4411. {"Pacific/Fiji","太平洋/斐济"} ,
  4412. {"Pacific/Funafuti","太平洋/富纳富提"} ,
  4413. {"Pacific/Galapagos","太平洋/加拉帕戈斯群岛"} ,
  4414. {"Pacific/Gambier","太平洋/甘比尔"} ,
  4415. {"Pacific/Guadalcanal","太平洋/瓜达尔卡纳尔岛"} ,
  4416. {"Pacific/Guam","太平洋/关岛"} ,
  4417. {"Pacific/Honolulu","太平洋/檀香山"} ,
  4418. {"Pacific/Johnston","太平洋/约翰斯顿"} ,
  4419. {"Pacific/Kanton","太平洋/关东"} ,
  4420. {"Pacific/Kiritimati","太平洋/基里蒂马蒂"} ,
  4421. {"Pacific/Kosrae","太平洋/科斯雷"} ,
  4422. {"Pacific/Kwajalein","太平洋/夸贾林环礁"} ,
  4423. {"Pacific/Majuro","太平洋/马朱罗"} ,
  4424. {"Pacific/Marquesas","太平洋/马克萨斯"} ,
  4425. {"Pacific/Midway","太平洋/中途岛"} ,
  4426. {"Pacific/Nauru","太平洋/瑙鲁"} ,
  4427. {"Pacific/Niue","太平洋/纽埃"} ,
  4428. {"Pacific/Norfolk","太平洋/诺福克"} ,
  4429. {"Pacific/Noumea","太平洋/努美阿"} ,
  4430. {"Pacific/Pago_Pago","太平洋/帕果"} ,
  4431. {"Pacific/Palau","太平洋/帕劳"} ,
  4432. {"Pacific/Pitcairn","太平洋/皮特凯恩"} ,
  4433. {"Pacific/Pohnpei","太平洋/波纳佩"} ,
  4434. {"Pacific/Ponape","太平洋/波纳佩"} ,
  4435. {"Pacific/Port_Moresby","太平洋/莫尔兹比港"} ,
  4436. {"Pacific/Rarotonga","太平洋/拉罗汤加"} ,
  4437. {"Pacific/Saipan","太平洋/塞班岛"} ,
  4438. {"Pacific/Samoa","太平洋/萨摩亚"} ,
  4439. {"Pacific/Tahiti","太平洋/大溪地"} ,
  4440. {"Pacific/Tarawa","太平洋/塔拉瓦"} ,
  4441. {"Pacific/Tongatapu","太平洋/汤加塔布岛"} ,
  4442. {"Pacific/Truk","太平洋/特鲁克"} ,
  4443. {"Pacific/Wake","太平洋/威克"} ,
  4444. {"Pacific/Wallis","太平洋/沃利斯"} ,
  4445. {"Pacific/Yap","太平洋/雅浦岛"} ,
  4446. {"Poland","波兰"} ,
  4447. {"Portugal","葡萄牙"} ,
  4448. {"ROC","ROC"} ,
  4449. {"ROK","韩国"} ,
  4450. {"Singapore","新加坡"} ,
  4451. {"Turkey","Turkey"} ,
  4452. {"UCT","世界标准时间"} ,
  4453. {"US/Alaska","美国/阿拉斯加"} ,
  4454. {"US/Aleutian","美国/阿留申群岛"} ,
  4455. {"US/Arizona","美国/亚利桑那州"} ,
  4456. {"US/Central","美国/中部"} ,
  4457. {"US/East-Indiana","美国/东印第安纳州"} ,
  4458. {"US/Eastern","美国/东部"} ,
  4459. {"US/Hawaii","美国/夏威夷"} ,
  4460. {"US/Indiana-Starke","美国/印第安纳州斯塔克"} ,
  4461. {"US/Michigan","美国/密歇根州"} ,
  4462. {"US/Mountain","美国/山地"} ,
  4463. {"US/Pacific","美国/太平洋地区"} ,
  4464. {"US/Samoa","美国/萨摩亚"} ,
  4465. {"UTC","世界标准时间"} ,
  4466. {"Universal","Universal"} ,
  4467. {"W-SU","W-SU"} ,
  4468. {"WET","WET"} ,
  4469. {"Zulu","Zulu"}
  4470. };
  4471. /// <summary>
  4472. /// 获取国家或城市当地时间
  4473. /// </summary>
  4474. /// <param name="country"></param>
  4475. /// <param name="city"></param>
  4476. /// <returns></returns>
  4477. public static DateTime? GetCountryOrCityCurrentDateTime(string country, string city)
  4478. {
  4479. DateTime? currDt = null;
  4480. var currTimezones = _timeZoneCityMappings.Where(x => x.Value.Contains(city)).ToList();
  4481. if (!currTimezones.Any()) {
  4482. currTimezones = _timeZoneCityMappings.Where(x => x.Value.Contains(country)).ToList();
  4483. };
  4484. string timeZoneId = string.Empty;
  4485. if (currTimezones.Count > 1)
  4486. {
  4487. currTimezones = currTimezones.Where(x => x.Value.Contains(country)).ToList();
  4488. timeZoneId = currTimezones.FirstOrDefault().Key ?? string.Empty;
  4489. }else timeZoneId = currTimezones.FirstOrDefault().Key ?? string.Empty;
  4490. if (string.IsNullOrEmpty(timeZoneId)) return currDt;
  4491. // Step 1: 获取当前 UTC 时间
  4492. Instant now = SystemClock.Instance.GetCurrentInstant();
  4493. // Step 2: 加载目标时区(以 "Asia/Shanghai" 为例)
  4494. var timeZone = DateTimeZoneProviders.Tzdb[timeZoneId];
  4495. if (timeZone == null) return currDt;
  4496. // Step 3: 将 UTC 时间转换为目标时区的本地时间
  4497. currDt = now.InZone(timeZone).ToDateTimeUnspecified();
  4498. return currDt;
  4499. }
  4500. #endregion
  4501. #region aspose
  4502. /// <summary>
  4503. /// aspose word 设置页脚
  4504. /// </summary>
  4505. /// <param name="builder"></param>
  4506. /// <param name="footerLabel">页脚内容</param>
  4507. /// <param name="font">字体名称</param>
  4508. /// <param name="fontSize"><字体大小/param>
  4509. public static void AsposeWordSetFooter(DocumentBuilder builder,string footerLabel,string font,int fontSize)
  4510. {
  4511. Section currentSection = builder.CurrentSection;
  4512. var pageSetup = currentSection.PageSetup;
  4513. pageSetup.DifferentFirstPageHeaderFooter = true;
  4514. //第一页页脚
  4515. builder.MoveToHeaderFooter(HeaderFooterType.FooterFirst);
  4516. builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
  4517. builder.Font.Name = font;
  4518. builder.Font.Bold = true;
  4519. builder.Font.Size = fontSize;
  4520. builder.Write(footerLabel);
  4521. //非第一页页脚
  4522. builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
  4523. builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
  4524. builder.Font.Name = font;
  4525. builder.Font.Bold = true;
  4526. builder.Font.Size = fontSize;
  4527. builder.Write(footerLabel);
  4528. }
  4529. #endregion
  4530. }
  4531. }