| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.DB;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterApi.Interface.Models.Common;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Transactions;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.workorder
- {
- public class WorkOrderController : BaseController
- {
- // GET: WorkOrder
- //工单状态:0新工单 1待交办 2待查收 3退回审核中 4办理中 5延时审核中 6已办理 7已回访 8重办中 9已结案
- //操作按钮:1查询 2编辑 3删除 4提交 5交办 6领导批示 7市长指示 8督办 9监察 10收回 11查收 12退回申请
- // 13办理 14延时申请 15退回审核 16回访 17延时审核 18重办 19结案 20导出 21回退 22强制结案
- private information.InternalMessagesController msg = new information.InternalMessagesController();
- private BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
- private BLL.T_Bus_WorkOrder workorderBLL = new BLL.T_Bus_WorkOrder();
- private BLL.T_Bus_AssignedInfo assignBLL = new BLL.T_Bus_AssignedInfo();
- private BLL.T_Bus_AssignedItemInfo assignItemBLL = new BLL.T_Bus_AssignedItemInfo();
- private BLL.T_Bus_Operation operBLL = new BLL.T_Bus_Operation();
- private BLL.T_Sys_SystemConfig configBll = new BLL.T_Sys_SystemConfig();
- #region 获取工单
- /// <summary>
- /// 获取工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetList(int isdc = 0)
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- DataTable dt = new DataTable();
- string sql = " and F_IsDelete=0 ";
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- int dealtype = RequestString.GetInt("dealtype", -1);
- int issend = RequestString.GetInt("issend", -1);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- #region sql 语句相关处理
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (dealtype != -1)
- {
- sql += " and isnull(F_IsResult,0) = '" + dealtype + "' ";
- }
- if (issend != -1)
- {
- sql += " and isnull(F_IsRelease,0) = '" + issend + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- #endregion
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件和交办超时
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));//语音文件路径
- dt.Columns.Add("Buttons", typeof(object));//操作按钮
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- if (state < 6 || state == 8)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw);
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取坐席处理列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetZXDealList(int isdc=0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- switch (strtab)
- {
- case "-1"://待处理工单(其他来源)
- sql = " and F_IsDelete=1 and F_IsEnabled=0 ";
- break;
- case "0"://待处理工单
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "'";
- }
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- else
- {
- sql += " and F_WorkState in (0,6) ";
- }
- break;
- case "1"://已提交的工单
- //sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 ";
- sql += " and F_WorkState >0 ";
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "'";
- }
- break;
- case "2"://已回访的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_VisitResult where F_State=1 and F_IsDelete=0 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "3"://已回退的工单
- sql += " and F_WorkState=0 and F_IsReturn=1 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode;
- }
- break;
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg=new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));//语音文件路径
- dt.Columns.Add("Buttons", typeof(object));//操作按钮
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- if (state < 6 || state == 8)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- if (Int32.Parse(strtab) == 0)
- {
- dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw);
- }
- else if (Int32.Parse(strtab) == -1)
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- btns.Add(ButtonGroup.edit());
- dr["Buttons"] = btns;
- }
- else
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- }
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取领导处理列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetLDDealList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- int issatisfie = RequestString.GetInt("issatisfie", -1);//0不满意 1满意
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- switch (strtab)
- {
- case "0"://待处理工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- if (strstate.Trim() == "7" && issatisfie != -1)
- {
- sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_VisitResult where F_State=1 and F_IsDelete=0 ";
- sql += " and F_IsSatisfie='" + issatisfie + "')";
- }
- if (userModel.F_RoleCode != "GLY" && userModel.F_RoleCode != "ZXLDGLY")
- {
- sql += " and (F_AssignUser='" + userModel.F_UserCode + "' or isnull(F_AssignUser,'')='')";
- }
- }
- else
- {
- sql += " and F_WorkState in (1,2,3,5,7,8) ";
- if (userModel.F_RoleCode != "GLY" && userModel.F_RoleCode != "ZXLDGLY")
- {
- sql += " and (F_AssignUser='" + userModel.F_UserCode + "' or isnull(F_AssignUser,'')='')";
- }
- }
- break;
- case "1"://已交办的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "2"://已审核退回的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_Feedback where F_State=1 and F_IsDelete=0 and F_IsAudit>0 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_AuditUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "3"://已审核延时的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_DelayTime where F_State=1 and F_IsDelete=0 and F_IsAudit>0 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_AuditUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "4"://已重办的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_IsReload>0 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_ReloadUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "5"://已结案的工单
- sql += " and F_WorkState =9 and F_IsDelete=0 and F_IsClosed=1 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CloseUser='" + userModel.F_UserCode + "'";
- }
- break;
- case "6"://已督办的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =1 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "7"://已监察的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =2 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));//语音文件路径
- dt.Columns.Add("Buttons", typeof(object));//操作按钮
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- if (state < 6 || state == 8)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- if (Int32.Parse(strtab) < 1)
- {
- dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw);
- }
- else
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取单位处理列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetDWDealList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- switch (strtab)
- {
- case "0"://待处理工单
- int isyq = RequestString.GetInt("isyq", -1);
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- else
- {
- sql += " and F_WorkState in (2,4,8)";
- }
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and ISNULL(F_DealTime, '')='' and F_MainDeptId =" + userModel.F_DeptId + "";
- if (isyq != -1)
- {
- sql += " and dbo.GetOverState(F_WorkOrderId)=" + isyq;
- }
- }
- break;
- case "1"://已查收的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_IsSure=1 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_SureUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "2"://已申请退回的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_Feedback where F_State=1 and F_IsDelete=0 and F_Type = 3 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "3"://已申请延时的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_DelayTime where F_State=1 and F_IsDelete=0 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "4"://已办理的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_Feedback where F_State=1 and F_IsDelete=0 and F_Type in (1,2) ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "5"://被督办的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =1 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_DeptId='" + userModel.F_DeptId + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- case "6"://被监察的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =2 ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_DeptId='" + userModel.F_DeptId + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));//语音文件路径
- dt.Columns.Add("PDState", typeof(string));//派单状态
- dt.Columns.Add("Buttons", typeof(object));//操作按钮
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- string ispd = "";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- string sqljb = "SELECT TOP 1 * FROM T_Bus_AssignedInfo WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 and F_IsSure<>3 ORDER BY F_Id DESC";
- var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
- if (dtjb.Rows.Count > 0)
- {
- if (state < 6 || state == 8)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
-
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- ispd = dtjb.Rows[0]["F_IsNext"].ToString();
- dr["PDState"] = ispd;
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- if (Int32.Parse(strtab) < 1)
- {
- dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw, ispd);
- }
- else
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取单位处理列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetXBDWDealList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- switch (strtab)
- {
- case "0"://待处理工单
- int isyq = RequestString.GetInt("isyq", -1);
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- else
- {
- sql += " and F_WorkState in (2,4,8)";
- }
- sql += " and F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo where F_State=1 and F_IsDelete=0 and "
- + " ISNULL(F_FeedbackTime, '')='' ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_DeptId =" + userModel.F_DeptId;
- }
- if (isyq != -1)
- {
- sql += " and dbo.GetOverState(F_WorkOrderId)=" + isyq;
- }
- else
- {
- sql += ")";
- }
- break;
- case "1"://已办理的工单
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_Feedback where F_State=1 and F_IsDelete=0 and F_Type in (1,2) ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));//语音文件路径
- dt.Columns.Add("Buttons", typeof(object));//操作按钮
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- if (state < 6 || state == 8)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- if (Int32.Parse(strtab) < 1)
- {
- dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw);
- }
- else
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取单位主办协办未处理工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetDWNoDealList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (userModel.F_RoleCode == "ZXHWY")
- {
- sql += " and F_CreateUser = '" + userModel.F_UserCode + "' ";
- }
- else if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- sql += " and ( F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and isnull(F_FeedbackTime,'')='' and F_IsSure in (0,1) ";
- if (userModel.F_RoleCode == "WLDW")
- {
- sql += " and F_MainDeptId = '" + userModel.F_DeptId + "' ";
- }
- else if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "' ";
- }
- sql += ") or F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo where F_State=1 and F_IsDelete=0 and ISNULL(F_FeedbackTime, '')='' ";
- if (userModel.F_RoleCode == "WLDW")
- {
- sql += " and F_DeptId = '" + userModel.F_DeptId + "' ";
- }
- else if (deptid != 0)
- {
- sql += " and F_DeptId = '" + deptid + "' ";
- }
- sql += "))";
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- else
- {
- sql += " and F_WorkState in (2,4,8)";
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));
- dt.Columns.Add("Buttons", typeof(object));
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- if (state < 6 || state == 8)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取二级单位处理列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetEJDWDealList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- #region 模块
- switch (strtab)
- {
- case "0"://待处理工单
- sql += " and F_WorkState in (4,5) ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedInfo_Next where F_State=1 and F_IsDelete=0 and "
- + " ISNULL(F_FeedbackTime, '')='' and F_MainDeptId =" + userModel.F_DeptId + " and F_IsSure in (0,1))";
- }
- break;
- case "1"://已办理的工单
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_Feedback_Next where F_State=1 and F_IsDelete=0 and F_Type in (1,2) ";
- if (userModel.F_RoleCode != "GLY")
- {
- sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
- }
- else
- {
- sql += ")";
- }
- break;
- }
- #endregion
- #region 条件
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- #endregion
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));//语音文件路径
- dt.Columns.Add("PDState", typeof(string));//派单状态
- dt.Columns.Add("Buttons", typeof(object));//操作按钮
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新交办信息
- string iszbdw = "0";
- string ispd = "";
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1)
- {
- string sqljb = "SELECT TOP 1 * FROM T_Bus_AssignedInfo WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 and F_IsSure<>3 ORDER BY F_Id DESC";
- var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
- if (dtjb.Rows.Count > 0)
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (state < 6 || state == 8)
- {
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- ispd = dtjb.Rows[0]["F_IsNext"].ToString();
- dr["PDState"] = ispd;
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- if (Int32.Parse(strtab) < 1)
- {
- dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw, ispd);
- }
- else
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取逾期未回复工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetTimeOutList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (userModel.F_RoleCode == "ZXHWY")
- {
- sql += " and F_CreateUser = '" + userModel.F_UserCode + "' ";
- }
- else if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- string sqlwhere = ""; string sqlwhere1 = "";
- sqlwhere += " and ( F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_LimitTime<getdate() and isnull(F_FeedbackTime,'')='' and F_IsSure in (0,1) ";
- if (userModel.F_RoleCode == "WLDW")
- {
- sqlwhere += " and F_MainDeptId = '" + userModel.F_DeptId + "' ";
- sqlwhere1 += " and F_MainDeptId = '" + userModel.F_DeptId + "'";
- }
- else if (deptid != 0)
- {
- sqlwhere += " and F_MainDeptId = '" + deptid + "' ";
- sqlwhere1 += " and F_MainDeptId = '" + deptid + "'";
- }
- sqlwhere += ") or F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo where F_State=1 and F_IsDelete=0 and F_LimitTime<getdate() and ISNULL(F_FeedbackTime, '')='' ";
- if (userModel.F_RoleCode == "WLDW")
- {
- sqlwhere += " and F_DeptId = '" + userModel.F_DeptId + "' ";
- }
- else if (deptid != 0)
- {
- sqlwhere += " and F_DeptId = '" + deptid + "' ";
- }
- sqlwhere += "))";
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_WorkState = '" + strstate.Trim() + "' ";
- if (strstate.Trim()=="9")
- {
- sql += " and F_LimitTime<F_DealTime " + sqlwhere1;
- }
- else
- sql += sqlwhere;
- }
- else
- {
- sql += " and F_WorkState in (2,4,8)" + sqlwhere;
- }
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("OverState", typeof(string));//超时状态
- dt.Columns.Add("LimitTime", typeof(string));//限制时间
- dt.Columns.Add("GapTime", typeof(string));//时间差
- dt.Columns.Add("FilePath", typeof(string));
- dt.Columns.Add("Buttons", typeof(object));
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- int state = Int32.Parse(dr["F_WorkState"].ToString());
- if (state > 1 )
- {
- var lt = dr["F_LimitTime"].ToString();//限制时间
- dr["LimitTime"] = lt;
- if (state < 6 || state == 8)
- {
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(DateTime.Now);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime > DateTime.Now)
- {
- if (configcs != null)
- {
- int cs = Int32.Parse(configcs.F_ParamValue);
- if (ts.TotalHours > cs)
- {
- dr["OverState"] = 1;
- }
- else
- {
- dr["OverState"] = 2;
- }
- }
- dr["GapTime"] = "剩余" + gshsj;
- }
- else
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- if (state == 9)
- {
- var closetime = dr["F_DealTime"].ToString();//关闭工单时间
- var dttime = DateTime.Now;
- if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
- if (!string.IsNullOrWhiteSpace(lt))
- {
- var ltime = DateTime.Parse(lt);
- TimeSpan ts = ltime.Subtract(dttime);
- int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
- if (tss < 0) { tss = -tss; }
- string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
- if (ltime < dttime)
- {
- dr["OverState"] = 3;
- dr["GapTime"] = "超时" + gshsj;
- }
- }
- }
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取媒体工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetMediaList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0";
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- sql += " and isnull(F_IsRelease,0) =1 ";
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("IsReturnMedia", typeof(string));
- dt.Columns.Add("Buttons", typeof(object));
- int IsReturnMedia = 0;
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- IsReturnMedia = 1;
- }
- foreach (DataRow dr in dt.Rows)
- {
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- dr["IsReturnMedia"] = IsReturnMedia;
- }
-
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- ///// <summary>
- ///// 获取通报工单列表
- ///// </summary>
- ///// <returns></returns>
- //[Authority]
- //public ActionResult GetNoticeList(int isdc = 0)
- //{
- // DataTable dt = new DataTable();
- // int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- // Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- // string sql = " and F_IsDelete=0 and isnull(F_IsNotice,0) =1";
- // string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- // string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- // string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- // string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- // string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- // string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- // string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- // int source = RequestString.GetInt("source", 0);
- // int keyid = RequestString.GetInt("keyid", 0);
- // int type = RequestString.GetInt("type", 0);
- // int bigtype = RequestString.GetInt("bigtype", 0);
- // int smalltype = RequestString.GetInt("smalltype", 0);
- // int sourcearea = RequestString.GetInt("sourcearea", 0);
- // int deptid = RequestString.GetInt("deptid", 0);
- // string strpageindex = RequestString.GetQueryString("page");
- // int pageindex = 1;
- // string strpagesize = RequestString.GetQueryString("pagesize");
- // int pagesize = 10;
- // if (strworkid.Trim() != "" && strworkid != "undefined")
- // {
- // sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- // }
- // if (strname.Trim() != "" && strname != "undefined")
- // {
- // sql += " and F_CusName like '%" + strname + "%' ";
- // }
- // if (strtel.Trim() != "" && strtel != "undefined")
- // {
- // sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- // }
- // if (strkey.Trim() != "" && strkey != "undefined")
- // {
- // sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- // }
- // if (strusercode.Trim() != "" && strusercode != "undefined")
- // {
- // sql += " and F_CreateUser = '" + strusercode + "' ";
- // }
- // if (source != 0)
- // {
- // sql += " and F_InfoSource = '" + source + "' ";
- // }
- // if (keyid != 0)
- // {
- // sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- // }
- // if (type != 0)
- // {
- // sql += " and F_InfoType = '" + type + "' ";
- // }
- // if (bigtype != 0)
- // {
- // sql += " and F_InfoConBigType = '" + bigtype + "' ";
- // }
- // if (smalltype != 0)
- // {
- // sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- // }
- // if (sourcearea != 0)
- // {
- // sql += " and F_SourceArea = '" + sourcearea + "' ";
- // }
- // if (deptid != 0)
- // {
- // string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
- // sql += " and F_WorkOrderID in(" + sqlwhere + ")";
- // }
- // if (strstarttime.Trim() != "" && strstarttime != "undefined")
- // {
- // sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- // }
- // if (strendtime.Trim() != "" && strendtime != "undefined")
- // {
- // sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- // }
- // if (strpageindex.Trim() != "")
- // {
- // pageindex = Convert.ToInt32(strpageindex);
- // }
- // if (strpagesize.Trim() != "")
- // {
- // pagesize = Convert.ToInt32(strpagesize);
- // }
- // string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName";
- // if (isdc > 0)
- // {
- // var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- // var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- // if (msg == "")
- // {
- // return Success("导出成功");
- // }
- // else
- // {
- // return Error("导出失败");
- // }
- // }
- // int recordCount = 0;
- // dt = BLL.PagerBLL.GetListPager(
- // "T_Bus_WorkOrder",
- // "F_WorkOrderId",
- // cols,
- // sql,
- // "ORDER BY F_CreateTime DESC",
- // pagesize,
- // pageindex,
- // true,
- // out recordCount);
- // #region 声音文件
- // dt.Columns.Add("DeptName", typeof(string));//交办单位
- // dt.Columns.Add("OtherDeptName", typeof(string));//协办单位
- // dt.Columns.Add("NoticeDeptName", typeof(string));//通报单位
- // dt.Columns.Add("NoticeReson", typeof(string));//通报原因
- // dt.Columns.Add("IsReturnNotice", typeof(string));
- // dt.Columns.Add("FilePath", typeof(string));
- // dt.Columns.Add("Buttons", typeof(object));
- // var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- // var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- // int IsReturnNotice = 0;
- // if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- // {
- // IsReturnNotice = 1;
- // }
- // foreach (DataRow dr in dt.Rows)
- // {
- // //获取最新交办信息
- // //string iszbdw = "0";
- // string sqljb = "SELECT TOP 1 * FROM T_Bus_AssignedInfo WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 and F_IsSure<>3 ORDER BY F_Id DESC";
- // var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
- // if (dtjb.Rows.Count > 0)
- // {
- // //if (dtjb.Rows[0]["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- // dr["DeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_MainDeptId"].ToString() + "')");
- // if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
- // {
- // dr["OtherDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_OtherDeptIds"].ToString() + "')");
- // }
- // //int did = Int32.Parse(dtjb.Rows[0]["F_MainDeptId"].ToString());
- // //var deptinfo = new BLL.T_Sys_Department().GetModel(did);
- // //if (deptinfo != null)
- // //{
- // // //if (did == userModel.F_DeptId) { iszbdw = "1"; }
- // // dr["DeptName"] = deptinfo.F_DeptName;//交办单位
- // //}
- // //if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
- // //{
- // // string[] strids = dtjb.Rows[0]["F_OtherDeptIds"].ToString().Split(',');
- // // string dns = string.Empty;
- // // foreach (string strid in strids)
- // // {
- // // var dinfo = new BLL.T_Sys_Department().GetModel(Int32.Parse(strid));
- // // if (dinfo != null)
- // // {
- // // if (string.IsNullOrEmpty(dns))
- // // {
- // // dns = dinfo.F_DeptName;//交办单位
- // // }
- // // else
- // // {
- // // dns += "," + dinfo.F_DeptName;//交办单位
- // // }
- // // }
- // // }
- // // dr["OtherDeptName"] = dns;
- // //}
- // }
- // //获取最新通报信息
- // string sqltb = "SELECT TOP 1 * FROM T_Bus_NoticeCriticism WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 ORDER BY F_Id DESC";
- // var dttb = DbHelperSQL.Query(sqltb).Tables[0];
- // if (dttb.Rows.Count > 0)
- // {
- // if (dttb.Rows[0]["F_DeptIds"] != null && dttb.Rows[0]["F_DeptIds"].ToString() != "")
- // {
- // dr["NoticeDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dttb.Rows[0]["F_DeptIds"].ToString() + "')");
- // }
- // dr["NoticeReson"] = dttb.Rows[0]["F_Content"] != null? dttb.Rows[0]["F_Content"].ToString():"";
- // }
- // if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- // {
- // dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- // }
- // else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- // {
- // dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- // }
- // List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- // btns.Add(ButtonGroup.query());
- // dr["Buttons"] = btns;
- // dr["IsReturnNotice"] = IsReturnNotice;
- // }
- // #endregion
- // var obj = new
- // {
- // state = "success",
- // message = "成功",
- // rows = dt,
- // total = recordCount
- // };
- // return Content(obj.ToJson());
- //}
- /// <summary>
- /// 获取通报工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetNoticeList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0 ";
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (userModel.F_RoleCode == "WLDW")
- {
- string sqlwhere = "select F_WorkOrderID from T_Bus_NoticeCriticism where ','+F_DeptIds+',' like '%," + userModel.F_DeptId + ",%' and F_State=1 and F_IsDelete=0 ";
- sql += " and F_WorkOrderID in(" + sqlwhere + ")";
- }
- else
- {
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_NoticeCriticism where F_State=1 and F_IsDelete=0) ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName"
- + ",dbo.GetDeptNames(F_NoticeDeptIds) as NoticeDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("NoticeReson", typeof(string));//通报原因
- dt.Columns.Add("IsReturnNotice", typeof(string));
- dt.Columns.Add("FilePath", typeof(string));
- dt.Columns.Add("Buttons", typeof(object));
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- int IsReturnNotice = 0;
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- IsReturnNotice = 1;
- }
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新通报信息
- string sqltb = "SELECT TOP 1 * FROM T_Bus_NoticeCriticism WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 ORDER BY F_Id DESC";
- var dttb = DbHelperSQL.Query(sqltb).Tables[0];
- if (dttb.Rows.Count > 0)
- {
- dr["NoticeReson"] = dttb.Rows[0]["F_Content"] != null ? dttb.Rows[0]["F_Content"].ToString() : "";
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- dr["IsReturnNotice"] = IsReturnNotice;
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取批示工单列表
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetSuperList(int isdc = 0)
- {
- DataTable dt = new DataTable();
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string sql = " and F_IsDelete=0 ";
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
- string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
- string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
- string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
- int source = RequestString.GetInt("source", 0);
- int keyid = RequestString.GetInt("keyid", 0);
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- int deptid = RequestString.GetInt("deptid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strworkid.Trim() != "" && strworkid != "undefined")
- {
- sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_CusName like '%" + strname + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
- }
- if (strkey.Trim() != "" && strkey != "undefined")
- {
- sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type in (1,2))";
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName"
- + ",dbo.GetDeptNames(F_NoticeDeptIds) as NoticeDeptName";
- if (isdc > 0)
- {
- var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Bus_WorkOrder",
- "F_WorkOrderId",
- cols,
- sql,
- "ORDER BY F_CreateTime DESC",
- pagesize,
- pageindex,
- true,
- out recordCount);
- #region 声音文件
- dt.Columns.Add("FilePath", typeof(string));
- dt.Columns.Add("Buttons", typeof(object));
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- //获取最新通报信息
- string sqltb = "SELECT TOP 1 * FROM T_Bus_NoticeCriticism WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 ORDER BY F_Id DESC";
- var dttb = DbHelperSQL.Query(sqltb).Tables[0];
- if (dttb.Rows.Count > 0)
- {
- dr["NoticeReson"] = dttb.Rows[0]["F_Content"] != null ? dttb.Rows[0]["F_Content"].ToString() : "";
- }
- if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
- {
- dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
- btns.Add(ButtonGroup.query());
- dr["Buttons"] = btns;
- }
- #endregion
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取工单信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
- //int type = RequestString.GetInt("type", 0);//0基本信息1监察意见2领导批示3办理情况4回访信息5督办信息6办理过程
- if (!string.IsNullOrEmpty(strworkorderid))
- {
- string sql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName1,dbo.GetDictionaryName(F_InfoSource) as SourceName"
- + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName"
- + ",dbo.GetDeptNames(F_NoticeDeptIds) as NoticeDeptName,dbo.GetAreaName(F_SourceArea) as AreaName "
- + " from T_Bus_WorkOrder where F_WorkOrderId ='" + strworkorderid + "'";
- var dt = DbHelperSQL.Query(sql).Tables[0];
- if (dt.Rows.Count > 0)
- {
- if (dt.Rows[0]["F_IsProtect"] != null && userModel.F_RoleCode == "WLDW")
- {
- string isp = dt.Rows[0]["F_IsProtect"].ToString();
- if (isp == "1")
- {
- dt.Rows[0]["F_CusName"] = "";
- dt.Rows[0]["F_CusPhone"] = "";
- dt.Rows[0]["F_ConPhone"] = "";
- }
- }
- var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
- var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- string jcsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_DeptId) as DeptName "
- + "from T_Bus_RemindRecord where F_Type=2 and F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string dbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_DeptId) as DeptName "
- + "from T_Bus_RemindRecord where F_Type=1 and F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string pssql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type=1 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string zssql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type=2 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string htsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type=3 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string jbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName "
- + "from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string thsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_CreateDeptId) as DeptName "
- + "from T_Bus_Feedback where F_State=1 and F_Type=3 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string yssql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_DelayTime where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string blsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_CreateDeptId) as DeptName "
- + "from T_Bus_Feedback where F_State=1 and F_Type!=3 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string hfsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_VisitResult where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string gcsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_Operation where F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- string cbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_Additional where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
- #region 声音文件
- dt.Columns.Add("FilePath", typeof(string));
- if (dt.Rows[0]["F_LeaveRecordId"] != null)
- {
- dt.Rows[0]["FilePath"] = GetLeavePath(dt.Rows[0]["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (dt.Rows[0]["F_CallRecordId"] != null)
- {
- dt.Rows[0]["FilePath"] = GetCallPath(dt.Rows[0]["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- #endregion
- #region 附件
- if (configfj != null)
- {
- dt = BindFileData(dt, configfj.F_ParamValue);
- }
- #endregion
- #region 监察信息
- var jcdt = DbHelperSQL.Query(jcsql).Tables[0];
- if (configfj != null)
- {
- jcdt = BindFileData(jcdt, configfj.F_ParamValue);
- }
- #endregion
- #region 批示信息
- var psdt = DbHelperSQL.Query(pssql).Tables[0];
- if (configfj != null)
- {
- psdt = BindFileData(psdt, configfj.F_ParamValue);
- }
- #endregion
- #region 指示信息
- var zsdt = DbHelperSQL.Query(zssql).Tables[0];
- if (configfj != null)
- {
- zsdt = BindFileData(zsdt, configfj.F_ParamValue);
- }
- #endregion
- #region 回退信息
- var htdt = DbHelperSQL.Query(htsql).Tables[0];
- #endregion
- #region 督办信息
- var dbdt = DbHelperSQL.Query(dbsql).Tables[0];
- if (configfj != null)
- {
- dbdt = BindFileData(dbdt, configfj.F_ParamValue);
- }
- #endregion
- #region 交办信息
- var jbdt = DbHelperSQL.Query(jbsql).Tables[0];
- if (configfj != null)
- {
- jbdt = BindFileData(jbdt, configfj.F_ParamValue);
- }
- #endregion
- #region 退回信息
- var thdt = DbHelperSQL.Query(thsql).Tables[0];
- #endregion
- #region 延时信息
- var ysdt = DbHelperSQL.Query(yssql).Tables[0];
- #endregion
- #region 办理情况
- var bldt = DbHelperSQL.Query(blsql).Tables[0];
- if (configfj != null)
- {
- bldt = BindFileData(bldt, configfj.F_ParamValue);
- }
- #endregion
- #region 回访信息
- var hfdt = DbHelperSQL.Query(hfsql).Tables[0];
- hfdt.Columns.Add("FilePath", typeof(string));
- foreach (DataRow bldr in hfdt.Rows)
- {
- if (bldr["F_CallRecordId"] != null && config != null)
- {
- bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- }
- #endregion
- #region 市民催单
- var cbdt = DbHelperSQL.Query(cbsql).Tables[0];
- cbdt.Columns.Add("FilePath", typeof(string));
- foreach (DataRow bldr in cbdt.Rows)
- {
- if (bldr["F_CallRecordId"] != null && config != null)
- {
- bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- }
- #endregion
- #region 办理过程
- var gcdt = DbHelperSQL.Query(gcsql).Tables[0];
- gcdt.Columns.Add("File", typeof(object));
- gcdt.Columns.Add("FilePath", typeof(string));
- if (configfj != null || configly != null || config != null)
- {
- foreach (DataRow bldr in gcdt.Rows)
- {
- if (bldr["F_File"] != null && bldr["F_File"].ToString() != "" && configfj != null)
- {
- bldr["File"] = GetFileData(bldr["F_File"].ToString(), configfj.F_ParamValue);
- }
- if (bldr["F_LeaveRecordId"] != null && configly != null)
- {
- bldr["FilePath"] = GetLeavePath(bldr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
- }
- else if (bldr["F_CallRecordId"] != null && config != null)
- {
- bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
- }
- }
- }
- #endregion
- #region 流程显示
- var lcdt = new DataTable();
- lcdt.Columns.Add("step", typeof(int));
- lcdt.Columns.Add("name", typeof(string));
- lcdt.Columns.Add("dept", typeof(string));
- lcdt.Columns.Add("time", typeof(string));
- DataRow dr1 = lcdt.NewRow();
- dr1["step"] = 1;
- if (dt.Rows[0]["F_CreateUser"] != null)
- {
- var lruser = new BLL.T_Sys_UserAccount().GetModel(dt.Rows[0]["F_CreateUser"].ToString());
- if (lruser != null)
- {
- dr1["name"] = lruser.F_UserName;
- dr1["dept"] = lruser.depname;
- }
- else
- {
- dr1["name"] = dt.Rows[0]["F_CreateUser"].ToString();
- dr1["dept"] = "";
- }
- }
- dr1["time"] = dt.Rows[0]["F_CreateTime"];
- lcdt.Rows.Add(dr1);
- int state = Int32.Parse(dt.Rows[0]["F_WorkState"].ToString());
- if (state >= 1) {
- if (jbdt.Rows.Count > 0)
- {
- var newjb = jbdt.Rows[jbdt.Rows.Count - 1];
- DataRow dr2 = lcdt.NewRow();
- dr2["step"] = 2;
- var jbuser = new BLL.T_Sys_UserAccount().GetModel(newjb["F_CreateUser"].ToString());
- if (jbuser != null)
- {
- dr2["name"] = jbuser.F_UserName;
- dr2["dept"] = jbuser.depname;
- }
- else
- {
- dr2["name"] = newjb["F_CreateUser"].ToString();
- dr2["dept"] = "";
- }
- dr2["time"] = newjb["F_CreateTime"];
- lcdt.Rows.Add(dr2);
- }
- }
- if (state >= 6)
- {
- if (bldt.Rows.Count > 0)
- {
- var newbl = bldt.Rows[bldt.Rows.Count - 1];
- DataRow dr3 = lcdt.NewRow();
- dr3["step"] = 3;
- var jbuser = new BLL.T_Sys_UserAccount().GetModel(newbl["F_CreateUser"].ToString());
- if (jbuser != null)
- {
- dr3["name"] = jbuser.F_UserName;
- dr3["dept"] = jbuser.depname;
- }
- else
- {
- dr3["name"] = newbl["F_CreateUser"].ToString();
- dr3["dept"] = "";
- }
- dr3["time"] = newbl["F_CreateTime"];
- lcdt.Rows.Add(dr3);
- }
- }
- if (state >= 7)
- {
- if (hfdt.Rows.Count > 0)
- {
- var newhf = hfdt.Rows[hfdt.Rows.Count - 1];
- DataRow dr4 = lcdt.NewRow();
- dr4["step"] = 4;
- var jbuser = new BLL.T_Sys_UserAccount().GetModel(newhf["F_CreateUser"].ToString());
- if (jbuser != null)
- {
- dr4["name"] = jbuser.F_UserName;
- dr4["dept"] = jbuser.depname;
- }
- else
- {
- dr4["name"] = newhf["F_CreateUser"].ToString();
- dr4["dept"] = "";
- }
- dr4["time"] = newhf["F_CreateTime"];
- lcdt.Rows.Add(dr4);
- }
- }
- if (state == 9)
- {
- DataRow dr5 = lcdt.NewRow();
- dr5["step"] = 5;
- var enduser = new BLL.T_Sys_UserAccount().GetModel(dt.Rows[0]["F_CloseUser"].ToString());
- if (enduser != null)
- {
- dr5["name"] = enduser.F_UserName;
- dr5["dept"] = enduser.depname;
- }
- else
- {
- dr5["name"] = dt.Rows[0]["F_CloseUser"].ToString();
- dr5["dept"] = "";
- }
- dr5["time"] = dt.Rows[0]["F_CloseTime"];
- lcdt.Rows.Add(dr5);
- }
- #endregion
- #region 操作按钮
- var btns = new List<ButtonGroup.button>();
- if (jbdt.Rows.Count > 0)
- {
- var jbzx = jbdt.Rows[jbdt.Rows.Count - 1];
- string iszbdw = "0";
- string fmd = jbzx["F_MainDeptId"].ToString();
- string fod = jbzx["F_OtherDeptIds"] == null ? "" : jbzx["F_OtherDeptIds"].ToString();
- if (fmd == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
- else if (fod != "" && fod.Split(',').Contains(userModel.F_DeptId.ToString()))
- {
- iszbdw = "2";
- }
- if (!(userModel.F_RoleCode == "WLDW" && iszbdw == "0"))
- {
- btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), iszbdw);
- }
- }
- else
- {
- btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), "0");
- }
- #endregion
- #region 其他权限
- int issend = 0;
- if (dt.Rows[0]["F_IsRelease"] != null && (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
- {
- if (dt.Rows[0]["F_IsRelease"].ToString() != "1")
- {
- issend = 1;
- }
- }
- int isnotice = 0;
- if (dt.Rows[0]["F_IsNotice"] != null && (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
- {
- if (dt.Rows[0]["F_IsNotice"].ToString() != "1")
- {
- isnotice = 1;
- }
- }
- int isedit = 0;
- if (dt.Rows[0]["F_IsRelease"] != null && (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
- {
- isedit = 1;
- }
- #endregion
- var obj = new
- {
- data = dt,
- jcdata = jcdt,
- psdata = psdt,
- zsdata = zsdt,
- htdata = htdt,
- dbdata = dbdt,
- jbdata = jbdt,
- thdata = thdt,
- ysdata = ysdt,
- bldata = bldt,
- hfdata = hfdt,
- cbdata = cbdt,
- gcdata = gcdt,
- lcdata= lcdt,
- issend = issend,
- isedit = isedit,
- isnotice = isnotice,
- btndata = btns
- };
- return Success("获取成功", obj);
- }
- else
- {
- return Error("获取失败");
- }
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- /// <summary>
- /// 获取草稿信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetDraftInfo()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
- int type = RequestString.GetInt("type", 0);//1交办信息2反馈信息3回访信息
- if (!string.IsNullOrEmpty(strworkorderid) && type != 0)
- {
- string sql = string.Empty;
- switch (type)
- {
- case 1: sql = "select top 1 *,dbo.GetDeptName(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName from T_Bus_AssignedInfo"; break;
- case 2: sql = "select top 1 * from T_Bus_Feedback"; break;
- case 3: sql = "select top 1 * from T_Bus_VisitResult"; break;
- }
- sql += " where F_WorkOrderId='" + strworkorderid + "' and F_State=0 and F_IsDelete=0 and F_CreateUser=" + userModel.F_UserCode + " order by F_CreateTime desc";
- var dt = DbHelperSQL.Query(sql).Tables[0];
- if (dt.Rows.Count > 0)
- {
- #region 附件
- var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- if (!string.IsNullOrEmpty(configfj.F_ParamValue))
- {
- BindFileData(dt, configfj.F_ParamValue);
- }
- #endregion
- }
- return Success("获取成功", dt);
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- /// <summary>
- /// 获取审核信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetAuditInfo()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
- int type = RequestString.GetInt("type", 0);//1退回信息2延时信息
- if (!string.IsNullOrEmpty(strworkorderid) && type != 0)
- {
- string sql = string.Empty;
- switch (type)
- {
- case 1: sql = "select top 1 * from T_Bus_Feedback where F_Type=3 and"; break;
- case 2: sql = "select top 1 * from T_Bus_DelayTime where"; break;
- }
- sql += " F_WorkOrderId='" + strworkorderid + "' and F_State=1 and F_IsDelete=0 and F_IsAudit=0 order by F_CreateTime desc";
- var dt = DbHelperSQL.Query(sql).Tables[0];
- if (dt.Rows.Count > 0)
- {
- #region 附件
- var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- if (!string.IsNullOrEmpty(configfj.F_ParamValue))
- {
- BindFileData(dt, configfj.F_ParamValue);
- }
- #endregion
- }
- return Success("获取成功", dt);
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- /// <summary>
- /// 获取所有交办单位
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetAllAssignDept()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(strworkorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- string ids = string.Empty;
- var Assigns = assignBLL.GetModelList(" F_WorkOrderId='" + strworkorderid + "' and F_IsDelete=0 and F_IsSure in (0,1,2) ");
- foreach (var assign in Assigns)
- {
- if (string.IsNullOrEmpty(ids))
- {
- ids = assign.F_MainDeptId.Value.ToString();
- if (!string.IsNullOrEmpty(assign.F_OtherDeptIds))
- {
- ids += "," + assign.F_OtherDeptIds;
- }
- }
- else
- {
- ids += ","+ assign.F_MainDeptId.Value.ToString();
- if (!string.IsNullOrEmpty(assign.F_OtherDeptIds))
- {
- ids += "," + assign.F_OtherDeptIds;
- }
- }
- }
- if (string.IsNullOrEmpty(ids))
- {
- ids = "0";
- }
- var dt = new BLL.T_Sys_Department().GetModelList(" F_DeptId in ( " + ids + " ) ");
- return Success("获取成功", dt);
- }
- else
- {
- return Error("操作失败");
- }
- }
- /// <summary>
- /// 获取二级单位处理信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetSecondDealInfo()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
- if (!string.IsNullOrEmpty(strworkorderid))
- {
- //string sql = "SELECT an.F_Id, an.F_WorkOrderId, an.F_MainDeptId, an.F_OtherDeptIds, an.F_AssignedOpinion, an.F_Remark, an.F_CreateUser, an.F_CreateTime, an.F_IsSure, an.F_State, ";
- //sql += " an.F_SureTime, an.F_IsDelete, an.F_DeleteUser, an.F_DeleteTime, an.F_SureUser, an.F_FeedbackTime, an.F_LimitTime, an.F_IsOverdue, an.F_IsSatisfie, ";
- //sql += " an.F_IsReload, an.F_ReloadUser, an.F_ReloadTime, an.F_File, an.F_IsNotice, an.F_NoticeUser, an.F_NoticeTime, fn.F_AssignedId, ";
- //sql += " fn.F_Result, fn.F_CreateDeptId, fn.F_IsFeedEnd, fn.F_IsAudit, fn.F_AuditUser, fn.F_AuditTime, fn.F_AuditReason ";
- //sql += " FROM T_Bus_AssignedInfo_Next AS an LEFT OUTER JOIN T_Bus_Feedback_Next AS fn ON an.F_Id = fn.F_AssignedId AND an.F_IsDelete = 0 AND fn.F_IsDelete = 0";
- //sql += " where an.F_WorkOrderId='" + strworkorderid + "' order by F_CreateTime desc";
- //var dt = DbHelperSQL.Query(sql).Tables[0];
- string sql = "select top 1 * from T_Bus_AssignedInfo_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 order by F_CreateTime desc";
- string sql1 = "select * from T_Bus_Feedback_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 ";
- var bldt = DbHelperSQL.Query(sql1).Tables[0];
- var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- if (configfj != null)
- {
- bldt = BindFileData(bldt, configfj.F_ParamValue);
- }
- var obj = new
- {
- pdinfo = DbHelperSQL.Query(sql).Tables[0],
- fkinfo = bldt
- };
- return Success("获取成功", obj);
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- /// <summary>
- /// 获取二级单位最新处理信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetNewSecondDealInfo()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
- if (!string.IsNullOrEmpty(strworkorderid))
- {
- string sql = "select top 1 * from T_Bus_Feedback_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 order by F_CreateTime desc";
- var bldt = DbHelperSQL.Query(sql).Tables[0];
- var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
- if (configfj != null)
- {
- bldt = BindFileData(bldt, configfj.F_ParamValue);
- }
- return Success("获取成功", bldt);
- }
- else
- {
- return Error("参数传输失败");
- }
- }
- #endregion
- #region 新增工单
- /// <summary>
- /// 上传附件
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult UploadFile()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- #region 单个上传 no use
- //string path = string.Empty;
- //HttpPostedFile _upfile = RequestString.GetFile("upFile");
- //if (_upfile != null)
- //{
- // //byte[] buffer = new Byte[(int)_upfile.InputStream.Length]; //声明文件长度的二进制类型
- // //_upfile.InputStream.Read(buffer, 0, buffer.Length); //将文件转成二进制
- // string name = string.Empty;
- // FileUp fu = new FileUp();
- // var model = configBll.GetModelList(" F_ParamCode='FilePath' ").FirstOrDefault();
- // if (model != null)
- // {
- // name = fu.Upload(_upfile, model.F_ParamValue);
- // Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
- // model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
- // model_T_Sys_Accessories.F_FileName = name;//附件名称
- // model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(_upfile.FileName);//附件类型
- // model_T_Sys_Accessories.F_FileUrl = model.F_ParamValue + name;//附件地址
- // model_T_Sys_Accessories.F_Size = _upfile.ContentLength;
- // model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
- // int p_fuId = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
- // return Success("成功", model_T_Sys_Accessories);
- // }
- // else
- // {
- // return Error("上传失败");
- // }
- //}
- //else
- //{
- // return Error("请选择要上传的文件");
- //}
- #endregion
- #region 多个上传
- HttpFileCollection files = RequestString.GetFiles();
- if (files.Count > 0)
- {
- List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
- string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
- for (int i = 0; i < files.Count; i++)
- {
- HttpPostedFile file = files[i];
- FileUp fu = new FileUp();
- string name = fu.Upload(file, path);
- Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
- model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
- model_T_Sys_Accessories.F_FileName = name;//附件名称
- model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
- model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
- model_T_Sys_Accessories.F_Size = file.ContentLength;
- model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
- int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
- model_T_Sys_Accessories.F_FileId = id;
- acs.Add(model_T_Sys_Accessories);
- }
- return Success("成功", acs);
- }
- else
- {
- return Error("请选择要上传的文件");
- }
- #endregion
- }
- /// <summary>
- /// 添加工单信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AddWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- // 15:01 2019/10/9 中心领导 和 中心领导管理员 添加工单的权限 - 永城市12345修改
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY" )//|| userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY")
- {
- int source = RequestString.GetInt("source", 0);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- int isresult = RequestString.GetInt("isresult", 0);
- string result = RequestString.GetFormString("result");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- int issubmit = RequestString.GetInt("issubmit", 0);
- string callid = RequestString.GetFormString("callid");
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
- modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(userModel.F_UserCode);
- modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
- modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
- modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
- modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
- modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
- modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
- modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
- modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
- modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
- modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
- modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
- modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
- modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
- modelT_Bus_WorkOrder.F_Email = email;//E-mail
- modelT_Bus_WorkOrder.F_ComTitle = title;//标题
- modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
- modelT_Bus_WorkOrder.F_File = files;//附件
- modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
- modelT_Bus_WorkOrder.F_Key = keys;
- modelT_Bus_WorkOrder.F_SplitUser = splituser;
- modelT_Bus_WorkOrder.F_Level = level;
- //是否直办(即时答复)0:,否1: 是
- modelT_Bus_WorkOrder.F_IsResult = isresult;
- modelT_Bus_WorkOrder.F_Result = result;//处理结果
- modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
- modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
- modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
- modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
- modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
- modelT_Bus_WorkOrder.F_IsDelete = 0;//是否删除(0:否,1:是)
- //如果选择即刻答复:是,即为直办,工单结束
- if (isresult == 1)
- {
- modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
- modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
- modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_IsClosed = 1;
- modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
- }
- else if (issubmit == 1)
- {
- modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
- }
- if (!string.IsNullOrEmpty(callid))
- {
- modelT_Bus_WorkOrder.F_CallId = callid;
- var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
- if (rd != null)
- {
- rd.IsExitWorkOrder = true;
- new BLL.T_Call_CallRecords().Update(rd);
- modelT_Bus_WorkOrder.F_CallRecordId = rd.CallRecordsId;
- }
- }
- workorderBLL.Add(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
- oper.F_File = modelT_Bus_WorkOrder.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- if (modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- oper.F_Message = userinfo + " 登记并提交了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 9)
- {
- oper.F_Message = userinfo + " 登记并结案了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- if (modelT_Bus_WorkOrder.F_WorkState != 0)
- {
- var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
- var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message, u.F_UserCode, userModel.F_UserCode);
- }
- }
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 添加工单信息
- /// </summary>
- /// <returns></returns>
- public string AddWorkOrderBySource(int source, string cusname, string cussex, string cusphone, string cusaddress, string email,
- string zipcode, string conname, string conphone, string title, string content, int sourcearea, string sourceaddress,
- string keys, string splituser, int type, int bigtype, int smalltype, int isprotect, int level, string files=null)
- {
- string workorderid = string.Empty;
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
- modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(source.ToString().PadLeft(4, '0'));
- modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
- modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
- modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
- modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
- modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
- modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
- modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
- modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
- modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
- modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
- modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
- modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
- modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
- modelT_Bus_WorkOrder.F_Email = email;//E-mail
- modelT_Bus_WorkOrder.F_ComTitle = title;//标题
- modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
- modelT_Bus_WorkOrder.F_File = files;//附件
- modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
- modelT_Bus_WorkOrder.F_Key = keys;
- modelT_Bus_WorkOrder.F_SplitUser = splituser;
- modelT_Bus_WorkOrder.F_Level = level;
- //modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
- modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
- modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
- modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
- modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
- modelT_Bus_WorkOrder.F_IsDelete = 1;//是否删除(0:否,1:是)
- modelT_Bus_WorkOrder.F_IsEnabled = 0;//是否处理
- workorderBLL.Add(modelT_Bus_WorkOrder);
- workorderid = modelT_Bus_WorkOrder.F_WorkOrderId;
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = "";
- var sourceinfo = new BLL.T_Sys_DictionaryValue().GetModel(source);
- if (sourceinfo != null) { userinfo = "由 " + sourceinfo.F_Value; }
- if (modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- //oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return workorderid;
- }
- /// <summary>
- /// 添加工单信息留言
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AddWorkOrderByLY()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
- {
- int source = RequestString.GetInt("source", 0);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- int isresult = RequestString.GetInt("isresult", 0);
- string result = RequestString.GetFormString("result");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- int issubmit = RequestString.GetInt("issubmit", 0);
- int lyid = RequestString.GetInt("lyid", 0);
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
- modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(userModel.F_UserCode);
- modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
- modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
- modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
- modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
- modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
- modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
- modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
- modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
- modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
- modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
- modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
- modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
- modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
- modelT_Bus_WorkOrder.F_Email = email;//E-mail
- modelT_Bus_WorkOrder.F_ComTitle = title;//标题
- modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
- modelT_Bus_WorkOrder.F_File = files;//附件
- modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
- modelT_Bus_WorkOrder.F_Key = keys;
- modelT_Bus_WorkOrder.F_Level = level;
- //是否直办(即时答复)0:,否1: 是
- modelT_Bus_WorkOrder.F_IsResult = isresult;
- modelT_Bus_WorkOrder.F_Result = result;//处理结果
- modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
- modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
- modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
- modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
- modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
- modelT_Bus_WorkOrder.F_IsDelete = 0;//是否删除(0:否,1:是)
- //如果选择即刻答复:是,即为直办,工单结束
- if (isresult == 1)
- {
- modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
- modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
- modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_IsClosed = 1;
- modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
- }
- else if (issubmit == 1)
- {
- modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
- }
- if (lyid != 0)
- {
- var rd = new BLL.T_Call_LeaveRecord().GetModel(lyid);
- if (rd != null)
- {
- rd.F_Status = 1;
- rd.F_DealTime = DateTime.Now;
- rd.F_UserCode = userModel.F_UserCode;
- rd.F_UserName = userModel.F_UserName;
- rd.F_UserId= userModel.F_UserId;
- new BLL.T_Call_LeaveRecord().Update(rd);
- modelT_Bus_WorkOrder.F_LeaveRecordId = rd.F_Id;
- }
- }
- workorderBLL.Add(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
- oper.F_File = modelT_Bus_WorkOrder.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- if (modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- oper.F_Message = userinfo + " 登记并提交了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 9)
- {
- oper.F_Message = userinfo + " 登记并结案了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- if (modelT_Bus_WorkOrder.F_WorkState != 0)
- {
- var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
- var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message, u.F_UserCode, userModel.F_UserCode);
- }
- }
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 添加工单信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AddWorkOrderByAPP()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
-
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
-
- int source = RequestString.GetInt("source", 6);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- int isresult = RequestString.GetInt("isresult", 0);
- string result = RequestString.GetFormString("result");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- string workorderid = AddWorkOrderBySource(6, cusname, cussex, cusphone, cusaddress, email, zipcode, conname,
- conphone, title, content, sourcearea, sourceaddress, keys, splituser, type, bigtype, smalltype, isprotect, level);
- if (!string.IsNullOrEmpty(workorderid))
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存用户工单信息
- var model = new BLL.T_Sys_Users().GetModel(userModel.F_UserCode);
- if (model == null)
- {
- model = new Model.T_Sys_Users();
- model.F_OpenId = userModel.F_UserCode;
- model.F_Type = 3;
- model.F_CreateTime = DateTime.Now;
- model.F_Id=new BLL.T_Sys_Users().Add(model);
- }
- Model.T_Bus_UserWorkOrder tbu = new Model.T_Bus_UserWorkOrder();
- tbu.F_UserId = model.F_Id;
- tbu.F_WorkOrderId = workorderid;
- new BLL.T_Bus_UserWorkOrder().Add(tbu);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
-
- }
- #endregion
- #region 操作工单
- /// <summary>
- /// 修改工单信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null && (modelT_Bus_WorkOrder.F_WorkState == 1 || modelT_Bus_WorkOrder.F_WorkState == 0))
- {
- int source = RequestString.GetInt("source", 0);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- int isresult = RequestString.GetInt("isresult", 0);
- string result = RequestString.GetFormString("result");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- int issubmit = RequestString.GetInt("issubmit", 0);
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
- modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
- modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
- modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
- modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
- modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
- modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
- modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
- modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
- modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
- modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
- modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
- modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
- modelT_Bus_WorkOrder.F_Email = email;//E-mail
- modelT_Bus_WorkOrder.F_ComTitle = title;//标题
- modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
- modelT_Bus_WorkOrder.F_File = files;//附件
- modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
- modelT_Bus_WorkOrder.F_Key = keys;
- modelT_Bus_WorkOrder.F_Level = level;
- //是否直办(即时答复)0:,否1: 是
- modelT_Bus_WorkOrder.F_IsResult = isresult;
- modelT_Bus_WorkOrder.F_Result = result;//处理结果
- //如果选择即刻答复:是,即为直办,工单结束
- if (isresult == 1)
- {
- modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
- modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
- modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_IsClosed = 1;
- modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
- }
- else if (issubmit == 1)
- {
- modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
- }
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
- oper.F_File = modelT_Bus_WorkOrder.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- if (modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- oper.F_Message = userinfo + " 修改了工单";
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- oper.F_Message = userinfo + " 修改并提交了工单";
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 9)
- {
- oper.F_Message = userinfo + " 修改并结案了工单";
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
- var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
- }
- }
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Success("权限不足");
- }
- }
- /// <summary>
- /// 修改工单信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditWorkOrderBySource()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int source = RequestString.GetInt("source", 0);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- int isresult = RequestString.GetInt("isresult", 0);
- string result = RequestString.GetFormString("result");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- int issubmit = RequestString.GetInt("issubmit", 0);
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
- modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
- modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
- modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
- modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
- modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
- modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
- modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
- modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
- modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
- modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
- modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
- modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
- modelT_Bus_WorkOrder.F_Email = email;//E-mail
- modelT_Bus_WorkOrder.F_ComTitle = title;//标题
- modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
- modelT_Bus_WorkOrder.F_File = files;//附件
- modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
- modelT_Bus_WorkOrder.F_Key = keys;
- modelT_Bus_WorkOrder.F_Level = level;
- //是否直办(即时答复)0:,否1: 是
- modelT_Bus_WorkOrder.F_IsResult = isresult;
- modelT_Bus_WorkOrder.F_Result = result;//处理结果
- //如果选择即刻答复:是,即为直办,工单结束
- if (isresult == 1)
- {
- modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
- modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
- modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_IsClosed = 1;
- modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
- }
- else if (issubmit == 1)
- {
- modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
- }
- modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_IsEnabled = 1;
- modelT_Bus_WorkOrder.F_EnableTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_IsDelete = 0;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 保存转单记录
- Model.T_Bus_CityTurn modelT_Bus_CityTurn = new BLL.T_Bus_CityTurn().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
- if (modelT_Bus_CityTurn != null && modelT_Bus_CityTurn.F_IsSure == 0)
- {
- modelT_Bus_CityTurn.F_IsSure = 1;
- modelT_Bus_CityTurn.F_SureUser = userModel.F_UserCode;
- modelT_Bus_CityTurn.F_SureTime = DateTime.Now;
- new BLL.T_Bus_CityTurn().Update(modelT_Bus_CityTurn);
- }
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
- oper.F_File = modelT_Bus_WorkOrder.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- if (modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- oper.F_Message = userinfo + " 处理了工单";
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- oper.F_Message = userinfo + " 处理并提交了工单";
- }
- if (modelT_Bus_WorkOrder.F_WorkState == 9)
- {
- oper.F_Message = userinfo + " 处理并结案了工单";
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
- var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
- }
- }
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Success("权限不足");
- }
- }
- /// <summary>
- /// 提交工单
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult SubmitWorkOrder(string[] ids)
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
- {
- if (ids != null && ids.Length > 0)
- {
- foreach (string str in ids)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(str);
- if (modelT_Bus_WorkOrder != null)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 提交了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
- var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
- }
- }
- #endregion
- }
- }
- trans.Complete();
- }
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 回退工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult ReturnWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
- string workorderid = RequestString.GetFormString("workorderid");
- string backuser = RequestString.GetFormString("backuser");
- string backreason = RequestString.GetFormString("backreason");
- string files = RequestString.GetFormString("files");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 1 || (modelT_Bus_WorkOrder.F_WorkState == 9 && modelT_Bus_WorkOrder.F_IsResult==1))
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 0;
- modelT_Bus_WorkOrder.F_IsResult = 0;
- modelT_Bus_WorkOrder.F_IsReturn = 1;
- modelT_Bus_WorkOrder.F_LimitTime = null;
- modelT_Bus_WorkOrder.F_IsOverdue = 0;
- modelT_Bus_WorkOrder.F_MainDeptId = null;
- modelT_Bus_WorkOrder.F_OtherDeptIds = "";
- modelT_Bus_WorkOrder.F_DealDeptId = null;
- modelT_Bus_WorkOrder.F_DealUser = "";
- modelT_Bus_WorkOrder.F_DealTime = null;
- modelT_Bus_WorkOrder.F_AssignUser= userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入批示记录
- //批示记录
- Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new Model.T_Bus_SubmitSuper();
- model_T_Bus_SubmitSuper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
- model_T_Bus_SubmitSuper.F_Type = 3;//1领导批示 2市长指示 3回退
- model_T_Bus_SubmitSuper.F_BatchReason = backuser;//批示人
- model_T_Bus_SubmitSuper.F_SuperOpinion = backreason;//批示内容
- model_T_Bus_SubmitSuper.F_File = files;//附件
- model_T_Bus_SubmitSuper.F_CreateUser = userModel.F_UserCode;//呈批人
- model_T_Bus_SubmitSuper.F_CreateTime = DateTime.Now;//呈批时间
- model_T_Bus_SubmitSuper.F_IsDelete = 0;
- model_T_Bus_SubmitSuper.F_State = 1;//审批状态(0:未处理,1:通过)
- new BLL.T_Bus_SubmitSuper().Add(model_T_Bus_SubmitSuper);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 回退了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("已经处理过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- /// <summary>
- /// 领导批示/市长指示
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult SuperWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string workorderid = RequestString.GetFormString("workorderid");
- int type = RequestString.GetInt("type", 0);//1领导批示 2市长指示
- string superuser = RequestString.GetFormString("superuser");
- string superopinion = RequestString.GetFormString("superopinion");
- string files = RequestString.GetFormString("files");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息 no use
- //modelT_Bus_WorkOrder.F_WorkState = 2;//领导批示
- //workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入批示记录
- //批示记录
- Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new Model.T_Bus_SubmitSuper();
- model_T_Bus_SubmitSuper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
- model_T_Bus_SubmitSuper.F_Type = type;//1领导批示 2市长指示
- model_T_Bus_SubmitSuper.F_BatchReason = superuser;//批示人
- model_T_Bus_SubmitSuper.F_SuperOpinion = superopinion;//批示内容
- model_T_Bus_SubmitSuper.F_File = files;//附件
- model_T_Bus_SubmitSuper.F_CreateUser = userModel.F_UserCode;//呈批人
- model_T_Bus_SubmitSuper.F_CreateTime = DateTime.Now;//呈批时间
- model_T_Bus_SubmitSuper.F_IsDelete = 0;
- model_T_Bus_SubmitSuper.F_State = 1;//审批状态(0:未处理,1:通过)
- new BLL.T_Bus_SubmitSuper().Add(model_T_Bus_SubmitSuper);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 批示了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- /// <summary>
- /// 交办工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AssignWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int state = RequestString.GetInt("state", 0);
- int assignid = RequestString.GetInt("assignid", 0);
- int maindeptid = RequestString.GetInt("maindeptid", 0);
- string otherdeptids = RequestString.GetFormString("otherdeptids");
- DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime")+" 23:59:59");
- string assignedopinion = RequestString.GetFormString("assignedopinion");
- if (!string.IsNullOrEmpty(otherdeptids))
- {
- if (otherdeptids.Split(',').Contains(maindeptid.ToString()))
- {
- return Error("主办单位不能出现在协办单位");
- }
- }
- if (limittime < DateTime.Now)
- {
- return Error("办理时限不能小于当前时间");
- }
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = new Model.T_Bus_AssignedInfo();
- var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
- if (modelT_Bus_WorkOrder != null && deptinfo != null)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- int aid = 0;
- using (TransactionScope trans = new TransactionScope())
- {
- if (assignid == 0)
- {
- #region 插入交办记录
- modelT_Bus_AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
- modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
- modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
- modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
- modelT_Bus_AssignedInfo.F_State = state;//0草稿 1正式
- modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
- modelT_Bus_AssignedInfo.F_IsDelete = 0;
- modelT_Bus_AssignedInfo.F_IsOverdue = 0;
- modelT_Bus_AssignedInfo.F_IsSure = 0;
- modelT_Bus_AssignedInfo.F_IsReload = 0;
- aid = assignBLL.Add(modelT_Bus_AssignedInfo);
- #endregion
- }
- else
- {
- #region 修改交办记录
- modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
- if (modelT_Bus_AssignedInfo != null)
- {
- modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
- modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
- modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
- modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
- modelT_Bus_AssignedInfo.F_State = state;//0草稿 1正式
- modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- aid = modelT_Bus_AssignedInfo.F_Id;
- }
- #endregion
- }
- if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_State == 1)
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
- modelT_Bus_WorkOrder.F_LimitTime = limittime;
- modelT_Bus_WorkOrder.F_MainDeptId = maindeptid;
- modelT_Bus_WorkOrder.F_OtherDeptIds = otherdeptids;
- modelT_Bus_WorkOrder.F_AssignUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 删除草稿信息
- var cglist = assignBLL.GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- assignBLL.Update(cg);
- }
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 交办了工单,主办单位:" + deptinfo.F_DeptName;
- if (!string.IsNullOrEmpty(otherdeptids))
- {
- string sql = "select dbo.GetDeptNames('" + otherdeptids + "')";
- oper.F_Message += ",协办单位:" + DbHelperSQL.GetSingle(sql);
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
- }
- #endregion
- }
- trans.Complete();
- }
- return Success("操作成功", modelT_Bus_AssignedInfo.F_Id);
- }
- else
- {
- return Error("已经交办过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 收回工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult TakeBackWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
- {
- if (modelT_Bus_AssignedInfo.F_IsSure == 0 || (modelT_Bus_AssignedInfo.F_IsSure == 1 && modelT_Bus_WorkOrder.F_WorkState == 4))
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 插入交办记录
- Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
- AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- AssignedInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;//办理时限
- AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
- AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
- AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
- AssignedInfo.F_State = 0;//0草稿 1正式
- AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
- AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
- AssignedInfo.F_IsDelete = 0;
- AssignedInfo.F_IsOverdue = 0;
- AssignedInfo.F_IsSure = 0;
- AssignedInfo.F_IsReload = 0;
- assignBLL.Add(AssignedInfo);
- #endregion
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
- modelT_Bus_WorkOrder.F_MainDeptId = null;
- modelT_Bus_WorkOrder.F_OtherDeptIds = "";
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 删除交办信息
- modelT_Bus_AssignedInfo.F_IsDelete = 1;//删除
- modelT_Bus_AssignedInfo.F_DeleteUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_DeleteTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 收回了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("单位已查收,不能收回");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 查收工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult ReceiveWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId
- && (modelT_Bus_WorkOrder.F_WorkState == 2 || modelT_Bus_WorkOrder.F_WorkState == 8))
- {
- if (modelT_Bus_AssignedInfo.F_IsSure == 0 )
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 4;//办理中
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 保存查收信息
- modelT_Bus_AssignedInfo.F_IsSure = 1;//查收
- modelT_Bus_AssignedInfo.F_SureUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_SureTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 保存明细信息
- if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds))
- {
- string[] strids = modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',');
- foreach (string strid in strids)
- {
- Model.T_Bus_AssignedItemInfo modelT_Bus_AssignedItemInfo = new Model.T_Bus_AssignedItemInfo();
- modelT_Bus_AssignedItemInfo.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- modelT_Bus_AssignedItemInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;
- modelT_Bus_AssignedItemInfo.F_DeptId = Int32.Parse(strid);
- modelT_Bus_AssignedItemInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;
- modelT_Bus_AssignedItemInfo.F_Remark = modelT_Bus_AssignedInfo.F_Remark;
- modelT_Bus_AssignedItemInfo.F_State = 1;
- modelT_Bus_AssignedItemInfo.F_Type = 2;
- modelT_Bus_AssignedItemInfo.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
- modelT_Bus_AssignedItemInfo.F_IsSure = 0;
- modelT_Bus_AssignedItemInfo.F_CreateTime = DateTime.Now;
- modelT_Bus_AssignedItemInfo.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_AssignedItemInfo.F_IsDelete = 0;
- new BLL.T_Bus_AssignedItemInfo().Add(modelT_Bus_AssignedItemInfo);
- }
- }
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 查收了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("单位已查收,不能再次查收");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 退回工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult RebackWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string backreason = RequestString.GetFormString("backreason");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
- {
- if (modelT_Bus_AssignedInfo.F_IsSure == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 3;//退回审核中
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入退回申请信息
- Model.T_Bus_Feedback model_T_Bus_Feedback = new Model.T_Bus_Feedback();
- model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
- model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
- model_T_Bus_Feedback.F_Result = backreason;//退回原因
- model_T_Bus_Feedback.F_IsAudit = 0;
- model_T_Bus_Feedback.F_IsDelete = 0;
- model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//退回人
- model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//退回时间
- model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//退回部门
- model_T_Bus_Feedback.F_IsFeedEnd = 1;
- model_T_Bus_Feedback.F_State = 1;
- model_T_Bus_Feedback.F_Type = 3;
- new BLL.T_Bus_Feedback().Add(model_T_Bus_Feedback);
- #endregion
- #region 保存交办信息
- //modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;//办理
- //if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
- //{
- // modelT_Bus_AssignedInfo.F_IsOverdue = 1;
- //}
- modelT_Bus_AssignedInfo.F_IsSure = 2;//申请退回
- modelT_Bus_AssignedInfo.F_SureUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_SureTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 申请退回了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("单位已查收,不能退回");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 审核退回工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AuditRebackWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int state = RequestString.GetInt("state", 0);
- string reason = RequestString.GetFormString("reason");
- int rebackid = RequestString.GetInt("rebackid", 0);
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_Feedback modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(rebackid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_Feedback != null && modelT_Bus_AssignedInfo != null)
- {
- if (modelT_Bus_Feedback.F_Type == 3 && modelT_Bus_Feedback.F_IsAudit == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存查收信息
- modelT_Bus_Feedback.F_IsAudit = state;//审核
- modelT_Bus_Feedback.F_AuditUser = userModel.F_UserCode;
- modelT_Bus_Feedback.F_AuditTime = DateTime.Now;
- modelT_Bus_Feedback.F_AuditReason = reason;
- new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
- #endregion
- string strmsg = "同意";
- if (modelT_Bus_Feedback.F_IsAudit == 1)
- {
- #region 插入交办记录
- Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
- AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- AssignedInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;//办理时限
- AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
- AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
- AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
- AssignedInfo.F_State = 0;//0草稿 1正式
- AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
- AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
- AssignedInfo.F_IsDelete = 0;
- AssignedInfo.F_IsOverdue = 0;
- AssignedInfo.F_IsSure = 0;
- AssignedInfo.F_IsReload = modelT_Bus_AssignedInfo.F_IsReload;
- assignBLL.Add(AssignedInfo);
- #endregion
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsSure = 3;//退回
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- }
- else
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 保存交办信息
- //modelT_Bus_AssignedInfo.F_FeedbackTime = null;//反馈时间
- modelT_Bus_AssignedInfo.F_IsSure = 0;
- modelT_Bus_AssignedInfo.F_SureUser = "";
- modelT_Bus_AssignedInfo.F_SureTime = null;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- strmsg = "拒绝";
- }
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " " + strmsg + "了工单退回申请";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_Feedback.F_CreateUser, userModel.F_UserCode);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("此审核已经处理");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 申请延时
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult DelayWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- //int state = RequestString.GetInt("state", 0);
- DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");
- string reason = RequestString.GetFormString("reason");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
- {
- if (modelT_Bus_AssignedInfo.F_IsSure == 1)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 5;//延时审核中
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入申请延时信息
- Model.T_Bus_DelayTime delay = new Model.T_Bus_DelayTime();
- delay.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- //delay.F_State = state;
- delay.F_OldTime = modelT_Bus_AssignedInfo.F_LimitTime;
- delay.F_NewTime = newlimittime;
- delay.F_Reason = reason;
- delay.F_State = 1;
- delay.F_IsAudit = 0;
- delay.F_IsDelete = 0;
- delay.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- delay.F_CreateUser = userModel.F_UserCode;
- delay.F_CreateTime = DateTime.Now;
- new BLL.T_Bus_DelayTime().Add(delay);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 申请了延时处理";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失敗,已查收");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 审核延时工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AuditDelayWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int state = RequestString.GetInt("state", 0);
- string reason = RequestString.GetFormString("reason");
- DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");
- int delayid = RequestString.GetInt("delayid", 0);
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_DelayTime modelT_Bus_DelayTime = new BLL.T_Bus_DelayTime().GetModel(delayid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_DelayTime != null && modelT_Bus_AssignedInfo != null)
- {
- if (modelT_Bus_DelayTime.F_IsAudit == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 4;//办理中
- if (state == 1)
- {
- modelT_Bus_WorkOrder.F_LimitTime = newlimittime;
- }
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 保存审核信息
- modelT_Bus_DelayTime.F_IsAudit = state;//审核
- modelT_Bus_DelayTime.F_AuditUser = userModel.F_UserCode;
- modelT_Bus_DelayTime.F_AuditTime = DateTime.Now;
- modelT_Bus_DelayTime.F_RefuseReason = reason;
- modelT_Bus_DelayTime.F_AgreeTime = newlimittime;
- new BLL.T_Bus_DelayTime().Update(modelT_Bus_DelayTime);
- #endregion
- string type = "同意"; string des = "";
- if (modelT_Bus_DelayTime.F_IsAudit == 1)
- {
- #region 修改交办记录
- modelT_Bus_AssignedInfo.F_LimitTime = modelT_Bus_DelayTime.F_AgreeTime;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 处理协办单位
- var xblist = assignItemBLL.GetModelList(" F_IsDelete=0 and F_State=1 and ISNULL(F_FeedbackTime, '')='' and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
- foreach (var xb in xblist)
- {
- //xb.F_LimitTime = DateTime.Now;
- xb.F_LimitTime = modelT_Bus_DelayTime.F_AgreeTime;
- assignItemBLL.Update(xb);
- }
- #endregion
- des = ",原定时间" + modelT_Bus_DelayTime.F_OldTime + ",申请延长到" + modelT_Bus_DelayTime.F_AgreeTime;
- }
- else
- {
- type = "拒绝";
- }
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " " + type + "了工单延时申请" + des;
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_DelayTime.F_CreateUser, userModel.F_UserCode);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("此审核已经处理");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 办理工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult FeedBackWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string dealman = RequestString.GetFormString("dealman");
- string result = RequestString.GetFormString("result");
- string files = RequestString.GetFormString("files");
- int state = RequestString.GetInt("state", 0);
- int feedbackid = RequestString.GetInt("feedbackid", 0);
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_Feedback model_T_Bus_Feedback = new Model.T_Bus_Feedback();
- int type = 0;
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
- {
- type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
- if (type > 0)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 4)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- if (feedbackid == 0)
- {
- #region 插入反馈记录
- model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
- model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
- model_T_Bus_Feedback.F_DealUser = dealman;
- model_T_Bus_Feedback.F_Result = result;//反馈内容
- model_T_Bus_Feedback.F_File = files;
- model_T_Bus_Feedback.F_IsAudit = 0;
- model_T_Bus_Feedback.F_IsDelete = 0;
- model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
- model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
- model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
- model_T_Bus_Feedback.F_IsFeedEnd = 1;
- model_T_Bus_Feedback.F_State = state;
- model_T_Bus_Feedback.F_Type = type;
- new BLL.T_Bus_Feedback().Add(model_T_Bus_Feedback);
- #endregion
- }
- else
- {
- #region 修改反馈记录
- model_T_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
- if (model_T_Bus_Feedback != null)
- {
- model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
- model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
- model_T_Bus_Feedback.F_DealUser = dealman;
- model_T_Bus_Feedback.F_Result = result;//反馈内容
- model_T_Bus_Feedback.F_File = files;
- model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
- model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
- model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
- model_T_Bus_Feedback.F_IsFeedEnd = 1;
- model_T_Bus_Feedback.F_State = state;
- if (modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
- {
- model_T_Bus_Feedback.F_Type = 1;
- }
- else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(userModel.F_DeptId.ToString()))
- {
- model_T_Bus_Feedback.F_Type = 2;
- }
- new BLL.T_Bus_Feedback().Update(model_T_Bus_Feedback);
- }
- #endregion
- }
- if (model_T_Bus_Feedback != null && model_T_Bus_Feedback.F_State == 1)
- {
- string typemsg = "办理";
- if (type == 1)
- {
- int iscs = 0;
- if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
- {
- iscs = 1;
- }
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
- modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
- modelT_Bus_WorkOrder.F_DealUser= userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_DealTime= DateTime.Now;
- modelT_Bus_WorkOrder.F_IsOverdue = iscs;
- modelT_Bus_WorkOrder.F_Result = result;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
- modelT_Bus_AssignedInfo.F_IsOverdue = iscs;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 删除草稿信息
- var cglist = new BLL.T_Bus_Feedback().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "' and F_CreateDeptId='" + userModel.F_DeptId + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_Feedback().Update(cg);
- }
- #endregion
- #region 处理协办单位
- var xblist = new BLL.T_Bus_AssignedItemInfo().GetModelList(" F_IsDelete=0 and F_State=1 and ISNULL(F_FeedbackTime, '')='' and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
- foreach (var xb in xblist)
- {
- xb.F_State = 2;
- xb.F_SureUser = userModel.F_UserCode;
- xb.F_SureTime = DateTime.Now;
- new BLL.T_Bus_AssignedItemInfo().Update(xb);
- }
- #endregion
- typemsg = "主办";
- }
- else if (type == 2)
- {
- #region 保存明细信息
- Model.T_Bus_AssignedItemInfo modelT_Bus_AssignedItemInfo = new BLL.T_Bus_AssignedItemInfo().GetModelList(" F_IsDelete=0 and F_State=1 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "' and F_DeptId='" + userModel.F_DeptId + "'").FirstOrDefault();
- modelT_Bus_AssignedItemInfo.F_FeedbackTime = DateTime.Now;
- if (modelT_Bus_AssignedItemInfo.F_LimitTime < DateTime.Now)
- {
- modelT_Bus_AssignedItemInfo.F_IsOverdue = 1;
- }
- new BLL.T_Bus_AssignedItemInfo().Update(modelT_Bus_AssignedItemInfo);
- #endregion
- #region 删除草稿信息
- var cglist = new BLL.T_Bus_Feedback().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "' and F_CreateDeptId='" + userModel.F_DeptId + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_Feedback().Update(cg);
- }
- #endregion
- typemsg = "协办";
- }
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " " + typemsg + "了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
- #endregion
- }
- trans.Complete();
- }
- return Success("操作成功", model_T_Bus_Feedback.F_Id);
- }
- else
- {
- return Error("已经办理过了");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 派工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult SplitWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int maindeptid = RequestString.GetInt("maindeptid", 0);
- string otherdeptids = RequestString.GetFormString("otherdeptids");
- DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime") + " 23:59:59");
- string assignedopinion = RequestString.GetFormString("assignedopinion");
- string files = RequestString.GetFormString("files");
- int state = RequestString.GetInt("state", 0);
- int nextid = RequestString.GetInt("nextid", 0);
- if (limittime < DateTime.Now)
- {
- return Error("办理时限不能小于当前时间");
- }
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new Model.T_Bus_AssignedInfo_Next();
- var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && deptinfo != null)
- {
- int type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
- if ((type == 1 && modelT_Bus_WorkOrder.F_WorkState == 4) || userModel.F_RoleCode == "GLY")
- {
- if (modelT_Bus_AssignedInfo.F_IsNext == null || modelT_Bus_AssignedInfo.F_IsNext.Value == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- if (nextid == 0)
- {
- #region 插入派单记录
- modelT_Bus_AssignedInfo_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_AssignedInfo_Next.F_LimitTime = limittime;//办理时限
- modelT_Bus_AssignedInfo_Next.F_MainDeptId = maindeptid;//主办单位id
- modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = otherdeptids;//协办单位id
- modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = assignedopinion;//交办意见
- modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
- modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
- modelT_Bus_AssignedInfo_Next.F_IsDelete = 0;
- modelT_Bus_AssignedInfo_Next.F_IsOverdue = 0;
- modelT_Bus_AssignedInfo_Next.F_IsSure = 0;
- modelT_Bus_AssignedInfo_Next.F_IsReload = 0;
- modelT_Bus_AssignedInfo_Next.F_Id = new BLL.T_Bus_AssignedInfo_Next().Add(modelT_Bus_AssignedInfo_Next);
- #endregion
- }
- else
- {
- #region 修改派单记录
- modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetModel(nextid);
- if (modelT_Bus_AssignedInfo_Next != null)
- {
- modelT_Bus_AssignedInfo_Next.F_LimitTime = limittime;//办理时限
- modelT_Bus_AssignedInfo_Next.F_MainDeptId = maindeptid;//主办单位id
- modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = otherdeptids;//协办单位id
- modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = assignedopinion;//交办意见
- modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
- modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
- new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
- }
- #endregion
- }
- if (modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_State == 1)
- {
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsNext = 1;
- modelT_Bus_AssignedInfo.F_NextUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_NextTime = DateTime.Now;
- new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 派单给单位:" + deptinfo.F_DeptName;
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
- #endregion
- }
- trans.Complete();
- }
- return Success("操作成功", modelT_Bus_AssignedInfo_Next.F_Id);
- }
- else
- {
- return Error("已经派过单了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 撤回工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult WithdrawWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存撤单信息
- modelT_Bus_AssignedInfo_Next.F_IsDelete = 1;
- modelT_Bus_AssignedInfo_Next.F_DeleteUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo_Next.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
- #endregion
- #region 删除处理信息
- var cglist = new BLL.T_Bus_Feedback_Next().GetModelList(" F_IsDelete=0 and F_AssignedId='" + modelT_Bus_AssignedInfo_Next.F_Id + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_Feedback_Next().Update(cg);
- }
- #endregion
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsNext = 0;
- new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 撤回了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 签收工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult SignWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId)
- {
- if (modelT_Bus_AssignedInfo_Next.F_IsSure == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存签收信息
- modelT_Bus_AssignedInfo_Next.F_IsSure = 1;//签收
- modelT_Bus_AssignedInfo_Next.F_SureUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo_Next.F_SureTime = DateTime.Now;
- new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
- #endregion
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsNext = 2;
- new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 签收了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("单位已签收,不能再次签收");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 拒收工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult RefuseWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId)
- {
- if (modelT_Bus_AssignedInfo_Next.F_IsSure == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存签收信息
- modelT_Bus_AssignedInfo_Next.F_IsSure = 3;//签收
- modelT_Bus_AssignedInfo_Next.F_SureUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo_Next.F_SureTime = DateTime.Now;
- new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
- #endregion
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsNext = 0;
- new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 拒收了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("单位已签收,不能再次签收");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 处理工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult DealWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string dealman = RequestString.GetFormString("dealman");
- string result = RequestString.GetFormString("result");
- string files = RequestString.GetFormString("files");
- int state = RequestString.GetInt("state", 0);
- int dealid = RequestString.GetInt("dealid", 0);
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_Feedback_Next modelT_Bus_Feedback_Next = new Model.T_Bus_Feedback_Next();
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId && modelT_Bus_AssignedInfo_Next.F_IsSure == 1)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 4 || modelT_Bus_WorkOrder.F_WorkState == 5)
- {
- if (modelT_Bus_AssignedInfo.F_IsNext == 2)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- if (dealid == 0)
- {
- #region 插入反馈记录
- modelT_Bus_Feedback_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
- modelT_Bus_Feedback_Next.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;//交办id
- modelT_Bus_Feedback_Next.F_DealUser = dealman;
- modelT_Bus_Feedback_Next.F_Result = result;//反馈内容
- modelT_Bus_Feedback_Next.F_File = files;
- modelT_Bus_Feedback_Next.F_IsAudit = 0;
- modelT_Bus_Feedback_Next.F_IsDelete = 0;
- modelT_Bus_Feedback_Next.F_CreateUser = userModel.F_UserCode;//办理人
- modelT_Bus_Feedback_Next.F_CreateTime = DateTime.Now;//办理时间
- modelT_Bus_Feedback_Next.F_CreateDeptId = userModel.F_DeptId;//办理部门
- modelT_Bus_Feedback_Next.F_IsFeedEnd = 1;
- modelT_Bus_Feedback_Next.F_State = state;
- modelT_Bus_Feedback_Next.F_Type = 1;
- new BLL.T_Bus_Feedback_Next().Add(modelT_Bus_Feedback_Next);
- #endregion
- }
- else
- {
- #region 修改反馈记录
- modelT_Bus_Feedback_Next = new BLL.T_Bus_Feedback_Next().GetModel(dealid);
- if (modelT_Bus_Feedback_Next != null)
- {
- modelT_Bus_Feedback_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
- modelT_Bus_Feedback_Next.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;//交办id
- modelT_Bus_Feedback_Next.F_DealUser = dealman;
- modelT_Bus_Feedback_Next.F_Result = result;//反馈内容
- modelT_Bus_Feedback_Next.F_File = files;
- modelT_Bus_Feedback_Next.F_CreateUser = userModel.F_UserCode;//办理人
- modelT_Bus_Feedback_Next.F_CreateTime = DateTime.Now;//办理时间
- modelT_Bus_Feedback_Next.F_CreateDeptId = userModel.F_DeptId;//办理部门
- modelT_Bus_Feedback_Next.F_IsFeedEnd = 1;
- modelT_Bus_Feedback_Next.F_State = state;
- new BLL.T_Bus_Feedback_Next().Update(modelT_Bus_Feedback_Next);
- }
- #endregion
- }
- if (modelT_Bus_Feedback_Next != null && modelT_Bus_Feedback_Next.F_State == 1)
- {
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsNext = 3;
- new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 保存派单信息
- modelT_Bus_AssignedInfo_Next.F_FeedbackTime = DateTime.Now;
- if (modelT_Bus_AssignedInfo_Next.F_LimitTime < DateTime.Now)
- {
- modelT_Bus_AssignedInfo_Next.F_IsOverdue = 1;
- }
- new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
- #endregion
- #region 删除草稿信息
- var cglist = new BLL.T_Bus_Feedback_Next().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "' and F_CreateDeptId='" + userModel.F_DeptId + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_Feedback_Next().Update(cg);
- }
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 办理了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
- #endregion
- }
- trans.Complete();
- }
- return Success("操作成功", modelT_Bus_AssignedInfo_Next.F_Id);
- }
- else
- {
- return Error("已经办理过了");
- }
- }
- else
- {
- return Error("已经办理过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 审核派单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AuditSplitWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int state = RequestString.GetInt("state", 0);
- string reason = RequestString.GetFormString("reason");
- int backid = RequestString.GetInt("backid", 0);
- string files = RequestString.GetFormString("files");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_Feedback_Next modelT_Bus_Feedback_Next = new BLL.T_Bus_Feedback_Next().GetModel(backid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_Feedback_Next != null)
- {
- if (modelT_Bus_Feedback_Next.F_IsAudit.Value == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- modelT_Bus_Feedback_Next.F_IsAudit = state;
- modelT_Bus_Feedback_Next.F_AuditUser = userModel.F_UserCode;
- modelT_Bus_Feedback_Next.F_AuditTime = DateTime.Now;
- modelT_Bus_Feedback_Next.F_AuditReason = reason;
- new BLL.T_Bus_Feedback_Next().Update(modelT_Bus_Feedback_Next);
- string strmsg = "";
- if (state == 1)
- {
- strmsg = "同意";
- #region 插入反馈记录
- Model.T_Bus_Feedback modelT_Bus_Feedback = new Model.T_Bus_Feedback();
- modelT_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
- modelT_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
- modelT_Bus_Feedback.F_DealUser = modelT_Bus_Feedback_Next.F_DealUser;
- modelT_Bus_Feedback.F_Result = modelT_Bus_Feedback_Next.F_Result;//反馈内容
- modelT_Bus_Feedback.F_File = modelT_Bus_Feedback_Next.F_File;
- modelT_Bus_Feedback.F_IsAudit = 0;
- modelT_Bus_Feedback.F_IsDelete = 0;
- modelT_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
- modelT_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
- modelT_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
- modelT_Bus_Feedback.F_IsFeedEnd = 1;
- modelT_Bus_Feedback.F_State = state;
- modelT_Bus_Feedback.F_Type = 1;
- new BLL.T_Bus_Feedback().Add(modelT_Bus_Feedback);
- #endregion
- if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
- {
- modelT_Bus_AssignedInfo.F_IsOverdue = 1;
- modelT_Bus_WorkOrder.F_IsOverdue = 1;
- }
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
- modelT_Bus_WorkOrder.F_Result = modelT_Bus_Feedback_Next.F_Result;
- modelT_Bus_WorkOrder.F_DealDeptId = modelT_Bus_Feedback_Next.F_CreateDeptId;
- modelT_Bus_WorkOrder.F_DealUser = modelT_Bus_Feedback_Next.F_CreateUser;
- modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 删除草稿信息
- var cglist = new BLL.T_Bus_Feedback().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "' and F_CreateDeptId='" + userModel.F_DeptId + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_Feedback().Update(cg);
- }
- #endregion
- #region 处理协办单位
- var xblist = new BLL.T_Bus_AssignedItemInfo().GetModelList(" F_IsDelete=0 and F_State=1 and ISNULL(F_FeedbackTime, '')='' and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
- foreach (var xb in xblist)
- {
- xb.F_State = 2;
- xb.F_SureUser = userModel.F_UserCode;
- xb.F_SureTime = DateTime.Now;
- new BLL.T_Bus_AssignedItemInfo().Update(xb);
- }
- #endregion
- }
- else if (state == 2)
- {
- strmsg = "拒绝";
- Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next1 = new BLL.T_Bus_AssignedInfo_Next().GetModel(modelT_Bus_Feedback_Next.F_AssignedId.Value);
- modelT_Bus_AssignedInfo_Next1.F_FeedbackTime = null;
- new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next1);
- modelT_Bus_AssignedInfo.F_IsNext = 2;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- //#region 插入派单记录
- //Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next1 = new BLL.T_Bus_AssignedInfo_Next().GetModel(modelT_Bus_Feedback_Next.F_AssignedId.Value);
- //Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new Model.T_Bus_AssignedInfo_Next();
- //modelT_Bus_AssignedInfo_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- //modelT_Bus_AssignedInfo_Next.F_LimitTime = modelT_Bus_AssignedInfo_Next1.F_LimitTime;//办理时限
- //modelT_Bus_AssignedInfo_Next.F_MainDeptId = modelT_Bus_AssignedInfo_Next1.F_MainDeptId;//主办单位id
- //modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = modelT_Bus_AssignedInfo_Next1.F_OtherDeptIds;//协办单位id
- //modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = reason;//交办意见
- //modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
- //modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
- //modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
- //modelT_Bus_AssignedInfo_Next.F_IsDelete = 0;
- //modelT_Bus_AssignedInfo_Next.F_IsOverdue = 0;
- //modelT_Bus_AssignedInfo_Next.F_IsSure = 0;
- //modelT_Bus_AssignedInfo_Next.F_IsReload = 0;
- //modelT_Bus_AssignedInfo_Next.F_Id = new BLL.T_Bus_AssignedInfo_Next().Add(modelT_Bus_AssignedInfo_Next);
- //#endregion
- }
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " " + strmsg + "了此处理";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("已经审核过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 回访工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult VisitWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string visituser = RequestString.GetFormString("visituser");//回访人
- int type = RequestString.GetInt("type", 0);//回访方式
- int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
- //DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime"));//不满意,重办的办理时限
- int state = RequestString.GetInt("state", 0);//0保存 1保存并下一步
- int visitid = RequestString.GetInt("visitid", 0);
- string result = RequestString.GetFormString("result");//回访情况
- //int nexttype = RequestString.GetInt("nexttype", 0);//1重办 2结案
- //string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
- //string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
- string callid = RequestString.GetFormString("callid");
- string guid= RequestString.GetFormString("guid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- Model.T_Bus_VisitResult modelT_Bus_VisitResult = new Model.T_Bus_VisitResult();
- if (modelT_Bus_WorkOrder != null)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 6)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- if (visitid == 0)
- {
- #region 新增回访结果记录
- modelT_Bus_VisitResult.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_VisitResult.F_AssignedId = 0;
- modelT_Bus_VisitResult.F_VisitUser = visituser;
- modelT_Bus_VisitResult.F_Type = type;
- modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
- modelT_Bus_VisitResult.F_Result = result;
- modelT_Bus_VisitResult.F_State = state;
- if (!string.IsNullOrEmpty(callid))
- {
- var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
- if (rd != null)
- {
- modelT_Bus_VisitResult.F_CallRecordId = rd.CallRecordsId;
- }
- }
- //modelT_Bus_VisitResult.F_LimitTime = newlimittime;
- modelT_Bus_VisitResult.F_IsDelete = 0;
- modelT_Bus_VisitResult.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_VisitResult.F_CreateTime = DateTime.Now;
- if (modelT_Bus_AssignedInfo != null)
- {
- modelT_Bus_VisitResult.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- }
- int id = new BLL.T_Bus_VisitResult().Add(modelT_Bus_VisitResult);
- modelT_Bus_VisitResult.F_Id = id;
- //保存回访记录
- new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
- #endregion
- }
- else
- {
- #region 修改回访结果记录
- modelT_Bus_VisitResult = new BLL.T_Bus_VisitResult().GetModel(visitid);
- if (modelT_Bus_VisitResult != null)
- {
- modelT_Bus_VisitResult.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_VisitResult.F_AssignedId = 0;
- modelT_Bus_VisitResult.F_VisitUser = visituser;
- modelT_Bus_VisitResult.F_Type = type;
- modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
- modelT_Bus_VisitResult.F_Result = result;
- modelT_Bus_VisitResult.F_State = state;
- if (!string.IsNullOrEmpty(callid))
- {
- var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
- if (rd != null)
- {
- modelT_Bus_VisitResult.F_CallRecordId = rd.CallRecordsId;
- }
- }
- //modelT_Bus_VisitResult.F_LimitTime = newlimittime;
- modelT_Bus_VisitResult.F_IsDelete = 0;
- modelT_Bus_VisitResult.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_VisitResult.F_CreateTime = DateTime.Now;
- if (modelT_Bus_AssignedInfo != null)
- {
- modelT_Bus_VisitResult.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- }
- int id=new BLL.T_Bus_VisitResult().Add(modelT_Bus_VisitResult);
- modelT_Bus_VisitResult.F_Id = id;
- //保存回访记录
- new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
- }
- #endregion
- }
- if (modelT_Bus_VisitResult != null && modelT_Bus_VisitResult.F_State == 1)
- {
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_IsSatisfie = issatisfie;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 7;//已回访
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 删除草稿信息
- var cglist = new BLL.T_Bus_VisitResult().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
- foreach (var cg in cglist)
- {
- cg.F_IsDelete = 1;
- cg.F_DeleteUser = userModel.F_UserCode;
- cg.F_DeleteTime = DateTime.Now;
- new BLL.T_Bus_VisitResult().Update(cg);
- //保存回访记录
- new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
- }
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_VisitResult.F_AssignedId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 回访了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
- #endregion
- #region 自动语音回访
- if (issatisfie == 1)//如果满意就进行自动语音回访
- {
- var configacb = configBll.GetModelList(" F_ParamCode='AutoCallBack' ").FirstOrDefault();
- if (configacb != null && configacb.F_ParamValue == "1")//如果为1就是开启了自动语音回访,其他都是关闭
- {
- string AutoCallMsg = string.Empty;
- new BLL.T_CTI_Task().AddToAutoVoiceNotice(modelT_Bus_WorkOrder.F_CusPhone, modelT_Bus_WorkOrder.F_WorkOrderId, modelT_Bus_AssignedInfo.F_Id, out AutoCallMsg);
- }
- }
- #endregion
- }
- trans.Complete();
- }
- return Success("操作成功", modelT_Bus_VisitResult.F_Id);
- }
- else
- {
- return Error("已经回访过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 督办或监察工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult RemindWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string workorderid = RequestString.GetFormString("workorderid");
- int type = RequestString.GetInt("type", 0);//1督办 2监察
- string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
- string files = RequestString.GetFormString("files");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 插入督办记录
- Model.T_Bus_RemindRecord modelT_Bus_RemindRecord = new Model.T_Bus_RemindRecord();
- modelT_Bus_RemindRecord.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_RemindRecord.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- modelT_Bus_RemindRecord.F_Type = type;
- modelT_Bus_RemindRecord.F_DeptId = modelT_Bus_AssignedInfo.F_MainDeptId;
- modelT_Bus_RemindRecord.F_Content = overseeopinion;
- modelT_Bus_RemindRecord.F_File = files;
- modelT_Bus_RemindRecord.F_State = 1;
- modelT_Bus_RemindRecord.F_IsDelete = 0;
- modelT_Bus_RemindRecord.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_RemindRecord.F_CreateTime = DateTime.Now;
- new BLL.T_Bus_RemindRecord().Add(modelT_Bus_RemindRecord);
- #endregion
- #region 插入操作记录
- string typename = "督办";
- if (type == 2) { typename = "监察"; }
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " " + typename + "了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- /// <summary>
- /// 重办工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult ReloadWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
- DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");//不满意,重办的办理时限
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 7)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 插入督办记录
- Model.T_Bus_RemindRecord modelT_Bus_RemindRecord = new Model.T_Bus_RemindRecord();
- modelT_Bus_RemindRecord.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_RemindRecord.F_AssignedId = 0;
- modelT_Bus_RemindRecord.F_Type = 1;
- if (modelT_Bus_AssignedInfo != null)//转办后重办
- {
- #region 插入交办记录
- int n = Int32.Parse(DbHelperSQL.GetSingle("select count(1) from T_Bus_AssignedInfo where F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "' and F_State=1 and F_IsSure=1 and F_IsDelete=0 and isnull(F_IsReload,0)>0").ToString());
- modelT_Bus_WorkOrder.F_IsReload= n + 1;
- modelT_Bus_WorkOrder.F_LimitTime = newlimittime;
- modelT_Bus_WorkOrder.F_IsOverdue = 0;
- Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
- AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- AssignedInfo.F_LimitTime = newlimittime;//办理时限
- AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
- AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
- AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
- AssignedInfo.F_State = 1;//0草稿 1正式
- AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
- AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
- AssignedInfo.F_IsDelete = 0;
- AssignedInfo.F_IsOverdue = 0;
- AssignedInfo.F_IsSure = 0;
- AssignedInfo.F_IsReload = n + 1;
- AssignedInfo.F_ReloadUser = userModel.F_UserCode;
- AssignedInfo.F_ReloadTime = DateTime.Now;
- assignBLL.Add(AssignedInfo);
- #endregion
- modelT_Bus_RemindRecord.F_AssignedId = AssignedInfo.F_Id;
- modelT_Bus_RemindRecord.F_DeptId = AssignedInfo.F_MainDeptId;
- }
- else if (modelT_Bus_WorkOrder.F_IsResult == 1)//直办后重办
- {
- var cruser = userBLL.GetModel(modelT_Bus_WorkOrder.F_CreateUser);
- if (cruser != null)
- {
- modelT_Bus_RemindRecord.F_DeptId = cruser.F_DeptId;
- }
- }
- modelT_Bus_RemindRecord.F_Content = overseeopinion;
- modelT_Bus_RemindRecord.F_State = 1;
- modelT_Bus_RemindRecord.F_IsDelete = 0;
- modelT_Bus_RemindRecord.F_CreateUser = userModel.F_UserCode;
- modelT_Bus_RemindRecord.F_CreateTime = DateTime.Now;
- new BLL.T_Bus_RemindRecord().Add(modelT_Bus_RemindRecord);
- #endregion
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_WorkState = 8;//重办中
- modelT_Bus_WorkOrder.F_Result = "";
- modelT_Bus_WorkOrder.F_DealDeptId = null;
- modelT_Bus_WorkOrder.F_DealUser = "";
- modelT_Bus_WorkOrder.F_DealTime = null;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- if (modelT_Bus_AssignedInfo != null)
- {
- oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
- }
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string deptname = "";
- var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
- if (deptinfo != null) { deptname = deptinfo.F_DeptName; }
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 重办并督办了工单,交办单位:" + deptname;
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- //推送消息表
- var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
- foreach (var u in users)
- {
- msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
- }
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("已经处理过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 结案工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult FinishWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
- int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
- int isnotice = RequestString.GetInt("isnotice", 0);//0不通告 1通告
- string deptids = RequestString.GetFormString("deptids");//通告单位
- string noticereson = RequestString.GetFormString("noticereson");//通告原因
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- if (modelT_Bus_WorkOrder.F_WorkState == 7)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 修改工单记录
- modelT_Bus_WorkOrder.F_WorkState = 9;
- modelT_Bus_WorkOrder.F_IsSatisfie = issatisfie;
- modelT_Bus_WorkOrder.F_IsClosed = 1;
- modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_FinalOpinion = finalopinion;
- if (isnotice == 1)
- {
- Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
- modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
- modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_NoticeCriticism.F_Content = noticereson;
- modelT_Bus_NoticeCriticism.F_State = 1;
- modelT_Bus_NoticeCriticism.F_IsDelete = 0;
- modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
- modelT_Bus_NoticeCriticism.F_CreateUser= userModel.F_UserCode;
- new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
- modelT_Bus_AssignedInfo.F_IsNotice = 1;
- modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- modelT_Bus_WorkOrder.F_IsNotice = 1;
- modelT_Bus_WorkOrder.F_NoticeDeptIds= deptids;
- }
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
- if (isnotice == 1)
- {
- string sql = "select dbo.GetDeptNames('" + deptids + "')";
- oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("已经处理过了");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 结案工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult ForceFinishWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string result = RequestString.GetFormString("result");//处理结果
- string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
- int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
- int isnotice = RequestString.GetInt("isnotice", 0);//0不通告 1通告
- string deptids = RequestString.GetFormString("deptids");//通告单位
- string noticereson = RequestString.GetFormString("noticereson");//通告原因
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 修改工单记录
- modelT_Bus_WorkOrder.F_Result = result;
- modelT_Bus_WorkOrder.F_WorkState = 9;
- modelT_Bus_WorkOrder.F_IsSatisfie = issatisfie;
- modelT_Bus_WorkOrder.F_IsClosed = 1;
- modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
- modelT_Bus_WorkOrder.F_FinalOpinion = finalopinion;
- if (isnotice == 1)
- {
- Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
- modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
- modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_NoticeCriticism.F_Content = noticereson;
- modelT_Bus_NoticeCriticism.F_State = 1;
- modelT_Bus_NoticeCriticism.F_IsDelete = 0;
- modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
- modelT_Bus_NoticeCriticism.F_CreateUser = userModel.F_UserCode;
- new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
- if (modelT_Bus_AssignedInfo != null)
- {
- modelT_Bus_AssignedInfo.F_IsNotice = 1;
- modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- }
- modelT_Bus_WorkOrder.F_IsNotice = 1;
- modelT_Bus_WorkOrder.F_NoticeDeptIds = deptids;
- }
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 强制结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
- if (isnotice == 1)
- {
- string sql = "select dbo.GetDeptNames('" + deptids + "')";
- oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
- }
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 删除工单
- /// </summary>
- /// <returns></returns>
- public ActionResult DelWorkOrder(string[] ids)
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
- {
- //StringBuilder sb = new StringBuilder();
- foreach (var item in ids)
- {
- //sb.Append("'" + item + "',");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(item);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_WorkOrder.F_WorkState == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 修改工单记录
- modelT_Bus_WorkOrder.F_IsDelete = 1;
- modelT_Bus_WorkOrder.F_DeleteUser = userModel.F_UserCode;
- modelT_Bus_WorkOrder.F_DeleteTime = DateTime.Now;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 删除了工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- }
- }
- return Success("删除成功");
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 转媒体工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult ReleaseWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int isrelease = RequestString.GetInt("isrelease", -1);
- if (isrelease != -1)
- {
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 修改工单记录
- modelT_Bus_WorkOrder.F_IsRelease = isrelease;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " " + (isrelease == 1 ? "发布了" : "撤回了发布") + "工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- ///// <summary>
- ///// 通告和撤销通告
- ///// </summary>
- ///// <returns></returns>
- //[Authority]
- //public ActionResult NoticeWorkOrder()
- //{
- // int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- // Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- // if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- // {
- // int assignid = RequestString.GetInt("id", 0);
- // int isnotice = RequestString.GetInt("isnotice", -1);
- // Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
- // if (modelT_Bus_AssignedInfo != null)
- // {
- // if (isnotice == 0 && modelT_Bus_AssignedInfo.F_IsNotice == 1)
- // {
- // using (TransactionScope trans = new TransactionScope())
- // {
- // #region 修改交办记录
- // modelT_Bus_AssignedInfo.F_IsNotice = 0;
- // assignBLL.Update(modelT_Bus_AssignedInfo);
- // #endregion
- // #region 插入操作记录
- // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- // oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
- // var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
- // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- // oper.F_Message = userinfo + " 撤销了通告交办单位:" + (deptinfo != null ? deptinfo.F_DeptName : "");
- // oper.F_CreateUser = userModel.F_UserCode;
- // oper.F_CreateTime = DateTime.Now;
- // oper.F_IsDelete = 0;
- // operBLL.Add(oper);
- // #endregion
- // trans.Complete();
- // }
- // return Success("操作成功");
- // }
- // else if (isnotice == 1 && modelT_Bus_AssignedInfo.F_IsNotice == 0)
- // {
- // using (TransactionScope trans = new TransactionScope())
- // {
- // #region 修改交办记录
- // modelT_Bus_AssignedInfo.F_IsNotice = 1;
- // assignBLL.Update(modelT_Bus_AssignedInfo);
- // #endregion
- // #region 插入操作记录
- // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- // oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
- // var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
- // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- // oper.F_Message = userinfo + " 通告了交办单位:" + (deptinfo != null ? deptinfo.F_DeptName : "");
- // oper.F_CreateUser = userModel.F_UserCode;
- // oper.F_CreateTime = DateTime.Now;
- // oper.F_IsDelete = 0;
- // operBLL.Add(oper);
- // #endregion
- // trans.Complete();
- // }
- // return Success("操作成功");
- // }
- // else
- // {
- // return Error("操作失败");
- // }
- // }
- // else
- // {
- // return Error("操作失败");
- // }
- // }
- // else
- // {
- // return Error("权限不足");
- // }
- //}
- /// <summary>
- /// 通告和撤销通告
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult NoticeWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int isnotice = RequestString.GetInt("isnotice", -1);
- string deptids = RequestString.GetFormString("deptids");//通告单位
- string noticereson = RequestString.GetFormString("noticereson");//通告原因
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- if (isnotice == 0 && modelT_Bus_WorkOrder.F_IsNotice == 1)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 修改工单记录
- modelT_Bus_WorkOrder.F_IsNotice = 0;
- modelT_Bus_WorkOrder.F_NoticeDeptIds = "";
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- if (modelT_Bus_AssignedInfo != null)
- {
- #region 修改交办记录
- modelT_Bus_AssignedInfo.F_IsNotice = 0;
- modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- }
- #region 修改通告记录
- Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new BLL.T_Bus_NoticeCriticism().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
- modelT_Bus_NoticeCriticism.F_IsDelete = 1;
- modelT_Bus_NoticeCriticism.F_DeleteTime = DateTime.Now;
- modelT_Bus_NoticeCriticism.F_DeleteUser = userModel.F_UserCode;
- new BLL.T_Bus_NoticeCriticism().Update(modelT_Bus_NoticeCriticism);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- string sql = "select dbo.GetDeptNames('" + modelT_Bus_NoticeCriticism.F_DeptIds + "')";
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 撤销了通告交办单位:" + DbHelperSQL.GetSingle(sql).ToString();
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else if (isnotice == 1 && modelT_Bus_WorkOrder.F_IsNotice == 0)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 修改工单记录
- modelT_Bus_WorkOrder.F_IsNotice = 1;
- modelT_Bus_WorkOrder.F_NoticeDeptIds = deptids;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- if (modelT_Bus_AssignedInfo != null)
- {
- #region 修改交办记录
- modelT_Bus_AssignedInfo.F_IsNotice = 1;
- modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
- modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- }
- #region 新增通告记录
- Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
- modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
- modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- modelT_Bus_NoticeCriticism.F_Content = noticereson;
- modelT_Bus_NoticeCriticism.F_State = 1;
- modelT_Bus_NoticeCriticism.F_IsDelete = 0;
- modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
- modelT_Bus_NoticeCriticism.F_CreateUser = userModel.F_UserCode;
- new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- string sql = "select dbo.GetDeptNames('"+ deptids + "')";
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 通告了交办单位:" + DbHelperSQL.GetSingle(sql).ToString();
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 市民催单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult AdditionalWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
- string workorderid = RequestString.GetFormString("workorderid");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- string callid = RequestString.GetFormString("callid");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 插入附加记录
- //批示记录
- Model.T_Bus_Additional model_T_Bus_Additional = new Model.T_Bus_Additional();
- model_T_Bus_Additional.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
- model_T_Bus_Additional.F_Title = title;
- model_T_Bus_Additional.F_Content = content;
- if (!string.IsNullOrEmpty(callid))
- {
- model_T_Bus_Additional.F_CallId = callid;
- var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
- if (rd != null)
- {
- model_T_Bus_Additional.F_CallRecordId = rd.CallRecordsId;
- }
- }
- model_T_Bus_Additional.F_File = files;//附件
- model_T_Bus_Additional.F_CreateUser = userModel.F_UserCode;//呈批人
- model_T_Bus_Additional.F_CreateTime = DateTime.Now;//呈批时间
- model_T_Bus_Additional.F_IsDelete = 0;
- model_T_Bus_Additional.F_State = 1;//审批状态(0:未处理,1:通过)
- new BLL.T_Bus_Additional().Add(model_T_Bus_Additional);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 接到市民催单,内容:" + content;
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- #endregion
- #region 语音附件其他
- /// <summary>
- /// 验证当前单位是否交办单位
- /// </summary>
- /// <param name="modelT_Bus_AssignedInfo"></param>
- /// <param name="deptid"></param>
- /// <returns></returns>
- public int AssignDeptType(Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo, int deptid)
- {
- int type = 0;
- if (modelT_Bus_AssignedInfo.F_MainDeptId == deptid)
- {
- type = 1;//主办
- }
- else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(deptid.ToString()))
- {
- type = 2;//协办
- }
- return type;
- }
- /// <summary>
- /// 获取留言路径
- /// </summary>
- /// <param name="lid">留言id</param>
- /// <param name="prefix">前缀</param>
- /// <returns></returns>
- public string GetLeavePath(string lid, string prefix)
- {
- string path = string.Empty;
- var liuyan = new BLL.T_Call_LeaveRecord().GetModelList(" F_Id='" + lid + "' ").FirstOrDefault();
- if (liuyan != null)
- {
- if (!string.IsNullOrEmpty(liuyan.F_RecFileUrl))
- {
- path = prefix + liuyan.F_RecFileUrl;
- }
- }
- return path;
- }
- /// <summary>
- /// 获取通话录音路径
- /// </summary>
- /// <param name="cid">通话id</param>
- /// <param name="prefix">前缀</param>
- /// <returns></returns>
- public string GetCallPath(string cid, string prefix)
- {
- string path = string.Empty;
- var luyin = new BLL.T_Call_CallRecords().GetModelList(" CallRecordsId='" + cid + "' ").FirstOrDefault();
- if (luyin != null)
- {
- if (!string.IsNullOrEmpty(luyin.FilePath))
- {
- var ym = prefix;
- ym = ym.Substring(0, ym.Length - 1);
- path = ym + luyin.FilePath.Substring(luyin.FilePath.IndexOf(':') + 1).Replace('\\', '/');
- }
- }
- return path;
- }
- /// <summary>
- /// 获取附件数据
- /// </summary>
- /// <param name="ids">附件id,多个用英文逗号,隔开</param>
- /// <param name="prefix">前缀</param>
- /// <returns></returns>
- public DataTable GetFileData(string ids, string prefix)
- {
- DataTable dt = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + ids + ")").Tables[0];
- foreach (DataRow dr in dt.Rows)
- {
- dr["F_FileUrl"] = prefix + dr["F_FileUrl"].ToString();
- }
- return dt;
- }
- /// <summary>
- /// 绑定附件信息
- /// </summary>
- /// <param name="dt"></param>
- /// <param name="prefix"></param>
- /// <returns></returns>
- public DataTable BindFileData(DataTable dt, string prefix)
- {
- dt.Columns.Add("File", typeof(object));
- foreach (DataRow dr in dt.Rows)
- {
- if (dr["F_File"] != null && dr["F_File"].ToString() != "")
- {
- dr["File"] = GetFileData(dr["F_File"].ToString(), prefix);
- //web站点使用虚拟目录(api站点里面的Upload文件夹)后用下面代码,否则用上面代码
- //dr["File"] = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + dr["F_File"].ToString() + ")").Tables[0];
- }
- }
- return dt;
- }
- #endregion
- #region 修改工单 by admin
- /// <summary>
- /// 获取详情
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult GetInfoByAdmin(int id,int type)
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- //string sql = "select * from ";
- string table = string.Empty;
- switch (type)
- {
- case 1: table = "T_Bus_AssignedInfo"; break;
- case 2: table = "T_Bus_DelayTime"; break;
- case 3: table = "T_Bus_Feedback"; break;
- case 4: table = "T_Bus_RemindRecord"; break;
- case 5: table = "T_Bus_SubmitSuper"; break;
- case 6: table = "T_Bus_VisitResult"; break;
- }
- string sql = "select * from " + table + " where F_IsDelete=0 and F_Id=" + id;
- var dt = DbHelperSQL.Query(sql).Tables[0];
- return Success("操作成功", dt);
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 修改工单信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditWorkOrderByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- int source = RequestString.GetInt("source", 0);
- string cusname = RequestString.GetFormString("cusname");
- string cussex = RequestString.GetFormString("cussex");
- string cusphone = RequestString.GetFormString("cusphone");
- string cusaddress = RequestString.GetFormString("cusaddress");
- string email = RequestString.GetFormString("email");
- string zipcode = RequestString.GetFormString("zipcode");
- string conname = RequestString.GetFormString("conname");
- string conphone = RequestString.GetFormString("conphone");
- string title = RequestString.GetFormString("title");
- string content = RequestString.GetFormString("content");
- string files = RequestString.GetFormString("files");
- int sourcearea = RequestString.GetInt("sourcearea", 0);
- string sourceaddress = RequestString.GetFormString("sourceaddress");
- //int isresult = RequestString.GetInt("isresult", 0);
- string result = RequestString.GetFormString("result");
- string keys = RequestString.GetFormString("keys");
- string splituser = RequestString.GetFormString("splituser");
- int type = RequestString.GetInt("type", 0);
- int bigtype = RequestString.GetInt("bigtype", 0);
- int smalltype = RequestString.GetInt("smalltype", 0);
- int isprotect = RequestString.GetInt("isprotect", 0);
- int level = RequestString.GetInt("level", 0);
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存工单信息
- modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
- modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
- modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
- modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
- modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
- modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
- modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
- modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
- modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
- modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
- modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
- modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
- modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
- modelT_Bus_WorkOrder.F_Email = email;//E-mail
- modelT_Bus_WorkOrder.F_ComTitle = title;//标题
- modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
- modelT_Bus_WorkOrder.F_File = files;//附件
- modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
- modelT_Bus_WorkOrder.F_Result = result;
- modelT_Bus_WorkOrder.F_Key = keys;
- modelT_Bus_WorkOrder.F_Level = level;
- workorderBLL.Update(modelT_Bus_WorkOrder);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
- oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
- oper.F_File = modelT_Bus_WorkOrder.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单基本信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Success("权限不足");
- }
- }
- /// <summary>
- /// 修改批示信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditSuperInfoByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- //int type = RequestString.GetInt("type", 0);//1领导批示 2市长指示
- string superuser = RequestString.GetFormString("superuser");
- string superopinion = RequestString.GetFormString("superopinion");
- string files = RequestString.GetFormString("files");
- int id = RequestString.GetInt("id", 0);
- Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new BLL.T_Bus_SubmitSuper().GetModel(id);
- if (model_T_Bus_SubmitSuper != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存批示信息
- //model_T_Bus_SubmitSuper.F_Type = type;//1领导批示 2市长指示
- model_T_Bus_SubmitSuper.F_BatchReason = superuser;//批示人
- model_T_Bus_SubmitSuper.F_SuperOpinion = superopinion;//批示内容
- model_T_Bus_SubmitSuper.F_File = files;//附件
- new BLL.T_Bus_SubmitSuper().Update(model_T_Bus_SubmitSuper);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = model_T_Bus_SubmitSuper.F_WorkOrderId;
- oper.F_File = model_T_Bus_SubmitSuper.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单批示信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 修改交办信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditAssignInfoByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- int assignid = RequestString.GetInt("id", 0);
- //int maindeptid = RequestString.GetInt("maindeptid", 0);
- //string otherdeptids = RequestString.GetFormString("otherdeptids");
- DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime"));
- string assignedopinion = RequestString.GetFormString("assignedopinion");
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
- if (modelT_Bus_AssignedInfo != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存交办信息
- modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
- //modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
- //modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
- modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
- assignBLL.Update(modelT_Bus_AssignedInfo);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
- oper.F_File = modelT_Bus_AssignedInfo.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单交办信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 修改办理信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditFeedBackInfoByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string dealman = RequestString.GetFormString("dealman");
- string result = RequestString.GetFormString("result");
- string files = RequestString.GetFormString("files");
- int feedbackid = RequestString.GetInt("id", 0);
- Model.T_Bus_Feedback model_T_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
- if (model_T_Bus_Feedback != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存办理信息
- model_T_Bus_Feedback.F_DealUser = dealman;
- model_T_Bus_Feedback.F_Result = result;//反馈内容
- model_T_Bus_Feedback.F_File = files;
- new BLL.T_Bus_Feedback().Update(model_T_Bus_Feedback);
- #endregion
- #region 保存工单信息
- int maxid = Int32.Parse(DbHelperSQL.GetSingle("select max(F_Id) from T_Bus_AssignedInfo where F_WorkOrderId='" + model_T_Bus_Feedback.F_WorkOrderId + "' and F_State=1 and F_IsSure=1 and F_IsDelete=0 ").ToString());
- var assign = assignBLL.GetModel(model_T_Bus_Feedback.F_AssignedId.Value);
- if (maxid == assign.F_Id)
- {
- var order = workorderBLL.GetModel(model_T_Bus_Feedback.F_WorkOrderId);
- order.F_Result = result;//反馈内容
- workorderBLL.Update(order);
- }
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = model_T_Bus_Feedback.F_WorkOrderId;
- oper.F_File = model_T_Bus_Feedback.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单办理信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 修改回访信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditVisitInfoByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string visituser = RequestString.GetFormString("visituser");//回访人
- int type = RequestString.GetInt("type", 0);//回访方式
- int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
- int visitid = RequestString.GetInt("id", 0);
- string result = RequestString.GetFormString("result");//回访情况
- string guid = RequestString.GetFormString("guid");
- Model.T_Bus_VisitResult modelT_Bus_VisitResult = new BLL.T_Bus_VisitResult().GetModel(visitid);
- if (modelT_Bus_VisitResult != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存回访信息
- modelT_Bus_VisitResult.F_VisitUser = visituser;
- modelT_Bus_VisitResult.F_Type = type;
- modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
- modelT_Bus_VisitResult.F_Result = result;
- new BLL.T_Bus_VisitResult().Update(modelT_Bus_VisitResult);
- //保存回访记录
- new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_VisitResult.F_WorkOrderId;
- oper.F_File = modelT_Bus_VisitResult.F_File;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单回访信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 修改退回审核信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditAuditRebackByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string reason = RequestString.GetFormString("reason");
- int rebackid = RequestString.GetInt("id", 0);
- Model.T_Bus_Feedback modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(rebackid);
- if (modelT_Bus_Feedback != null)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存反馈信息
- modelT_Bus_Feedback.F_AuditReason = reason;//交办意见
- new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_Feedback.F_WorkOrderId;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单退回审核信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- /// <summary>
- /// 修改退回审核信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult EditAuditDelayByAdmin()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
- {
- string reason = RequestString.GetFormString("reason");
- //DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime"));
- int delayid = RequestString.GetInt("id", 0);
- Model.T_Bus_DelayTime modelT_Bus_DelayTime = new BLL.T_Bus_DelayTime().GetModel(delayid);
-
- if (modelT_Bus_DelayTime != null )
- {
- Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(modelT_Bus_DelayTime.F_AssignedId.Value);
- using (TransactionScope trans = new TransactionScope())
- {
- #region 保存延时审核信息
- modelT_Bus_DelayTime.F_RefuseReason = reason;
- //modelT_Bus_DelayTime.F_AgreeTime = newlimittime;
- new BLL.T_Bus_DelayTime().Update(modelT_Bus_DelayTime);
- #endregion
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_DelayTime.F_WorkOrderId;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 修改了工单延时审核信息";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Error("权限不足");
- }
- }
- #endregion
- #region 县级对接
- /// <summary>
- /// 获取网点列表
- /// </summary>
- /// <param name="code"></param>
- /// <param name="name"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult GetCityList(string code, string name)
- {
- string signcode = Configs.GetValue("CityOutSignCode");
- string url = Configs.GetValue("CityOutUrl");
- string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityList", signcode);
- string strparams = "?code=" + code + "&name=" + name + "&signcode=" + outsigncode;
- string result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityList" + strparams);
- return Content(result);
- }
- /// <summary>
- /// 获取网点详情
- /// </summary>
- /// <param name="code"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult GetCityDetail(string code)
- {
- string signcode = Configs.GetValue("CityOutSignCode");
- string url = Configs.GetValue("CityOutUrl");
- string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityDetail", signcode);
- string strparams = "?code=" + code + "&signcode=" + outsigncode;
- string result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityDetail" + strparams);
- return Content(result);
- }
- /// <summary>
- /// 转派工单到县级
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult TurnWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLYGLY" || userModel.F_RoleCode == "GLY")
- {
- string workorderid = RequestString.GetFormString("workorderid");
- string citycode = RequestString.GetFormString("citycode");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- if (modelT_Bus_WorkOrder != null && modelT_Bus_WorkOrder.F_WorkState == 1)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- else
- {
- return Success("权限不足");
- }
- }
- /// <summary>
- /// 退回市工单
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult RefuseCityWorkOrder()
- {
- int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
- Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
- string workorderid = RequestString.GetFormString("workorderid");
- string reson = RequestString.GetFormString("reson");
- Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
- Model.T_Bus_CityTurn modelT_Bus_CityTurn = new BLL.T_Bus_CityTurn().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
- if (modelT_Bus_WorkOrder != null && modelT_Bus_CityTurn != null && modelT_Bus_CityTurn.F_IsSure != 2)
- {
- using (TransactionScope trans = new TransactionScope())
- {
- string signcode = Configs.GetValue("CityOutSignCode");
- string url = Configs.GetValue("CityOutUrl");
- string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityDetail", signcode);
- string strparams = "?code=" + modelT_Bus_CityTurn.F_CityCode + "&signcode=" + outsigncode;
- var result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityDetail" + strparams).ToJObject();
- if (result["state"].ToString() == "success")
- {
- var model = result["data"].ToString().ToJObject();
- string turnsigncode = model["F_Sign"].ToString();
- string turnurl = model["F_Url"].ToString();
- string turnoutsigncode = CommonHelper.getsigncode("CountyBusiness", "RefuseCityWorkOrder", turnsigncode);
- string turnstrparams = "workorderid=" + modelT_Bus_CityTurn.F_CityWorkOrderId + "&reson=" + reson + "&signcode=" + turnoutsigncode;
- string turnresultstr = HttpMethods.HttpPost(turnurl + "/CountyBusiness/RefuseCityWorkOrder", turnstrparams);
- var turnresult = turnresultstr.ToJObject();
- if (turnresult["state"].ToString() != "success")
- {
- return Content(turnresultstr);
- }
- }
- modelT_Bus_WorkOrder.F_IsDelete = 1;
- modelT_Bus_WorkOrder.F_DeleteTime = DateTime.Now;
- if (modelT_Bus_WorkOrder.F_IsEnabled == 0)
- {
- modelT_Bus_WorkOrder.F_IsEnabled = 1;
- modelT_Bus_WorkOrder.F_EnableTime = DateTime.Now;
- }
- workorderBLL.Update(modelT_Bus_WorkOrder);
- modelT_Bus_CityTurn.F_IsSure = 2;
- modelT_Bus_CityTurn.F_SureUser = userModel.F_UserCode;
- modelT_Bus_CityTurn.F_SureTime = DateTime.Now;
- modelT_Bus_CityTurn.F_Reson = reson;
- new BLL.T_Bus_CityTurn().Update(modelT_Bus_CityTurn);
- #region 插入操作记录
- Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
- oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
- string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
- oper.F_Message = userinfo + " 退回了" + modelT_Bus_CityTurn.F_CityName + "工单";
- oper.F_CreateUser = userModel.F_UserCode;
- oper.F_CreateTime = DateTime.Now;
- oper.F_IsDelete = 0;
- operBLL.Add(oper);
- #endregion
- trans.Complete();
- }
- return Success("操作成功");
- }
- else
- {
- return Error("操作失败");
- }
- }
- #endregion
- }
- }
|