县级12345后端

WorkOrderController.cs 391KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423
  1. using CallCenter.Utility;
  2. using CallCenterApi.Common;
  3. using CallCenterApi.DB;
  4. using CallCenterApi.Interface.Controllers.Base;
  5. using CallCenterApi.Interface.Models.Common;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Transactions;
  12. using System.Web;
  13. using System.Web.Mvc;
  14. namespace CallCenterApi.Interface.Controllers.workorder
  15. {
  16. public class WorkOrderController : BaseController
  17. {
  18. // GET: WorkOrder
  19. //工单状态:0新工单 1待交办 2待查收 3退回审核中 4办理中 5延时审核中 6已办理 7已回访 8重办中 9已结案
  20. //操作按钮:1查询 2编辑 3删除 4提交 5交办 6领导批示 7市长指示 8督办 9监察 10收回 11查收 12退回申请
  21. // 13办理 14延时申请 15退回审核 16回访 17延时审核 18重办 19结案 20导出 21回退 22强制结案
  22. private information.InternalMessagesController msg = new information.InternalMessagesController();
  23. private BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
  24. private BLL.T_Bus_WorkOrder workorderBLL = new BLL.T_Bus_WorkOrder();
  25. private BLL.T_Bus_AssignedInfo assignBLL = new BLL.T_Bus_AssignedInfo();
  26. private BLL.T_Bus_AssignedItemInfo assignItemBLL = new BLL.T_Bus_AssignedItemInfo();
  27. private BLL.T_Bus_Operation operBLL = new BLL.T_Bus_Operation();
  28. private BLL.T_Sys_SystemConfig configBll = new BLL.T_Sys_SystemConfig();
  29. #region 获取工单
  30. /// <summary>
  31. /// 获取工单列表
  32. /// </summary>
  33. /// <returns></returns>
  34. [Authority]
  35. public ActionResult GetList(int isdc = 0)
  36. {
  37. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  38. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  39. DataTable dt = new DataTable();
  40. string sql = " and F_IsDelete=0 ";
  41. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  42. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  43. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  44. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  45. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  46. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  47. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  48. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  49. int source = RequestString.GetInt("source", 0);
  50. int keyid = RequestString.GetInt("keyid", 0);
  51. int type = RequestString.GetInt("type", 0);
  52. int bigtype = RequestString.GetInt("bigtype", 0);
  53. int smalltype = RequestString.GetInt("smalltype", 0);
  54. int sourcearea = RequestString.GetInt("sourcearea", 0);
  55. int deptid = RequestString.GetInt("deptid", 0);
  56. int dealtype = RequestString.GetInt("dealtype", -1);
  57. int issend = RequestString.GetInt("issend", -1);
  58. string strpageindex = RequestString.GetQueryString("page");
  59. int pageindex = 1;
  60. string strpagesize = RequestString.GetQueryString("pagesize");
  61. int pagesize = 10;
  62. #region sql 语句相关处理
  63. if (strstate.Trim() != "" && strstate != "undefined")
  64. {
  65. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  66. }
  67. if (strworkid.Trim() != "" && strworkid != "undefined")
  68. {
  69. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  70. }
  71. if (strname.Trim() != "" && strname != "undefined")
  72. {
  73. sql += " and F_CusName like '%" + strname + "%' ";
  74. }
  75. if (strtel.Trim() != "" && strtel != "undefined")
  76. {
  77. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  78. }
  79. if (strkey.Trim() != "" && strkey != "undefined")
  80. {
  81. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  82. }
  83. if (strusercode.Trim() != "" && strusercode != "undefined")
  84. {
  85. sql += " and F_CreateUser = '" + strusercode + "' ";
  86. }
  87. if (source != 0)
  88. {
  89. sql += " and F_InfoSource = '" + source + "' ";
  90. }
  91. if (keyid != 0)
  92. {
  93. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  94. }
  95. if (type != 0)
  96. {
  97. sql += " and F_InfoType = '" + type + "' ";
  98. }
  99. if (bigtype != 0)
  100. {
  101. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  102. }
  103. if (smalltype != 0)
  104. {
  105. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  106. }
  107. if (sourcearea != 0)
  108. {
  109. sql += " and F_SourceArea = '" + sourcearea + "' ";
  110. }
  111. if (deptid != 0)
  112. {
  113. sql += " and F_MainDeptId = '" + deptid + "'";
  114. }
  115. if (dealtype != -1)
  116. {
  117. sql += " and isnull(F_IsResult,0) = '" + dealtype + "' ";
  118. }
  119. if (issend != -1)
  120. {
  121. sql += " and isnull(F_IsRelease,0) = '" + issend + "' ";
  122. }
  123. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  124. {
  125. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  126. }
  127. if (strendtime.Trim() != "" && strendtime != "undefined")
  128. {
  129. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  130. }
  131. #endregion
  132. if (strpageindex.Trim() != "")
  133. {
  134. pageindex = Convert.ToInt32(strpageindex);
  135. }
  136. if (strpagesize.Trim() != "")
  137. {
  138. pagesize = Convert.ToInt32(strpagesize);
  139. }
  140. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  141. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  142. if (isdc > 0)
  143. {
  144. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  145. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  146. if (msg == "")
  147. {
  148. return Success("导出成功");
  149. }
  150. else
  151. {
  152. return Error("导出失败");
  153. }
  154. }
  155. int recordCount = 0;
  156. dt = BLL.PagerBLL.GetListPager(
  157. "T_Bus_WorkOrder",
  158. "F_WorkOrderId",
  159. cols,
  160. sql,
  161. "ORDER BY F_CreateTime DESC",
  162. pagesize,
  163. pageindex,
  164. true,
  165. out recordCount);
  166. #region 声音文件和交办超时
  167. dt.Columns.Add("OverState", typeof(string));//超时状态
  168. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  169. dt.Columns.Add("GapTime", typeof(string));//时间差
  170. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  171. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  172. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  173. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  174. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  175. foreach (DataRow dr in dt.Rows)
  176. {
  177. //获取最新交办信息
  178. string iszbdw = "0";
  179. int state = Int32.Parse(dr["F_WorkState"].ToString());
  180. if (state > 1)
  181. {
  182. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  183. if (state < 6 || state == 8)
  184. {
  185. var lt = dr["F_LimitTime"].ToString();//限制时间
  186. dr["LimitTime"] = lt;
  187. if (!string.IsNullOrWhiteSpace(lt))
  188. {
  189. var ltime = DateTime.Parse(lt);
  190. TimeSpan ts = ltime.Subtract(DateTime.Now);
  191. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  192. if (tss < 0) { tss = -tss; }
  193. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  194. if (ltime > DateTime.Now)
  195. {
  196. if (configcs != null)
  197. {
  198. int cs = Int32.Parse(configcs.F_ParamValue);
  199. if (ts.TotalHours > cs)
  200. {
  201. dr["OverState"] = 1;
  202. }
  203. else
  204. {
  205. dr["OverState"] = 2;
  206. }
  207. }
  208. dr["GapTime"] = "剩余" + gshsj;
  209. }
  210. else
  211. {
  212. dr["OverState"] = 3;
  213. dr["GapTime"] = "超时" + gshsj;
  214. }
  215. }
  216. }
  217. if (state == 9)
  218. {
  219. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  220. var dttime = DateTime.Now;
  221. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  222. var lt = dr["F_LimitTime"].ToString();//限制时间
  223. dr["LimitTime"] = lt;
  224. if (!string.IsNullOrWhiteSpace(lt))
  225. {
  226. var ltime = DateTime.Parse(lt);
  227. TimeSpan ts = ltime.Subtract(dttime);
  228. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  229. if (tss < 0) { tss = -tss; }
  230. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  231. if (ltime < dttime)
  232. {
  233. dr["OverState"] = 3;
  234. dr["GapTime"] = "超时" + gshsj;
  235. }
  236. }
  237. }
  238. }
  239. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  240. {
  241. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  242. }
  243. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  244. {
  245. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  246. }
  247. dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw);
  248. }
  249. #endregion
  250. var obj = new
  251. {
  252. state = "success",
  253. message = "成功",
  254. rows = dt,
  255. total = recordCount
  256. };
  257. return Content(obj.ToJson());
  258. }
  259. /// <summary>
  260. /// 获取坐席处理列表
  261. /// </summary>
  262. /// <returns></returns>
  263. [Authority]
  264. public ActionResult GetZXDealList(int isdc=0)
  265. {
  266. DataTable dt = new DataTable();
  267. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  268. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  269. string sql = " and F_IsDelete=0";
  270. string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
  271. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  272. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  273. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  274. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  275. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  276. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  277. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  278. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  279. int source = RequestString.GetInt("source", 0);
  280. int keyid = RequestString.GetInt("keyid", 0);
  281. int type = RequestString.GetInt("type", 0);
  282. int bigtype = RequestString.GetInt("bigtype", 0);
  283. int smalltype = RequestString.GetInt("smalltype", 0);
  284. int sourcearea = RequestString.GetInt("sourcearea", 0);
  285. int deptid = RequestString.GetInt("deptid", 0);
  286. string strpageindex = RequestString.GetQueryString("page");
  287. int pageindex = 1;
  288. string strpagesize = RequestString.GetQueryString("pagesize");
  289. int pagesize = 10;
  290. switch (strtab)
  291. {
  292. case "-1"://待处理工单(其他来源)
  293. sql = " and F_IsDelete=1 and F_IsEnabled=0 ";
  294. break;
  295. case "0"://待处理工单
  296. if (userModel.F_RoleCode != "GLY")
  297. {
  298. sql += " and F_CreateUser='" + userModel.F_UserCode + "'";
  299. }
  300. if (strstate.Trim() != "" && strstate != "undefined")
  301. {
  302. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  303. }
  304. else
  305. {
  306. sql += " and F_WorkState in (0,6) ";
  307. }
  308. break;
  309. case "1"://已提交的工单
  310. //sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 ";
  311. sql += " and F_WorkState >0 ";
  312. if (strstate.Trim() != "" && strstate != "undefined")
  313. {
  314. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  315. }
  316. if (userModel.F_RoleCode != "GLY")
  317. {
  318. sql += " and F_CreateUser='" + userModel.F_UserCode + "'";
  319. }
  320. break;
  321. case "2"://已回访的工单
  322. if (strstate.Trim() != "" && strstate != "undefined")
  323. {
  324. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  325. }
  326. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_VisitResult where F_State=1 and F_IsDelete=0 ";
  327. if (userModel.F_RoleCode != "GLY")
  328. {
  329. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  330. }
  331. else
  332. {
  333. sql += ")";
  334. }
  335. break;
  336. case "3"://已回退的工单
  337. sql += " and F_WorkState=0 and F_IsReturn=1 ";
  338. if (userModel.F_RoleCode != "GLY")
  339. {
  340. sql += " and F_CreateUser='" + userModel.F_UserCode;
  341. }
  342. break;
  343. }
  344. if (strworkid.Trim() != "" && strworkid != "undefined")
  345. {
  346. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  347. }
  348. if (strname.Trim() != "" && strname != "undefined")
  349. {
  350. sql += " and F_CusName like '%" + strname + "%' ";
  351. }
  352. if (strtel.Trim() != "" && strtel != "undefined")
  353. {
  354. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  355. }
  356. if (strkey.Trim() != "" && strkey != "undefined")
  357. {
  358. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  359. }
  360. if (strusercode.Trim() != "" && strusercode != "undefined")
  361. {
  362. sql += " and F_CreateUser = '" + strusercode + "' ";
  363. }
  364. if (source != 0)
  365. {
  366. sql += " and F_InfoSource = '" + source + "' ";
  367. }
  368. if (keyid != 0)
  369. {
  370. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  371. }
  372. if (type != 0)
  373. {
  374. sql += " and F_InfoType = '" + type + "' ";
  375. }
  376. if (bigtype != 0)
  377. {
  378. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  379. }
  380. if (smalltype != 0)
  381. {
  382. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  383. }
  384. if (sourcearea != 0)
  385. {
  386. sql += " and F_SourceArea = '" + sourcearea + "' ";
  387. }
  388. if (deptid != 0)
  389. {
  390. sql += " and F_MainDeptId = '" + deptid + "'";
  391. }
  392. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  393. {
  394. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  395. }
  396. if (strendtime.Trim() != "" && strendtime != "undefined")
  397. {
  398. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  399. }
  400. if (strpageindex.Trim() != "")
  401. {
  402. pageindex = Convert.ToInt32(strpageindex);
  403. }
  404. if (strpagesize.Trim() != "")
  405. {
  406. pagesize = Convert.ToInt32(strpagesize);
  407. }
  408. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  409. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  410. if (isdc > 0)
  411. {
  412. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  413. var msg=new NPOIHelper().ExportToExcel("工单列表", dtdc);
  414. if (msg == "")
  415. {
  416. return Success("导出成功");
  417. }
  418. else
  419. {
  420. return Error("导出失败");
  421. }
  422. }
  423. int recordCount = 0;
  424. dt = BLL.PagerBLL.GetListPager(
  425. "T_Bus_WorkOrder",
  426. "F_WorkOrderId",
  427. cols,
  428. sql,
  429. "ORDER BY F_CreateTime DESC",
  430. pagesize,
  431. pageindex,
  432. true,
  433. out recordCount);
  434. dt.Columns.Add("OverState", typeof(string));//超时状态
  435. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  436. dt.Columns.Add("GapTime", typeof(string));//时间差
  437. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  438. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  439. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  440. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  441. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  442. foreach (DataRow dr in dt.Rows)
  443. {
  444. //获取最新交办信息
  445. string iszbdw = "0";
  446. int state = Int32.Parse(dr["F_WorkState"].ToString());
  447. if (state > 1)
  448. {
  449. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  450. if (state < 6 || state == 8)
  451. {
  452. var lt = dr["F_LimitTime"].ToString();//限制时间
  453. dr["LimitTime"] = lt;
  454. if (!string.IsNullOrWhiteSpace(lt))
  455. {
  456. var ltime = DateTime.Parse(lt);
  457. TimeSpan ts = ltime.Subtract(DateTime.Now);
  458. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  459. if (tss < 0) { tss = -tss; }
  460. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  461. if (ltime > DateTime.Now)
  462. {
  463. if (configcs != null)
  464. {
  465. int cs = Int32.Parse(configcs.F_ParamValue);
  466. if (ts.TotalHours > cs)
  467. {
  468. dr["OverState"] = 1;
  469. }
  470. else
  471. {
  472. dr["OverState"] = 2;
  473. }
  474. }
  475. dr["GapTime"] = "剩余" + gshsj;
  476. }
  477. else
  478. {
  479. dr["OverState"] = 3;
  480. dr["GapTime"] = "超时" + gshsj;
  481. }
  482. }
  483. }
  484. if (state == 9)
  485. {
  486. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  487. var dttime = DateTime.Now;
  488. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  489. var lt = dr["F_LimitTime"].ToString();//限制时间
  490. dr["LimitTime"] = lt;
  491. if (!string.IsNullOrWhiteSpace(lt))
  492. {
  493. var ltime = DateTime.Parse(lt);
  494. TimeSpan ts = ltime.Subtract(dttime);
  495. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  496. if (tss < 0) { tss = -tss; }
  497. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  498. if (ltime < dttime)
  499. {
  500. dr["OverState"] = 3;
  501. dr["GapTime"] = "超时" + gshsj;
  502. }
  503. }
  504. }
  505. }
  506. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  507. {
  508. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  509. }
  510. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  511. {
  512. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  513. }
  514. if (Int32.Parse(strtab) == 0)
  515. {
  516. dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw);
  517. }
  518. else if (Int32.Parse(strtab) == -1)
  519. {
  520. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  521. btns.Add(ButtonGroup.query());
  522. btns.Add(ButtonGroup.edit());
  523. dr["Buttons"] = btns;
  524. }
  525. else
  526. {
  527. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  528. btns.Add(ButtonGroup.query());
  529. dr["Buttons"] = btns;
  530. }
  531. }
  532. var obj = new
  533. {
  534. state = "success",
  535. message = "成功",
  536. rows = dt,
  537. total = recordCount
  538. };
  539. return Content(obj.ToJson());
  540. }
  541. /// <summary>
  542. /// 获取领导处理列表
  543. /// </summary>
  544. /// <returns></returns>
  545. [Authority]
  546. public ActionResult GetLDDealList(int isdc = 0)
  547. {
  548. DataTable dt = new DataTable();
  549. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  550. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  551. string sql = " and F_IsDelete=0";
  552. string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
  553. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  554. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  555. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  556. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  557. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  558. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  559. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  560. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  561. int source = RequestString.GetInt("source", 0);
  562. int keyid = RequestString.GetInt("keyid", 0);
  563. int type = RequestString.GetInt("type", 0);
  564. int bigtype = RequestString.GetInt("bigtype", 0);
  565. int smalltype = RequestString.GetInt("smalltype", 0);
  566. int sourcearea = RequestString.GetInt("sourcearea", 0);
  567. int deptid = RequestString.GetInt("deptid", 0);
  568. int issatisfie = RequestString.GetInt("issatisfie", -1);//0不满意 1满意
  569. string strpageindex = RequestString.GetQueryString("page");
  570. int pageindex = 1;
  571. string strpagesize = RequestString.GetQueryString("pagesize");
  572. int pagesize = 10;
  573. switch (strtab)
  574. {
  575. case "0"://待处理工单
  576. if (strstate.Trim() != "" && strstate != "undefined")
  577. {
  578. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  579. if (strstate.Trim() == "7" && issatisfie != -1)
  580. {
  581. sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_VisitResult where F_State=1 and F_IsDelete=0 ";
  582. sql += " and F_IsSatisfie='" + issatisfie + "')";
  583. }
  584. if (userModel.F_RoleCode != "GLY" && userModel.F_RoleCode != "ZXLDGLY")
  585. {
  586. sql += " and (F_AssignUser='" + userModel.F_UserCode + "' or isnull(F_AssignUser,'')='')";
  587. }
  588. }
  589. else
  590. {
  591. sql += " and F_WorkState in (1,2,3,5,7,8) ";
  592. if (userModel.F_RoleCode != "GLY" && userModel.F_RoleCode != "ZXLDGLY")
  593. {
  594. sql += " and (F_AssignUser='" + userModel.F_UserCode + "' or isnull(F_AssignUser,'')='')";
  595. }
  596. }
  597. break;
  598. case "1"://已交办的工单
  599. if (strstate.Trim() != "" && strstate != "undefined")
  600. {
  601. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  602. }
  603. sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 ";
  604. if (userModel.F_RoleCode != "GLY")
  605. {
  606. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  607. }
  608. else
  609. {
  610. sql += ")";
  611. }
  612. break;
  613. case "2"://已审核退回的工单
  614. if (strstate.Trim() != "" && strstate != "undefined")
  615. {
  616. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  617. }
  618. sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_Feedback where F_State=1 and F_IsDelete=0 and F_IsAudit>0 ";
  619. if (userModel.F_RoleCode != "GLY")
  620. {
  621. sql += " and F_AuditUser='" + userModel.F_UserCode + "')";
  622. }
  623. else
  624. {
  625. sql += ")";
  626. }
  627. break;
  628. case "3"://已审核延时的工单
  629. if (strstate.Trim() != "" && strstate != "undefined")
  630. {
  631. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  632. }
  633. sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_DelayTime where F_State=1 and F_IsDelete=0 and F_IsAudit>0 ";
  634. if (userModel.F_RoleCode != "GLY")
  635. {
  636. sql += " and F_AuditUser='" + userModel.F_UserCode + "')";
  637. }
  638. else
  639. {
  640. sql += ")";
  641. }
  642. break;
  643. case "4"://已重办的工单
  644. if (strstate.Trim() != "" && strstate != "undefined")
  645. {
  646. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  647. }
  648. sql += " and F_WorkOrderID in (select F_WorkOrderID from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_IsReload>0 ";
  649. if (userModel.F_RoleCode != "GLY")
  650. {
  651. sql += " and F_ReloadUser='" + userModel.F_UserCode + "')";
  652. }
  653. else
  654. {
  655. sql += ")";
  656. }
  657. break;
  658. case "5"://已结案的工单
  659. sql += " and F_WorkState =9 and F_IsDelete=0 and F_IsClosed=1 ";
  660. if (userModel.F_RoleCode != "GLY")
  661. {
  662. sql += " and F_CloseUser='" + userModel.F_UserCode + "'";
  663. }
  664. break;
  665. case "6"://已督办的工单
  666. if (strstate.Trim() != "" && strstate != "undefined")
  667. {
  668. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  669. }
  670. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =1 ";
  671. if (userModel.F_RoleCode != "GLY")
  672. {
  673. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  674. }
  675. else
  676. {
  677. sql += ")";
  678. }
  679. break;
  680. case "7"://已监察的工单
  681. if (strstate.Trim() != "" && strstate != "undefined")
  682. {
  683. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  684. }
  685. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =2 ";
  686. if (userModel.F_RoleCode != "GLY")
  687. {
  688. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  689. }
  690. else
  691. {
  692. sql += ")";
  693. }
  694. break;
  695. }
  696. if (strworkid.Trim() != "" && strworkid != "undefined")
  697. {
  698. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  699. }
  700. if (strname.Trim() != "" && strname != "undefined")
  701. {
  702. sql += " and F_CusName like '%" + strname + "%' ";
  703. }
  704. if (strtel.Trim() != "" && strtel != "undefined")
  705. {
  706. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  707. }
  708. if (strkey.Trim() != "" && strkey != "undefined")
  709. {
  710. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  711. }
  712. if (strusercode.Trim() != "" && strusercode != "undefined")
  713. {
  714. sql += " and F_CreateUser = '" + strusercode + "' ";
  715. }
  716. if (source != 0)
  717. {
  718. sql += " and F_InfoSource = '" + source + "' ";
  719. }
  720. if (keyid != 0)
  721. {
  722. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  723. }
  724. if (type != 0)
  725. {
  726. sql += " and F_InfoType = '" + type + "' ";
  727. }
  728. if (bigtype != 0)
  729. {
  730. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  731. }
  732. if (smalltype != 0)
  733. {
  734. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  735. }
  736. if (sourcearea != 0)
  737. {
  738. sql += " and F_SourceArea = '" + sourcearea + "' ";
  739. }
  740. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  741. {
  742. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  743. }
  744. if (strendtime.Trim() != "" && strendtime != "undefined")
  745. {
  746. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  747. }
  748. if (deptid != 0)
  749. {
  750. sql += " and F_MainDeptId = '" + deptid + "'";
  751. }
  752. if (strpageindex.Trim() != "")
  753. {
  754. pageindex = Convert.ToInt32(strpageindex);
  755. }
  756. if (strpagesize.Trim() != "")
  757. {
  758. pagesize = Convert.ToInt32(strpagesize);
  759. }
  760. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  761. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  762. if (isdc > 0)
  763. {
  764. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  765. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  766. if (msg == "")
  767. {
  768. return Success("导出成功");
  769. }
  770. else
  771. {
  772. return Error("导出失败");
  773. }
  774. }
  775. int recordCount = 0;
  776. dt = BLL.PagerBLL.GetListPager(
  777. "T_Bus_WorkOrder",
  778. "F_WorkOrderId",
  779. cols,
  780. sql,
  781. "ORDER BY F_CreateTime DESC",
  782. pagesize,
  783. pageindex,
  784. true,
  785. out recordCount);
  786. #region 声音文件
  787. dt.Columns.Add("OverState", typeof(string));//超时状态
  788. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  789. dt.Columns.Add("GapTime", typeof(string));//时间差
  790. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  791. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  792. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  793. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  794. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  795. foreach (DataRow dr in dt.Rows)
  796. {
  797. //获取最新交办信息
  798. string iszbdw = "0";
  799. int state = Int32.Parse(dr["F_WorkState"].ToString());
  800. if (state > 1)
  801. {
  802. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  803. if (state < 6 || state == 8)
  804. {
  805. var lt = dr["F_LimitTime"].ToString();//限制时间
  806. dr["LimitTime"] = lt;
  807. if (!string.IsNullOrWhiteSpace(lt))
  808. {
  809. var ltime = DateTime.Parse(lt);
  810. TimeSpan ts = ltime.Subtract(DateTime.Now);
  811. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  812. if (tss < 0) { tss = -tss; }
  813. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  814. if (ltime > DateTime.Now)
  815. {
  816. if (configcs != null)
  817. {
  818. int cs = Int32.Parse(configcs.F_ParamValue);
  819. if (ts.TotalHours > cs)
  820. {
  821. dr["OverState"] = 1;
  822. }
  823. else
  824. {
  825. dr["OverState"] = 2;
  826. }
  827. }
  828. dr["GapTime"] = "剩余" + gshsj;
  829. }
  830. else
  831. {
  832. dr["OverState"] = 3;
  833. dr["GapTime"] = "超时" + gshsj;
  834. }
  835. }
  836. }
  837. if (state == 9)
  838. {
  839. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  840. var dttime = DateTime.Now;
  841. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  842. var lt = dr["F_LimitTime"].ToString();//限制时间
  843. dr["LimitTime"] = lt;
  844. if (!string.IsNullOrWhiteSpace(lt))
  845. {
  846. var ltime = DateTime.Parse(lt);
  847. TimeSpan ts = ltime.Subtract(dttime);
  848. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  849. if (tss < 0) { tss = -tss; }
  850. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  851. if (ltime < dttime)
  852. {
  853. dr["OverState"] = 3;
  854. dr["GapTime"] = "超时" + gshsj;
  855. }
  856. }
  857. }
  858. }
  859. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  860. {
  861. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  862. }
  863. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  864. {
  865. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  866. }
  867. if (Int32.Parse(strtab) < 1)
  868. {
  869. dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw);
  870. }
  871. else
  872. {
  873. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  874. btns.Add(ButtonGroup.query());
  875. dr["Buttons"] = btns;
  876. }
  877. }
  878. #endregion
  879. var obj = new
  880. {
  881. state = "success",
  882. message = "成功",
  883. rows = dt,
  884. total = recordCount
  885. };
  886. return Content(obj.ToJson());
  887. }
  888. /// <summary>
  889. /// 获取单位处理列表
  890. /// </summary>
  891. /// <returns></returns>
  892. [Authority]
  893. public ActionResult GetDWDealList(int isdc = 0)
  894. {
  895. DataTable dt = new DataTable();
  896. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  897. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  898. string sql = " and F_IsDelete=0";
  899. string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
  900. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  901. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  902. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  903. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  904. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  905. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  906. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  907. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  908. int source = RequestString.GetInt("source", 0);
  909. int keyid = RequestString.GetInt("keyid", 0);
  910. int type = RequestString.GetInt("type", 0);
  911. int bigtype = RequestString.GetInt("bigtype", 0);
  912. int smalltype = RequestString.GetInt("smalltype", 0);
  913. int sourcearea = RequestString.GetInt("sourcearea", 0);
  914. int deptid = RequestString.GetInt("deptid", 0);
  915. string strpageindex = RequestString.GetQueryString("page");
  916. int pageindex = 1;
  917. string strpagesize = RequestString.GetQueryString("pagesize");
  918. int pagesize = 10;
  919. switch (strtab)
  920. {
  921. case "0"://待处理工单
  922. int isyq = RequestString.GetInt("isyq", -1);
  923. if (strstate.Trim() != "" && strstate != "undefined")
  924. {
  925. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  926. }
  927. else
  928. {
  929. sql += " and F_WorkState in (2,4,8)";
  930. }
  931. if (userModel.F_RoleCode != "GLY")
  932. {
  933. sql += " and ISNULL(F_DealTime, '')='' and F_MainDeptId =" + userModel.F_DeptId + "";
  934. if (isyq != -1)
  935. {
  936. sql += " and dbo.GetOverState(F_WorkOrderId)=" + isyq;
  937. }
  938. }
  939. break;
  940. case "1"://已查收的工单
  941. if (strstate.Trim() != "" && strstate != "undefined")
  942. {
  943. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  944. }
  945. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_IsSure=1 ";
  946. if (userModel.F_RoleCode != "GLY")
  947. {
  948. sql += " and F_SureUser='" + userModel.F_UserCode + "')";
  949. }
  950. else
  951. {
  952. sql += ")";
  953. }
  954. break;
  955. case "2"://已申请退回的工单
  956. if (strstate.Trim() != "" && strstate != "undefined")
  957. {
  958. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  959. }
  960. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_Feedback where F_State=1 and F_IsDelete=0 and F_Type = 3 ";
  961. if (userModel.F_RoleCode != "GLY")
  962. {
  963. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  964. }
  965. else
  966. {
  967. sql += ")";
  968. }
  969. break;
  970. case "3"://已申请延时的工单
  971. if (strstate.Trim() != "" && strstate != "undefined")
  972. {
  973. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  974. }
  975. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_DelayTime where F_State=1 and F_IsDelete=0 ";
  976. if (userModel.F_RoleCode != "GLY")
  977. {
  978. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  979. }
  980. else
  981. {
  982. sql += ")";
  983. }
  984. break;
  985. case "4"://已办理的工单
  986. if (strstate.Trim() != "" && strstate != "undefined")
  987. {
  988. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  989. }
  990. 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) ";
  991. if (userModel.F_RoleCode != "GLY")
  992. {
  993. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  994. }
  995. else
  996. {
  997. sql += ")";
  998. }
  999. break;
  1000. case "5"://被督办的工单
  1001. if (strstate.Trim() != "" && strstate != "undefined")
  1002. {
  1003. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  1004. }
  1005. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =1 ";
  1006. if (userModel.F_RoleCode != "GLY")
  1007. {
  1008. sql += " and F_DeptId='" + userModel.F_DeptId + "')";
  1009. }
  1010. else
  1011. {
  1012. sql += ")";
  1013. }
  1014. break;
  1015. case "6"://被监察的工单
  1016. if (strstate.Trim() != "" && strstate != "undefined")
  1017. {
  1018. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  1019. }
  1020. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_RemindRecord where F_State=1 and F_IsDelete=0 and F_Type =2 ";
  1021. if (userModel.F_RoleCode != "GLY")
  1022. {
  1023. sql += " and F_DeptId='" + userModel.F_DeptId + "')";
  1024. }
  1025. else
  1026. {
  1027. sql += ")";
  1028. }
  1029. break;
  1030. }
  1031. if (strworkid.Trim() != "" && strworkid != "undefined")
  1032. {
  1033. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  1034. }
  1035. if (strname.Trim() != "" && strname != "undefined")
  1036. {
  1037. sql += " and F_CusName like '%" + strname + "%' ";
  1038. }
  1039. if (strtel.Trim() != "" && strtel != "undefined")
  1040. {
  1041. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  1042. }
  1043. if (strkey.Trim() != "" && strkey != "undefined")
  1044. {
  1045. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  1046. }
  1047. if (strusercode.Trim() != "" && strusercode != "undefined")
  1048. {
  1049. sql += " and F_CreateUser = '" + strusercode + "' ";
  1050. }
  1051. if (source != 0)
  1052. {
  1053. sql += " and F_InfoSource = '" + source + "' ";
  1054. }
  1055. if (keyid != 0)
  1056. {
  1057. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  1058. }
  1059. if (type != 0)
  1060. {
  1061. sql += " and F_InfoType = '" + type + "' ";
  1062. }
  1063. if (bigtype != 0)
  1064. {
  1065. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  1066. }
  1067. if (smalltype != 0)
  1068. {
  1069. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  1070. }
  1071. if (sourcearea != 0)
  1072. {
  1073. sql += " and F_SourceArea = '" + sourcearea + "' ";
  1074. }
  1075. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  1076. {
  1077. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  1078. }
  1079. if (strendtime.Trim() != "" && strendtime != "undefined")
  1080. {
  1081. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  1082. }
  1083. if (deptid != 0)
  1084. {
  1085. sql += " and F_MainDeptId = '" + deptid + "'";
  1086. }
  1087. if (strpageindex.Trim() != "")
  1088. {
  1089. pageindex = Convert.ToInt32(strpageindex);
  1090. }
  1091. if (strpagesize.Trim() != "")
  1092. {
  1093. pagesize = Convert.ToInt32(strpagesize);
  1094. }
  1095. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  1096. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  1097. if (isdc > 0)
  1098. {
  1099. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  1100. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  1101. if (msg == "")
  1102. {
  1103. return Success("导出成功");
  1104. }
  1105. else
  1106. {
  1107. return Error("导出失败");
  1108. }
  1109. }
  1110. int recordCount = 0;
  1111. dt = BLL.PagerBLL.GetListPager(
  1112. "T_Bus_WorkOrder",
  1113. "F_WorkOrderId",
  1114. cols,
  1115. sql,
  1116. "ORDER BY F_CreateTime DESC",
  1117. pagesize,
  1118. pageindex,
  1119. true,
  1120. out recordCount);
  1121. #region 声音文件
  1122. dt.Columns.Add("OverState", typeof(string));//超时状态
  1123. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  1124. dt.Columns.Add("GapTime", typeof(string));//时间差
  1125. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  1126. dt.Columns.Add("PDState", typeof(string));//派单状态
  1127. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  1128. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  1129. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  1130. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  1131. foreach (DataRow dr in dt.Rows)
  1132. {
  1133. //获取最新交办信息
  1134. string iszbdw = "0";
  1135. string ispd = "";
  1136. int state = Int32.Parse(dr["F_WorkState"].ToString());
  1137. if (state > 1)
  1138. {
  1139. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  1140. 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";
  1141. var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
  1142. if (dtjb.Rows.Count > 0)
  1143. {
  1144. if (state < 6 || state == 8)
  1145. {
  1146. var lt = dr["F_LimitTime"].ToString();//限制时间
  1147. dr["LimitTime"] = lt;
  1148. if (!string.IsNullOrWhiteSpace(lt))
  1149. {
  1150. var ltime = DateTime.Parse(lt);
  1151. TimeSpan ts = ltime.Subtract(DateTime.Now);
  1152. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1153. if (tss < 0) { tss = -tss; }
  1154. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1155. if (ltime > DateTime.Now)
  1156. {
  1157. if (configcs != null)
  1158. {
  1159. int cs = Int32.Parse(configcs.F_ParamValue);
  1160. if (ts.TotalHours > cs)
  1161. {
  1162. dr["OverState"] = 1;
  1163. }
  1164. else
  1165. {
  1166. dr["OverState"] = 2;
  1167. }
  1168. }
  1169. dr["GapTime"] = "剩余" + gshsj;
  1170. }
  1171. else
  1172. {
  1173. dr["OverState"] = 3;
  1174. dr["GapTime"] = "超时" + gshsj;
  1175. }
  1176. }
  1177. }
  1178. if (state == 9)
  1179. {
  1180. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  1181. var dttime = DateTime.Now;
  1182. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  1183. var lt = dr["F_LimitTime"].ToString();//限制时间
  1184. dr["LimitTime"] = lt;
  1185. if (!string.IsNullOrWhiteSpace(lt))
  1186. {
  1187. var ltime = DateTime.Parse(lt);
  1188. TimeSpan ts = ltime.Subtract(dttime);
  1189. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1190. if (tss < 0) { tss = -tss; }
  1191. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1192. if (ltime < dttime)
  1193. {
  1194. dr["OverState"] = 3;
  1195. dr["GapTime"] = "超时" + gshsj;
  1196. }
  1197. }
  1198. }
  1199. ispd = dtjb.Rows[0]["F_IsNext"].ToString();
  1200. dr["PDState"] = ispd;
  1201. }
  1202. }
  1203. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  1204. {
  1205. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  1206. }
  1207. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  1208. {
  1209. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  1210. }
  1211. if (Int32.Parse(strtab) < 1)
  1212. {
  1213. dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw, ispd);
  1214. }
  1215. else
  1216. {
  1217. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  1218. btns.Add(ButtonGroup.query());
  1219. dr["Buttons"] = btns;
  1220. }
  1221. }
  1222. #endregion
  1223. var obj = new
  1224. {
  1225. state = "success",
  1226. message = "成功",
  1227. rows = dt,
  1228. total = recordCount
  1229. };
  1230. return Content(obj.ToJson());
  1231. }
  1232. /// <summary>
  1233. /// 获取单位处理列表
  1234. /// </summary>
  1235. /// <returns></returns>
  1236. [Authority]
  1237. public ActionResult GetXBDWDealList(int isdc = 0)
  1238. {
  1239. DataTable dt = new DataTable();
  1240. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  1241. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  1242. string sql = " and F_IsDelete=0";
  1243. string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
  1244. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  1245. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  1246. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  1247. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  1248. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  1249. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  1250. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  1251. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  1252. int source = RequestString.GetInt("source", 0);
  1253. int keyid = RequestString.GetInt("keyid", 0);
  1254. int type = RequestString.GetInt("type", 0);
  1255. int bigtype = RequestString.GetInt("bigtype", 0);
  1256. int smalltype = RequestString.GetInt("smalltype", 0);
  1257. int sourcearea = RequestString.GetInt("sourcearea", 0);
  1258. int deptid = RequestString.GetInt("deptid", 0);
  1259. string strpageindex = RequestString.GetQueryString("page");
  1260. int pageindex = 1;
  1261. string strpagesize = RequestString.GetQueryString("pagesize");
  1262. int pagesize = 10;
  1263. switch (strtab)
  1264. {
  1265. case "0"://待处理工单
  1266. int isyq = RequestString.GetInt("isyq", -1);
  1267. if (strstate.Trim() != "" && strstate != "undefined")
  1268. {
  1269. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  1270. }
  1271. else
  1272. {
  1273. sql += " and F_WorkState in (2,4,8)";
  1274. }
  1275. sql += " and F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo where F_State=1 and F_IsDelete=0 and "
  1276. + " ISNULL(F_FeedbackTime, '')='' ";
  1277. if (userModel.F_RoleCode != "GLY")
  1278. {
  1279. sql += " and F_DeptId =" + userModel.F_DeptId;
  1280. }
  1281. if (isyq != -1)
  1282. {
  1283. sql += " and dbo.GetOverState(F_WorkOrderId)=" + isyq;
  1284. }
  1285. else
  1286. {
  1287. sql += ")";
  1288. }
  1289. break;
  1290. case "1"://已办理的工单
  1291. 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) ";
  1292. if (userModel.F_RoleCode != "GLY")
  1293. {
  1294. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  1295. }
  1296. else
  1297. {
  1298. sql += ")";
  1299. }
  1300. break;
  1301. }
  1302. if (strworkid.Trim() != "" && strworkid != "undefined")
  1303. {
  1304. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  1305. }
  1306. if (strname.Trim() != "" && strname != "undefined")
  1307. {
  1308. sql += " and F_CusName like '%" + strname + "%' ";
  1309. }
  1310. if (strtel.Trim() != "" && strtel != "undefined")
  1311. {
  1312. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  1313. }
  1314. if (strkey.Trim() != "" && strkey != "undefined")
  1315. {
  1316. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  1317. }
  1318. if (strusercode.Trim() != "" && strusercode != "undefined")
  1319. {
  1320. sql += " and F_CreateUser = '" + strusercode + "' ";
  1321. }
  1322. if (source != 0)
  1323. {
  1324. sql += " and F_InfoSource = '" + source + "' ";
  1325. }
  1326. if (keyid != 0)
  1327. {
  1328. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  1329. }
  1330. if (type != 0)
  1331. {
  1332. sql += " and F_InfoType = '" + type + "' ";
  1333. }
  1334. if (bigtype != 0)
  1335. {
  1336. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  1337. }
  1338. if (smalltype != 0)
  1339. {
  1340. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  1341. }
  1342. if (sourcearea != 0)
  1343. {
  1344. sql += " and F_SourceArea = '" + sourcearea + "' ";
  1345. }
  1346. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  1347. {
  1348. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  1349. }
  1350. if (strendtime.Trim() != "" && strendtime != "undefined")
  1351. {
  1352. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  1353. }
  1354. if (deptid != 0)
  1355. {
  1356. sql += " and F_MainDeptId = '" + deptid + "'";
  1357. }
  1358. if (strpageindex.Trim() != "")
  1359. {
  1360. pageindex = Convert.ToInt32(strpageindex);
  1361. }
  1362. if (strpagesize.Trim() != "")
  1363. {
  1364. pagesize = Convert.ToInt32(strpagesize);
  1365. }
  1366. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  1367. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  1368. if (isdc > 0)
  1369. {
  1370. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  1371. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  1372. if (msg == "")
  1373. {
  1374. return Success("导出成功");
  1375. }
  1376. else
  1377. {
  1378. return Error("导出失败");
  1379. }
  1380. }
  1381. int recordCount = 0;
  1382. dt = BLL.PagerBLL.GetListPager(
  1383. "T_Bus_WorkOrder",
  1384. "F_WorkOrderId",
  1385. cols,
  1386. sql,
  1387. "ORDER BY F_CreateTime DESC",
  1388. pagesize,
  1389. pageindex,
  1390. true,
  1391. out recordCount);
  1392. #region 声音文件
  1393. dt.Columns.Add("OverState", typeof(string));//超时状态
  1394. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  1395. dt.Columns.Add("GapTime", typeof(string));//时间差
  1396. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  1397. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  1398. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  1399. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  1400. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  1401. foreach (DataRow dr in dt.Rows)
  1402. {
  1403. //获取最新交办信息
  1404. string iszbdw = "0";
  1405. int state = Int32.Parse(dr["F_WorkState"].ToString());
  1406. if (state > 1)
  1407. {
  1408. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  1409. if (state < 6 || state == 8)
  1410. {
  1411. var lt = dr["F_LimitTime"].ToString();//限制时间
  1412. dr["LimitTime"] = lt;
  1413. if (!string.IsNullOrWhiteSpace(lt))
  1414. {
  1415. var ltime = DateTime.Parse(lt);
  1416. TimeSpan ts = ltime.Subtract(DateTime.Now);
  1417. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1418. if (tss < 0) { tss = -tss; }
  1419. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1420. if (ltime > DateTime.Now)
  1421. {
  1422. if (configcs != null)
  1423. {
  1424. int cs = Int32.Parse(configcs.F_ParamValue);
  1425. if (ts.TotalHours > cs)
  1426. {
  1427. dr["OverState"] = 1;
  1428. }
  1429. else
  1430. {
  1431. dr["OverState"] = 2;
  1432. }
  1433. }
  1434. dr["GapTime"] = "剩余" + gshsj;
  1435. }
  1436. else
  1437. {
  1438. dr["OverState"] = 3;
  1439. dr["GapTime"] = "超时" + gshsj;
  1440. }
  1441. }
  1442. }
  1443. if (state == 9)
  1444. {
  1445. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  1446. var dttime = DateTime.Now;
  1447. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  1448. var lt = dr["F_LimitTime"].ToString();//限制时间
  1449. dr["LimitTime"] = lt;
  1450. if (!string.IsNullOrWhiteSpace(lt))
  1451. {
  1452. var ltime = DateTime.Parse(lt);
  1453. TimeSpan ts = ltime.Subtract(dttime);
  1454. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1455. if (tss < 0) { tss = -tss; }
  1456. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1457. if (ltime < dttime)
  1458. {
  1459. dr["OverState"] = 3;
  1460. dr["GapTime"] = "超时" + gshsj;
  1461. }
  1462. }
  1463. }
  1464. }
  1465. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  1466. {
  1467. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  1468. }
  1469. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  1470. {
  1471. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  1472. }
  1473. if (Int32.Parse(strtab) < 1)
  1474. {
  1475. dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw);
  1476. }
  1477. else
  1478. {
  1479. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  1480. btns.Add(ButtonGroup.query());
  1481. dr["Buttons"] = btns;
  1482. }
  1483. }
  1484. #endregion
  1485. var obj = new
  1486. {
  1487. state = "success",
  1488. message = "成功",
  1489. rows = dt,
  1490. total = recordCount
  1491. };
  1492. return Content(obj.ToJson());
  1493. }
  1494. /// <summary>
  1495. /// 获取单位主办协办未处理工单列表
  1496. /// </summary>
  1497. /// <returns></returns>
  1498. [Authority]
  1499. public ActionResult GetDWNoDealList(int isdc = 0)
  1500. {
  1501. DataTable dt = new DataTable();
  1502. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  1503. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  1504. string sql = " and F_IsDelete=0";
  1505. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  1506. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  1507. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  1508. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  1509. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  1510. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  1511. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  1512. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  1513. int source = RequestString.GetInt("source", 0);
  1514. int keyid = RequestString.GetInt("keyid", 0);
  1515. int type = RequestString.GetInt("type", 0);
  1516. int bigtype = RequestString.GetInt("bigtype", 0);
  1517. int smalltype = RequestString.GetInt("smalltype", 0);
  1518. int sourcearea = RequestString.GetInt("sourcearea", 0);
  1519. int deptid = RequestString.GetInt("deptid", 0);
  1520. string strpageindex = RequestString.GetQueryString("page");
  1521. int pageindex = 1;
  1522. string strpagesize = RequestString.GetQueryString("pagesize");
  1523. int pagesize = 10;
  1524. if (userModel.F_RoleCode == "ZXHWY")
  1525. {
  1526. sql += " and F_CreateUser = '" + userModel.F_UserCode + "' ";
  1527. }
  1528. else if (strusercode.Trim() != "" && strusercode != "undefined")
  1529. {
  1530. sql += " and F_CreateUser = '" + strusercode + "' ";
  1531. }
  1532. 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) ";
  1533. if (userModel.F_RoleCode == "WLDW")
  1534. {
  1535. sql += " and F_MainDeptId = '" + userModel.F_DeptId + "' ";
  1536. }
  1537. else if (deptid != 0)
  1538. {
  1539. sql += " and F_MainDeptId = '" + deptid + "' ";
  1540. }
  1541. sql += ") or F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo where F_State=1 and F_IsDelete=0 and ISNULL(F_FeedbackTime, '')='' ";
  1542. if (userModel.F_RoleCode == "WLDW")
  1543. {
  1544. sql += " and F_DeptId = '" + userModel.F_DeptId + "' ";
  1545. }
  1546. else if (deptid != 0)
  1547. {
  1548. sql += " and F_DeptId = '" + deptid + "' ";
  1549. }
  1550. sql += "))";
  1551. if (strstate.Trim() != "" && strstate != "undefined")
  1552. {
  1553. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  1554. }
  1555. else
  1556. {
  1557. sql += " and F_WorkState in (2,4,8)";
  1558. }
  1559. if (strworkid.Trim() != "" && strworkid != "undefined")
  1560. {
  1561. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  1562. }
  1563. if (strname.Trim() != "" && strname != "undefined")
  1564. {
  1565. sql += " and F_CusName like '%" + strname + "%' ";
  1566. }
  1567. if (strtel.Trim() != "" && strtel != "undefined")
  1568. {
  1569. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  1570. }
  1571. if (strkey.Trim() != "" && strkey != "undefined")
  1572. {
  1573. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  1574. }
  1575. if (source != 0)
  1576. {
  1577. sql += " and F_InfoSource = '" + source + "' ";
  1578. }
  1579. if (keyid != 0)
  1580. {
  1581. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  1582. }
  1583. if (type != 0)
  1584. {
  1585. sql += " and F_InfoType = '" + type + "' ";
  1586. }
  1587. if (bigtype != 0)
  1588. {
  1589. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  1590. }
  1591. if (smalltype != 0)
  1592. {
  1593. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  1594. }
  1595. if (sourcearea != 0)
  1596. {
  1597. sql += " and F_SourceArea = '" + sourcearea + "' ";
  1598. }
  1599. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  1600. {
  1601. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  1602. }
  1603. if (strendtime.Trim() != "" && strendtime != "undefined")
  1604. {
  1605. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  1606. }
  1607. if (deptid != 0)
  1608. {
  1609. sql += " and F_MainDeptId = '" + deptid + "'";
  1610. }
  1611. if (strpageindex.Trim() != "")
  1612. {
  1613. pageindex = Convert.ToInt32(strpageindex);
  1614. }
  1615. if (strpagesize.Trim() != "")
  1616. {
  1617. pagesize = Convert.ToInt32(strpagesize);
  1618. }
  1619. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  1620. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  1621. if (isdc > 0)
  1622. {
  1623. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  1624. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  1625. if (msg == "")
  1626. {
  1627. return Success("导出成功");
  1628. }
  1629. else
  1630. {
  1631. return Error("导出失败");
  1632. }
  1633. }
  1634. int recordCount = 0;
  1635. dt = BLL.PagerBLL.GetListPager(
  1636. "T_Bus_WorkOrder",
  1637. "F_WorkOrderId",
  1638. cols,
  1639. sql,
  1640. "ORDER BY F_CreateTime DESC",
  1641. pagesize,
  1642. pageindex,
  1643. true,
  1644. out recordCount);
  1645. #region 声音文件
  1646. dt.Columns.Add("OverState", typeof(string));//超时状态
  1647. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  1648. dt.Columns.Add("GapTime", typeof(string));//时间差
  1649. dt.Columns.Add("FilePath", typeof(string));
  1650. dt.Columns.Add("Buttons", typeof(object));
  1651. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  1652. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  1653. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  1654. foreach (DataRow dr in dt.Rows)
  1655. {
  1656. //获取最新交办信息
  1657. string iszbdw = "0";
  1658. int state = Int32.Parse(dr["F_WorkState"].ToString());
  1659. if (state > 1)
  1660. {
  1661. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  1662. if (state < 6 || state == 8)
  1663. {
  1664. var lt = dr["F_LimitTime"].ToString();//限制时间
  1665. dr["LimitTime"] = lt;
  1666. if (!string.IsNullOrWhiteSpace(lt))
  1667. {
  1668. var ltime = DateTime.Parse(lt);
  1669. TimeSpan ts = ltime.Subtract(DateTime.Now);
  1670. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1671. if (tss < 0) { tss = -tss; }
  1672. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1673. if (ltime > DateTime.Now)
  1674. {
  1675. if (configcs != null)
  1676. {
  1677. int cs = Int32.Parse(configcs.F_ParamValue);
  1678. if (ts.TotalHours > cs)
  1679. {
  1680. dr["OverState"] = 1;
  1681. }
  1682. else
  1683. {
  1684. dr["OverState"] = 2;
  1685. }
  1686. }
  1687. dr["GapTime"] = "剩余" + gshsj;
  1688. }
  1689. else
  1690. {
  1691. dr["OverState"] = 3;
  1692. dr["GapTime"] = "超时" + gshsj;
  1693. }
  1694. }
  1695. }
  1696. if (state == 9)
  1697. {
  1698. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  1699. var dttime = DateTime.Now;
  1700. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  1701. var lt = dr["F_LimitTime"].ToString();//限制时间
  1702. dr["LimitTime"] = lt;
  1703. if (!string.IsNullOrWhiteSpace(lt))
  1704. {
  1705. var ltime = DateTime.Parse(lt);
  1706. TimeSpan ts = ltime.Subtract(dttime);
  1707. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1708. if (tss < 0) { tss = -tss; }
  1709. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1710. if (ltime < dttime)
  1711. {
  1712. dr["OverState"] = 3;
  1713. dr["GapTime"] = "超时" + gshsj;
  1714. }
  1715. }
  1716. }
  1717. }
  1718. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  1719. {
  1720. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  1721. }
  1722. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  1723. {
  1724. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  1725. }
  1726. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  1727. btns.Add(ButtonGroup.query());
  1728. dr["Buttons"] = btns;
  1729. }
  1730. #endregion
  1731. var obj = new
  1732. {
  1733. state = "success",
  1734. message = "成功",
  1735. rows = dt,
  1736. total = recordCount
  1737. };
  1738. return Content(obj.ToJson());
  1739. }
  1740. /// <summary>
  1741. /// 获取二级单位处理列表
  1742. /// </summary>
  1743. /// <returns></returns>
  1744. [Authority]
  1745. public ActionResult GetEJDWDealList(int isdc = 0)
  1746. {
  1747. DataTable dt = new DataTable();
  1748. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  1749. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  1750. string sql = " and F_IsDelete=0";
  1751. string strtab = HttpUtility.UrlDecode(RequestString.GetQueryString("tab"));
  1752. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  1753. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  1754. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  1755. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  1756. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  1757. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  1758. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  1759. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  1760. int source = RequestString.GetInt("source", 0);
  1761. int keyid = RequestString.GetInt("keyid", 0);
  1762. int type = RequestString.GetInt("type", 0);
  1763. int bigtype = RequestString.GetInt("bigtype", 0);
  1764. int smalltype = RequestString.GetInt("smalltype", 0);
  1765. int sourcearea = RequestString.GetInt("sourcearea", 0);
  1766. int deptid = RequestString.GetInt("deptid", 0);
  1767. string strpageindex = RequestString.GetQueryString("page");
  1768. int pageindex = 1;
  1769. string strpagesize = RequestString.GetQueryString("pagesize");
  1770. int pagesize = 10;
  1771. #region 模块
  1772. switch (strtab)
  1773. {
  1774. case "0"://待处理工单
  1775. sql += " and F_WorkState in (4,5) ";
  1776. if (userModel.F_RoleCode != "GLY")
  1777. {
  1778. sql += " and F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedInfo_Next where F_State=1 and F_IsDelete=0 and "
  1779. + " ISNULL(F_FeedbackTime, '')='' and F_MainDeptId =" + userModel.F_DeptId + " and F_IsSure in (0,1))";
  1780. }
  1781. break;
  1782. case "1"://已办理的工单
  1783. if (strstate.Trim() != "" && strstate != "undefined")
  1784. {
  1785. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  1786. }
  1787. 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) ";
  1788. if (userModel.F_RoleCode != "GLY")
  1789. {
  1790. sql += " and F_CreateUser='" + userModel.F_UserCode + "')";
  1791. }
  1792. else
  1793. {
  1794. sql += ")";
  1795. }
  1796. break;
  1797. }
  1798. #endregion
  1799. #region 条件
  1800. if (strworkid.Trim() != "" && strworkid != "undefined")
  1801. {
  1802. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  1803. }
  1804. if (strname.Trim() != "" && strname != "undefined")
  1805. {
  1806. sql += " and F_CusName like '%" + strname + "%' ";
  1807. }
  1808. if (strtel.Trim() != "" && strtel != "undefined")
  1809. {
  1810. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  1811. }
  1812. if (strkey.Trim() != "" && strkey != "undefined")
  1813. {
  1814. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  1815. }
  1816. if (strusercode.Trim() != "" && strusercode != "undefined")
  1817. {
  1818. sql += " and F_CreateUser = '" + strusercode + "' ";
  1819. }
  1820. if (source != 0)
  1821. {
  1822. sql += " and F_InfoSource = '" + source + "' ";
  1823. }
  1824. if (keyid != 0)
  1825. {
  1826. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  1827. }
  1828. if (type != 0)
  1829. {
  1830. sql += " and F_InfoType = '" + type + "' ";
  1831. }
  1832. if (bigtype != 0)
  1833. {
  1834. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  1835. }
  1836. if (smalltype != 0)
  1837. {
  1838. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  1839. }
  1840. if (sourcearea != 0)
  1841. {
  1842. sql += " and F_SourceArea = '" + sourcearea + "' ";
  1843. }
  1844. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  1845. {
  1846. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  1847. }
  1848. if (strendtime.Trim() != "" && strendtime != "undefined")
  1849. {
  1850. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  1851. }
  1852. if (deptid != 0)
  1853. {
  1854. sql += " and F_MainDeptId = '" + deptid + "'";
  1855. }
  1856. if (strpageindex.Trim() != "")
  1857. {
  1858. pageindex = Convert.ToInt32(strpageindex);
  1859. }
  1860. if (strpagesize.Trim() != "")
  1861. {
  1862. pagesize = Convert.ToInt32(strpagesize);
  1863. }
  1864. #endregion
  1865. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  1866. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  1867. if (isdc > 0)
  1868. {
  1869. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  1870. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  1871. if (msg == "")
  1872. {
  1873. return Success("导出成功");
  1874. }
  1875. else
  1876. {
  1877. return Error("导出失败");
  1878. }
  1879. }
  1880. int recordCount = 0;
  1881. dt = BLL.PagerBLL.GetListPager(
  1882. "T_Bus_WorkOrder",
  1883. "F_WorkOrderId",
  1884. cols,
  1885. sql,
  1886. "ORDER BY F_CreateTime DESC",
  1887. pagesize,
  1888. pageindex,
  1889. true,
  1890. out recordCount);
  1891. #region 声音文件
  1892. dt.Columns.Add("OverState", typeof(string));//超时状态
  1893. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  1894. dt.Columns.Add("GapTime", typeof(string));//时间差
  1895. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  1896. dt.Columns.Add("PDState", typeof(string));//派单状态
  1897. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  1898. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  1899. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  1900. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  1901. foreach (DataRow dr in dt.Rows)
  1902. {
  1903. //获取最新交办信息
  1904. string iszbdw = "0";
  1905. string ispd = "";
  1906. int state = Int32.Parse(dr["F_WorkState"].ToString());
  1907. if (state > 1)
  1908. {
  1909. 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";
  1910. var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
  1911. if (dtjb.Rows.Count > 0)
  1912. {
  1913. var lt = dr["F_LimitTime"].ToString();//限制时间
  1914. dr["LimitTime"] = lt;
  1915. if (state < 6 || state == 8)
  1916. {
  1917. if (!string.IsNullOrWhiteSpace(lt))
  1918. {
  1919. var ltime = DateTime.Parse(lt);
  1920. TimeSpan ts = ltime.Subtract(DateTime.Now);
  1921. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1922. if (tss < 0) { tss = -tss; }
  1923. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1924. if (ltime > DateTime.Now)
  1925. {
  1926. if (configcs != null)
  1927. {
  1928. int cs = Int32.Parse(configcs.F_ParamValue);
  1929. if (ts.TotalHours > cs)
  1930. {
  1931. dr["OverState"] = 1;
  1932. }
  1933. else
  1934. {
  1935. dr["OverState"] = 2;
  1936. }
  1937. }
  1938. dr["GapTime"] = "剩余" + gshsj;
  1939. }
  1940. else
  1941. {
  1942. dr["OverState"] = 3;
  1943. dr["GapTime"] = "超时" + gshsj;
  1944. }
  1945. }
  1946. }
  1947. if (state == 9)
  1948. {
  1949. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  1950. var dttime = DateTime.Now;
  1951. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  1952. if (!string.IsNullOrWhiteSpace(lt))
  1953. {
  1954. var ltime = DateTime.Parse(lt);
  1955. TimeSpan ts = ltime.Subtract(dttime);
  1956. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  1957. if (tss < 0) { tss = -tss; }
  1958. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  1959. if (ltime < dttime)
  1960. {
  1961. dr["OverState"] = 3;
  1962. dr["GapTime"] = "超时" + gshsj;
  1963. }
  1964. }
  1965. }
  1966. ispd = dtjb.Rows[0]["F_IsNext"].ToString();
  1967. dr["PDState"] = ispd;
  1968. }
  1969. }
  1970. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  1971. {
  1972. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  1973. }
  1974. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  1975. {
  1976. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  1977. }
  1978. if (Int32.Parse(strtab) < 1)
  1979. {
  1980. dr["Buttons"] = ButtonGroup.GetButtons(dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dr["F_IsResult"].ToString(), iszbdw, ispd);
  1981. }
  1982. else
  1983. {
  1984. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  1985. btns.Add(ButtonGroup.query());
  1986. dr["Buttons"] = btns;
  1987. }
  1988. }
  1989. #endregion
  1990. var obj = new
  1991. {
  1992. state = "success",
  1993. message = "成功",
  1994. rows = dt,
  1995. total = recordCount
  1996. };
  1997. return Content(obj.ToJson());
  1998. }
  1999. /// <summary>
  2000. /// 获取逾期未回复工单列表
  2001. /// </summary>
  2002. /// <returns></returns>
  2003. [Authority]
  2004. public ActionResult GetTimeOutList(int isdc = 0)
  2005. {
  2006. DataTable dt = new DataTable();
  2007. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2008. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2009. string sql = " and F_IsDelete=0";
  2010. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  2011. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  2012. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  2013. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  2014. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  2015. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  2016. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  2017. string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
  2018. int source = RequestString.GetInt("source", 0);
  2019. int keyid = RequestString.GetInt("keyid", 0);
  2020. int type = RequestString.GetInt("type", 0);
  2021. int bigtype = RequestString.GetInt("bigtype", 0);
  2022. int smalltype = RequestString.GetInt("smalltype", 0);
  2023. int sourcearea = RequestString.GetInt("sourcearea", 0);
  2024. int deptid = RequestString.GetInt("deptid", 0);
  2025. string strpageindex = RequestString.GetQueryString("page");
  2026. int pageindex = 1;
  2027. string strpagesize = RequestString.GetQueryString("pagesize");
  2028. int pagesize = 10;
  2029. if (userModel.F_RoleCode == "ZXHWY")
  2030. {
  2031. sql += " and F_CreateUser = '" + userModel.F_UserCode + "' ";
  2032. }
  2033. else if (strusercode.Trim() != "" && strusercode != "undefined")
  2034. {
  2035. sql += " and F_CreateUser = '" + strusercode + "' ";
  2036. }
  2037. string sqlwhere = ""; string sqlwhere1 = "";
  2038. 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) ";
  2039. if (userModel.F_RoleCode == "WLDW")
  2040. {
  2041. sqlwhere += " and F_MainDeptId = '" + userModel.F_DeptId + "' ";
  2042. sqlwhere1 += " and F_MainDeptId = '" + userModel.F_DeptId + "'";
  2043. }
  2044. else if (deptid != 0)
  2045. {
  2046. sqlwhere += " and F_MainDeptId = '" + deptid + "' ";
  2047. sqlwhere1 += " and F_MainDeptId = '" + deptid + "'";
  2048. }
  2049. 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, '')='' ";
  2050. if (userModel.F_RoleCode == "WLDW")
  2051. {
  2052. sqlwhere += " and F_DeptId = '" + userModel.F_DeptId + "' ";
  2053. }
  2054. else if (deptid != 0)
  2055. {
  2056. sqlwhere += " and F_DeptId = '" + deptid + "' ";
  2057. }
  2058. sqlwhere += "))";
  2059. if (strstate.Trim() != "" && strstate != "undefined")
  2060. {
  2061. sql += " and F_WorkState = '" + strstate.Trim() + "' ";
  2062. if (strstate.Trim()=="9")
  2063. {
  2064. sql += " and F_LimitTime<F_DealTime " + sqlwhere1;
  2065. }
  2066. else
  2067. sql += sqlwhere;
  2068. }
  2069. else
  2070. {
  2071. sql += " and F_WorkState in (2,4,8)" + sqlwhere;
  2072. }
  2073. if (strworkid.Trim() != "" && strworkid != "undefined")
  2074. {
  2075. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  2076. }
  2077. if (strname.Trim() != "" && strname != "undefined")
  2078. {
  2079. sql += " and F_CusName like '%" + strname + "%' ";
  2080. }
  2081. if (strtel.Trim() != "" && strtel != "undefined")
  2082. {
  2083. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  2084. }
  2085. if (strkey.Trim() != "" && strkey != "undefined")
  2086. {
  2087. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  2088. }
  2089. if (source != 0)
  2090. {
  2091. sql += " and F_InfoSource = '" + source + "' ";
  2092. }
  2093. if (keyid != 0)
  2094. {
  2095. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  2096. }
  2097. if (type != 0)
  2098. {
  2099. sql += " and F_InfoType = '" + type + "' ";
  2100. }
  2101. if (bigtype != 0)
  2102. {
  2103. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  2104. }
  2105. if (smalltype != 0)
  2106. {
  2107. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  2108. }
  2109. if (sourcearea != 0)
  2110. {
  2111. sql += " and F_SourceArea = '" + sourcearea + "' ";
  2112. }
  2113. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  2114. {
  2115. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  2116. }
  2117. if (strendtime.Trim() != "" && strendtime != "undefined")
  2118. {
  2119. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  2120. }
  2121. if (deptid != 0)
  2122. {
  2123. sql += " and F_MainDeptId = '" + deptid + "'";
  2124. }
  2125. if (strpageindex.Trim() != "")
  2126. {
  2127. pageindex = Convert.ToInt32(strpageindex);
  2128. }
  2129. if (strpagesize.Trim() != "")
  2130. {
  2131. pagesize = Convert.ToInt32(strpagesize);
  2132. }
  2133. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  2134. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  2135. if (isdc > 0)
  2136. {
  2137. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  2138. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  2139. if (msg == "")
  2140. {
  2141. return Success("导出成功");
  2142. }
  2143. else
  2144. {
  2145. return Error("导出失败");
  2146. }
  2147. }
  2148. int recordCount = 0;
  2149. dt = BLL.PagerBLL.GetListPager(
  2150. "T_Bus_WorkOrder",
  2151. "F_WorkOrderId",
  2152. cols,
  2153. sql,
  2154. "ORDER BY F_CreateTime DESC",
  2155. pagesize,
  2156. pageindex,
  2157. true,
  2158. out recordCount);
  2159. #region 声音文件
  2160. dt.Columns.Add("OverState", typeof(string));//超时状态
  2161. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  2162. dt.Columns.Add("GapTime", typeof(string));//时间差
  2163. dt.Columns.Add("FilePath", typeof(string));
  2164. dt.Columns.Add("Buttons", typeof(object));
  2165. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  2166. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  2167. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  2168. foreach (DataRow dr in dt.Rows)
  2169. {
  2170. int state = Int32.Parse(dr["F_WorkState"].ToString());
  2171. if (state > 1 )
  2172. {
  2173. var lt = dr["F_LimitTime"].ToString();//限制时间
  2174. dr["LimitTime"] = lt;
  2175. if (state < 6 || state == 8)
  2176. {
  2177. if (!string.IsNullOrWhiteSpace(lt))
  2178. {
  2179. var ltime = DateTime.Parse(lt);
  2180. TimeSpan ts = ltime.Subtract(DateTime.Now);
  2181. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  2182. if (tss < 0) { tss = -tss; }
  2183. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  2184. if (ltime > DateTime.Now)
  2185. {
  2186. if (configcs != null)
  2187. {
  2188. int cs = Int32.Parse(configcs.F_ParamValue);
  2189. if (ts.TotalHours > cs)
  2190. {
  2191. dr["OverState"] = 1;
  2192. }
  2193. else
  2194. {
  2195. dr["OverState"] = 2;
  2196. }
  2197. }
  2198. dr["GapTime"] = "剩余" + gshsj;
  2199. }
  2200. else
  2201. {
  2202. dr["OverState"] = 3;
  2203. dr["GapTime"] = "超时" + gshsj;
  2204. }
  2205. }
  2206. }
  2207. if (state == 9)
  2208. {
  2209. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  2210. var dttime = DateTime.Now;
  2211. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  2212. if (!string.IsNullOrWhiteSpace(lt))
  2213. {
  2214. var ltime = DateTime.Parse(lt);
  2215. TimeSpan ts = ltime.Subtract(dttime);
  2216. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  2217. if (tss < 0) { tss = -tss; }
  2218. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  2219. if (ltime < dttime)
  2220. {
  2221. dr["OverState"] = 3;
  2222. dr["GapTime"] = "超时" + gshsj;
  2223. }
  2224. }
  2225. }
  2226. }
  2227. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  2228. {
  2229. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  2230. }
  2231. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  2232. {
  2233. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  2234. }
  2235. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  2236. btns.Add(ButtonGroup.query());
  2237. dr["Buttons"] = btns;
  2238. }
  2239. #endregion
  2240. var obj = new
  2241. {
  2242. state = "success",
  2243. message = "成功",
  2244. rows = dt,
  2245. total = recordCount
  2246. };
  2247. return Content(obj.ToJson());
  2248. }
  2249. /// <summary>
  2250. /// 获取媒体工单列表
  2251. /// </summary>
  2252. /// <returns></returns>
  2253. [Authority]
  2254. public ActionResult GetMediaList(int isdc = 0)
  2255. {
  2256. DataTable dt = new DataTable();
  2257. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2258. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2259. string sql = " and F_IsDelete=0";
  2260. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  2261. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  2262. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  2263. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  2264. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  2265. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  2266. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  2267. int source = RequestString.GetInt("source", 0);
  2268. int keyid = RequestString.GetInt("keyid", 0);
  2269. int type = RequestString.GetInt("type", 0);
  2270. int bigtype = RequestString.GetInt("bigtype", 0);
  2271. int smalltype = RequestString.GetInt("smalltype", 0);
  2272. int sourcearea = RequestString.GetInt("sourcearea", 0);
  2273. int deptid = RequestString.GetInt("deptid", 0);
  2274. string strpageindex = RequestString.GetQueryString("page");
  2275. int pageindex = 1;
  2276. string strpagesize = RequestString.GetQueryString("pagesize");
  2277. int pagesize = 10;
  2278. sql += " and isnull(F_IsRelease,0) =1 ";
  2279. if (strworkid.Trim() != "" && strworkid != "undefined")
  2280. {
  2281. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  2282. }
  2283. if (strname.Trim() != "" && strname != "undefined")
  2284. {
  2285. sql += " and F_CusName like '%" + strname + "%' ";
  2286. }
  2287. if (strtel.Trim() != "" && strtel != "undefined")
  2288. {
  2289. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  2290. }
  2291. if (strkey.Trim() != "" && strkey != "undefined")
  2292. {
  2293. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  2294. }
  2295. if (strusercode.Trim() != "" && strusercode != "undefined")
  2296. {
  2297. sql += " and F_CreateUser = '" + strusercode + "' ";
  2298. }
  2299. if (source != 0)
  2300. {
  2301. sql += " and F_InfoSource = '" + source + "' ";
  2302. }
  2303. if (keyid != 0)
  2304. {
  2305. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  2306. }
  2307. if (type != 0)
  2308. {
  2309. sql += " and F_InfoType = '" + type + "' ";
  2310. }
  2311. if (bigtype != 0)
  2312. {
  2313. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  2314. }
  2315. if (smalltype != 0)
  2316. {
  2317. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  2318. }
  2319. if (sourcearea != 0)
  2320. {
  2321. sql += " and F_SourceArea = '" + sourcearea + "' ";
  2322. }
  2323. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  2324. {
  2325. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  2326. }
  2327. if (strendtime.Trim() != "" && strendtime != "undefined")
  2328. {
  2329. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  2330. }
  2331. if (deptid != 0)
  2332. {
  2333. sql += " and F_MainDeptId = '" + deptid + "'";
  2334. }
  2335. if (strpageindex.Trim() != "")
  2336. {
  2337. pageindex = Convert.ToInt32(strpageindex);
  2338. }
  2339. if (strpagesize.Trim() != "")
  2340. {
  2341. pagesize = Convert.ToInt32(strpagesize);
  2342. }
  2343. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  2344. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName";
  2345. if (isdc > 0)
  2346. {
  2347. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  2348. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  2349. if (msg == "")
  2350. {
  2351. return Success("导出成功");
  2352. }
  2353. else
  2354. {
  2355. return Error("导出失败");
  2356. }
  2357. }
  2358. int recordCount = 0;
  2359. dt = BLL.PagerBLL.GetListPager(
  2360. "T_Bus_WorkOrder",
  2361. "F_WorkOrderId",
  2362. cols,
  2363. sql,
  2364. "ORDER BY F_CreateTime DESC",
  2365. pagesize,
  2366. pageindex,
  2367. true,
  2368. out recordCount);
  2369. #region 声音文件
  2370. dt.Columns.Add("IsReturnMedia", typeof(string));
  2371. dt.Columns.Add("Buttons", typeof(object));
  2372. int IsReturnMedia = 0;
  2373. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  2374. {
  2375. IsReturnMedia = 1;
  2376. }
  2377. foreach (DataRow dr in dt.Rows)
  2378. {
  2379. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  2380. btns.Add(ButtonGroup.query());
  2381. dr["Buttons"] = btns;
  2382. dr["IsReturnMedia"] = IsReturnMedia;
  2383. }
  2384. #endregion
  2385. var obj = new
  2386. {
  2387. state = "success",
  2388. message = "成功",
  2389. rows = dt,
  2390. total = recordCount
  2391. };
  2392. return Content(obj.ToJson());
  2393. }
  2394. ///// <summary>
  2395. ///// 获取通报工单列表
  2396. ///// </summary>
  2397. ///// <returns></returns>
  2398. //[Authority]
  2399. //public ActionResult GetNoticeList(int isdc = 0)
  2400. //{
  2401. // DataTable dt = new DataTable();
  2402. // int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2403. // Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2404. // string sql = " and F_IsDelete=0 and isnull(F_IsNotice,0) =1";
  2405. // string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  2406. // string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  2407. // string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  2408. // string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  2409. // string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  2410. // string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  2411. // string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  2412. // int source = RequestString.GetInt("source", 0);
  2413. // int keyid = RequestString.GetInt("keyid", 0);
  2414. // int type = RequestString.GetInt("type", 0);
  2415. // int bigtype = RequestString.GetInt("bigtype", 0);
  2416. // int smalltype = RequestString.GetInt("smalltype", 0);
  2417. // int sourcearea = RequestString.GetInt("sourcearea", 0);
  2418. // int deptid = RequestString.GetInt("deptid", 0);
  2419. // string strpageindex = RequestString.GetQueryString("page");
  2420. // int pageindex = 1;
  2421. // string strpagesize = RequestString.GetQueryString("pagesize");
  2422. // int pagesize = 10;
  2423. // if (strworkid.Trim() != "" && strworkid != "undefined")
  2424. // {
  2425. // sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  2426. // }
  2427. // if (strname.Trim() != "" && strname != "undefined")
  2428. // {
  2429. // sql += " and F_CusName like '%" + strname + "%' ";
  2430. // }
  2431. // if (strtel.Trim() != "" && strtel != "undefined")
  2432. // {
  2433. // sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  2434. // }
  2435. // if (strkey.Trim() != "" && strkey != "undefined")
  2436. // {
  2437. // sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  2438. // }
  2439. // if (strusercode.Trim() != "" && strusercode != "undefined")
  2440. // {
  2441. // sql += " and F_CreateUser = '" + strusercode + "' ";
  2442. // }
  2443. // if (source != 0)
  2444. // {
  2445. // sql += " and F_InfoSource = '" + source + "' ";
  2446. // }
  2447. // if (keyid != 0)
  2448. // {
  2449. // sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  2450. // }
  2451. // if (type != 0)
  2452. // {
  2453. // sql += " and F_InfoType = '" + type + "' ";
  2454. // }
  2455. // if (bigtype != 0)
  2456. // {
  2457. // sql += " and F_InfoConBigType = '" + bigtype + "' ";
  2458. // }
  2459. // if (smalltype != 0)
  2460. // {
  2461. // sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  2462. // }
  2463. // if (sourcearea != 0)
  2464. // {
  2465. // sql += " and F_SourceArea = '" + sourcearea + "' ";
  2466. // }
  2467. // if (deptid != 0)
  2468. // {
  2469. // 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 ";
  2470. // sql += " and F_WorkOrderID in(" + sqlwhere + ")";
  2471. // }
  2472. // if (strstarttime.Trim() != "" && strstarttime != "undefined")
  2473. // {
  2474. // sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  2475. // }
  2476. // if (strendtime.Trim() != "" && strendtime != "undefined")
  2477. // {
  2478. // sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  2479. // }
  2480. // if (strpageindex.Trim() != "")
  2481. // {
  2482. // pageindex = Convert.ToInt32(strpageindex);
  2483. // }
  2484. // if (strpagesize.Trim() != "")
  2485. // {
  2486. // pagesize = Convert.ToInt32(strpagesize);
  2487. // }
  2488. // string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName";
  2489. // if (isdc > 0)
  2490. // {
  2491. // var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  2492. // var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  2493. // if (msg == "")
  2494. // {
  2495. // return Success("导出成功");
  2496. // }
  2497. // else
  2498. // {
  2499. // return Error("导出失败");
  2500. // }
  2501. // }
  2502. // int recordCount = 0;
  2503. // dt = BLL.PagerBLL.GetListPager(
  2504. // "T_Bus_WorkOrder",
  2505. // "F_WorkOrderId",
  2506. // cols,
  2507. // sql,
  2508. // "ORDER BY F_CreateTime DESC",
  2509. // pagesize,
  2510. // pageindex,
  2511. // true,
  2512. // out recordCount);
  2513. // #region 声音文件
  2514. // dt.Columns.Add("DeptName", typeof(string));//交办单位
  2515. // dt.Columns.Add("OtherDeptName", typeof(string));//协办单位
  2516. // dt.Columns.Add("NoticeDeptName", typeof(string));//通报单位
  2517. // dt.Columns.Add("NoticeReson", typeof(string));//通报原因
  2518. // dt.Columns.Add("IsReturnNotice", typeof(string));
  2519. // dt.Columns.Add("FilePath", typeof(string));
  2520. // dt.Columns.Add("Buttons", typeof(object));
  2521. // var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  2522. // var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  2523. // int IsReturnNotice = 0;
  2524. // if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  2525. // {
  2526. // IsReturnNotice = 1;
  2527. // }
  2528. // foreach (DataRow dr in dt.Rows)
  2529. // {
  2530. // //获取最新交办信息
  2531. // //string iszbdw = "0";
  2532. // 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";
  2533. // var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
  2534. // if (dtjb.Rows.Count > 0)
  2535. // {
  2536. // //if (dtjb.Rows[0]["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  2537. // dr["DeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_MainDeptId"].ToString() + "')");
  2538. // if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
  2539. // {
  2540. // dr["OtherDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_OtherDeptIds"].ToString() + "')");
  2541. // }
  2542. // //int did = Int32.Parse(dtjb.Rows[0]["F_MainDeptId"].ToString());
  2543. // //var deptinfo = new BLL.T_Sys_Department().GetModel(did);
  2544. // //if (deptinfo != null)
  2545. // //{
  2546. // // //if (did == userModel.F_DeptId) { iszbdw = "1"; }
  2547. // // dr["DeptName"] = deptinfo.F_DeptName;//交办单位
  2548. // //}
  2549. // //if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
  2550. // //{
  2551. // // string[] strids = dtjb.Rows[0]["F_OtherDeptIds"].ToString().Split(',');
  2552. // // string dns = string.Empty;
  2553. // // foreach (string strid in strids)
  2554. // // {
  2555. // // var dinfo = new BLL.T_Sys_Department().GetModel(Int32.Parse(strid));
  2556. // // if (dinfo != null)
  2557. // // {
  2558. // // if (string.IsNullOrEmpty(dns))
  2559. // // {
  2560. // // dns = dinfo.F_DeptName;//交办单位
  2561. // // }
  2562. // // else
  2563. // // {
  2564. // // dns += "," + dinfo.F_DeptName;//交办单位
  2565. // // }
  2566. // // }
  2567. // // }
  2568. // // dr["OtherDeptName"] = dns;
  2569. // //}
  2570. // }
  2571. // //获取最新通报信息
  2572. // 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";
  2573. // var dttb = DbHelperSQL.Query(sqltb).Tables[0];
  2574. // if (dttb.Rows.Count > 0)
  2575. // {
  2576. // if (dttb.Rows[0]["F_DeptIds"] != null && dttb.Rows[0]["F_DeptIds"].ToString() != "")
  2577. // {
  2578. // dr["NoticeDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dttb.Rows[0]["F_DeptIds"].ToString() + "')");
  2579. // }
  2580. // dr["NoticeReson"] = dttb.Rows[0]["F_Content"] != null? dttb.Rows[0]["F_Content"].ToString():"";
  2581. // }
  2582. // if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  2583. // {
  2584. // dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  2585. // }
  2586. // else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  2587. // {
  2588. // dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  2589. // }
  2590. // List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  2591. // btns.Add(ButtonGroup.query());
  2592. // dr["Buttons"] = btns;
  2593. // dr["IsReturnNotice"] = IsReturnNotice;
  2594. // }
  2595. // #endregion
  2596. // var obj = new
  2597. // {
  2598. // state = "success",
  2599. // message = "成功",
  2600. // rows = dt,
  2601. // total = recordCount
  2602. // };
  2603. // return Content(obj.ToJson());
  2604. //}
  2605. /// <summary>
  2606. /// 获取通报工单列表
  2607. /// </summary>
  2608. /// <returns></returns>
  2609. [Authority]
  2610. public ActionResult GetNoticeList(int isdc = 0)
  2611. {
  2612. DataTable dt = new DataTable();
  2613. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2614. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2615. string sql = " and F_IsDelete=0 ";
  2616. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  2617. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  2618. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  2619. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  2620. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  2621. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  2622. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  2623. int source = RequestString.GetInt("source", 0);
  2624. int keyid = RequestString.GetInt("keyid", 0);
  2625. int type = RequestString.GetInt("type", 0);
  2626. int bigtype = RequestString.GetInt("bigtype", 0);
  2627. int smalltype = RequestString.GetInt("smalltype", 0);
  2628. int sourcearea = RequestString.GetInt("sourcearea", 0);
  2629. int deptid = RequestString.GetInt("deptid", 0);
  2630. string strpageindex = RequestString.GetQueryString("page");
  2631. int pageindex = 1;
  2632. string strpagesize = RequestString.GetQueryString("pagesize");
  2633. int pagesize = 10;
  2634. if (strworkid.Trim() != "" && strworkid != "undefined")
  2635. {
  2636. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  2637. }
  2638. if (strname.Trim() != "" && strname != "undefined")
  2639. {
  2640. sql += " and F_CusName like '%" + strname + "%' ";
  2641. }
  2642. if (strtel.Trim() != "" && strtel != "undefined")
  2643. {
  2644. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  2645. }
  2646. if (strkey.Trim() != "" && strkey != "undefined")
  2647. {
  2648. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  2649. }
  2650. if (strusercode.Trim() != "" && strusercode != "undefined")
  2651. {
  2652. sql += " and F_CreateUser = '" + strusercode + "' ";
  2653. }
  2654. if (source != 0)
  2655. {
  2656. sql += " and F_InfoSource = '" + source + "' ";
  2657. }
  2658. if (keyid != 0)
  2659. {
  2660. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  2661. }
  2662. if (type != 0)
  2663. {
  2664. sql += " and F_InfoType = '" + type + "' ";
  2665. }
  2666. if (bigtype != 0)
  2667. {
  2668. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  2669. }
  2670. if (smalltype != 0)
  2671. {
  2672. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  2673. }
  2674. if (sourcearea != 0)
  2675. {
  2676. sql += " and F_SourceArea = '" + sourcearea + "' ";
  2677. }
  2678. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  2679. {
  2680. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  2681. }
  2682. if (strendtime.Trim() != "" && strendtime != "undefined")
  2683. {
  2684. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  2685. }
  2686. if (userModel.F_RoleCode == "WLDW")
  2687. {
  2688. string sqlwhere = "select F_WorkOrderID from T_Bus_NoticeCriticism where ','+F_DeptIds+',' like '%," + userModel.F_DeptId + ",%' and F_State=1 and F_IsDelete=0 ";
  2689. sql += " and F_WorkOrderID in(" + sqlwhere + ")";
  2690. }
  2691. else
  2692. {
  2693. sql += " and F_WorkOrderID in(select F_WorkOrderID from T_Bus_NoticeCriticism where F_State=1 and F_IsDelete=0) ";
  2694. }
  2695. if (deptid != 0)
  2696. {
  2697. sql += " and F_MainDeptId = '" + deptid + "'";
  2698. }
  2699. if (strpageindex.Trim() != "")
  2700. {
  2701. pageindex = Convert.ToInt32(strpageindex);
  2702. }
  2703. if (strpagesize.Trim() != "")
  2704. {
  2705. pagesize = Convert.ToInt32(strpagesize);
  2706. }
  2707. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  2708. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName"
  2709. + ",dbo.GetDeptNames(F_NoticeDeptIds) as NoticeDeptName";
  2710. if (isdc > 0)
  2711. {
  2712. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  2713. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  2714. if (msg == "")
  2715. {
  2716. return Success("导出成功");
  2717. }
  2718. else
  2719. {
  2720. return Error("导出失败");
  2721. }
  2722. }
  2723. int recordCount = 0;
  2724. dt = BLL.PagerBLL.GetListPager(
  2725. "T_Bus_WorkOrder",
  2726. "F_WorkOrderId",
  2727. cols,
  2728. sql,
  2729. "ORDER BY F_CreateTime DESC",
  2730. pagesize,
  2731. pageindex,
  2732. true,
  2733. out recordCount);
  2734. #region 声音文件
  2735. dt.Columns.Add("NoticeReson", typeof(string));//通报原因
  2736. dt.Columns.Add("IsReturnNotice", typeof(string));
  2737. dt.Columns.Add("FilePath", typeof(string));
  2738. dt.Columns.Add("Buttons", typeof(object));
  2739. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  2740. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  2741. int IsReturnNotice = 0;
  2742. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  2743. {
  2744. IsReturnNotice = 1;
  2745. }
  2746. foreach (DataRow dr in dt.Rows)
  2747. {
  2748. //获取最新通报信息
  2749. 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";
  2750. var dttb = DbHelperSQL.Query(sqltb).Tables[0];
  2751. if (dttb.Rows.Count > 0)
  2752. {
  2753. dr["NoticeReson"] = dttb.Rows[0]["F_Content"] != null ? dttb.Rows[0]["F_Content"].ToString() : "";
  2754. }
  2755. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  2756. {
  2757. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  2758. }
  2759. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  2760. {
  2761. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  2762. }
  2763. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  2764. btns.Add(ButtonGroup.query());
  2765. dr["Buttons"] = btns;
  2766. dr["IsReturnNotice"] = IsReturnNotice;
  2767. }
  2768. #endregion
  2769. var obj = new
  2770. {
  2771. state = "success",
  2772. message = "成功",
  2773. rows = dt,
  2774. total = recordCount
  2775. };
  2776. return Content(obj.ToJson());
  2777. }
  2778. /// <summary>
  2779. /// 获取批示工单列表
  2780. /// </summary>
  2781. /// <returns></returns>
  2782. [Authority]
  2783. public ActionResult GetSuperList(int isdc = 0)
  2784. {
  2785. DataTable dt = new DataTable();
  2786. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2787. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2788. string sql = " and F_IsDelete=0 ";
  2789. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  2790. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  2791. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  2792. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  2793. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  2794. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  2795. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  2796. int source = RequestString.GetInt("source", 0);
  2797. int keyid = RequestString.GetInt("keyid", 0);
  2798. int type = RequestString.GetInt("type", 0);
  2799. int bigtype = RequestString.GetInt("bigtype", 0);
  2800. int smalltype = RequestString.GetInt("smalltype", 0);
  2801. int sourcearea = RequestString.GetInt("sourcearea", 0);
  2802. int deptid = RequestString.GetInt("deptid", 0);
  2803. string strpageindex = RequestString.GetQueryString("page");
  2804. int pageindex = 1;
  2805. string strpagesize = RequestString.GetQueryString("pagesize");
  2806. int pagesize = 10;
  2807. if (strworkid.Trim() != "" && strworkid != "undefined")
  2808. {
  2809. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  2810. }
  2811. if (strname.Trim() != "" && strname != "undefined")
  2812. {
  2813. sql += " and F_CusName like '%" + strname + "%' ";
  2814. }
  2815. if (strtel.Trim() != "" && strtel != "undefined")
  2816. {
  2817. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  2818. }
  2819. if (strkey.Trim() != "" && strkey != "undefined")
  2820. {
  2821. sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
  2822. }
  2823. if (strusercode.Trim() != "" && strusercode != "undefined")
  2824. {
  2825. sql += " and F_CreateUser = '" + strusercode + "' ";
  2826. }
  2827. if (source != 0)
  2828. {
  2829. sql += " and F_InfoSource = '" + source + "' ";
  2830. }
  2831. if (keyid != 0)
  2832. {
  2833. sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
  2834. }
  2835. if (type != 0)
  2836. {
  2837. sql += " and F_InfoType = '" + type + "' ";
  2838. }
  2839. if (bigtype != 0)
  2840. {
  2841. sql += " and F_InfoConBigType = '" + bigtype + "' ";
  2842. }
  2843. if (smalltype != 0)
  2844. {
  2845. sql += " and F_InfoConSmallType = '" + smalltype + "' ";
  2846. }
  2847. if (sourcearea != 0)
  2848. {
  2849. sql += " and F_SourceArea = '" + sourcearea + "' ";
  2850. }
  2851. if (strstarttime.Trim() != "" && strstarttime != "undefined")
  2852. {
  2853. sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
  2854. }
  2855. if (strendtime.Trim() != "" && strendtime != "undefined")
  2856. {
  2857. sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
  2858. }
  2859. 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))";
  2860. if (deptid != 0)
  2861. {
  2862. sql += " and F_MainDeptId = '" + deptid + "'";
  2863. }
  2864. if (strpageindex.Trim() != "")
  2865. {
  2866. pageindex = Convert.ToInt32(strpageindex);
  2867. }
  2868. if (strpagesize.Trim() != "")
  2869. {
  2870. pagesize = Convert.ToInt32(strpagesize);
  2871. }
  2872. string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  2873. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName"
  2874. + ",dbo.GetDeptNames(F_NoticeDeptIds) as NoticeDeptName";
  2875. if (isdc > 0)
  2876. {
  2877. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  2878. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  2879. if (msg == "")
  2880. {
  2881. return Success("导出成功");
  2882. }
  2883. else
  2884. {
  2885. return Error("导出失败");
  2886. }
  2887. }
  2888. int recordCount = 0;
  2889. dt = BLL.PagerBLL.GetListPager(
  2890. "T_Bus_WorkOrder",
  2891. "F_WorkOrderId",
  2892. cols,
  2893. sql,
  2894. "ORDER BY F_CreateTime DESC",
  2895. pagesize,
  2896. pageindex,
  2897. true,
  2898. out recordCount);
  2899. #region 声音文件
  2900. dt.Columns.Add("FilePath", typeof(string));
  2901. dt.Columns.Add("Buttons", typeof(object));
  2902. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  2903. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  2904. foreach (DataRow dr in dt.Rows)
  2905. {
  2906. //获取最新通报信息
  2907. 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";
  2908. var dttb = DbHelperSQL.Query(sqltb).Tables[0];
  2909. if (dttb.Rows.Count > 0)
  2910. {
  2911. dr["NoticeReson"] = dttb.Rows[0]["F_Content"] != null ? dttb.Rows[0]["F_Content"].ToString() : "";
  2912. }
  2913. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  2914. {
  2915. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  2916. }
  2917. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  2918. {
  2919. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  2920. }
  2921. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  2922. btns.Add(ButtonGroup.query());
  2923. dr["Buttons"] = btns;
  2924. }
  2925. #endregion
  2926. var obj = new
  2927. {
  2928. state = "success",
  2929. message = "成功",
  2930. rows = dt,
  2931. total = recordCount
  2932. };
  2933. return Content(obj.ToJson());
  2934. }
  2935. /// <summary>
  2936. /// 获取工单信息
  2937. /// </summary>
  2938. /// <returns></returns>
  2939. [Authority]
  2940. public ActionResult GetWorkOrder()
  2941. {
  2942. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2943. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2944. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  2945. //int type = RequestString.GetInt("type", 0);//0基本信息1监察意见2领导批示3办理情况4回访信息5督办信息6办理过程
  2946. if (!string.IsNullOrEmpty(strworkorderid))
  2947. {
  2948. string sql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName1,dbo.GetDictionaryName(F_InfoSource) as SourceName"
  2949. + ",dbo.GetDeptNames(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName,dbo.GetDeptNames(F_DealDeptId) as DealDeptName"
  2950. + ",dbo.GetDeptNames(F_NoticeDeptIds) as NoticeDeptName,dbo.GetAreaName(F_SourceArea) as AreaName "
  2951. + " from T_Bus_WorkOrder where F_WorkOrderId ='" + strworkorderid + "'";
  2952. var dt = DbHelperSQL.Query(sql).Tables[0];
  2953. if (dt.Rows.Count > 0)
  2954. {
  2955. if (dt.Rows[0]["F_IsProtect"] != null && userModel.F_RoleCode == "WLDW")
  2956. {
  2957. string isp = dt.Rows[0]["F_IsProtect"].ToString();
  2958. if (isp == "1")
  2959. {
  2960. dt.Rows[0]["F_CusName"] = "";
  2961. dt.Rows[0]["F_CusPhone"] = "";
  2962. dt.Rows[0]["F_ConPhone"] = "";
  2963. }
  2964. }
  2965. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  2966. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  2967. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  2968. string jcsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_DeptId) as DeptName "
  2969. + "from T_Bus_RemindRecord where F_Type=2 and F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2970. string dbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_DeptId) as DeptName "
  2971. + "from T_Bus_RemindRecord where F_Type=1 and F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2972. string pssql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2973. + "from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type=1 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2974. string zssql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2975. + "from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type=2 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2976. string htsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2977. + "from T_Bus_SubmitSuper where F_State=1 and F_IsDelete=0 and F_Type=3 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2978. string jbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName "
  2979. + "from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2980. string thsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_CreateDeptId) as DeptName "
  2981. + "from T_Bus_Feedback where F_State=1 and F_Type=3 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2982. string yssql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2983. + "from T_Bus_DelayTime where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2984. string blsql = "select *,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_CreateDeptId) as DeptName "
  2985. + "from T_Bus_Feedback where F_State=1 and F_Type!=3 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2986. string hfsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2987. + "from T_Bus_VisitResult where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2988. string gcsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2989. + "from T_Bus_Operation where F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2990. string cbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  2991. + "from T_Bus_Additional where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  2992. #region 声音文件
  2993. dt.Columns.Add("FilePath", typeof(string));
  2994. if (dt.Rows[0]["F_LeaveRecordId"] != null)
  2995. {
  2996. dt.Rows[0]["FilePath"] = GetLeavePath(dt.Rows[0]["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  2997. }
  2998. else if (dt.Rows[0]["F_CallRecordId"] != null)
  2999. {
  3000. dt.Rows[0]["FilePath"] = GetCallPath(dt.Rows[0]["F_CallRecordId"].ToString(), config.F_ParamValue);
  3001. }
  3002. #endregion
  3003. #region 附件
  3004. if (configfj != null)
  3005. {
  3006. dt = BindFileData(dt, configfj.F_ParamValue);
  3007. }
  3008. #endregion
  3009. #region 监察信息
  3010. var jcdt = DbHelperSQL.Query(jcsql).Tables[0];
  3011. if (configfj != null)
  3012. {
  3013. jcdt = BindFileData(jcdt, configfj.F_ParamValue);
  3014. }
  3015. #endregion
  3016. #region 批示信息
  3017. var psdt = DbHelperSQL.Query(pssql).Tables[0];
  3018. if (configfj != null)
  3019. {
  3020. psdt = BindFileData(psdt, configfj.F_ParamValue);
  3021. }
  3022. #endregion
  3023. #region 指示信息
  3024. var zsdt = DbHelperSQL.Query(zssql).Tables[0];
  3025. if (configfj != null)
  3026. {
  3027. zsdt = BindFileData(zsdt, configfj.F_ParamValue);
  3028. }
  3029. #endregion
  3030. #region 回退信息
  3031. var htdt = DbHelperSQL.Query(htsql).Tables[0];
  3032. #endregion
  3033. #region 督办信息
  3034. var dbdt = DbHelperSQL.Query(dbsql).Tables[0];
  3035. if (configfj != null)
  3036. {
  3037. dbdt = BindFileData(dbdt, configfj.F_ParamValue);
  3038. }
  3039. #endregion
  3040. #region 交办信息
  3041. var jbdt = DbHelperSQL.Query(jbsql).Tables[0];
  3042. if (configfj != null)
  3043. {
  3044. jbdt = BindFileData(jbdt, configfj.F_ParamValue);
  3045. }
  3046. #endregion
  3047. #region 退回信息
  3048. var thdt = DbHelperSQL.Query(thsql).Tables[0];
  3049. #endregion
  3050. #region 延时信息
  3051. var ysdt = DbHelperSQL.Query(yssql).Tables[0];
  3052. #endregion
  3053. #region 办理情况
  3054. var bldt = DbHelperSQL.Query(blsql).Tables[0];
  3055. if (configfj != null)
  3056. {
  3057. bldt = BindFileData(bldt, configfj.F_ParamValue);
  3058. }
  3059. #endregion
  3060. #region 回访信息
  3061. var hfdt = DbHelperSQL.Query(hfsql).Tables[0];
  3062. hfdt.Columns.Add("FilePath", typeof(string));
  3063. foreach (DataRow bldr in hfdt.Rows)
  3064. {
  3065. if (bldr["F_CallRecordId"] != null && config != null)
  3066. {
  3067. bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
  3068. }
  3069. }
  3070. #endregion
  3071. #region 市民催单
  3072. var cbdt = DbHelperSQL.Query(cbsql).Tables[0];
  3073. cbdt.Columns.Add("FilePath", typeof(string));
  3074. foreach (DataRow bldr in cbdt.Rows)
  3075. {
  3076. if (bldr["F_CallRecordId"] != null && config != null)
  3077. {
  3078. bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
  3079. }
  3080. }
  3081. #endregion
  3082. #region 办理过程
  3083. var gcdt = DbHelperSQL.Query(gcsql).Tables[0];
  3084. gcdt.Columns.Add("File", typeof(object));
  3085. gcdt.Columns.Add("FilePath", typeof(string));
  3086. if (configfj != null || configly != null || config != null)
  3087. {
  3088. foreach (DataRow bldr in gcdt.Rows)
  3089. {
  3090. if (bldr["F_File"] != null && bldr["F_File"].ToString() != "" && configfj != null)
  3091. {
  3092. bldr["File"] = GetFileData(bldr["F_File"].ToString(), configfj.F_ParamValue);
  3093. }
  3094. if (bldr["F_LeaveRecordId"] != null && configly != null)
  3095. {
  3096. bldr["FilePath"] = GetLeavePath(bldr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  3097. }
  3098. else if (bldr["F_CallRecordId"] != null && config != null)
  3099. {
  3100. bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
  3101. }
  3102. }
  3103. }
  3104. #endregion
  3105. #region 流程显示
  3106. var lcdt = new DataTable();
  3107. lcdt.Columns.Add("step", typeof(int));
  3108. lcdt.Columns.Add("name", typeof(string));
  3109. lcdt.Columns.Add("dept", typeof(string));
  3110. lcdt.Columns.Add("time", typeof(string));
  3111. DataRow dr1 = lcdt.NewRow();
  3112. dr1["step"] = 1;
  3113. if (dt.Rows[0]["F_CreateUser"] != null)
  3114. {
  3115. var lruser = new BLL.T_Sys_UserAccount().GetModel(dt.Rows[0]["F_CreateUser"].ToString());
  3116. if (lruser != null)
  3117. {
  3118. dr1["name"] = lruser.F_UserName;
  3119. dr1["dept"] = lruser.depname;
  3120. }
  3121. else
  3122. {
  3123. dr1["name"] = dt.Rows[0]["F_CreateUser"].ToString();
  3124. dr1["dept"] = "";
  3125. }
  3126. }
  3127. dr1["time"] = dt.Rows[0]["F_CreateTime"];
  3128. lcdt.Rows.Add(dr1);
  3129. int state = Int32.Parse(dt.Rows[0]["F_WorkState"].ToString());
  3130. if (state >= 1) {
  3131. if (jbdt.Rows.Count > 0)
  3132. {
  3133. var newjb = jbdt.Rows[jbdt.Rows.Count - 1];
  3134. DataRow dr2 = lcdt.NewRow();
  3135. dr2["step"] = 2;
  3136. var jbuser = new BLL.T_Sys_UserAccount().GetModel(newjb["F_CreateUser"].ToString());
  3137. if (jbuser != null)
  3138. {
  3139. dr2["name"] = jbuser.F_UserName;
  3140. dr2["dept"] = jbuser.depname;
  3141. }
  3142. else
  3143. {
  3144. dr2["name"] = newjb["F_CreateUser"].ToString();
  3145. dr2["dept"] = "";
  3146. }
  3147. dr2["time"] = newjb["F_CreateTime"];
  3148. lcdt.Rows.Add(dr2);
  3149. }
  3150. }
  3151. if (state >= 6)
  3152. {
  3153. if (bldt.Rows.Count > 0)
  3154. {
  3155. var newbl = bldt.Rows[bldt.Rows.Count - 1];
  3156. DataRow dr3 = lcdt.NewRow();
  3157. dr3["step"] = 3;
  3158. var jbuser = new BLL.T_Sys_UserAccount().GetModel(newbl["F_CreateUser"].ToString());
  3159. if (jbuser != null)
  3160. {
  3161. dr3["name"] = jbuser.F_UserName;
  3162. dr3["dept"] = jbuser.depname;
  3163. }
  3164. else
  3165. {
  3166. dr3["name"] = newbl["F_CreateUser"].ToString();
  3167. dr3["dept"] = "";
  3168. }
  3169. dr3["time"] = newbl["F_CreateTime"];
  3170. lcdt.Rows.Add(dr3);
  3171. }
  3172. }
  3173. if (state >= 7)
  3174. {
  3175. if (hfdt.Rows.Count > 0)
  3176. {
  3177. var newhf = hfdt.Rows[hfdt.Rows.Count - 1];
  3178. DataRow dr4 = lcdt.NewRow();
  3179. dr4["step"] = 4;
  3180. var jbuser = new BLL.T_Sys_UserAccount().GetModel(newhf["F_CreateUser"].ToString());
  3181. if (jbuser != null)
  3182. {
  3183. dr4["name"] = jbuser.F_UserName;
  3184. dr4["dept"] = jbuser.depname;
  3185. }
  3186. else
  3187. {
  3188. dr4["name"] = newhf["F_CreateUser"].ToString();
  3189. dr4["dept"] = "";
  3190. }
  3191. dr4["time"] = newhf["F_CreateTime"];
  3192. lcdt.Rows.Add(dr4);
  3193. }
  3194. }
  3195. if (state == 9)
  3196. {
  3197. DataRow dr5 = lcdt.NewRow();
  3198. dr5["step"] = 5;
  3199. var enduser = new BLL.T_Sys_UserAccount().GetModel(dt.Rows[0]["F_CloseUser"].ToString());
  3200. if (enduser != null)
  3201. {
  3202. dr5["name"] = enduser.F_UserName;
  3203. dr5["dept"] = enduser.depname;
  3204. }
  3205. else
  3206. {
  3207. dr5["name"] = dt.Rows[0]["F_CloseUser"].ToString();
  3208. dr5["dept"] = "";
  3209. }
  3210. dr5["time"] = dt.Rows[0]["F_CloseTime"];
  3211. lcdt.Rows.Add(dr5);
  3212. }
  3213. #endregion
  3214. #region 操作按钮
  3215. var btns = new List<ButtonGroup.button>();
  3216. if (jbdt.Rows.Count > 0)
  3217. {
  3218. var jbzx = jbdt.Rows[jbdt.Rows.Count - 1];
  3219. string iszbdw = "0";
  3220. string fmd = jbzx["F_MainDeptId"].ToString();
  3221. string fod = jbzx["F_OtherDeptIds"] == null ? "" : jbzx["F_OtherDeptIds"].ToString();
  3222. if (fmd == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  3223. else if (fod != "" && fod.Split(',').Contains(userModel.F_DeptId.ToString()))
  3224. {
  3225. iszbdw = "2";
  3226. }
  3227. if (!(userModel.F_RoleCode == "WLDW" && iszbdw == "0"))
  3228. {
  3229. btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), iszbdw);
  3230. }
  3231. }
  3232. else
  3233. {
  3234. btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), "0");
  3235. }
  3236. #endregion
  3237. #region 其他权限
  3238. int issend = 0;
  3239. if (dt.Rows[0]["F_IsRelease"] != null && (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
  3240. {
  3241. if (dt.Rows[0]["F_IsRelease"].ToString() != "1")
  3242. {
  3243. issend = 1;
  3244. }
  3245. }
  3246. int isnotice = 0;
  3247. if (dt.Rows[0]["F_IsNotice"] != null && (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
  3248. {
  3249. if (dt.Rows[0]["F_IsNotice"].ToString() != "1")
  3250. {
  3251. isnotice = 1;
  3252. }
  3253. }
  3254. int isedit = 0;
  3255. if (dt.Rows[0]["F_IsRelease"] != null && (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
  3256. {
  3257. isedit = 1;
  3258. }
  3259. #endregion
  3260. var obj = new
  3261. {
  3262. data = dt,
  3263. jcdata = jcdt,
  3264. psdata = psdt,
  3265. zsdata = zsdt,
  3266. htdata = htdt,
  3267. dbdata = dbdt,
  3268. jbdata = jbdt,
  3269. thdata = thdt,
  3270. ysdata = ysdt,
  3271. bldata = bldt,
  3272. hfdata = hfdt,
  3273. cbdata = cbdt,
  3274. gcdata = gcdt,
  3275. lcdata= lcdt,
  3276. issend = issend,
  3277. isedit = isedit,
  3278. isnotice = isnotice,
  3279. btndata = btns
  3280. };
  3281. return Success("获取成功", obj);
  3282. }
  3283. else
  3284. {
  3285. return Error("获取失败");
  3286. }
  3287. }
  3288. else
  3289. {
  3290. return Error("参数传输失败");
  3291. }
  3292. }
  3293. /// <summary>
  3294. /// 获取草稿信息
  3295. /// </summary>
  3296. /// <returns></returns>
  3297. [Authority]
  3298. public ActionResult GetDraftInfo()
  3299. {
  3300. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3301. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3302. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3303. int type = RequestString.GetInt("type", 0);//1交办信息2反馈信息3回访信息
  3304. if (!string.IsNullOrEmpty(strworkorderid) && type != 0)
  3305. {
  3306. string sql = string.Empty;
  3307. switch (type)
  3308. {
  3309. case 1: sql = "select top 1 *,dbo.GetDeptName(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName from T_Bus_AssignedInfo"; break;
  3310. case 2: sql = "select top 1 * from T_Bus_Feedback"; break;
  3311. case 3: sql = "select top 1 * from T_Bus_VisitResult"; break;
  3312. }
  3313. sql += " where F_WorkOrderId='" + strworkorderid + "' and F_State=0 and F_IsDelete=0 and F_CreateUser=" + userModel.F_UserCode + " order by F_CreateTime desc";
  3314. var dt = DbHelperSQL.Query(sql).Tables[0];
  3315. if (dt.Rows.Count > 0)
  3316. {
  3317. #region 附件
  3318. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3319. if (!string.IsNullOrEmpty(configfj.F_ParamValue))
  3320. {
  3321. BindFileData(dt, configfj.F_ParamValue);
  3322. }
  3323. #endregion
  3324. }
  3325. return Success("获取成功", dt);
  3326. }
  3327. else
  3328. {
  3329. return Error("参数传输失败");
  3330. }
  3331. }
  3332. /// <summary>
  3333. /// 获取审核信息
  3334. /// </summary>
  3335. /// <returns></returns>
  3336. [Authority]
  3337. public ActionResult GetAuditInfo()
  3338. {
  3339. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3340. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3341. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3342. int type = RequestString.GetInt("type", 0);//1退回信息2延时信息
  3343. if (!string.IsNullOrEmpty(strworkorderid) && type != 0)
  3344. {
  3345. string sql = string.Empty;
  3346. switch (type)
  3347. {
  3348. case 1: sql = "select top 1 * from T_Bus_Feedback where F_Type=3 and"; break;
  3349. case 2: sql = "select top 1 * from T_Bus_DelayTime where"; break;
  3350. }
  3351. sql += " F_WorkOrderId='" + strworkorderid + "' and F_State=1 and F_IsDelete=0 and F_IsAudit=0 order by F_CreateTime desc";
  3352. var dt = DbHelperSQL.Query(sql).Tables[0];
  3353. if (dt.Rows.Count > 0)
  3354. {
  3355. #region 附件
  3356. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3357. if (!string.IsNullOrEmpty(configfj.F_ParamValue))
  3358. {
  3359. BindFileData(dt, configfj.F_ParamValue);
  3360. }
  3361. #endregion
  3362. }
  3363. return Success("获取成功", dt);
  3364. }
  3365. else
  3366. {
  3367. return Error("参数传输失败");
  3368. }
  3369. }
  3370. /// <summary>
  3371. /// 获取所有交办单位
  3372. /// </summary>
  3373. /// <returns></returns>
  3374. [Authority]
  3375. public ActionResult GetAllAssignDept()
  3376. {
  3377. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3378. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3379. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3380. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(strworkorderid);
  3381. if (modelT_Bus_WorkOrder != null)
  3382. {
  3383. string ids = string.Empty;
  3384. var Assigns = assignBLL.GetModelList(" F_WorkOrderId='" + strworkorderid + "' and F_IsDelete=0 and F_IsSure in (0,1,2) ");
  3385. foreach (var assign in Assigns)
  3386. {
  3387. if (string.IsNullOrEmpty(ids))
  3388. {
  3389. ids = assign.F_MainDeptId.Value.ToString();
  3390. if (!string.IsNullOrEmpty(assign.F_OtherDeptIds))
  3391. {
  3392. ids += "," + assign.F_OtherDeptIds;
  3393. }
  3394. }
  3395. else
  3396. {
  3397. ids += ","+ assign.F_MainDeptId.Value.ToString();
  3398. if (!string.IsNullOrEmpty(assign.F_OtherDeptIds))
  3399. {
  3400. ids += "," + assign.F_OtherDeptIds;
  3401. }
  3402. }
  3403. }
  3404. if (string.IsNullOrEmpty(ids))
  3405. {
  3406. ids = "0";
  3407. }
  3408. var dt = new BLL.T_Sys_Department().GetModelList(" F_DeptId in ( " + ids + " ) ");
  3409. return Success("获取成功", dt);
  3410. }
  3411. else
  3412. {
  3413. return Error("操作失败");
  3414. }
  3415. }
  3416. /// <summary>
  3417. /// 获取二级单位处理信息
  3418. /// </summary>
  3419. /// <returns></returns>
  3420. [Authority]
  3421. public ActionResult GetSecondDealInfo()
  3422. {
  3423. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3424. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3425. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3426. if (!string.IsNullOrEmpty(strworkorderid))
  3427. {
  3428. //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, ";
  3429. //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, ";
  3430. //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, ";
  3431. //sql += " fn.F_Result, fn.F_CreateDeptId, fn.F_IsFeedEnd, fn.F_IsAudit, fn.F_AuditUser, fn.F_AuditTime, fn.F_AuditReason ";
  3432. //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";
  3433. //sql += " where an.F_WorkOrderId='" + strworkorderid + "' order by F_CreateTime desc";
  3434. //var dt = DbHelperSQL.Query(sql).Tables[0];
  3435. string sql = "select top 1 * from T_Bus_AssignedInfo_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 order by F_CreateTime desc";
  3436. string sql1 = "select * from T_Bus_Feedback_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 ";
  3437. var bldt = DbHelperSQL.Query(sql1).Tables[0];
  3438. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3439. if (configfj != null)
  3440. {
  3441. bldt = BindFileData(bldt, configfj.F_ParamValue);
  3442. }
  3443. var obj = new
  3444. {
  3445. pdinfo = DbHelperSQL.Query(sql).Tables[0],
  3446. fkinfo = bldt
  3447. };
  3448. return Success("获取成功", obj);
  3449. }
  3450. else
  3451. {
  3452. return Error("参数传输失败");
  3453. }
  3454. }
  3455. /// <summary>
  3456. /// 获取二级单位最新处理信息
  3457. /// </summary>
  3458. /// <returns></returns>
  3459. [Authority]
  3460. public ActionResult GetNewSecondDealInfo()
  3461. {
  3462. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3463. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3464. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3465. if (!string.IsNullOrEmpty(strworkorderid))
  3466. {
  3467. string sql = "select top 1 * from T_Bus_Feedback_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 order by F_CreateTime desc";
  3468. var bldt = DbHelperSQL.Query(sql).Tables[0];
  3469. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3470. if (configfj != null)
  3471. {
  3472. bldt = BindFileData(bldt, configfj.F_ParamValue);
  3473. }
  3474. return Success("获取成功", bldt);
  3475. }
  3476. else
  3477. {
  3478. return Error("参数传输失败");
  3479. }
  3480. }
  3481. #endregion
  3482. #region 新增工单
  3483. /// <summary>
  3484. /// 上传附件
  3485. /// </summary>
  3486. /// <returns></returns>
  3487. [Authority]
  3488. public ActionResult UploadFile()
  3489. {
  3490. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3491. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3492. #region 单个上传 no use
  3493. //string path = string.Empty;
  3494. //HttpPostedFile _upfile = RequestString.GetFile("upFile");
  3495. //if (_upfile != null)
  3496. //{
  3497. // //byte[] buffer = new Byte[(int)_upfile.InputStream.Length]; //声明文件长度的二进制类型
  3498. // //_upfile.InputStream.Read(buffer, 0, buffer.Length); //将文件转成二进制
  3499. // string name = string.Empty;
  3500. // FileUp fu = new FileUp();
  3501. // var model = configBll.GetModelList(" F_ParamCode='FilePath' ").FirstOrDefault();
  3502. // if (model != null)
  3503. // {
  3504. // name = fu.Upload(_upfile, model.F_ParamValue);
  3505. // Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
  3506. // model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
  3507. // model_T_Sys_Accessories.F_FileName = name;//附件名称
  3508. // model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(_upfile.FileName);//附件类型
  3509. // model_T_Sys_Accessories.F_FileUrl = model.F_ParamValue + name;//附件地址
  3510. // model_T_Sys_Accessories.F_Size = _upfile.ContentLength;
  3511. // model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
  3512. // int p_fuId = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
  3513. // return Success("成功", model_T_Sys_Accessories);
  3514. // }
  3515. // else
  3516. // {
  3517. // return Error("上传失败");
  3518. // }
  3519. //}
  3520. //else
  3521. //{
  3522. // return Error("请选择要上传的文件");
  3523. //}
  3524. #endregion
  3525. #region 多个上传
  3526. HttpFileCollection files = RequestString.GetFiles();
  3527. if (files.Count > 0)
  3528. {
  3529. List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
  3530. string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
  3531. for (int i = 0; i < files.Count; i++)
  3532. {
  3533. HttpPostedFile file = files[i];
  3534. FileUp fu = new FileUp();
  3535. string name = fu.Upload(file, path);
  3536. Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
  3537. model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
  3538. model_T_Sys_Accessories.F_FileName = name;//附件名称
  3539. model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
  3540. model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
  3541. model_T_Sys_Accessories.F_Size = file.ContentLength;
  3542. model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
  3543. int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
  3544. model_T_Sys_Accessories.F_FileId = id;
  3545. acs.Add(model_T_Sys_Accessories);
  3546. }
  3547. return Success("成功", acs);
  3548. }
  3549. else
  3550. {
  3551. return Error("请选择要上传的文件");
  3552. }
  3553. #endregion
  3554. }
  3555. /// <summary>
  3556. /// 添加工单信息
  3557. /// </summary>
  3558. /// <returns></returns>
  3559. [Authority]
  3560. public ActionResult AddWorkOrder()
  3561. {
  3562. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3563. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3564. // 15:01 2019/10/9 中心领导 和 中心领导管理员 添加工单的权限 - 永城市12345修改
  3565. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY" )//|| userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY")
  3566. {
  3567. int source = RequestString.GetInt("source", 0);
  3568. string cusname = RequestString.GetFormString("cusname");
  3569. string cussex = RequestString.GetFormString("cussex");
  3570. string cusphone = RequestString.GetFormString("cusphone");
  3571. string cusaddress = RequestString.GetFormString("cusaddress");
  3572. string email = RequestString.GetFormString("email");
  3573. string zipcode = RequestString.GetFormString("zipcode");
  3574. string conname = RequestString.GetFormString("conname");
  3575. string conphone = RequestString.GetFormString("conphone");
  3576. string title = RequestString.GetFormString("title");
  3577. string content = RequestString.GetFormString("content");
  3578. string files = RequestString.GetFormString("files");
  3579. int sourcearea = RequestString.GetInt("sourcearea", 0);
  3580. string sourceaddress = RequestString.GetFormString("sourceaddress");
  3581. int isresult = RequestString.GetInt("isresult", 0);
  3582. string result = RequestString.GetFormString("result");
  3583. string keys = RequestString.GetFormString("keys");
  3584. string splituser = RequestString.GetFormString("splituser");
  3585. int type = RequestString.GetInt("type", 0);
  3586. int bigtype = RequestString.GetInt("bigtype", 0);
  3587. int smalltype = RequestString.GetInt("smalltype", 0);
  3588. int isprotect = RequestString.GetInt("isprotect", 0);
  3589. int level = RequestString.GetInt("level", 0);
  3590. int issubmit = RequestString.GetInt("issubmit", 0);
  3591. string callid = RequestString.GetFormString("callid");
  3592. using (TransactionScope trans = new TransactionScope())
  3593. {
  3594. #region 保存工单信息
  3595. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
  3596. modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(userModel.F_UserCode);
  3597. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  3598. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  3599. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  3600. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  3601. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  3602. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  3603. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  3604. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  3605. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  3606. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  3607. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  3608. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  3609. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  3610. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  3611. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  3612. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  3613. modelT_Bus_WorkOrder.F_File = files;//附件
  3614. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  3615. modelT_Bus_WorkOrder.F_Key = keys;
  3616. modelT_Bus_WorkOrder.F_SplitUser = splituser;
  3617. modelT_Bus_WorkOrder.F_Level = level;
  3618. //是否直办(即时答复)0:,否1: 是
  3619. modelT_Bus_WorkOrder.F_IsResult = isresult;
  3620. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  3621. modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
  3622. modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
  3623. modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
  3624. modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
  3625. modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
  3626. modelT_Bus_WorkOrder.F_IsDelete = 0;//是否删除(0:否,1:是)
  3627. //如果选择即刻答复:是,即为直办,工单结束
  3628. if (isresult == 1)
  3629. {
  3630. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  3631. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  3632. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  3633. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  3634. modelT_Bus_WorkOrder.F_IsClosed = 1;
  3635. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  3636. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  3637. }
  3638. else if (issubmit == 1)
  3639. {
  3640. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  3641. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  3642. }
  3643. if (!string.IsNullOrEmpty(callid))
  3644. {
  3645. modelT_Bus_WorkOrder.F_CallId = callid;
  3646. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  3647. if (rd != null)
  3648. {
  3649. rd.IsExitWorkOrder = true;
  3650. new BLL.T_Call_CallRecords().Update(rd);
  3651. modelT_Bus_WorkOrder.F_CallRecordId = rd.CallRecordsId;
  3652. }
  3653. }
  3654. workorderBLL.Add(modelT_Bus_WorkOrder);
  3655. #endregion
  3656. #region 插入操作记录
  3657. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  3658. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  3659. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  3660. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  3661. oper.F_File = modelT_Bus_WorkOrder.F_File;
  3662. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  3663. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  3664. {
  3665. oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3666. }
  3667. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  3668. {
  3669. oper.F_Message = userinfo + " 登记并提交了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3670. }
  3671. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  3672. {
  3673. oper.F_Message = userinfo + " 登记并结案了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3674. }
  3675. oper.F_CreateUser = userModel.F_UserCode;
  3676. oper.F_CreateTime = DateTime.Now;
  3677. oper.F_IsDelete = 0;
  3678. operBLL.Add(oper);
  3679. //推送消息表
  3680. if (modelT_Bus_WorkOrder.F_WorkState != 0)
  3681. {
  3682. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  3683. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  3684. foreach (var u in users)
  3685. {
  3686. msg.AddInternalMessagesInfo("工单消息", oper.F_Message, u.F_UserCode, userModel.F_UserCode);
  3687. }
  3688. }
  3689. #endregion
  3690. trans.Complete();
  3691. }
  3692. return Success("操作成功");
  3693. }
  3694. else
  3695. {
  3696. return Error("权限不足");
  3697. }
  3698. }
  3699. /// <summary>
  3700. /// 添加工单信息
  3701. /// </summary>
  3702. /// <returns></returns>
  3703. public string AddWorkOrderBySource(int source, string cusname, string cussex, string cusphone, string cusaddress, string email,
  3704. string zipcode, string conname, string conphone, string title, string content, int sourcearea, string sourceaddress,
  3705. string keys, string splituser, int type, int bigtype, int smalltype, int isprotect, int level, string files=null)
  3706. {
  3707. string workorderid = string.Empty;
  3708. using (TransactionScope trans = new TransactionScope())
  3709. {
  3710. #region 保存工单信息
  3711. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
  3712. modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(source.ToString().PadLeft(4, '0'));
  3713. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  3714. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  3715. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  3716. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  3717. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  3718. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  3719. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  3720. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  3721. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  3722. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  3723. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  3724. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  3725. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  3726. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  3727. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  3728. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  3729. modelT_Bus_WorkOrder.F_File = files;//附件
  3730. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  3731. modelT_Bus_WorkOrder.F_Key = keys;
  3732. modelT_Bus_WorkOrder.F_SplitUser = splituser;
  3733. modelT_Bus_WorkOrder.F_Level = level;
  3734. //modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
  3735. modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
  3736. modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
  3737. modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
  3738. modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
  3739. modelT_Bus_WorkOrder.F_IsDelete = 1;//是否删除(0:否,1:是)
  3740. modelT_Bus_WorkOrder.F_IsEnabled = 0;//是否处理
  3741. workorderBLL.Add(modelT_Bus_WorkOrder);
  3742. workorderid = modelT_Bus_WorkOrder.F_WorkOrderId;
  3743. #endregion
  3744. #region 插入操作记录
  3745. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  3746. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  3747. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  3748. string userinfo = "";
  3749. var sourceinfo = new BLL.T_Sys_DictionaryValue().GetModel(source);
  3750. if (sourceinfo != null) { userinfo = "由 " + sourceinfo.F_Value; }
  3751. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  3752. {
  3753. oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3754. }
  3755. //oper.F_CreateUser = userModel.F_UserCode;
  3756. oper.F_CreateTime = DateTime.Now;
  3757. oper.F_IsDelete = 0;
  3758. operBLL.Add(oper);
  3759. #endregion
  3760. trans.Complete();
  3761. }
  3762. return workorderid;
  3763. }
  3764. /// <summary>
  3765. /// 添加工单信息留言
  3766. /// </summary>
  3767. /// <returns></returns>
  3768. [Authority]
  3769. public ActionResult AddWorkOrderByLY()
  3770. {
  3771. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3772. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3773. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  3774. {
  3775. int source = RequestString.GetInt("source", 0);
  3776. string cusname = RequestString.GetFormString("cusname");
  3777. string cussex = RequestString.GetFormString("cussex");
  3778. string cusphone = RequestString.GetFormString("cusphone");
  3779. string cusaddress = RequestString.GetFormString("cusaddress");
  3780. string email = RequestString.GetFormString("email");
  3781. string zipcode = RequestString.GetFormString("zipcode");
  3782. string conname = RequestString.GetFormString("conname");
  3783. string conphone = RequestString.GetFormString("conphone");
  3784. string title = RequestString.GetFormString("title");
  3785. string content = RequestString.GetFormString("content");
  3786. string files = RequestString.GetFormString("files");
  3787. int sourcearea = RequestString.GetInt("sourcearea", 0);
  3788. string sourceaddress = RequestString.GetFormString("sourceaddress");
  3789. int isresult = RequestString.GetInt("isresult", 0);
  3790. string result = RequestString.GetFormString("result");
  3791. string keys = RequestString.GetFormString("keys");
  3792. string splituser = RequestString.GetFormString("splituser");
  3793. int type = RequestString.GetInt("type", 0);
  3794. int bigtype = RequestString.GetInt("bigtype", 0);
  3795. int smalltype = RequestString.GetInt("smalltype", 0);
  3796. int isprotect = RequestString.GetInt("isprotect", 0);
  3797. int level = RequestString.GetInt("level", 0);
  3798. int issubmit = RequestString.GetInt("issubmit", 0);
  3799. int lyid = RequestString.GetInt("lyid", 0);
  3800. using (TransactionScope trans = new TransactionScope())
  3801. {
  3802. #region 保存工单信息
  3803. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
  3804. modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(userModel.F_UserCode);
  3805. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  3806. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  3807. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  3808. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  3809. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  3810. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  3811. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  3812. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  3813. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  3814. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  3815. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  3816. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  3817. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  3818. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  3819. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  3820. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  3821. modelT_Bus_WorkOrder.F_File = files;//附件
  3822. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  3823. modelT_Bus_WorkOrder.F_Key = keys;
  3824. modelT_Bus_WorkOrder.F_Level = level;
  3825. //是否直办(即时答复)0:,否1: 是
  3826. modelT_Bus_WorkOrder.F_IsResult = isresult;
  3827. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  3828. modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
  3829. modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
  3830. modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
  3831. modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
  3832. modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
  3833. modelT_Bus_WorkOrder.F_IsDelete = 0;//是否删除(0:否,1:是)
  3834. //如果选择即刻答复:是,即为直办,工单结束
  3835. if (isresult == 1)
  3836. {
  3837. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  3838. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  3839. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  3840. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  3841. modelT_Bus_WorkOrder.F_IsClosed = 1;
  3842. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  3843. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  3844. }
  3845. else if (issubmit == 1)
  3846. {
  3847. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  3848. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  3849. }
  3850. if (lyid != 0)
  3851. {
  3852. var rd = new BLL.T_Call_LeaveRecord().GetModel(lyid);
  3853. if (rd != null)
  3854. {
  3855. rd.F_Status = 1;
  3856. rd.F_DealTime = DateTime.Now;
  3857. rd.F_UserCode = userModel.F_UserCode;
  3858. rd.F_UserName = userModel.F_UserName;
  3859. rd.F_UserId= userModel.F_UserId;
  3860. new BLL.T_Call_LeaveRecord().Update(rd);
  3861. modelT_Bus_WorkOrder.F_LeaveRecordId = rd.F_Id;
  3862. }
  3863. }
  3864. workorderBLL.Add(modelT_Bus_WorkOrder);
  3865. #endregion
  3866. #region 插入操作记录
  3867. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  3868. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  3869. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  3870. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  3871. oper.F_File = modelT_Bus_WorkOrder.F_File;
  3872. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  3873. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  3874. {
  3875. oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3876. }
  3877. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  3878. {
  3879. oper.F_Message = userinfo + " 登记并提交了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3880. }
  3881. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  3882. {
  3883. oper.F_Message = userinfo + " 登记并结案了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3884. }
  3885. oper.F_CreateUser = userModel.F_UserCode;
  3886. oper.F_CreateTime = DateTime.Now;
  3887. oper.F_IsDelete = 0;
  3888. operBLL.Add(oper);
  3889. //推送消息表
  3890. if (modelT_Bus_WorkOrder.F_WorkState != 0)
  3891. {
  3892. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  3893. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  3894. foreach (var u in users)
  3895. {
  3896. msg.AddInternalMessagesInfo("工单消息", oper.F_Message, u.F_UserCode, userModel.F_UserCode);
  3897. }
  3898. }
  3899. #endregion
  3900. trans.Complete();
  3901. }
  3902. return Success("操作成功");
  3903. }
  3904. else
  3905. {
  3906. return Error("权限不足");
  3907. }
  3908. }
  3909. /// <summary>
  3910. /// 添加工单信息
  3911. /// </summary>
  3912. /// <returns></returns>
  3913. [Authority]
  3914. public ActionResult AddWorkOrderByAPP()
  3915. {
  3916. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3917. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3918. int source = RequestString.GetInt("source", 6);
  3919. string cusname = RequestString.GetFormString("cusname");
  3920. string cussex = RequestString.GetFormString("cussex");
  3921. string cusphone = RequestString.GetFormString("cusphone");
  3922. string cusaddress = RequestString.GetFormString("cusaddress");
  3923. string email = RequestString.GetFormString("email");
  3924. string zipcode = RequestString.GetFormString("zipcode");
  3925. string conname = RequestString.GetFormString("conname");
  3926. string conphone = RequestString.GetFormString("conphone");
  3927. string title = RequestString.GetFormString("title");
  3928. string content = RequestString.GetFormString("content");
  3929. string files = RequestString.GetFormString("files");
  3930. int sourcearea = RequestString.GetInt("sourcearea", 0);
  3931. string sourceaddress = RequestString.GetFormString("sourceaddress");
  3932. int isresult = RequestString.GetInt("isresult", 0);
  3933. string result = RequestString.GetFormString("result");
  3934. string keys = RequestString.GetFormString("keys");
  3935. string splituser = RequestString.GetFormString("splituser");
  3936. int type = RequestString.GetInt("type", 0);
  3937. int bigtype = RequestString.GetInt("bigtype", 0);
  3938. int smalltype = RequestString.GetInt("smalltype", 0);
  3939. int isprotect = RequestString.GetInt("isprotect", 0);
  3940. int level = RequestString.GetInt("level", 0);
  3941. string workorderid = AddWorkOrderBySource(6, cusname, cussex, cusphone, cusaddress, email, zipcode, conname,
  3942. conphone, title, content, sourcearea, sourceaddress, keys, splituser, type, bigtype, smalltype, isprotect, level);
  3943. if (!string.IsNullOrEmpty(workorderid))
  3944. {
  3945. using (TransactionScope trans = new TransactionScope())
  3946. {
  3947. #region 保存用户工单信息
  3948. var model = new BLL.T_Sys_Users().GetModel(userModel.F_UserCode);
  3949. if (model == null)
  3950. {
  3951. model = new Model.T_Sys_Users();
  3952. model.F_OpenId = userModel.F_UserCode;
  3953. model.F_Type = 3;
  3954. model.F_CreateTime = DateTime.Now;
  3955. model.F_Id=new BLL.T_Sys_Users().Add(model);
  3956. }
  3957. Model.T_Bus_UserWorkOrder tbu = new Model.T_Bus_UserWorkOrder();
  3958. tbu.F_UserId = model.F_Id;
  3959. tbu.F_WorkOrderId = workorderid;
  3960. new BLL.T_Bus_UserWorkOrder().Add(tbu);
  3961. #endregion
  3962. trans.Complete();
  3963. }
  3964. return Success("操作成功");
  3965. }
  3966. else
  3967. {
  3968. return Error("操作失败");
  3969. }
  3970. }
  3971. #endregion
  3972. #region 操作工单
  3973. /// <summary>
  3974. /// 修改工单信息
  3975. /// </summary>
  3976. /// <returns></returns>
  3977. [Authority]
  3978. public ActionResult EditWorkOrder()
  3979. {
  3980. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3981. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3982. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  3983. {
  3984. string workorderid = RequestString.GetFormString("workorderid");
  3985. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  3986. if (modelT_Bus_WorkOrder != null && (modelT_Bus_WorkOrder.F_WorkState == 1 || modelT_Bus_WorkOrder.F_WorkState == 0))
  3987. {
  3988. int source = RequestString.GetInt("source", 0);
  3989. string cusname = RequestString.GetFormString("cusname");
  3990. string cussex = RequestString.GetFormString("cussex");
  3991. string cusphone = RequestString.GetFormString("cusphone");
  3992. string cusaddress = RequestString.GetFormString("cusaddress");
  3993. string email = RequestString.GetFormString("email");
  3994. string zipcode = RequestString.GetFormString("zipcode");
  3995. string conname = RequestString.GetFormString("conname");
  3996. string conphone = RequestString.GetFormString("conphone");
  3997. string title = RequestString.GetFormString("title");
  3998. string content = RequestString.GetFormString("content");
  3999. string files = RequestString.GetFormString("files");
  4000. int sourcearea = RequestString.GetInt("sourcearea", 0);
  4001. string sourceaddress = RequestString.GetFormString("sourceaddress");
  4002. int isresult = RequestString.GetInt("isresult", 0);
  4003. string result = RequestString.GetFormString("result");
  4004. string keys = RequestString.GetFormString("keys");
  4005. string splituser = RequestString.GetFormString("splituser");
  4006. int type = RequestString.GetInt("type", 0);
  4007. int bigtype = RequestString.GetInt("bigtype", 0);
  4008. int smalltype = RequestString.GetInt("smalltype", 0);
  4009. int isprotect = RequestString.GetInt("isprotect", 0);
  4010. int level = RequestString.GetInt("level", 0);
  4011. int issubmit = RequestString.GetInt("issubmit", 0);
  4012. using (TransactionScope trans = new TransactionScope())
  4013. {
  4014. #region 保存工单信息
  4015. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  4016. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  4017. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  4018. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  4019. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  4020. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  4021. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  4022. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  4023. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  4024. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  4025. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  4026. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  4027. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  4028. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  4029. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  4030. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  4031. modelT_Bus_WorkOrder.F_File = files;//附件
  4032. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  4033. modelT_Bus_WorkOrder.F_Key = keys;
  4034. modelT_Bus_WorkOrder.F_Level = level;
  4035. //是否直办(即时答复)0:,否1: 是
  4036. modelT_Bus_WorkOrder.F_IsResult = isresult;
  4037. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  4038. //如果选择即刻答复:是,即为直办,工单结束
  4039. if (isresult == 1)
  4040. {
  4041. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  4042. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  4043. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  4044. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  4045. modelT_Bus_WorkOrder.F_IsClosed = 1;
  4046. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  4047. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  4048. }
  4049. else if (issubmit == 1)
  4050. {
  4051. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4052. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  4053. }
  4054. workorderBLL.Update(modelT_Bus_WorkOrder);
  4055. #endregion
  4056. #region 插入操作记录
  4057. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4058. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4059. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4060. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  4061. oper.F_File = modelT_Bus_WorkOrder.F_File;
  4062. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4063. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4064. {
  4065. oper.F_Message = userinfo + " 修改了工单";
  4066. }
  4067. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4068. {
  4069. oper.F_Message = userinfo + " 修改并提交了工单";
  4070. }
  4071. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  4072. {
  4073. oper.F_Message = userinfo + " 修改并结案了工单";
  4074. }
  4075. oper.F_CreateUser = userModel.F_UserCode;
  4076. oper.F_CreateTime = DateTime.Now;
  4077. oper.F_IsDelete = 0;
  4078. operBLL.Add(oper);
  4079. //推送消息表
  4080. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4081. {
  4082. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4083. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4084. foreach (var u in users)
  4085. {
  4086. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4087. }
  4088. }
  4089. #endregion
  4090. trans.Complete();
  4091. }
  4092. return Success("操作成功");
  4093. }
  4094. else
  4095. {
  4096. return Error("操作失败");
  4097. }
  4098. }
  4099. else
  4100. {
  4101. return Success("权限不足");
  4102. }
  4103. }
  4104. /// <summary>
  4105. /// 修改工单信息
  4106. /// </summary>
  4107. /// <returns></returns>
  4108. [Authority]
  4109. public ActionResult EditWorkOrderBySource()
  4110. {
  4111. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4112. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4113. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  4114. {
  4115. string workorderid = RequestString.GetFormString("workorderid");
  4116. int source = RequestString.GetInt("source", 0);
  4117. string cusname = RequestString.GetFormString("cusname");
  4118. string cussex = RequestString.GetFormString("cussex");
  4119. string cusphone = RequestString.GetFormString("cusphone");
  4120. string cusaddress = RequestString.GetFormString("cusaddress");
  4121. string email = RequestString.GetFormString("email");
  4122. string zipcode = RequestString.GetFormString("zipcode");
  4123. string conname = RequestString.GetFormString("conname");
  4124. string conphone = RequestString.GetFormString("conphone");
  4125. string title = RequestString.GetFormString("title");
  4126. string content = RequestString.GetFormString("content");
  4127. string files = RequestString.GetFormString("files");
  4128. int sourcearea = RequestString.GetInt("sourcearea", 0);
  4129. string sourceaddress = RequestString.GetFormString("sourceaddress");
  4130. int isresult = RequestString.GetInt("isresult", 0);
  4131. string result = RequestString.GetFormString("result");
  4132. string keys = RequestString.GetFormString("keys");
  4133. string splituser = RequestString.GetFormString("splituser");
  4134. int type = RequestString.GetInt("type", 0);
  4135. int bigtype = RequestString.GetInt("bigtype", 0);
  4136. int smalltype = RequestString.GetInt("smalltype", 0);
  4137. int isprotect = RequestString.GetInt("isprotect", 0);
  4138. int level = RequestString.GetInt("level", 0);
  4139. int issubmit = RequestString.GetInt("issubmit", 0);
  4140. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4141. if (modelT_Bus_WorkOrder != null)
  4142. {
  4143. using (TransactionScope trans = new TransactionScope())
  4144. {
  4145. #region 保存工单信息
  4146. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  4147. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  4148. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  4149. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  4150. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  4151. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  4152. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  4153. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  4154. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  4155. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  4156. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  4157. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  4158. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  4159. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  4160. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  4161. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  4162. modelT_Bus_WorkOrder.F_File = files;//附件
  4163. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  4164. modelT_Bus_WorkOrder.F_Key = keys;
  4165. modelT_Bus_WorkOrder.F_Level = level;
  4166. //是否直办(即时答复)0:,否1: 是
  4167. modelT_Bus_WorkOrder.F_IsResult = isresult;
  4168. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  4169. //如果选择即刻答复:是,即为直办,工单结束
  4170. if (isresult == 1)
  4171. {
  4172. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  4173. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  4174. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  4175. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  4176. modelT_Bus_WorkOrder.F_IsClosed = 1;
  4177. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  4178. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  4179. }
  4180. else if (issubmit == 1)
  4181. {
  4182. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4183. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  4184. }
  4185. modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;
  4186. modelT_Bus_WorkOrder.F_IsEnabled = 1;
  4187. modelT_Bus_WorkOrder.F_EnableTime = DateTime.Now;
  4188. modelT_Bus_WorkOrder.F_IsDelete = 0;
  4189. workorderBLL.Update(modelT_Bus_WorkOrder);
  4190. #endregion
  4191. #region 保存转单记录
  4192. Model.T_Bus_CityTurn modelT_Bus_CityTurn = new BLL.T_Bus_CityTurn().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
  4193. if (modelT_Bus_CityTurn != null && modelT_Bus_CityTurn.F_IsSure == 0)
  4194. {
  4195. modelT_Bus_CityTurn.F_IsSure = 1;
  4196. modelT_Bus_CityTurn.F_SureUser = userModel.F_UserCode;
  4197. modelT_Bus_CityTurn.F_SureTime = DateTime.Now;
  4198. new BLL.T_Bus_CityTurn().Update(modelT_Bus_CityTurn);
  4199. }
  4200. #endregion
  4201. #region 插入操作记录
  4202. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4203. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4204. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4205. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  4206. oper.F_File = modelT_Bus_WorkOrder.F_File;
  4207. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4208. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4209. {
  4210. oper.F_Message = userinfo + " 处理了工单";
  4211. }
  4212. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4213. {
  4214. oper.F_Message = userinfo + " 处理并提交了工单";
  4215. }
  4216. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  4217. {
  4218. oper.F_Message = userinfo + " 处理并结案了工单";
  4219. }
  4220. oper.F_CreateUser = userModel.F_UserCode;
  4221. oper.F_CreateTime = DateTime.Now;
  4222. oper.F_IsDelete = 0;
  4223. operBLL.Add(oper);
  4224. //推送消息表
  4225. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4226. {
  4227. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4228. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4229. foreach (var u in users)
  4230. {
  4231. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4232. }
  4233. }
  4234. #endregion
  4235. trans.Complete();
  4236. }
  4237. return Success("操作成功");
  4238. }
  4239. else
  4240. {
  4241. return Error("操作失败");
  4242. }
  4243. }
  4244. else
  4245. {
  4246. return Success("权限不足");
  4247. }
  4248. }
  4249. /// <summary>
  4250. /// 提交工单
  4251. /// </summary>
  4252. /// <param name="ids"></param>
  4253. /// <returns></returns>
  4254. [Authority]
  4255. public ActionResult SubmitWorkOrder(string[] ids)
  4256. {
  4257. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4258. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4259. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  4260. {
  4261. if (ids != null && ids.Length > 0)
  4262. {
  4263. foreach (string str in ids)
  4264. {
  4265. using (TransactionScope trans = new TransactionScope())
  4266. {
  4267. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(str);
  4268. if (modelT_Bus_WorkOrder != null)
  4269. {
  4270. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4271. {
  4272. #region 保存工单信息
  4273. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4274. modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
  4275. workorderBLL.Update(modelT_Bus_WorkOrder);
  4276. #endregion
  4277. #region 插入操作记录
  4278. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4279. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4280. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4281. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4282. oper.F_Message = userinfo + " 提交了工单";
  4283. oper.F_CreateUser = userModel.F_UserCode;
  4284. oper.F_CreateTime = DateTime.Now;
  4285. oper.F_IsDelete = 0;
  4286. operBLL.Add(oper);
  4287. //推送消息表
  4288. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4289. {
  4290. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4291. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4292. foreach (var u in users)
  4293. {
  4294. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4295. }
  4296. }
  4297. #endregion
  4298. }
  4299. }
  4300. trans.Complete();
  4301. }
  4302. }
  4303. return Success("操作成功");
  4304. }
  4305. else
  4306. {
  4307. return Error("操作失败");
  4308. }
  4309. }
  4310. else
  4311. {
  4312. return Error("权限不足");
  4313. }
  4314. }
  4315. /// <summary>
  4316. /// 回退工单
  4317. /// </summary>
  4318. /// <returns></returns>
  4319. [Authority]
  4320. public ActionResult ReturnWorkOrder()
  4321. {
  4322. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4323. Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
  4324. string workorderid = RequestString.GetFormString("workorderid");
  4325. string backuser = RequestString.GetFormString("backuser");
  4326. string backreason = RequestString.GetFormString("backreason");
  4327. string files = RequestString.GetFormString("files");
  4328. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
  4329. if (modelT_Bus_WorkOrder != null)
  4330. {
  4331. if (modelT_Bus_WorkOrder.F_WorkState == 1 || (modelT_Bus_WorkOrder.F_WorkState == 9 && modelT_Bus_WorkOrder.F_IsResult==1))
  4332. {
  4333. using (TransactionScope trans = new TransactionScope())
  4334. {
  4335. #region 保存工单信息
  4336. modelT_Bus_WorkOrder.F_WorkState = 0;
  4337. modelT_Bus_WorkOrder.F_IsResult = 0;
  4338. modelT_Bus_WorkOrder.F_IsReturn = 1;
  4339. modelT_Bus_WorkOrder.F_LimitTime = null;
  4340. modelT_Bus_WorkOrder.F_IsOverdue = 0;
  4341. modelT_Bus_WorkOrder.F_MainDeptId = null;
  4342. modelT_Bus_WorkOrder.F_OtherDeptIds = "";
  4343. modelT_Bus_WorkOrder.F_DealDeptId = null;
  4344. modelT_Bus_WorkOrder.F_DealUser = "";
  4345. modelT_Bus_WorkOrder.F_DealTime = null;
  4346. modelT_Bus_WorkOrder.F_AssignUser= userModel.F_UserCode;
  4347. modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
  4348. workorderBLL.Update(modelT_Bus_WorkOrder);
  4349. #endregion
  4350. #region 插入批示记录
  4351. //批示记录
  4352. Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new Model.T_Bus_SubmitSuper();
  4353. model_T_Bus_SubmitSuper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
  4354. model_T_Bus_SubmitSuper.F_Type = 3;//1领导批示 2市长指示 3回退
  4355. model_T_Bus_SubmitSuper.F_BatchReason = backuser;//批示人
  4356. model_T_Bus_SubmitSuper.F_SuperOpinion = backreason;//批示内容
  4357. model_T_Bus_SubmitSuper.F_File = files;//附件
  4358. model_T_Bus_SubmitSuper.F_CreateUser = userModel.F_UserCode;//呈批人
  4359. model_T_Bus_SubmitSuper.F_CreateTime = DateTime.Now;//呈批时间
  4360. model_T_Bus_SubmitSuper.F_IsDelete = 0;
  4361. model_T_Bus_SubmitSuper.F_State = 1;//审批状态(0:未处理,1:通过)
  4362. new BLL.T_Bus_SubmitSuper().Add(model_T_Bus_SubmitSuper);
  4363. #endregion
  4364. #region 插入操作记录
  4365. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4366. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4367. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4368. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4369. oper.F_Message = userinfo + " 回退了工单";
  4370. oper.F_CreateUser = userModel.F_UserCode;
  4371. oper.F_CreateTime = DateTime.Now;
  4372. oper.F_IsDelete = 0;
  4373. operBLL.Add(oper);
  4374. #endregion
  4375. trans.Complete();
  4376. }
  4377. return Success("操作成功");
  4378. }
  4379. else
  4380. {
  4381. return Error("已经处理过了");
  4382. }
  4383. }
  4384. else
  4385. {
  4386. return Error("操作失败");
  4387. }
  4388. }
  4389. /// <summary>
  4390. /// 领导批示/市长指示
  4391. /// </summary>
  4392. /// <param name="ids"></param>
  4393. /// <returns></returns>
  4394. [Authority]
  4395. public ActionResult SuperWorkOrder()
  4396. {
  4397. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4398. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4399. string workorderid = RequestString.GetFormString("workorderid");
  4400. int type = RequestString.GetInt("type", 0);//1领导批示 2市长指示
  4401. string superuser = RequestString.GetFormString("superuser");
  4402. string superopinion = RequestString.GetFormString("superopinion");
  4403. string files = RequestString.GetFormString("files");
  4404. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4405. if (modelT_Bus_WorkOrder != null)
  4406. {
  4407. using (TransactionScope trans = new TransactionScope())
  4408. {
  4409. #region 保存工单信息 no use
  4410. //modelT_Bus_WorkOrder.F_WorkState = 2;//领导批示
  4411. //workorderBLL.Update(modelT_Bus_WorkOrder);
  4412. #endregion
  4413. #region 插入批示记录
  4414. //批示记录
  4415. Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new Model.T_Bus_SubmitSuper();
  4416. model_T_Bus_SubmitSuper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
  4417. model_T_Bus_SubmitSuper.F_Type = type;//1领导批示 2市长指示
  4418. model_T_Bus_SubmitSuper.F_BatchReason = superuser;//批示人
  4419. model_T_Bus_SubmitSuper.F_SuperOpinion = superopinion;//批示内容
  4420. model_T_Bus_SubmitSuper.F_File = files;//附件
  4421. model_T_Bus_SubmitSuper.F_CreateUser = userModel.F_UserCode;//呈批人
  4422. model_T_Bus_SubmitSuper.F_CreateTime = DateTime.Now;//呈批时间
  4423. model_T_Bus_SubmitSuper.F_IsDelete = 0;
  4424. model_T_Bus_SubmitSuper.F_State = 1;//审批状态(0:未处理,1:通过)
  4425. new BLL.T_Bus_SubmitSuper().Add(model_T_Bus_SubmitSuper);
  4426. #endregion
  4427. #region 插入操作记录
  4428. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4429. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4430. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4431. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4432. oper.F_Message = userinfo + " 批示了工单";
  4433. oper.F_CreateUser = userModel.F_UserCode;
  4434. oper.F_CreateTime = DateTime.Now;
  4435. oper.F_IsDelete = 0;
  4436. operBLL.Add(oper);
  4437. #endregion
  4438. trans.Complete();
  4439. }
  4440. return Success("操作成功");
  4441. }
  4442. else
  4443. {
  4444. return Error("操作失败");
  4445. }
  4446. }
  4447. /// <summary>
  4448. /// 交办工单
  4449. /// </summary>
  4450. /// <returns></returns>
  4451. [Authority]
  4452. public ActionResult AssignWorkOrder()
  4453. {
  4454. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4455. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4456. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  4457. {
  4458. string workorderid = RequestString.GetFormString("workorderid");
  4459. int state = RequestString.GetInt("state", 0);
  4460. int assignid = RequestString.GetInt("assignid", 0);
  4461. int maindeptid = RequestString.GetInt("maindeptid", 0);
  4462. string otherdeptids = RequestString.GetFormString("otherdeptids");
  4463. DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime")+" 23:59:59");
  4464. string assignedopinion = RequestString.GetFormString("assignedopinion");
  4465. if (!string.IsNullOrEmpty(otherdeptids))
  4466. {
  4467. if (otherdeptids.Split(',').Contains(maindeptid.ToString()))
  4468. {
  4469. return Error("主办单位不能出现在协办单位");
  4470. }
  4471. }
  4472. if (limittime < DateTime.Now)
  4473. {
  4474. return Error("办理时限不能小于当前时间");
  4475. }
  4476. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4477. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = new Model.T_Bus_AssignedInfo();
  4478. var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
  4479. if (modelT_Bus_WorkOrder != null && deptinfo != null)
  4480. {
  4481. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4482. {
  4483. int aid = 0;
  4484. using (TransactionScope trans = new TransactionScope())
  4485. {
  4486. if (assignid == 0)
  4487. {
  4488. #region 插入交办记录
  4489. modelT_Bus_AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4490. modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
  4491. modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
  4492. modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
  4493. modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
  4494. modelT_Bus_AssignedInfo.F_State = state;//0草稿 1正式
  4495. modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
  4496. modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
  4497. modelT_Bus_AssignedInfo.F_IsDelete = 0;
  4498. modelT_Bus_AssignedInfo.F_IsOverdue = 0;
  4499. modelT_Bus_AssignedInfo.F_IsSure = 0;
  4500. modelT_Bus_AssignedInfo.F_IsReload = 0;
  4501. aid = assignBLL.Add(modelT_Bus_AssignedInfo);
  4502. #endregion
  4503. }
  4504. else
  4505. {
  4506. #region 修改交办记录
  4507. modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
  4508. if (modelT_Bus_AssignedInfo != null)
  4509. {
  4510. modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
  4511. modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
  4512. modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
  4513. modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
  4514. modelT_Bus_AssignedInfo.F_State = state;//0草稿 1正式
  4515. modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
  4516. modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
  4517. assignBLL.Update(modelT_Bus_AssignedInfo);
  4518. aid = modelT_Bus_AssignedInfo.F_Id;
  4519. }
  4520. #endregion
  4521. }
  4522. if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_State == 1)
  4523. {
  4524. #region 保存工单信息
  4525. modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
  4526. modelT_Bus_WorkOrder.F_LimitTime = limittime;
  4527. modelT_Bus_WorkOrder.F_MainDeptId = maindeptid;
  4528. modelT_Bus_WorkOrder.F_OtherDeptIds = otherdeptids;
  4529. modelT_Bus_WorkOrder.F_AssignUser = userModel.F_UserCode;
  4530. modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
  4531. workorderBLL.Update(modelT_Bus_WorkOrder);
  4532. #endregion
  4533. #region 删除草稿信息
  4534. var cglist = assignBLL.GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  4535. foreach (var cg in cglist)
  4536. {
  4537. cg.F_IsDelete = 1;
  4538. cg.F_DeleteUser = userModel.F_UserCode;
  4539. cg.F_DeleteTime = DateTime.Now;
  4540. assignBLL.Update(cg);
  4541. }
  4542. #endregion
  4543. #region 插入操作记录
  4544. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4545. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4546. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4547. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4548. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4549. oper.F_Message = userinfo + " 交办了工单,主办单位:" + deptinfo.F_DeptName;
  4550. if (!string.IsNullOrEmpty(otherdeptids))
  4551. {
  4552. string sql = "select dbo.GetDeptNames('" + otherdeptids + "')";
  4553. oper.F_Message += ",协办单位:" + DbHelperSQL.GetSingle(sql);
  4554. }
  4555. oper.F_CreateUser = userModel.F_UserCode;
  4556. oper.F_CreateTime = DateTime.Now;
  4557. oper.F_IsDelete = 0;
  4558. operBLL.Add(oper);
  4559. //推送消息表
  4560. var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
  4561. foreach (var u in users)
  4562. {
  4563. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4564. }
  4565. #endregion
  4566. }
  4567. trans.Complete();
  4568. }
  4569. return Success("操作成功", modelT_Bus_AssignedInfo.F_Id);
  4570. }
  4571. else
  4572. {
  4573. return Error("已经交办过了");
  4574. }
  4575. }
  4576. else
  4577. {
  4578. return Error("操作失败");
  4579. }
  4580. }
  4581. else
  4582. {
  4583. return Error("权限不足");
  4584. }
  4585. }
  4586. /// <summary>
  4587. /// 收回工单
  4588. /// </summary>
  4589. /// <returns></returns>
  4590. [Authority]
  4591. public ActionResult TakeBackWorkOrder()
  4592. {
  4593. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4594. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4595. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  4596. {
  4597. string workorderid = RequestString.GetFormString("workorderid");
  4598. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4599. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4600. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  4601. {
  4602. if (modelT_Bus_AssignedInfo.F_IsSure == 0 || (modelT_Bus_AssignedInfo.F_IsSure == 1 && modelT_Bus_WorkOrder.F_WorkState == 4))
  4603. {
  4604. using (TransactionScope trans = new TransactionScope())
  4605. {
  4606. #region 插入交办记录
  4607. Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
  4608. AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4609. AssignedInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;//办理时限
  4610. AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
  4611. AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
  4612. AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
  4613. AssignedInfo.F_State = 0;//0草稿 1正式
  4614. AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
  4615. AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
  4616. AssignedInfo.F_IsDelete = 0;
  4617. AssignedInfo.F_IsOverdue = 0;
  4618. AssignedInfo.F_IsSure = 0;
  4619. AssignedInfo.F_IsReload = 0;
  4620. assignBLL.Add(AssignedInfo);
  4621. #endregion
  4622. #region 保存工单信息
  4623. modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
  4624. modelT_Bus_WorkOrder.F_MainDeptId = null;
  4625. modelT_Bus_WorkOrder.F_OtherDeptIds = "";
  4626. workorderBLL.Update(modelT_Bus_WorkOrder);
  4627. #endregion
  4628. #region 删除交办信息
  4629. modelT_Bus_AssignedInfo.F_IsDelete = 1;//删除
  4630. modelT_Bus_AssignedInfo.F_DeleteUser = userModel.F_UserCode;
  4631. modelT_Bus_AssignedInfo.F_DeleteTime = DateTime.Now;
  4632. assignBLL.Update(modelT_Bus_AssignedInfo);
  4633. #endregion
  4634. #region 插入操作记录
  4635. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4636. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4637. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4638. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4639. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4640. oper.F_Message = userinfo + " 收回了工单";
  4641. oper.F_CreateUser = userModel.F_UserCode;
  4642. oper.F_CreateTime = DateTime.Now;
  4643. oper.F_IsDelete = 0;
  4644. operBLL.Add(oper);
  4645. #endregion
  4646. trans.Complete();
  4647. }
  4648. return Success("操作成功");
  4649. }
  4650. else
  4651. {
  4652. return Error("单位已查收,不能收回");
  4653. }
  4654. }
  4655. else
  4656. {
  4657. return Error("操作失败");
  4658. }
  4659. }
  4660. else
  4661. {
  4662. return Error("权限不足");
  4663. }
  4664. }
  4665. /// <summary>
  4666. /// 查收工单
  4667. /// </summary>
  4668. /// <returns></returns>
  4669. [Authority]
  4670. public ActionResult ReceiveWorkOrder()
  4671. {
  4672. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4673. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4674. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  4675. {
  4676. string workorderid = RequestString.GetFormString("workorderid");
  4677. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4678. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4679. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId
  4680. && (modelT_Bus_WorkOrder.F_WorkState == 2 || modelT_Bus_WorkOrder.F_WorkState == 8))
  4681. {
  4682. if (modelT_Bus_AssignedInfo.F_IsSure == 0 )
  4683. {
  4684. using (TransactionScope trans = new TransactionScope())
  4685. {
  4686. #region 保存工单信息
  4687. modelT_Bus_WorkOrder.F_WorkState = 4;//办理中
  4688. workorderBLL.Update(modelT_Bus_WorkOrder);
  4689. #endregion
  4690. #region 保存查收信息
  4691. modelT_Bus_AssignedInfo.F_IsSure = 1;//查收
  4692. modelT_Bus_AssignedInfo.F_SureUser = userModel.F_UserCode;
  4693. modelT_Bus_AssignedInfo.F_SureTime = DateTime.Now;
  4694. assignBLL.Update(modelT_Bus_AssignedInfo);
  4695. #endregion
  4696. #region 保存明细信息
  4697. if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds))
  4698. {
  4699. string[] strids = modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',');
  4700. foreach (string strid in strids)
  4701. {
  4702. Model.T_Bus_AssignedItemInfo modelT_Bus_AssignedItemInfo = new Model.T_Bus_AssignedItemInfo();
  4703. modelT_Bus_AssignedItemInfo.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4704. modelT_Bus_AssignedItemInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;
  4705. modelT_Bus_AssignedItemInfo.F_DeptId = Int32.Parse(strid);
  4706. modelT_Bus_AssignedItemInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;
  4707. modelT_Bus_AssignedItemInfo.F_Remark = modelT_Bus_AssignedInfo.F_Remark;
  4708. modelT_Bus_AssignedItemInfo.F_State = 1;
  4709. modelT_Bus_AssignedItemInfo.F_Type = 2;
  4710. modelT_Bus_AssignedItemInfo.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  4711. modelT_Bus_AssignedItemInfo.F_IsSure = 0;
  4712. modelT_Bus_AssignedItemInfo.F_CreateTime = DateTime.Now;
  4713. modelT_Bus_AssignedItemInfo.F_CreateUser = userModel.F_UserCode;
  4714. modelT_Bus_AssignedItemInfo.F_IsDelete = 0;
  4715. new BLL.T_Bus_AssignedItemInfo().Add(modelT_Bus_AssignedItemInfo);
  4716. }
  4717. }
  4718. #endregion
  4719. #region 插入操作记录
  4720. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4721. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4722. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4723. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4724. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4725. oper.F_Message = userinfo + " 查收了工单";
  4726. oper.F_CreateUser = userModel.F_UserCode;
  4727. oper.F_CreateTime = DateTime.Now;
  4728. oper.F_IsDelete = 0;
  4729. operBLL.Add(oper);
  4730. #endregion
  4731. trans.Complete();
  4732. }
  4733. return Success("操作成功");
  4734. }
  4735. else
  4736. {
  4737. return Error("单位已查收,不能再次查收");
  4738. }
  4739. }
  4740. else
  4741. {
  4742. return Error("操作失败");
  4743. }
  4744. }
  4745. else
  4746. {
  4747. return Error("权限不足");
  4748. }
  4749. }
  4750. /// <summary>
  4751. /// 退回工单
  4752. /// </summary>
  4753. /// <returns></returns>
  4754. [Authority]
  4755. public ActionResult RebackWorkOrder()
  4756. {
  4757. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4758. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4759. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  4760. {
  4761. string workorderid = RequestString.GetFormString("workorderid");
  4762. string backreason = RequestString.GetFormString("backreason");
  4763. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4764. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4765. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  4766. {
  4767. if (modelT_Bus_AssignedInfo.F_IsSure == 0)
  4768. {
  4769. using (TransactionScope trans = new TransactionScope())
  4770. {
  4771. #region 保存工单信息
  4772. modelT_Bus_WorkOrder.F_WorkState = 3;//退回审核中
  4773. workorderBLL.Update(modelT_Bus_WorkOrder);
  4774. #endregion
  4775. #region 插入退回申请信息
  4776. Model.T_Bus_Feedback model_T_Bus_Feedback = new Model.T_Bus_Feedback();
  4777. model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  4778. model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  4779. model_T_Bus_Feedback.F_Result = backreason;//退回原因
  4780. model_T_Bus_Feedback.F_IsAudit = 0;
  4781. model_T_Bus_Feedback.F_IsDelete = 0;
  4782. model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//退回人
  4783. model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//退回时间
  4784. model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//退回部门
  4785. model_T_Bus_Feedback.F_IsFeedEnd = 1;
  4786. model_T_Bus_Feedback.F_State = 1;
  4787. model_T_Bus_Feedback.F_Type = 3;
  4788. new BLL.T_Bus_Feedback().Add(model_T_Bus_Feedback);
  4789. #endregion
  4790. #region 保存交办信息
  4791. //modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;//办理
  4792. //if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  4793. //{
  4794. // modelT_Bus_AssignedInfo.F_IsOverdue = 1;
  4795. //}
  4796. modelT_Bus_AssignedInfo.F_IsSure = 2;//申请退回
  4797. modelT_Bus_AssignedInfo.F_SureUser = userModel.F_UserCode;
  4798. modelT_Bus_AssignedInfo.F_SureTime = DateTime.Now;
  4799. assignBLL.Update(modelT_Bus_AssignedInfo);
  4800. #endregion
  4801. #region 插入操作记录
  4802. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4803. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4804. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4805. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4806. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4807. oper.F_Message = userinfo + " 申请退回了工单";
  4808. oper.F_CreateUser = userModel.F_UserCode;
  4809. oper.F_CreateTime = DateTime.Now;
  4810. oper.F_IsDelete = 0;
  4811. operBLL.Add(oper);
  4812. //推送消息表
  4813. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
  4814. #endregion
  4815. trans.Complete();
  4816. }
  4817. return Success("操作成功");
  4818. }
  4819. else
  4820. {
  4821. return Error("单位已查收,不能退回");
  4822. }
  4823. }
  4824. else
  4825. {
  4826. return Error("操作失败");
  4827. }
  4828. }
  4829. else
  4830. {
  4831. return Error("权限不足");
  4832. }
  4833. }
  4834. /// <summary>
  4835. /// 审核退回工单
  4836. /// </summary>
  4837. /// <returns></returns>
  4838. [Authority]
  4839. public ActionResult AuditRebackWorkOrder()
  4840. {
  4841. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4842. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4843. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  4844. {
  4845. string workorderid = RequestString.GetFormString("workorderid");
  4846. int state = RequestString.GetInt("state", 0);
  4847. string reason = RequestString.GetFormString("reason");
  4848. int rebackid = RequestString.GetInt("rebackid", 0);
  4849. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4850. Model.T_Bus_Feedback modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(rebackid);
  4851. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4852. if (modelT_Bus_WorkOrder != null && modelT_Bus_Feedback != null && modelT_Bus_AssignedInfo != null)
  4853. {
  4854. if (modelT_Bus_Feedback.F_Type == 3 && modelT_Bus_Feedback.F_IsAudit == 0)
  4855. {
  4856. using (TransactionScope trans = new TransactionScope())
  4857. {
  4858. #region 保存查收信息
  4859. modelT_Bus_Feedback.F_IsAudit = state;//审核
  4860. modelT_Bus_Feedback.F_AuditUser = userModel.F_UserCode;
  4861. modelT_Bus_Feedback.F_AuditTime = DateTime.Now;
  4862. modelT_Bus_Feedback.F_AuditReason = reason;
  4863. new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
  4864. #endregion
  4865. string strmsg = "同意";
  4866. if (modelT_Bus_Feedback.F_IsAudit == 1)
  4867. {
  4868. #region 插入交办记录
  4869. Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
  4870. AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4871. AssignedInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;//办理时限
  4872. AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
  4873. AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
  4874. AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
  4875. AssignedInfo.F_State = 0;//0草稿 1正式
  4876. AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
  4877. AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
  4878. AssignedInfo.F_IsDelete = 0;
  4879. AssignedInfo.F_IsOverdue = 0;
  4880. AssignedInfo.F_IsSure = 0;
  4881. AssignedInfo.F_IsReload = modelT_Bus_AssignedInfo.F_IsReload;
  4882. assignBLL.Add(AssignedInfo);
  4883. #endregion
  4884. #region 保存交办信息
  4885. modelT_Bus_AssignedInfo.F_IsSure = 3;//退回
  4886. assignBLL.Update(modelT_Bus_AssignedInfo);
  4887. #endregion
  4888. #region 保存工单信息
  4889. modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
  4890. workorderBLL.Update(modelT_Bus_WorkOrder);
  4891. #endregion
  4892. }
  4893. else
  4894. {
  4895. #region 保存工单信息
  4896. modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
  4897. workorderBLL.Update(modelT_Bus_WorkOrder);
  4898. #endregion
  4899. #region 保存交办信息
  4900. //modelT_Bus_AssignedInfo.F_FeedbackTime = null;//反馈时间
  4901. modelT_Bus_AssignedInfo.F_IsSure = 0;
  4902. modelT_Bus_AssignedInfo.F_SureUser = "";
  4903. modelT_Bus_AssignedInfo.F_SureTime = null;
  4904. assignBLL.Update(modelT_Bus_AssignedInfo);
  4905. #endregion
  4906. strmsg = "拒绝";
  4907. }
  4908. #region 插入操作记录
  4909. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4910. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4911. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4912. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4913. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4914. oper.F_Message = userinfo + " " + strmsg + "了工单退回申请";
  4915. oper.F_CreateUser = userModel.F_UserCode;
  4916. oper.F_CreateTime = DateTime.Now;
  4917. oper.F_IsDelete = 0;
  4918. operBLL.Add(oper);
  4919. //推送消息表
  4920. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_Feedback.F_CreateUser, userModel.F_UserCode);
  4921. #endregion
  4922. trans.Complete();
  4923. }
  4924. return Success("操作成功");
  4925. }
  4926. else
  4927. {
  4928. return Error("此审核已经处理");
  4929. }
  4930. }
  4931. else
  4932. {
  4933. return Error("操作失败");
  4934. }
  4935. }
  4936. else
  4937. {
  4938. return Error("权限不足");
  4939. }
  4940. }
  4941. /// <summary>
  4942. /// 申请延时
  4943. /// </summary>
  4944. /// <returns></returns>
  4945. [Authority]
  4946. public ActionResult DelayWorkOrder()
  4947. {
  4948. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4949. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4950. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  4951. {
  4952. string workorderid = RequestString.GetFormString("workorderid");
  4953. //int state = RequestString.GetInt("state", 0);
  4954. DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");
  4955. string reason = RequestString.GetFormString("reason");
  4956. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4957. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4958. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  4959. {
  4960. if (modelT_Bus_AssignedInfo.F_IsSure == 1)
  4961. {
  4962. using (TransactionScope trans = new TransactionScope())
  4963. {
  4964. #region 保存工单信息
  4965. modelT_Bus_WorkOrder.F_WorkState = 5;//延时审核中
  4966. workorderBLL.Update(modelT_Bus_WorkOrder);
  4967. #endregion
  4968. #region 插入申请延时信息
  4969. Model.T_Bus_DelayTime delay = new Model.T_Bus_DelayTime();
  4970. delay.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4971. //delay.F_State = state;
  4972. delay.F_OldTime = modelT_Bus_AssignedInfo.F_LimitTime;
  4973. delay.F_NewTime = newlimittime;
  4974. delay.F_Reason = reason;
  4975. delay.F_State = 1;
  4976. delay.F_IsAudit = 0;
  4977. delay.F_IsDelete = 0;
  4978. delay.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4979. delay.F_CreateUser = userModel.F_UserCode;
  4980. delay.F_CreateTime = DateTime.Now;
  4981. new BLL.T_Bus_DelayTime().Add(delay);
  4982. #endregion
  4983. #region 插入操作记录
  4984. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4985. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4986. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4987. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4988. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4989. oper.F_Message = userinfo + " 申请了延时处理";
  4990. oper.F_CreateUser = userModel.F_UserCode;
  4991. oper.F_CreateTime = DateTime.Now;
  4992. oper.F_IsDelete = 0;
  4993. operBLL.Add(oper);
  4994. //推送消息表
  4995. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
  4996. #endregion
  4997. trans.Complete();
  4998. }
  4999. return Success("操作成功");
  5000. }
  5001. else
  5002. {
  5003. return Error("操作失敗,已查收");
  5004. }
  5005. }
  5006. else
  5007. {
  5008. return Error("操作失败");
  5009. }
  5010. }
  5011. else
  5012. {
  5013. return Error("权限不足");
  5014. }
  5015. }
  5016. /// <summary>
  5017. /// 审核延时工单
  5018. /// </summary>
  5019. /// <returns></returns>
  5020. [Authority]
  5021. public ActionResult AuditDelayWorkOrder()
  5022. {
  5023. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5024. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5025. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  5026. {
  5027. string workorderid = RequestString.GetFormString("workorderid");
  5028. int state = RequestString.GetInt("state", 0);
  5029. string reason = RequestString.GetFormString("reason");
  5030. DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");
  5031. int delayid = RequestString.GetInt("delayid", 0);
  5032. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5033. Model.T_Bus_DelayTime modelT_Bus_DelayTime = new BLL.T_Bus_DelayTime().GetModel(delayid);
  5034. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5035. if (modelT_Bus_WorkOrder != null && modelT_Bus_DelayTime != null && modelT_Bus_AssignedInfo != null)
  5036. {
  5037. if (modelT_Bus_DelayTime.F_IsAudit == 0)
  5038. {
  5039. using (TransactionScope trans = new TransactionScope())
  5040. {
  5041. #region 保存工单信息
  5042. modelT_Bus_WorkOrder.F_WorkState = 4;//办理中
  5043. if (state == 1)
  5044. {
  5045. modelT_Bus_WorkOrder.F_LimitTime = newlimittime;
  5046. }
  5047. workorderBLL.Update(modelT_Bus_WorkOrder);
  5048. #endregion
  5049. #region 保存审核信息
  5050. modelT_Bus_DelayTime.F_IsAudit = state;//审核
  5051. modelT_Bus_DelayTime.F_AuditUser = userModel.F_UserCode;
  5052. modelT_Bus_DelayTime.F_AuditTime = DateTime.Now;
  5053. modelT_Bus_DelayTime.F_RefuseReason = reason;
  5054. modelT_Bus_DelayTime.F_AgreeTime = newlimittime;
  5055. new BLL.T_Bus_DelayTime().Update(modelT_Bus_DelayTime);
  5056. #endregion
  5057. string type = "同意"; string des = "";
  5058. if (modelT_Bus_DelayTime.F_IsAudit == 1)
  5059. {
  5060. #region 修改交办记录
  5061. modelT_Bus_AssignedInfo.F_LimitTime = modelT_Bus_DelayTime.F_AgreeTime;
  5062. assignBLL.Update(modelT_Bus_AssignedInfo);
  5063. #endregion
  5064. #region 处理协办单位
  5065. var xblist = assignItemBLL.GetModelList(" F_IsDelete=0 and F_State=1 and ISNULL(F_FeedbackTime, '')='' and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  5066. foreach (var xb in xblist)
  5067. {
  5068. //xb.F_LimitTime = DateTime.Now;
  5069. xb.F_LimitTime = modelT_Bus_DelayTime.F_AgreeTime;
  5070. assignItemBLL.Update(xb);
  5071. }
  5072. #endregion
  5073. des = ",原定时间" + modelT_Bus_DelayTime.F_OldTime + ",申请延长到" + modelT_Bus_DelayTime.F_AgreeTime;
  5074. }
  5075. else
  5076. {
  5077. type = "拒绝";
  5078. }
  5079. #region 插入操作记录
  5080. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5081. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5082. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5083. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5084. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5085. oper.F_Message = userinfo + " " + type + "了工单延时申请" + des;
  5086. oper.F_CreateUser = userModel.F_UserCode;
  5087. oper.F_CreateTime = DateTime.Now;
  5088. oper.F_IsDelete = 0;
  5089. operBLL.Add(oper);
  5090. //推送消息表
  5091. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_DelayTime.F_CreateUser, userModel.F_UserCode);
  5092. #endregion
  5093. trans.Complete();
  5094. }
  5095. return Success("操作成功");
  5096. }
  5097. else
  5098. {
  5099. return Error("此审核已经处理");
  5100. }
  5101. }
  5102. else
  5103. {
  5104. return Error("操作失败");
  5105. }
  5106. }
  5107. else
  5108. {
  5109. return Error("权限不足");
  5110. }
  5111. }
  5112. /// <summary>
  5113. /// 办理工单
  5114. /// </summary>
  5115. /// <returns></returns>
  5116. [Authority]
  5117. public ActionResult FeedBackWorkOrder()
  5118. {
  5119. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5120. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5121. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5122. {
  5123. string workorderid = RequestString.GetFormString("workorderid");
  5124. string dealman = RequestString.GetFormString("dealman");
  5125. string result = RequestString.GetFormString("result");
  5126. string files = RequestString.GetFormString("files");
  5127. int state = RequestString.GetInt("state", 0);
  5128. int feedbackid = RequestString.GetInt("feedbackid", 0);
  5129. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5130. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5131. Model.T_Bus_Feedback model_T_Bus_Feedback = new Model.T_Bus_Feedback();
  5132. int type = 0;
  5133. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  5134. {
  5135. type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
  5136. if (type > 0)
  5137. {
  5138. if (modelT_Bus_WorkOrder.F_WorkState == 4)
  5139. {
  5140. using (TransactionScope trans = new TransactionScope())
  5141. {
  5142. if (feedbackid == 0)
  5143. {
  5144. #region 插入反馈记录
  5145. model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5146. model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5147. model_T_Bus_Feedback.F_DealUser = dealman;
  5148. model_T_Bus_Feedback.F_Result = result;//反馈内容
  5149. model_T_Bus_Feedback.F_File = files;
  5150. model_T_Bus_Feedback.F_IsAudit = 0;
  5151. model_T_Bus_Feedback.F_IsDelete = 0;
  5152. model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5153. model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5154. model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5155. model_T_Bus_Feedback.F_IsFeedEnd = 1;
  5156. model_T_Bus_Feedback.F_State = state;
  5157. model_T_Bus_Feedback.F_Type = type;
  5158. new BLL.T_Bus_Feedback().Add(model_T_Bus_Feedback);
  5159. #endregion
  5160. }
  5161. else
  5162. {
  5163. #region 修改反馈记录
  5164. model_T_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
  5165. if (model_T_Bus_Feedback != null)
  5166. {
  5167. model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5168. model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5169. model_T_Bus_Feedback.F_DealUser = dealman;
  5170. model_T_Bus_Feedback.F_Result = result;//反馈内容
  5171. model_T_Bus_Feedback.F_File = files;
  5172. model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5173. model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5174. model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5175. model_T_Bus_Feedback.F_IsFeedEnd = 1;
  5176. model_T_Bus_Feedback.F_State = state;
  5177. if (modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  5178. {
  5179. model_T_Bus_Feedback.F_Type = 1;
  5180. }
  5181. else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(userModel.F_DeptId.ToString()))
  5182. {
  5183. model_T_Bus_Feedback.F_Type = 2;
  5184. }
  5185. new BLL.T_Bus_Feedback().Update(model_T_Bus_Feedback);
  5186. }
  5187. #endregion
  5188. }
  5189. if (model_T_Bus_Feedback != null && model_T_Bus_Feedback.F_State == 1)
  5190. {
  5191. string typemsg = "办理";
  5192. if (type == 1)
  5193. {
  5194. int iscs = 0;
  5195. if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  5196. {
  5197. iscs = 1;
  5198. }
  5199. #region 保存工单信息
  5200. modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
  5201. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  5202. modelT_Bus_WorkOrder.F_DealUser= userModel.F_UserCode;
  5203. modelT_Bus_WorkOrder.F_DealTime= DateTime.Now;
  5204. modelT_Bus_WorkOrder.F_IsOverdue = iscs;
  5205. modelT_Bus_WorkOrder.F_Result = result;
  5206. workorderBLL.Update(modelT_Bus_WorkOrder);
  5207. #endregion
  5208. #region 保存交办信息
  5209. modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
  5210. modelT_Bus_AssignedInfo.F_IsOverdue = iscs;
  5211. assignBLL.Update(modelT_Bus_AssignedInfo);
  5212. #endregion
  5213. #region 删除草稿信息
  5214. 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 + "'");
  5215. foreach (var cg in cglist)
  5216. {
  5217. cg.F_IsDelete = 1;
  5218. cg.F_DeleteUser = userModel.F_UserCode;
  5219. cg.F_DeleteTime = DateTime.Now;
  5220. new BLL.T_Bus_Feedback().Update(cg);
  5221. }
  5222. #endregion
  5223. #region 处理协办单位
  5224. 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 + "'");
  5225. foreach (var xb in xblist)
  5226. {
  5227. xb.F_State = 2;
  5228. xb.F_SureUser = userModel.F_UserCode;
  5229. xb.F_SureTime = DateTime.Now;
  5230. new BLL.T_Bus_AssignedItemInfo().Update(xb);
  5231. }
  5232. #endregion
  5233. typemsg = "主办";
  5234. }
  5235. else if (type == 2)
  5236. {
  5237. #region 保存明细信息
  5238. 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();
  5239. modelT_Bus_AssignedItemInfo.F_FeedbackTime = DateTime.Now;
  5240. if (modelT_Bus_AssignedItemInfo.F_LimitTime < DateTime.Now)
  5241. {
  5242. modelT_Bus_AssignedItemInfo.F_IsOverdue = 1;
  5243. }
  5244. new BLL.T_Bus_AssignedItemInfo().Update(modelT_Bus_AssignedItemInfo);
  5245. #endregion
  5246. #region 删除草稿信息
  5247. 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 + "'");
  5248. foreach (var cg in cglist)
  5249. {
  5250. cg.F_IsDelete = 1;
  5251. cg.F_DeleteUser = userModel.F_UserCode;
  5252. cg.F_DeleteTime = DateTime.Now;
  5253. new BLL.T_Bus_Feedback().Update(cg);
  5254. }
  5255. #endregion
  5256. typemsg = "协办";
  5257. }
  5258. #region 插入操作记录
  5259. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5260. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5261. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5262. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5263. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5264. oper.F_Message = userinfo + " " + typemsg + "了工单";
  5265. oper.F_CreateUser = userModel.F_UserCode;
  5266. oper.F_CreateTime = DateTime.Now;
  5267. oper.F_IsDelete = 0;
  5268. operBLL.Add(oper);
  5269. //推送消息表
  5270. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  5271. #endregion
  5272. }
  5273. trans.Complete();
  5274. }
  5275. return Success("操作成功", model_T_Bus_Feedback.F_Id);
  5276. }
  5277. else
  5278. {
  5279. return Error("已经办理过了");
  5280. }
  5281. }
  5282. else
  5283. {
  5284. return Error("权限不足");
  5285. }
  5286. }
  5287. else
  5288. {
  5289. return Error("操作失败");
  5290. }
  5291. }
  5292. else
  5293. {
  5294. return Error("权限不足");
  5295. }
  5296. }
  5297. /// <summary>
  5298. /// 派工单
  5299. /// </summary>
  5300. /// <returns></returns>
  5301. [Authority]
  5302. public ActionResult SplitWorkOrder()
  5303. {
  5304. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5305. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5306. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5307. {
  5308. string workorderid = RequestString.GetFormString("workorderid");
  5309. int maindeptid = RequestString.GetInt("maindeptid", 0);
  5310. string otherdeptids = RequestString.GetFormString("otherdeptids");
  5311. DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime") + " 23:59:59");
  5312. string assignedopinion = RequestString.GetFormString("assignedopinion");
  5313. string files = RequestString.GetFormString("files");
  5314. int state = RequestString.GetInt("state", 0);
  5315. int nextid = RequestString.GetInt("nextid", 0);
  5316. if (limittime < DateTime.Now)
  5317. {
  5318. return Error("办理时限不能小于当前时间");
  5319. }
  5320. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5321. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5322. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new Model.T_Bus_AssignedInfo_Next();
  5323. var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
  5324. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && deptinfo != null)
  5325. {
  5326. int type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
  5327. if ((type == 1 && modelT_Bus_WorkOrder.F_WorkState == 4) || userModel.F_RoleCode == "GLY")
  5328. {
  5329. if (modelT_Bus_AssignedInfo.F_IsNext == null || modelT_Bus_AssignedInfo.F_IsNext.Value == 0)
  5330. {
  5331. using (TransactionScope trans = new TransactionScope())
  5332. {
  5333. if (nextid == 0)
  5334. {
  5335. #region 插入派单记录
  5336. modelT_Bus_AssignedInfo_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5337. modelT_Bus_AssignedInfo_Next.F_LimitTime = limittime;//办理时限
  5338. modelT_Bus_AssignedInfo_Next.F_MainDeptId = maindeptid;//主办单位id
  5339. modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = otherdeptids;//协办单位id
  5340. modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = assignedopinion;//交办意见
  5341. modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
  5342. modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
  5343. modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
  5344. modelT_Bus_AssignedInfo_Next.F_IsDelete = 0;
  5345. modelT_Bus_AssignedInfo_Next.F_IsOverdue = 0;
  5346. modelT_Bus_AssignedInfo_Next.F_IsSure = 0;
  5347. modelT_Bus_AssignedInfo_Next.F_IsReload = 0;
  5348. modelT_Bus_AssignedInfo_Next.F_Id = new BLL.T_Bus_AssignedInfo_Next().Add(modelT_Bus_AssignedInfo_Next);
  5349. #endregion
  5350. }
  5351. else
  5352. {
  5353. #region 修改派单记录
  5354. modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetModel(nextid);
  5355. if (modelT_Bus_AssignedInfo_Next != null)
  5356. {
  5357. modelT_Bus_AssignedInfo_Next.F_LimitTime = limittime;//办理时限
  5358. modelT_Bus_AssignedInfo_Next.F_MainDeptId = maindeptid;//主办单位id
  5359. modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = otherdeptids;//协办单位id
  5360. modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = assignedopinion;//交办意见
  5361. modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
  5362. modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
  5363. modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
  5364. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5365. }
  5366. #endregion
  5367. }
  5368. if (modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_State == 1)
  5369. {
  5370. #region 保存交办信息
  5371. modelT_Bus_AssignedInfo.F_IsNext = 1;
  5372. modelT_Bus_AssignedInfo.F_NextUser = userModel.F_UserCode;
  5373. modelT_Bus_AssignedInfo.F_NextTime = DateTime.Now;
  5374. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5375. #endregion
  5376. #region 插入操作记录
  5377. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5378. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5379. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5380. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5381. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5382. oper.F_Message = userinfo + " 派单给单位:" + deptinfo.F_DeptName;
  5383. oper.F_CreateUser = userModel.F_UserCode;
  5384. oper.F_CreateTime = DateTime.Now;
  5385. oper.F_IsDelete = 0;
  5386. operBLL.Add(oper);
  5387. //推送消息表
  5388. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  5389. #endregion
  5390. }
  5391. trans.Complete();
  5392. }
  5393. return Success("操作成功", modelT_Bus_AssignedInfo_Next.F_Id);
  5394. }
  5395. else
  5396. {
  5397. return Error("已经派过单了");
  5398. }
  5399. }
  5400. else
  5401. {
  5402. return Error("操作失败");
  5403. }
  5404. }
  5405. else
  5406. {
  5407. return Error("操作失败");
  5408. }
  5409. }
  5410. else
  5411. {
  5412. return Error("权限不足");
  5413. }
  5414. }
  5415. /// <summary>
  5416. /// 撤回工单
  5417. /// </summary>
  5418. /// <returns></returns>
  5419. [Authority]
  5420. public ActionResult WithdrawWorkOrder()
  5421. {
  5422. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5423. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5424. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5425. {
  5426. string workorderid = RequestString.GetFormString("workorderid");
  5427. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5428. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5429. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5430. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  5431. {
  5432. using (TransactionScope trans = new TransactionScope())
  5433. {
  5434. #region 保存撤单信息
  5435. modelT_Bus_AssignedInfo_Next.F_IsDelete = 1;
  5436. modelT_Bus_AssignedInfo_Next.F_DeleteUser = userModel.F_UserCode;
  5437. modelT_Bus_AssignedInfo_Next.F_DeleteTime = DateTime.Now;
  5438. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5439. #endregion
  5440. #region 删除处理信息
  5441. var cglist = new BLL.T_Bus_Feedback_Next().GetModelList(" F_IsDelete=0 and F_AssignedId='" + modelT_Bus_AssignedInfo_Next.F_Id + "'");
  5442. foreach (var cg in cglist)
  5443. {
  5444. cg.F_IsDelete = 1;
  5445. cg.F_DeleteUser = userModel.F_UserCode;
  5446. cg.F_DeleteTime = DateTime.Now;
  5447. new BLL.T_Bus_Feedback_Next().Update(cg);
  5448. }
  5449. #endregion
  5450. #region 保存交办信息
  5451. modelT_Bus_AssignedInfo.F_IsNext = 0;
  5452. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5453. #endregion
  5454. #region 插入操作记录
  5455. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5456. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5457. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5458. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5459. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5460. oper.F_Message = userinfo + " 撤回了工单";
  5461. oper.F_CreateUser = userModel.F_UserCode;
  5462. oper.F_CreateTime = DateTime.Now;
  5463. oper.F_IsDelete = 0;
  5464. operBLL.Add(oper);
  5465. #endregion
  5466. trans.Complete();
  5467. }
  5468. return Success("操作成功");
  5469. }
  5470. else
  5471. {
  5472. return Error("操作失败");
  5473. }
  5474. }
  5475. else
  5476. {
  5477. return Error("权限不足");
  5478. }
  5479. }
  5480. /// <summary>
  5481. /// 签收工单
  5482. /// </summary>
  5483. /// <returns></returns>
  5484. [Authority]
  5485. public ActionResult SignWorkOrder()
  5486. {
  5487. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5488. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5489. if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
  5490. {
  5491. string workorderid = RequestString.GetFormString("workorderid");
  5492. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5493. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5494. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5495. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId)
  5496. {
  5497. if (modelT_Bus_AssignedInfo_Next.F_IsSure == 0)
  5498. {
  5499. using (TransactionScope trans = new TransactionScope())
  5500. {
  5501. #region 保存签收信息
  5502. modelT_Bus_AssignedInfo_Next.F_IsSure = 1;//签收
  5503. modelT_Bus_AssignedInfo_Next.F_SureUser = userModel.F_UserCode;
  5504. modelT_Bus_AssignedInfo_Next.F_SureTime = DateTime.Now;
  5505. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5506. #endregion
  5507. #region 保存交办信息
  5508. modelT_Bus_AssignedInfo.F_IsNext = 2;
  5509. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5510. #endregion
  5511. #region 插入操作记录
  5512. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5513. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5514. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5515. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5516. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5517. oper.F_Message = userinfo + " 签收了工单";
  5518. oper.F_CreateUser = userModel.F_UserCode;
  5519. oper.F_CreateTime = DateTime.Now;
  5520. oper.F_IsDelete = 0;
  5521. operBLL.Add(oper);
  5522. #endregion
  5523. trans.Complete();
  5524. }
  5525. return Success("操作成功");
  5526. }
  5527. else
  5528. {
  5529. return Error("单位已签收,不能再次签收");
  5530. }
  5531. }
  5532. else
  5533. {
  5534. return Error("操作失败");
  5535. }
  5536. }
  5537. else
  5538. {
  5539. return Error("权限不足");
  5540. }
  5541. }
  5542. /// <summary>
  5543. /// 拒收工单
  5544. /// </summary>
  5545. /// <returns></returns>
  5546. [Authority]
  5547. public ActionResult RefuseWorkOrder()
  5548. {
  5549. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5550. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5551. if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
  5552. {
  5553. string workorderid = RequestString.GetFormString("workorderid");
  5554. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5555. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5556. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5557. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId)
  5558. {
  5559. if (modelT_Bus_AssignedInfo_Next.F_IsSure == 0)
  5560. {
  5561. using (TransactionScope trans = new TransactionScope())
  5562. {
  5563. #region 保存签收信息
  5564. modelT_Bus_AssignedInfo_Next.F_IsSure = 3;//签收
  5565. modelT_Bus_AssignedInfo_Next.F_SureUser = userModel.F_UserCode;
  5566. modelT_Bus_AssignedInfo_Next.F_SureTime = DateTime.Now;
  5567. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5568. #endregion
  5569. #region 保存交办信息
  5570. modelT_Bus_AssignedInfo.F_IsNext = 0;
  5571. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5572. #endregion
  5573. #region 插入操作记录
  5574. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5575. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5576. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5577. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5578. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5579. oper.F_Message = userinfo + " 拒收了工单";
  5580. oper.F_CreateUser = userModel.F_UserCode;
  5581. oper.F_CreateTime = DateTime.Now;
  5582. oper.F_IsDelete = 0;
  5583. operBLL.Add(oper);
  5584. #endregion
  5585. trans.Complete();
  5586. }
  5587. return Success("操作成功");
  5588. }
  5589. else
  5590. {
  5591. return Error("单位已签收,不能再次签收");
  5592. }
  5593. }
  5594. else
  5595. {
  5596. return Error("操作失败");
  5597. }
  5598. }
  5599. else
  5600. {
  5601. return Error("权限不足");
  5602. }
  5603. }
  5604. /// <summary>
  5605. /// 处理工单
  5606. /// </summary>
  5607. /// <returns></returns>
  5608. [Authority]
  5609. public ActionResult DealWorkOrder()
  5610. {
  5611. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5612. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5613. if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
  5614. {
  5615. string workorderid = RequestString.GetFormString("workorderid");
  5616. string dealman = RequestString.GetFormString("dealman");
  5617. string result = RequestString.GetFormString("result");
  5618. string files = RequestString.GetFormString("files");
  5619. int state = RequestString.GetInt("state", 0);
  5620. int dealid = RequestString.GetInt("dealid", 0);
  5621. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5622. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5623. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5624. Model.T_Bus_Feedback_Next modelT_Bus_Feedback_Next = new Model.T_Bus_Feedback_Next();
  5625. 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)
  5626. {
  5627. if (modelT_Bus_WorkOrder.F_WorkState == 4 || modelT_Bus_WorkOrder.F_WorkState == 5)
  5628. {
  5629. if (modelT_Bus_AssignedInfo.F_IsNext == 2)
  5630. {
  5631. using (TransactionScope trans = new TransactionScope())
  5632. {
  5633. if (dealid == 0)
  5634. {
  5635. #region 插入反馈记录
  5636. modelT_Bus_Feedback_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5637. modelT_Bus_Feedback_Next.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;//交办id
  5638. modelT_Bus_Feedback_Next.F_DealUser = dealman;
  5639. modelT_Bus_Feedback_Next.F_Result = result;//反馈内容
  5640. modelT_Bus_Feedback_Next.F_File = files;
  5641. modelT_Bus_Feedback_Next.F_IsAudit = 0;
  5642. modelT_Bus_Feedback_Next.F_IsDelete = 0;
  5643. modelT_Bus_Feedback_Next.F_CreateUser = userModel.F_UserCode;//办理人
  5644. modelT_Bus_Feedback_Next.F_CreateTime = DateTime.Now;//办理时间
  5645. modelT_Bus_Feedback_Next.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5646. modelT_Bus_Feedback_Next.F_IsFeedEnd = 1;
  5647. modelT_Bus_Feedback_Next.F_State = state;
  5648. modelT_Bus_Feedback_Next.F_Type = 1;
  5649. new BLL.T_Bus_Feedback_Next().Add(modelT_Bus_Feedback_Next);
  5650. #endregion
  5651. }
  5652. else
  5653. {
  5654. #region 修改反馈记录
  5655. modelT_Bus_Feedback_Next = new BLL.T_Bus_Feedback_Next().GetModel(dealid);
  5656. if (modelT_Bus_Feedback_Next != null)
  5657. {
  5658. modelT_Bus_Feedback_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5659. modelT_Bus_Feedback_Next.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;//交办id
  5660. modelT_Bus_Feedback_Next.F_DealUser = dealman;
  5661. modelT_Bus_Feedback_Next.F_Result = result;//反馈内容
  5662. modelT_Bus_Feedback_Next.F_File = files;
  5663. modelT_Bus_Feedback_Next.F_CreateUser = userModel.F_UserCode;//办理人
  5664. modelT_Bus_Feedback_Next.F_CreateTime = DateTime.Now;//办理时间
  5665. modelT_Bus_Feedback_Next.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5666. modelT_Bus_Feedback_Next.F_IsFeedEnd = 1;
  5667. modelT_Bus_Feedback_Next.F_State = state;
  5668. new BLL.T_Bus_Feedback_Next().Update(modelT_Bus_Feedback_Next);
  5669. }
  5670. #endregion
  5671. }
  5672. if (modelT_Bus_Feedback_Next != null && modelT_Bus_Feedback_Next.F_State == 1)
  5673. {
  5674. #region 保存交办信息
  5675. modelT_Bus_AssignedInfo.F_IsNext = 3;
  5676. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5677. #endregion
  5678. #region 保存派单信息
  5679. modelT_Bus_AssignedInfo_Next.F_FeedbackTime = DateTime.Now;
  5680. if (modelT_Bus_AssignedInfo_Next.F_LimitTime < DateTime.Now)
  5681. {
  5682. modelT_Bus_AssignedInfo_Next.F_IsOverdue = 1;
  5683. }
  5684. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5685. #endregion
  5686. #region 删除草稿信息
  5687. 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 + "'");
  5688. foreach (var cg in cglist)
  5689. {
  5690. cg.F_IsDelete = 1;
  5691. cg.F_DeleteUser = userModel.F_UserCode;
  5692. cg.F_DeleteTime = DateTime.Now;
  5693. new BLL.T_Bus_Feedback_Next().Update(cg);
  5694. }
  5695. #endregion
  5696. #region 插入操作记录
  5697. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5698. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5699. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5700. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5701. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5702. oper.F_Message = userinfo + " 办理了工单";
  5703. oper.F_CreateUser = userModel.F_UserCode;
  5704. oper.F_CreateTime = DateTime.Now;
  5705. oper.F_IsDelete = 0;
  5706. operBLL.Add(oper);
  5707. //推送消息表
  5708. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  5709. #endregion
  5710. }
  5711. trans.Complete();
  5712. }
  5713. return Success("操作成功", modelT_Bus_AssignedInfo_Next.F_Id);
  5714. }
  5715. else
  5716. {
  5717. return Error("已经办理过了");
  5718. }
  5719. }
  5720. else
  5721. {
  5722. return Error("已经办理过了");
  5723. }
  5724. }
  5725. else
  5726. {
  5727. return Error("操作失败");
  5728. }
  5729. }
  5730. else
  5731. {
  5732. return Error("权限不足");
  5733. }
  5734. }
  5735. /// <summary>
  5736. /// 审核派单
  5737. /// </summary>
  5738. /// <returns></returns>
  5739. [Authority]
  5740. public ActionResult AuditSplitWorkOrder()
  5741. {
  5742. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5743. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5744. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5745. {
  5746. string workorderid = RequestString.GetFormString("workorderid");
  5747. int state = RequestString.GetInt("state", 0);
  5748. string reason = RequestString.GetFormString("reason");
  5749. int backid = RequestString.GetInt("backid", 0);
  5750. string files = RequestString.GetFormString("files");
  5751. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5752. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5753. Model.T_Bus_Feedback_Next modelT_Bus_Feedback_Next = new BLL.T_Bus_Feedback_Next().GetModel(backid);
  5754. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_Feedback_Next != null)
  5755. {
  5756. if (modelT_Bus_Feedback_Next.F_IsAudit.Value == 0)
  5757. {
  5758. using (TransactionScope trans = new TransactionScope())
  5759. {
  5760. modelT_Bus_Feedback_Next.F_IsAudit = state;
  5761. modelT_Bus_Feedback_Next.F_AuditUser = userModel.F_UserCode;
  5762. modelT_Bus_Feedback_Next.F_AuditTime = DateTime.Now;
  5763. modelT_Bus_Feedback_Next.F_AuditReason = reason;
  5764. new BLL.T_Bus_Feedback_Next().Update(modelT_Bus_Feedback_Next);
  5765. string strmsg = "";
  5766. if (state == 1)
  5767. {
  5768. strmsg = "同意";
  5769. #region 插入反馈记录
  5770. Model.T_Bus_Feedback modelT_Bus_Feedback = new Model.T_Bus_Feedback();
  5771. modelT_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5772. modelT_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5773. modelT_Bus_Feedback.F_DealUser = modelT_Bus_Feedback_Next.F_DealUser;
  5774. modelT_Bus_Feedback.F_Result = modelT_Bus_Feedback_Next.F_Result;//反馈内容
  5775. modelT_Bus_Feedback.F_File = modelT_Bus_Feedback_Next.F_File;
  5776. modelT_Bus_Feedback.F_IsAudit = 0;
  5777. modelT_Bus_Feedback.F_IsDelete = 0;
  5778. modelT_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5779. modelT_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5780. modelT_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5781. modelT_Bus_Feedback.F_IsFeedEnd = 1;
  5782. modelT_Bus_Feedback.F_State = state;
  5783. modelT_Bus_Feedback.F_Type = 1;
  5784. new BLL.T_Bus_Feedback().Add(modelT_Bus_Feedback);
  5785. #endregion
  5786. if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  5787. {
  5788. modelT_Bus_AssignedInfo.F_IsOverdue = 1;
  5789. modelT_Bus_WorkOrder.F_IsOverdue = 1;
  5790. }
  5791. #region 保存工单信息
  5792. modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
  5793. modelT_Bus_WorkOrder.F_Result = modelT_Bus_Feedback_Next.F_Result;
  5794. modelT_Bus_WorkOrder.F_DealDeptId = modelT_Bus_Feedback_Next.F_CreateDeptId;
  5795. modelT_Bus_WorkOrder.F_DealUser = modelT_Bus_Feedback_Next.F_CreateUser;
  5796. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  5797. workorderBLL.Update(modelT_Bus_WorkOrder);
  5798. #endregion
  5799. #region 保存交办信息
  5800. modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
  5801. assignBLL.Update(modelT_Bus_AssignedInfo);
  5802. #endregion
  5803. #region 删除草稿信息
  5804. 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 + "'");
  5805. foreach (var cg in cglist)
  5806. {
  5807. cg.F_IsDelete = 1;
  5808. cg.F_DeleteUser = userModel.F_UserCode;
  5809. cg.F_DeleteTime = DateTime.Now;
  5810. new BLL.T_Bus_Feedback().Update(cg);
  5811. }
  5812. #endregion
  5813. #region 处理协办单位
  5814. 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 + "'");
  5815. foreach (var xb in xblist)
  5816. {
  5817. xb.F_State = 2;
  5818. xb.F_SureUser = userModel.F_UserCode;
  5819. xb.F_SureTime = DateTime.Now;
  5820. new BLL.T_Bus_AssignedItemInfo().Update(xb);
  5821. }
  5822. #endregion
  5823. }
  5824. else if (state == 2)
  5825. {
  5826. strmsg = "拒绝";
  5827. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next1 = new BLL.T_Bus_AssignedInfo_Next().GetModel(modelT_Bus_Feedback_Next.F_AssignedId.Value);
  5828. modelT_Bus_AssignedInfo_Next1.F_FeedbackTime = null;
  5829. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next1);
  5830. modelT_Bus_AssignedInfo.F_IsNext = 2;
  5831. assignBLL.Update(modelT_Bus_AssignedInfo);
  5832. //#region 插入派单记录
  5833. //Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next1 = new BLL.T_Bus_AssignedInfo_Next().GetModel(modelT_Bus_Feedback_Next.F_AssignedId.Value);
  5834. //Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new Model.T_Bus_AssignedInfo_Next();
  5835. //modelT_Bus_AssignedInfo_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5836. //modelT_Bus_AssignedInfo_Next.F_LimitTime = modelT_Bus_AssignedInfo_Next1.F_LimitTime;//办理时限
  5837. //modelT_Bus_AssignedInfo_Next.F_MainDeptId = modelT_Bus_AssignedInfo_Next1.F_MainDeptId;//主办单位id
  5838. //modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = modelT_Bus_AssignedInfo_Next1.F_OtherDeptIds;//协办单位id
  5839. //modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = reason;//交办意见
  5840. //modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
  5841. //modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
  5842. //modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
  5843. //modelT_Bus_AssignedInfo_Next.F_IsDelete = 0;
  5844. //modelT_Bus_AssignedInfo_Next.F_IsOverdue = 0;
  5845. //modelT_Bus_AssignedInfo_Next.F_IsSure = 0;
  5846. //modelT_Bus_AssignedInfo_Next.F_IsReload = 0;
  5847. //modelT_Bus_AssignedInfo_Next.F_Id = new BLL.T_Bus_AssignedInfo_Next().Add(modelT_Bus_AssignedInfo_Next);
  5848. //#endregion
  5849. }
  5850. #region 插入操作记录
  5851. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5852. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5853. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5854. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5855. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5856. oper.F_Message = userinfo + " " + strmsg + "了此处理";
  5857. oper.F_CreateUser = userModel.F_UserCode;
  5858. oper.F_CreateTime = DateTime.Now;
  5859. oper.F_IsDelete = 0;
  5860. operBLL.Add(oper);
  5861. //推送消息表
  5862. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  5863. #endregion
  5864. trans.Complete();
  5865. }
  5866. return Success("操作成功");
  5867. }
  5868. else
  5869. {
  5870. return Error("已经审核过了");
  5871. }
  5872. }
  5873. else
  5874. {
  5875. return Error("操作失败");
  5876. }
  5877. }
  5878. else
  5879. {
  5880. return Error("权限不足");
  5881. }
  5882. }
  5883. /// <summary>
  5884. /// 回访工单
  5885. /// </summary>
  5886. /// <returns></returns>
  5887. [Authority]
  5888. public ActionResult VisitWorkOrder()
  5889. {
  5890. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5891. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5892. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  5893. {
  5894. string workorderid = RequestString.GetFormString("workorderid");
  5895. string visituser = RequestString.GetFormString("visituser");//回访人
  5896. int type = RequestString.GetInt("type", 0);//回访方式
  5897. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  5898. //DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime"));//不满意,重办的办理时限
  5899. int state = RequestString.GetInt("state", 0);//0保存 1保存并下一步
  5900. int visitid = RequestString.GetInt("visitid", 0);
  5901. string result = RequestString.GetFormString("result");//回访情况
  5902. //int nexttype = RequestString.GetInt("nexttype", 0);//1重办 2结案
  5903. //string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
  5904. //string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
  5905. string callid = RequestString.GetFormString("callid");
  5906. string guid= RequestString.GetFormString("guid");
  5907. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5908. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5909. Model.T_Bus_VisitResult modelT_Bus_VisitResult = new Model.T_Bus_VisitResult();
  5910. if (modelT_Bus_WorkOrder != null)
  5911. {
  5912. if (modelT_Bus_WorkOrder.F_WorkState == 6)
  5913. {
  5914. using (TransactionScope trans = new TransactionScope())
  5915. {
  5916. if (visitid == 0)
  5917. {
  5918. #region 新增回访结果记录
  5919. modelT_Bus_VisitResult.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5920. modelT_Bus_VisitResult.F_AssignedId = 0;
  5921. modelT_Bus_VisitResult.F_VisitUser = visituser;
  5922. modelT_Bus_VisitResult.F_Type = type;
  5923. modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
  5924. modelT_Bus_VisitResult.F_Result = result;
  5925. modelT_Bus_VisitResult.F_State = state;
  5926. if (!string.IsNullOrEmpty(callid))
  5927. {
  5928. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  5929. if (rd != null)
  5930. {
  5931. modelT_Bus_VisitResult.F_CallRecordId = rd.CallRecordsId;
  5932. }
  5933. }
  5934. //modelT_Bus_VisitResult.F_LimitTime = newlimittime;
  5935. modelT_Bus_VisitResult.F_IsDelete = 0;
  5936. modelT_Bus_VisitResult.F_CreateUser = userModel.F_UserCode;
  5937. modelT_Bus_VisitResult.F_CreateTime = DateTime.Now;
  5938. if (modelT_Bus_AssignedInfo != null)
  5939. {
  5940. modelT_Bus_VisitResult.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5941. }
  5942. int id = new BLL.T_Bus_VisitResult().Add(modelT_Bus_VisitResult);
  5943. modelT_Bus_VisitResult.F_Id = id;
  5944. //保存回访记录
  5945. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  5946. #endregion
  5947. }
  5948. else
  5949. {
  5950. #region 修改回访结果记录
  5951. modelT_Bus_VisitResult = new BLL.T_Bus_VisitResult().GetModel(visitid);
  5952. if (modelT_Bus_VisitResult != null)
  5953. {
  5954. modelT_Bus_VisitResult.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5955. modelT_Bus_VisitResult.F_AssignedId = 0;
  5956. modelT_Bus_VisitResult.F_VisitUser = visituser;
  5957. modelT_Bus_VisitResult.F_Type = type;
  5958. modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
  5959. modelT_Bus_VisitResult.F_Result = result;
  5960. modelT_Bus_VisitResult.F_State = state;
  5961. if (!string.IsNullOrEmpty(callid))
  5962. {
  5963. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  5964. if (rd != null)
  5965. {
  5966. modelT_Bus_VisitResult.F_CallRecordId = rd.CallRecordsId;
  5967. }
  5968. }
  5969. //modelT_Bus_VisitResult.F_LimitTime = newlimittime;
  5970. modelT_Bus_VisitResult.F_IsDelete = 0;
  5971. modelT_Bus_VisitResult.F_CreateUser = userModel.F_UserCode;
  5972. modelT_Bus_VisitResult.F_CreateTime = DateTime.Now;
  5973. if (modelT_Bus_AssignedInfo != null)
  5974. {
  5975. modelT_Bus_VisitResult.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5976. }
  5977. int id=new BLL.T_Bus_VisitResult().Add(modelT_Bus_VisitResult);
  5978. modelT_Bus_VisitResult.F_Id = id;
  5979. //保存回访记录
  5980. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  5981. }
  5982. #endregion
  5983. }
  5984. if (modelT_Bus_VisitResult != null && modelT_Bus_VisitResult.F_State == 1)
  5985. {
  5986. #region 保存交办信息
  5987. modelT_Bus_AssignedInfo.F_IsSatisfie = issatisfie;
  5988. assignBLL.Update(modelT_Bus_AssignedInfo);
  5989. #endregion
  5990. #region 保存工单信息
  5991. modelT_Bus_WorkOrder.F_WorkState = 7;//已回访
  5992. workorderBLL.Update(modelT_Bus_WorkOrder);
  5993. #endregion
  5994. #region 删除草稿信息
  5995. var cglist = new BLL.T_Bus_VisitResult().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  5996. foreach (var cg in cglist)
  5997. {
  5998. cg.F_IsDelete = 1;
  5999. cg.F_DeleteUser = userModel.F_UserCode;
  6000. cg.F_DeleteTime = DateTime.Now;
  6001. new BLL.T_Bus_VisitResult().Update(cg);
  6002. //保存回访记录
  6003. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  6004. }
  6005. #endregion
  6006. #region 插入操作记录
  6007. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6008. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6009. oper.F_AssignedId = modelT_Bus_VisitResult.F_AssignedId;
  6010. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6011. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6012. oper.F_Message = userinfo + " 回访了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
  6013. oper.F_CreateUser = userModel.F_UserCode;
  6014. oper.F_CreateTime = DateTime.Now;
  6015. oper.F_IsDelete = 0;
  6016. operBLL.Add(oper);
  6017. //推送消息表
  6018. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
  6019. #endregion
  6020. #region 自动语音回访
  6021. if (issatisfie == 1)//如果满意就进行自动语音回访
  6022. {
  6023. var configacb = configBll.GetModelList(" F_ParamCode='AutoCallBack' ").FirstOrDefault();
  6024. if (configacb != null && configacb.F_ParamValue == "1")//如果为1就是开启了自动语音回访,其他都是关闭
  6025. {
  6026. string AutoCallMsg = string.Empty;
  6027. new BLL.T_CTI_Task().AddToAutoVoiceNotice(modelT_Bus_WorkOrder.F_CusPhone, modelT_Bus_WorkOrder.F_WorkOrderId, modelT_Bus_AssignedInfo.F_Id, out AutoCallMsg);
  6028. }
  6029. }
  6030. #endregion
  6031. }
  6032. trans.Complete();
  6033. }
  6034. return Success("操作成功", modelT_Bus_VisitResult.F_Id);
  6035. }
  6036. else
  6037. {
  6038. return Error("已经回访过了");
  6039. }
  6040. }
  6041. else
  6042. {
  6043. return Error("操作失败");
  6044. }
  6045. }
  6046. else
  6047. {
  6048. return Error("权限不足");
  6049. }
  6050. }
  6051. /// <summary>
  6052. /// 督办或监察工单
  6053. /// </summary>
  6054. /// <returns></returns>
  6055. [Authority]
  6056. public ActionResult RemindWorkOrder()
  6057. {
  6058. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6059. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6060. string workorderid = RequestString.GetFormString("workorderid");
  6061. int type = RequestString.GetInt("type", 0);//1督办 2监察
  6062. string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
  6063. string files = RequestString.GetFormString("files");
  6064. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6065. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6066. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  6067. {
  6068. using (TransactionScope trans = new TransactionScope())
  6069. {
  6070. #region 插入督办记录
  6071. Model.T_Bus_RemindRecord modelT_Bus_RemindRecord = new Model.T_Bus_RemindRecord();
  6072. modelT_Bus_RemindRecord.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6073. modelT_Bus_RemindRecord.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6074. modelT_Bus_RemindRecord.F_Type = type;
  6075. modelT_Bus_RemindRecord.F_DeptId = modelT_Bus_AssignedInfo.F_MainDeptId;
  6076. modelT_Bus_RemindRecord.F_Content = overseeopinion;
  6077. modelT_Bus_RemindRecord.F_File = files;
  6078. modelT_Bus_RemindRecord.F_State = 1;
  6079. modelT_Bus_RemindRecord.F_IsDelete = 0;
  6080. modelT_Bus_RemindRecord.F_CreateUser = userModel.F_UserCode;
  6081. modelT_Bus_RemindRecord.F_CreateTime = DateTime.Now;
  6082. new BLL.T_Bus_RemindRecord().Add(modelT_Bus_RemindRecord);
  6083. #endregion
  6084. #region 插入操作记录
  6085. string typename = "督办";
  6086. if (type == 2) { typename = "监察"; }
  6087. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6088. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6089. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6090. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6091. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6092. oper.F_Message = userinfo + " " + typename + "了工单";
  6093. oper.F_CreateUser = userModel.F_UserCode;
  6094. oper.F_CreateTime = DateTime.Now;
  6095. oper.F_IsDelete = 0;
  6096. operBLL.Add(oper);
  6097. #endregion
  6098. trans.Complete();
  6099. }
  6100. return Success("操作成功");
  6101. }
  6102. else
  6103. {
  6104. return Error("操作失败");
  6105. }
  6106. }
  6107. /// <summary>
  6108. /// 重办工单
  6109. /// </summary>
  6110. /// <returns></returns>
  6111. [Authority]
  6112. public ActionResult ReloadWorkOrder()
  6113. {
  6114. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6115. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6116. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6117. {
  6118. string workorderid = RequestString.GetFormString("workorderid");
  6119. string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
  6120. DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");//不满意,重办的办理时限
  6121. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6122. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6123. if (modelT_Bus_WorkOrder != null)
  6124. {
  6125. if (modelT_Bus_WorkOrder.F_WorkState == 7)
  6126. {
  6127. using (TransactionScope trans = new TransactionScope())
  6128. {
  6129. #region 插入督办记录
  6130. Model.T_Bus_RemindRecord modelT_Bus_RemindRecord = new Model.T_Bus_RemindRecord();
  6131. modelT_Bus_RemindRecord.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6132. modelT_Bus_RemindRecord.F_AssignedId = 0;
  6133. modelT_Bus_RemindRecord.F_Type = 1;
  6134. if (modelT_Bus_AssignedInfo != null)//转办后重办
  6135. {
  6136. #region 插入交办记录
  6137. 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());
  6138. modelT_Bus_WorkOrder.F_IsReload= n + 1;
  6139. modelT_Bus_WorkOrder.F_LimitTime = newlimittime;
  6140. modelT_Bus_WorkOrder.F_IsOverdue = 0;
  6141. Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
  6142. AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6143. AssignedInfo.F_LimitTime = newlimittime;//办理时限
  6144. AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
  6145. AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
  6146. AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
  6147. AssignedInfo.F_State = 1;//0草稿 1正式
  6148. AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
  6149. AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
  6150. AssignedInfo.F_IsDelete = 0;
  6151. AssignedInfo.F_IsOverdue = 0;
  6152. AssignedInfo.F_IsSure = 0;
  6153. AssignedInfo.F_IsReload = n + 1;
  6154. AssignedInfo.F_ReloadUser = userModel.F_UserCode;
  6155. AssignedInfo.F_ReloadTime = DateTime.Now;
  6156. assignBLL.Add(AssignedInfo);
  6157. #endregion
  6158. modelT_Bus_RemindRecord.F_AssignedId = AssignedInfo.F_Id;
  6159. modelT_Bus_RemindRecord.F_DeptId = AssignedInfo.F_MainDeptId;
  6160. }
  6161. else if (modelT_Bus_WorkOrder.F_IsResult == 1)//直办后重办
  6162. {
  6163. var cruser = userBLL.GetModel(modelT_Bus_WorkOrder.F_CreateUser);
  6164. if (cruser != null)
  6165. {
  6166. modelT_Bus_RemindRecord.F_DeptId = cruser.F_DeptId;
  6167. }
  6168. }
  6169. modelT_Bus_RemindRecord.F_Content = overseeopinion;
  6170. modelT_Bus_RemindRecord.F_State = 1;
  6171. modelT_Bus_RemindRecord.F_IsDelete = 0;
  6172. modelT_Bus_RemindRecord.F_CreateUser = userModel.F_UserCode;
  6173. modelT_Bus_RemindRecord.F_CreateTime = DateTime.Now;
  6174. new BLL.T_Bus_RemindRecord().Add(modelT_Bus_RemindRecord);
  6175. #endregion
  6176. #region 保存工单信息
  6177. modelT_Bus_WorkOrder.F_WorkState = 8;//重办中
  6178. modelT_Bus_WorkOrder.F_Result = "";
  6179. modelT_Bus_WorkOrder.F_DealDeptId = null;
  6180. modelT_Bus_WorkOrder.F_DealUser = "";
  6181. modelT_Bus_WorkOrder.F_DealTime = null;
  6182. workorderBLL.Update(modelT_Bus_WorkOrder);
  6183. #endregion
  6184. #region 插入操作记录
  6185. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6186. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6187. if (modelT_Bus_AssignedInfo != null)
  6188. {
  6189. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6190. }
  6191. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6192. string deptname = "";
  6193. var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
  6194. if (deptinfo != null) { deptname = deptinfo.F_DeptName; }
  6195. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6196. oper.F_Message = userinfo + " 重办并督办了工单,交办单位:" + deptname;
  6197. oper.F_CreateUser = userModel.F_UserCode;
  6198. oper.F_CreateTime = DateTime.Now;
  6199. oper.F_IsDelete = 0;
  6200. operBLL.Add(oper);
  6201. //推送消息表
  6202. var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
  6203. foreach (var u in users)
  6204. {
  6205. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  6206. }
  6207. #endregion
  6208. trans.Complete();
  6209. }
  6210. return Success("操作成功");
  6211. }
  6212. else
  6213. {
  6214. return Error("已经处理过了");
  6215. }
  6216. }
  6217. else
  6218. {
  6219. return Error("操作失败");
  6220. }
  6221. }
  6222. else
  6223. {
  6224. return Error("权限不足");
  6225. }
  6226. }
  6227. /// <summary>
  6228. /// 结案工单
  6229. /// </summary>
  6230. /// <returns></returns>
  6231. [Authority]
  6232. public ActionResult FinishWorkOrder()
  6233. {
  6234. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6235. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6236. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6237. {
  6238. string workorderid = RequestString.GetFormString("workorderid");
  6239. string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
  6240. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  6241. int isnotice = RequestString.GetInt("isnotice", 0);//0不通告 1通告
  6242. string deptids = RequestString.GetFormString("deptids");//通告单位
  6243. string noticereson = RequestString.GetFormString("noticereson");//通告原因
  6244. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6245. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6246. if (modelT_Bus_WorkOrder != null)
  6247. {
  6248. if (modelT_Bus_WorkOrder.F_WorkState == 7)
  6249. {
  6250. using (TransactionScope trans = new TransactionScope())
  6251. {
  6252. #region 修改工单记录
  6253. modelT_Bus_WorkOrder.F_WorkState = 9;
  6254. modelT_Bus_WorkOrder.F_IsSatisfie = issatisfie;
  6255. modelT_Bus_WorkOrder.F_IsClosed = 1;
  6256. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  6257. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  6258. modelT_Bus_WorkOrder.F_FinalOpinion = finalopinion;
  6259. if (isnotice == 1)
  6260. {
  6261. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
  6262. modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
  6263. modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6264. modelT_Bus_NoticeCriticism.F_Content = noticereson;
  6265. modelT_Bus_NoticeCriticism.F_State = 1;
  6266. modelT_Bus_NoticeCriticism.F_IsDelete = 0;
  6267. modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
  6268. modelT_Bus_NoticeCriticism.F_CreateUser= userModel.F_UserCode;
  6269. new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
  6270. modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6271. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  6272. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  6273. assignBLL.Update(modelT_Bus_AssignedInfo);
  6274. modelT_Bus_WorkOrder.F_IsNotice = 1;
  6275. modelT_Bus_WorkOrder.F_NoticeDeptIds= deptids;
  6276. }
  6277. workorderBLL.Update(modelT_Bus_WorkOrder);
  6278. #endregion
  6279. #region 插入操作记录
  6280. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6281. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6282. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6283. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6284. oper.F_Message = userinfo + " 结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
  6285. if (isnotice == 1)
  6286. {
  6287. string sql = "select dbo.GetDeptNames('" + deptids + "')";
  6288. oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
  6289. }
  6290. oper.F_CreateUser = userModel.F_UserCode;
  6291. oper.F_CreateTime = DateTime.Now;
  6292. oper.F_IsDelete = 0;
  6293. operBLL.Add(oper);
  6294. #endregion
  6295. trans.Complete();
  6296. }
  6297. return Success("操作成功");
  6298. }
  6299. else
  6300. {
  6301. return Error("已经处理过了");
  6302. }
  6303. }
  6304. else
  6305. {
  6306. return Error("操作失败");
  6307. }
  6308. }
  6309. else
  6310. {
  6311. return Error("权限不足");
  6312. }
  6313. }
  6314. /// <summary>
  6315. /// 结案工单
  6316. /// </summary>
  6317. /// <returns></returns>
  6318. [Authority]
  6319. public ActionResult ForceFinishWorkOrder()
  6320. {
  6321. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6322. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6323. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6324. {
  6325. string workorderid = RequestString.GetFormString("workorderid");
  6326. string result = RequestString.GetFormString("result");//处理结果
  6327. string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
  6328. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  6329. int isnotice = RequestString.GetInt("isnotice", 0);//0不通告 1通告
  6330. string deptids = RequestString.GetFormString("deptids");//通告单位
  6331. string noticereson = RequestString.GetFormString("noticereson");//通告原因
  6332. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6333. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6334. if (modelT_Bus_WorkOrder != null)
  6335. {
  6336. using (TransactionScope trans = new TransactionScope())
  6337. {
  6338. #region 修改工单记录
  6339. modelT_Bus_WorkOrder.F_Result = result;
  6340. modelT_Bus_WorkOrder.F_WorkState = 9;
  6341. modelT_Bus_WorkOrder.F_IsSatisfie = issatisfie;
  6342. modelT_Bus_WorkOrder.F_IsClosed = 1;
  6343. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  6344. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  6345. modelT_Bus_WorkOrder.F_FinalOpinion = finalopinion;
  6346. if (isnotice == 1)
  6347. {
  6348. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
  6349. modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
  6350. modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6351. modelT_Bus_NoticeCriticism.F_Content = noticereson;
  6352. modelT_Bus_NoticeCriticism.F_State = 1;
  6353. modelT_Bus_NoticeCriticism.F_IsDelete = 0;
  6354. modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
  6355. modelT_Bus_NoticeCriticism.F_CreateUser = userModel.F_UserCode;
  6356. new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
  6357. if (modelT_Bus_AssignedInfo != null)
  6358. {
  6359. modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6360. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  6361. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  6362. assignBLL.Update(modelT_Bus_AssignedInfo);
  6363. }
  6364. modelT_Bus_WorkOrder.F_IsNotice = 1;
  6365. modelT_Bus_WorkOrder.F_NoticeDeptIds = deptids;
  6366. }
  6367. workorderBLL.Update(modelT_Bus_WorkOrder);
  6368. #endregion
  6369. #region 插入操作记录
  6370. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6371. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6372. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6373. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6374. oper.F_Message = userinfo + " 强制结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
  6375. if (isnotice == 1)
  6376. {
  6377. string sql = "select dbo.GetDeptNames('" + deptids + "')";
  6378. oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
  6379. }
  6380. oper.F_CreateUser = userModel.F_UserCode;
  6381. oper.F_CreateTime = DateTime.Now;
  6382. oper.F_IsDelete = 0;
  6383. operBLL.Add(oper);
  6384. #endregion
  6385. trans.Complete();
  6386. }
  6387. return Success("操作成功");
  6388. }
  6389. else
  6390. {
  6391. return Error("操作失败");
  6392. }
  6393. }
  6394. else
  6395. {
  6396. return Error("权限不足");
  6397. }
  6398. }
  6399. /// <summary>
  6400. /// 删除工单
  6401. /// </summary>
  6402. /// <returns></returns>
  6403. public ActionResult DelWorkOrder(string[] ids)
  6404. {
  6405. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6406. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6407. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  6408. {
  6409. //StringBuilder sb = new StringBuilder();
  6410. foreach (var item in ids)
  6411. {
  6412. //sb.Append("'" + item + "',");
  6413. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(item);
  6414. if (modelT_Bus_WorkOrder != null && modelT_Bus_WorkOrder.F_WorkState == 0)
  6415. {
  6416. using (TransactionScope trans = new TransactionScope())
  6417. {
  6418. #region 修改工单记录
  6419. modelT_Bus_WorkOrder.F_IsDelete = 1;
  6420. modelT_Bus_WorkOrder.F_DeleteUser = userModel.F_UserCode;
  6421. modelT_Bus_WorkOrder.F_DeleteTime = DateTime.Now;
  6422. workorderBLL.Update(modelT_Bus_WorkOrder);
  6423. #endregion
  6424. #region 插入操作记录
  6425. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6426. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6427. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6428. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6429. oper.F_Message = userinfo + " 删除了工单";
  6430. oper.F_CreateUser = userModel.F_UserCode;
  6431. oper.F_CreateTime = DateTime.Now;
  6432. oper.F_IsDelete = 0;
  6433. operBLL.Add(oper);
  6434. #endregion
  6435. trans.Complete();
  6436. }
  6437. }
  6438. }
  6439. return Success("删除成功");
  6440. }
  6441. else
  6442. {
  6443. return Error("权限不足");
  6444. }
  6445. }
  6446. /// <summary>
  6447. /// 转媒体工单
  6448. /// </summary>
  6449. /// <returns></returns>
  6450. [Authority]
  6451. public ActionResult ReleaseWorkOrder()
  6452. {
  6453. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6454. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6455. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6456. {
  6457. string workorderid = RequestString.GetFormString("workorderid");
  6458. int isrelease = RequestString.GetInt("isrelease", -1);
  6459. if (isrelease != -1)
  6460. {
  6461. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6462. if (modelT_Bus_WorkOrder != null)
  6463. {
  6464. using (TransactionScope trans = new TransactionScope())
  6465. {
  6466. #region 修改工单记录
  6467. modelT_Bus_WorkOrder.F_IsRelease = isrelease;
  6468. workorderBLL.Update(modelT_Bus_WorkOrder);
  6469. #endregion
  6470. #region 插入操作记录
  6471. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6472. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6473. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6474. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6475. oper.F_Message = userinfo + " " + (isrelease == 1 ? "发布了" : "撤回了发布") + "工单";
  6476. oper.F_CreateUser = userModel.F_UserCode;
  6477. oper.F_CreateTime = DateTime.Now;
  6478. oper.F_IsDelete = 0;
  6479. operBLL.Add(oper);
  6480. #endregion
  6481. trans.Complete();
  6482. }
  6483. return Success("操作成功");
  6484. }
  6485. else
  6486. {
  6487. return Error("操作失败");
  6488. }
  6489. }
  6490. else
  6491. {
  6492. return Error("操作失败");
  6493. }
  6494. }
  6495. else
  6496. {
  6497. return Error("权限不足");
  6498. }
  6499. }
  6500. ///// <summary>
  6501. ///// 通告和撤销通告
  6502. ///// </summary>
  6503. ///// <returns></returns>
  6504. //[Authority]
  6505. //public ActionResult NoticeWorkOrder()
  6506. //{
  6507. // int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6508. // Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6509. // if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6510. // {
  6511. // int assignid = RequestString.GetInt("id", 0);
  6512. // int isnotice = RequestString.GetInt("isnotice", -1);
  6513. // Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
  6514. // if (modelT_Bus_AssignedInfo != null)
  6515. // {
  6516. // if (isnotice == 0 && modelT_Bus_AssignedInfo.F_IsNotice == 1)
  6517. // {
  6518. // using (TransactionScope trans = new TransactionScope())
  6519. // {
  6520. // #region 修改交办记录
  6521. // modelT_Bus_AssignedInfo.F_IsNotice = 0;
  6522. // assignBLL.Update(modelT_Bus_AssignedInfo);
  6523. // #endregion
  6524. // #region 插入操作记录
  6525. // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6526. // oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  6527. // var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
  6528. // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6529. // oper.F_Message = userinfo + " 撤销了通告交办单位:" + (deptinfo != null ? deptinfo.F_DeptName : "");
  6530. // oper.F_CreateUser = userModel.F_UserCode;
  6531. // oper.F_CreateTime = DateTime.Now;
  6532. // oper.F_IsDelete = 0;
  6533. // operBLL.Add(oper);
  6534. // #endregion
  6535. // trans.Complete();
  6536. // }
  6537. // return Success("操作成功");
  6538. // }
  6539. // else if (isnotice == 1 && modelT_Bus_AssignedInfo.F_IsNotice == 0)
  6540. // {
  6541. // using (TransactionScope trans = new TransactionScope())
  6542. // {
  6543. // #region 修改交办记录
  6544. // modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6545. // assignBLL.Update(modelT_Bus_AssignedInfo);
  6546. // #endregion
  6547. // #region 插入操作记录
  6548. // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6549. // oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  6550. // var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
  6551. // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6552. // oper.F_Message = userinfo + " 通告了交办单位:" + (deptinfo != null ? deptinfo.F_DeptName : "");
  6553. // oper.F_CreateUser = userModel.F_UserCode;
  6554. // oper.F_CreateTime = DateTime.Now;
  6555. // oper.F_IsDelete = 0;
  6556. // operBLL.Add(oper);
  6557. // #endregion
  6558. // trans.Complete();
  6559. // }
  6560. // return Success("操作成功");
  6561. // }
  6562. // else
  6563. // {
  6564. // return Error("操作失败");
  6565. // }
  6566. // }
  6567. // else
  6568. // {
  6569. // return Error("操作失败");
  6570. // }
  6571. // }
  6572. // else
  6573. // {
  6574. // return Error("权限不足");
  6575. // }
  6576. //}
  6577. /// <summary>
  6578. /// 通告和撤销通告
  6579. /// </summary>
  6580. /// <returns></returns>
  6581. [Authority]
  6582. public ActionResult NoticeWorkOrder()
  6583. {
  6584. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6585. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6586. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6587. {
  6588. string workorderid = RequestString.GetFormString("workorderid");
  6589. int isnotice = RequestString.GetInt("isnotice", -1);
  6590. string deptids = RequestString.GetFormString("deptids");//通告单位
  6591. string noticereson = RequestString.GetFormString("noticereson");//通告原因
  6592. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6593. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6594. if (modelT_Bus_WorkOrder != null)
  6595. {
  6596. if (isnotice == 0 && modelT_Bus_WorkOrder.F_IsNotice == 1)
  6597. {
  6598. using (TransactionScope trans = new TransactionScope())
  6599. {
  6600. #region 修改工单记录
  6601. modelT_Bus_WorkOrder.F_IsNotice = 0;
  6602. modelT_Bus_WorkOrder.F_NoticeDeptIds = "";
  6603. workorderBLL.Update(modelT_Bus_WorkOrder);
  6604. #endregion
  6605. if (modelT_Bus_AssignedInfo != null)
  6606. {
  6607. #region 修改交办记录
  6608. modelT_Bus_AssignedInfo.F_IsNotice = 0;
  6609. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  6610. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  6611. assignBLL.Update(modelT_Bus_AssignedInfo);
  6612. #endregion
  6613. }
  6614. #region 修改通告记录
  6615. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new BLL.T_Bus_NoticeCriticism().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
  6616. modelT_Bus_NoticeCriticism.F_IsDelete = 1;
  6617. modelT_Bus_NoticeCriticism.F_DeleteTime = DateTime.Now;
  6618. modelT_Bus_NoticeCriticism.F_DeleteUser = userModel.F_UserCode;
  6619. new BLL.T_Bus_NoticeCriticism().Update(modelT_Bus_NoticeCriticism);
  6620. #endregion
  6621. #region 插入操作记录
  6622. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6623. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6624. string sql = "select dbo.GetDeptNames('" + modelT_Bus_NoticeCriticism.F_DeptIds + "')";
  6625. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6626. oper.F_Message = userinfo + " 撤销了通告交办单位:" + DbHelperSQL.GetSingle(sql).ToString();
  6627. oper.F_CreateUser = userModel.F_UserCode;
  6628. oper.F_CreateTime = DateTime.Now;
  6629. oper.F_IsDelete = 0;
  6630. operBLL.Add(oper);
  6631. #endregion
  6632. trans.Complete();
  6633. }
  6634. return Success("操作成功");
  6635. }
  6636. else if (isnotice == 1 && modelT_Bus_WorkOrder.F_IsNotice == 0)
  6637. {
  6638. using (TransactionScope trans = new TransactionScope())
  6639. {
  6640. #region 修改工单记录
  6641. modelT_Bus_WorkOrder.F_IsNotice = 1;
  6642. modelT_Bus_WorkOrder.F_NoticeDeptIds = deptids;
  6643. workorderBLL.Update(modelT_Bus_WorkOrder);
  6644. #endregion
  6645. if (modelT_Bus_AssignedInfo != null)
  6646. {
  6647. #region 修改交办记录
  6648. modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6649. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  6650. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  6651. assignBLL.Update(modelT_Bus_AssignedInfo);
  6652. #endregion
  6653. }
  6654. #region 新增通告记录
  6655. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
  6656. modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
  6657. modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6658. modelT_Bus_NoticeCriticism.F_Content = noticereson;
  6659. modelT_Bus_NoticeCriticism.F_State = 1;
  6660. modelT_Bus_NoticeCriticism.F_IsDelete = 0;
  6661. modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
  6662. modelT_Bus_NoticeCriticism.F_CreateUser = userModel.F_UserCode;
  6663. new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
  6664. #endregion
  6665. #region 插入操作记录
  6666. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6667. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6668. string sql = "select dbo.GetDeptNames('"+ deptids + "')";
  6669. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6670. oper.F_Message = userinfo + " 通告了交办单位:" + DbHelperSQL.GetSingle(sql).ToString();
  6671. oper.F_CreateUser = userModel.F_UserCode;
  6672. oper.F_CreateTime = DateTime.Now;
  6673. oper.F_IsDelete = 0;
  6674. operBLL.Add(oper);
  6675. #endregion
  6676. trans.Complete();
  6677. }
  6678. return Success("操作成功");
  6679. }
  6680. else
  6681. {
  6682. return Error("操作失败");
  6683. }
  6684. }
  6685. else
  6686. {
  6687. return Error("操作失败");
  6688. }
  6689. }
  6690. else
  6691. {
  6692. return Error("权限不足");
  6693. }
  6694. }
  6695. /// <summary>
  6696. /// 市民催单
  6697. /// </summary>
  6698. /// <returns></returns>
  6699. [Authority]
  6700. public ActionResult AdditionalWorkOrder()
  6701. {
  6702. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6703. Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
  6704. string workorderid = RequestString.GetFormString("workorderid");
  6705. string title = RequestString.GetFormString("title");
  6706. string content = RequestString.GetFormString("content");
  6707. string files = RequestString.GetFormString("files");
  6708. string callid = RequestString.GetFormString("callid");
  6709. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
  6710. if (modelT_Bus_WorkOrder != null)
  6711. {
  6712. using (TransactionScope trans = new TransactionScope())
  6713. {
  6714. #region 插入附加记录
  6715. //批示记录
  6716. Model.T_Bus_Additional model_T_Bus_Additional = new Model.T_Bus_Additional();
  6717. model_T_Bus_Additional.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
  6718. model_T_Bus_Additional.F_Title = title;
  6719. model_T_Bus_Additional.F_Content = content;
  6720. if (!string.IsNullOrEmpty(callid))
  6721. {
  6722. model_T_Bus_Additional.F_CallId = callid;
  6723. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  6724. if (rd != null)
  6725. {
  6726. model_T_Bus_Additional.F_CallRecordId = rd.CallRecordsId;
  6727. }
  6728. }
  6729. model_T_Bus_Additional.F_File = files;//附件
  6730. model_T_Bus_Additional.F_CreateUser = userModel.F_UserCode;//呈批人
  6731. model_T_Bus_Additional.F_CreateTime = DateTime.Now;//呈批时间
  6732. model_T_Bus_Additional.F_IsDelete = 0;
  6733. model_T_Bus_Additional.F_State = 1;//审批状态(0:未处理,1:通过)
  6734. new BLL.T_Bus_Additional().Add(model_T_Bus_Additional);
  6735. #endregion
  6736. #region 插入操作记录
  6737. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6738. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6739. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6740. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6741. oper.F_Message = userinfo + " 接到市民催单,内容:" + content;
  6742. oper.F_CreateUser = userModel.F_UserCode;
  6743. oper.F_CreateTime = DateTime.Now;
  6744. oper.F_IsDelete = 0;
  6745. operBLL.Add(oper);
  6746. #endregion
  6747. trans.Complete();
  6748. }
  6749. return Success("操作成功");
  6750. }
  6751. else
  6752. {
  6753. return Error("操作失败");
  6754. }
  6755. }
  6756. #endregion
  6757. #region 语音附件其他
  6758. /// <summary>
  6759. /// 验证当前单位是否交办单位
  6760. /// </summary>
  6761. /// <param name="modelT_Bus_AssignedInfo"></param>
  6762. /// <param name="deptid"></param>
  6763. /// <returns></returns>
  6764. public int AssignDeptType(Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo, int deptid)
  6765. {
  6766. int type = 0;
  6767. if (modelT_Bus_AssignedInfo.F_MainDeptId == deptid)
  6768. {
  6769. type = 1;//主办
  6770. }
  6771. else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(deptid.ToString()))
  6772. {
  6773. type = 2;//协办
  6774. }
  6775. return type;
  6776. }
  6777. /// <summary>
  6778. /// 获取留言路径
  6779. /// </summary>
  6780. /// <param name="lid">留言id</param>
  6781. /// <param name="prefix">前缀</param>
  6782. /// <returns></returns>
  6783. public string GetLeavePath(string lid, string prefix)
  6784. {
  6785. string path = string.Empty;
  6786. var liuyan = new BLL.T_Call_LeaveRecord().GetModelList(" F_Id='" + lid + "' ").FirstOrDefault();
  6787. if (liuyan != null)
  6788. {
  6789. if (!string.IsNullOrEmpty(liuyan.F_RecFileUrl))
  6790. {
  6791. path = prefix + liuyan.F_RecFileUrl;
  6792. }
  6793. }
  6794. return path;
  6795. }
  6796. /// <summary>
  6797. /// 获取通话录音路径
  6798. /// </summary>
  6799. /// <param name="cid">通话id</param>
  6800. /// <param name="prefix">前缀</param>
  6801. /// <returns></returns>
  6802. public string GetCallPath(string cid, string prefix)
  6803. {
  6804. string path = string.Empty;
  6805. var luyin = new BLL.T_Call_CallRecords().GetModelList(" CallRecordsId='" + cid + "' ").FirstOrDefault();
  6806. if (luyin != null)
  6807. {
  6808. if (!string.IsNullOrEmpty(luyin.FilePath))
  6809. {
  6810. var ym = prefix;
  6811. ym = ym.Substring(0, ym.Length - 1);
  6812. path = ym + luyin.FilePath.Substring(luyin.FilePath.IndexOf(':') + 1).Replace('\\', '/');
  6813. }
  6814. }
  6815. return path;
  6816. }
  6817. /// <summary>
  6818. /// 获取附件数据
  6819. /// </summary>
  6820. /// <param name="ids">附件id,多个用英文逗号,隔开</param>
  6821. /// <param name="prefix">前缀</param>
  6822. /// <returns></returns>
  6823. public DataTable GetFileData(string ids, string prefix)
  6824. {
  6825. DataTable dt = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + ids + ")").Tables[0];
  6826. foreach (DataRow dr in dt.Rows)
  6827. {
  6828. dr["F_FileUrl"] = prefix + dr["F_FileUrl"].ToString();
  6829. }
  6830. return dt;
  6831. }
  6832. /// <summary>
  6833. /// 绑定附件信息
  6834. /// </summary>
  6835. /// <param name="dt"></param>
  6836. /// <param name="prefix"></param>
  6837. /// <returns></returns>
  6838. public DataTable BindFileData(DataTable dt, string prefix)
  6839. {
  6840. dt.Columns.Add("File", typeof(object));
  6841. foreach (DataRow dr in dt.Rows)
  6842. {
  6843. if (dr["F_File"] != null && dr["F_File"].ToString() != "")
  6844. {
  6845. dr["File"] = GetFileData(dr["F_File"].ToString(), prefix);
  6846. //web站点使用虚拟目录(api站点里面的Upload文件夹)后用下面代码,否则用上面代码
  6847. //dr["File"] = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + dr["F_File"].ToString() + ")").Tables[0];
  6848. }
  6849. }
  6850. return dt;
  6851. }
  6852. #endregion
  6853. #region 修改工单 by admin
  6854. /// <summary>
  6855. /// 获取详情
  6856. /// </summary>
  6857. /// <returns></returns>
  6858. [Authority]
  6859. public ActionResult GetInfoByAdmin(int id,int type)
  6860. {
  6861. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6862. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6863. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6864. {
  6865. //string sql = "select * from ";
  6866. string table = string.Empty;
  6867. switch (type)
  6868. {
  6869. case 1: table = "T_Bus_AssignedInfo"; break;
  6870. case 2: table = "T_Bus_DelayTime"; break;
  6871. case 3: table = "T_Bus_Feedback"; break;
  6872. case 4: table = "T_Bus_RemindRecord"; break;
  6873. case 5: table = "T_Bus_SubmitSuper"; break;
  6874. case 6: table = "T_Bus_VisitResult"; break;
  6875. }
  6876. string sql = "select * from " + table + " where F_IsDelete=0 and F_Id=" + id;
  6877. var dt = DbHelperSQL.Query(sql).Tables[0];
  6878. return Success("操作成功", dt);
  6879. }
  6880. else
  6881. {
  6882. return Error("权限不足");
  6883. }
  6884. }
  6885. /// <summary>
  6886. /// 修改工单信息
  6887. /// </summary>
  6888. /// <returns></returns>
  6889. [Authority]
  6890. public ActionResult EditWorkOrderByAdmin()
  6891. {
  6892. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6893. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6894. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6895. {
  6896. string workorderid = RequestString.GetFormString("workorderid");
  6897. int source = RequestString.GetInt("source", 0);
  6898. string cusname = RequestString.GetFormString("cusname");
  6899. string cussex = RequestString.GetFormString("cussex");
  6900. string cusphone = RequestString.GetFormString("cusphone");
  6901. string cusaddress = RequestString.GetFormString("cusaddress");
  6902. string email = RequestString.GetFormString("email");
  6903. string zipcode = RequestString.GetFormString("zipcode");
  6904. string conname = RequestString.GetFormString("conname");
  6905. string conphone = RequestString.GetFormString("conphone");
  6906. string title = RequestString.GetFormString("title");
  6907. string content = RequestString.GetFormString("content");
  6908. string files = RequestString.GetFormString("files");
  6909. int sourcearea = RequestString.GetInt("sourcearea", 0);
  6910. string sourceaddress = RequestString.GetFormString("sourceaddress");
  6911. //int isresult = RequestString.GetInt("isresult", 0);
  6912. string result = RequestString.GetFormString("result");
  6913. string keys = RequestString.GetFormString("keys");
  6914. string splituser = RequestString.GetFormString("splituser");
  6915. int type = RequestString.GetInt("type", 0);
  6916. int bigtype = RequestString.GetInt("bigtype", 0);
  6917. int smalltype = RequestString.GetInt("smalltype", 0);
  6918. int isprotect = RequestString.GetInt("isprotect", 0);
  6919. int level = RequestString.GetInt("level", 0);
  6920. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6921. if (modelT_Bus_WorkOrder != null)
  6922. {
  6923. using (TransactionScope trans = new TransactionScope())
  6924. {
  6925. #region 保存工单信息
  6926. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  6927. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  6928. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  6929. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  6930. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  6931. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  6932. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  6933. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  6934. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  6935. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  6936. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  6937. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  6938. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  6939. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  6940. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  6941. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  6942. modelT_Bus_WorkOrder.F_File = files;//附件
  6943. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  6944. modelT_Bus_WorkOrder.F_Result = result;
  6945. modelT_Bus_WorkOrder.F_Key = keys;
  6946. modelT_Bus_WorkOrder.F_Level = level;
  6947. workorderBLL.Update(modelT_Bus_WorkOrder);
  6948. #endregion
  6949. #region 插入操作记录
  6950. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6951. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6952. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6953. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  6954. oper.F_File = modelT_Bus_WorkOrder.F_File;
  6955. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6956. oper.F_Message = userinfo + " 修改了工单基本信息";
  6957. oper.F_CreateUser = userModel.F_UserCode;
  6958. oper.F_CreateTime = DateTime.Now;
  6959. oper.F_IsDelete = 0;
  6960. operBLL.Add(oper);
  6961. #endregion
  6962. trans.Complete();
  6963. }
  6964. return Success("操作成功");
  6965. }
  6966. else
  6967. {
  6968. return Error("操作失败");
  6969. }
  6970. }
  6971. else
  6972. {
  6973. return Success("权限不足");
  6974. }
  6975. }
  6976. /// <summary>
  6977. /// 修改批示信息
  6978. /// </summary>
  6979. /// <returns></returns>
  6980. [Authority]
  6981. public ActionResult EditSuperInfoByAdmin()
  6982. {
  6983. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6984. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6985. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6986. {
  6987. //int type = RequestString.GetInt("type", 0);//1领导批示 2市长指示
  6988. string superuser = RequestString.GetFormString("superuser");
  6989. string superopinion = RequestString.GetFormString("superopinion");
  6990. string files = RequestString.GetFormString("files");
  6991. int id = RequestString.GetInt("id", 0);
  6992. Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new BLL.T_Bus_SubmitSuper().GetModel(id);
  6993. if (model_T_Bus_SubmitSuper != null)
  6994. {
  6995. using (TransactionScope trans = new TransactionScope())
  6996. {
  6997. #region 保存批示信息
  6998. //model_T_Bus_SubmitSuper.F_Type = type;//1领导批示 2市长指示
  6999. model_T_Bus_SubmitSuper.F_BatchReason = superuser;//批示人
  7000. model_T_Bus_SubmitSuper.F_SuperOpinion = superopinion;//批示内容
  7001. model_T_Bus_SubmitSuper.F_File = files;//附件
  7002. new BLL.T_Bus_SubmitSuper().Update(model_T_Bus_SubmitSuper);
  7003. #endregion
  7004. #region 插入操作记录
  7005. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7006. oper.F_WorkOrderId = model_T_Bus_SubmitSuper.F_WorkOrderId;
  7007. oper.F_File = model_T_Bus_SubmitSuper.F_File;
  7008. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7009. oper.F_Message = userinfo + " 修改了工单批示信息";
  7010. oper.F_CreateUser = userModel.F_UserCode;
  7011. oper.F_CreateTime = DateTime.Now;
  7012. oper.F_IsDelete = 0;
  7013. operBLL.Add(oper);
  7014. #endregion
  7015. trans.Complete();
  7016. }
  7017. return Success("操作成功");
  7018. }
  7019. else
  7020. {
  7021. return Error("操作失败");
  7022. }
  7023. }
  7024. else
  7025. {
  7026. return Error("权限不足");
  7027. }
  7028. }
  7029. /// <summary>
  7030. /// 修改交办信息
  7031. /// </summary>
  7032. /// <returns></returns>
  7033. [Authority]
  7034. public ActionResult EditAssignInfoByAdmin()
  7035. {
  7036. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7037. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7038. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7039. {
  7040. int assignid = RequestString.GetInt("id", 0);
  7041. //int maindeptid = RequestString.GetInt("maindeptid", 0);
  7042. //string otherdeptids = RequestString.GetFormString("otherdeptids");
  7043. DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime"));
  7044. string assignedopinion = RequestString.GetFormString("assignedopinion");
  7045. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
  7046. if (modelT_Bus_AssignedInfo != null)
  7047. {
  7048. using (TransactionScope trans = new TransactionScope())
  7049. {
  7050. #region 保存交办信息
  7051. modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
  7052. //modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
  7053. //modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
  7054. modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
  7055. assignBLL.Update(modelT_Bus_AssignedInfo);
  7056. #endregion
  7057. #region 插入操作记录
  7058. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7059. oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  7060. oper.F_File = modelT_Bus_AssignedInfo.F_File;
  7061. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7062. oper.F_Message = userinfo + " 修改了工单交办信息";
  7063. oper.F_CreateUser = userModel.F_UserCode;
  7064. oper.F_CreateTime = DateTime.Now;
  7065. oper.F_IsDelete = 0;
  7066. operBLL.Add(oper);
  7067. #endregion
  7068. trans.Complete();
  7069. }
  7070. return Success("操作成功");
  7071. }
  7072. else
  7073. {
  7074. return Error("操作失败");
  7075. }
  7076. }
  7077. else
  7078. {
  7079. return Error("权限不足");
  7080. }
  7081. }
  7082. /// <summary>
  7083. /// 修改办理信息
  7084. /// </summary>
  7085. /// <returns></returns>
  7086. [Authority]
  7087. public ActionResult EditFeedBackInfoByAdmin()
  7088. {
  7089. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7090. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7091. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7092. {
  7093. string dealman = RequestString.GetFormString("dealman");
  7094. string result = RequestString.GetFormString("result");
  7095. string files = RequestString.GetFormString("files");
  7096. int feedbackid = RequestString.GetInt("id", 0);
  7097. Model.T_Bus_Feedback model_T_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
  7098. if (model_T_Bus_Feedback != null)
  7099. {
  7100. using (TransactionScope trans = new TransactionScope())
  7101. {
  7102. #region 保存办理信息
  7103. model_T_Bus_Feedback.F_DealUser = dealman;
  7104. model_T_Bus_Feedback.F_Result = result;//反馈内容
  7105. model_T_Bus_Feedback.F_File = files;
  7106. new BLL.T_Bus_Feedback().Update(model_T_Bus_Feedback);
  7107. #endregion
  7108. #region 保存工单信息
  7109. 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());
  7110. var assign = assignBLL.GetModel(model_T_Bus_Feedback.F_AssignedId.Value);
  7111. if (maxid == assign.F_Id)
  7112. {
  7113. var order = workorderBLL.GetModel(model_T_Bus_Feedback.F_WorkOrderId);
  7114. order.F_Result = result;//反馈内容
  7115. workorderBLL.Update(order);
  7116. }
  7117. #endregion
  7118. #region 插入操作记录
  7119. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7120. oper.F_WorkOrderId = model_T_Bus_Feedback.F_WorkOrderId;
  7121. oper.F_File = model_T_Bus_Feedback.F_File;
  7122. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7123. oper.F_Message = userinfo + " 修改了工单办理信息";
  7124. oper.F_CreateUser = userModel.F_UserCode;
  7125. oper.F_CreateTime = DateTime.Now;
  7126. oper.F_IsDelete = 0;
  7127. operBLL.Add(oper);
  7128. #endregion
  7129. trans.Complete();
  7130. }
  7131. return Success("操作成功");
  7132. }
  7133. else
  7134. {
  7135. return Error("操作失败");
  7136. }
  7137. }
  7138. else
  7139. {
  7140. return Error("权限不足");
  7141. }
  7142. }
  7143. /// <summary>
  7144. /// 修改回访信息
  7145. /// </summary>
  7146. /// <returns></returns>
  7147. [Authority]
  7148. public ActionResult EditVisitInfoByAdmin()
  7149. {
  7150. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7151. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7152. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7153. {
  7154. string visituser = RequestString.GetFormString("visituser");//回访人
  7155. int type = RequestString.GetInt("type", 0);//回访方式
  7156. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  7157. int visitid = RequestString.GetInt("id", 0);
  7158. string result = RequestString.GetFormString("result");//回访情况
  7159. string guid = RequestString.GetFormString("guid");
  7160. Model.T_Bus_VisitResult modelT_Bus_VisitResult = new BLL.T_Bus_VisitResult().GetModel(visitid);
  7161. if (modelT_Bus_VisitResult != null)
  7162. {
  7163. using (TransactionScope trans = new TransactionScope())
  7164. {
  7165. #region 保存回访信息
  7166. modelT_Bus_VisitResult.F_VisitUser = visituser;
  7167. modelT_Bus_VisitResult.F_Type = type;
  7168. modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
  7169. modelT_Bus_VisitResult.F_Result = result;
  7170. new BLL.T_Bus_VisitResult().Update(modelT_Bus_VisitResult);
  7171. //保存回访记录
  7172. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  7173. #endregion
  7174. #region 插入操作记录
  7175. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7176. oper.F_WorkOrderId = modelT_Bus_VisitResult.F_WorkOrderId;
  7177. oper.F_File = modelT_Bus_VisitResult.F_File;
  7178. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7179. oper.F_Message = userinfo + " 修改了工单回访信息";
  7180. oper.F_CreateUser = userModel.F_UserCode;
  7181. oper.F_CreateTime = DateTime.Now;
  7182. oper.F_IsDelete = 0;
  7183. operBLL.Add(oper);
  7184. #endregion
  7185. trans.Complete();
  7186. }
  7187. return Success("操作成功");
  7188. }
  7189. else
  7190. {
  7191. return Error("操作失败");
  7192. }
  7193. }
  7194. else
  7195. {
  7196. return Error("权限不足");
  7197. }
  7198. }
  7199. /// <summary>
  7200. /// 修改退回审核信息
  7201. /// </summary>
  7202. /// <returns></returns>
  7203. [Authority]
  7204. public ActionResult EditAuditRebackByAdmin()
  7205. {
  7206. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7207. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7208. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7209. {
  7210. string reason = RequestString.GetFormString("reason");
  7211. int rebackid = RequestString.GetInt("id", 0);
  7212. Model.T_Bus_Feedback modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(rebackid);
  7213. if (modelT_Bus_Feedback != null)
  7214. {
  7215. using (TransactionScope trans = new TransactionScope())
  7216. {
  7217. #region 保存反馈信息
  7218. modelT_Bus_Feedback.F_AuditReason = reason;//交办意见
  7219. new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
  7220. #endregion
  7221. #region 插入操作记录
  7222. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7223. oper.F_WorkOrderId = modelT_Bus_Feedback.F_WorkOrderId;
  7224. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7225. oper.F_Message = userinfo + " 修改了工单退回审核信息";
  7226. oper.F_CreateUser = userModel.F_UserCode;
  7227. oper.F_CreateTime = DateTime.Now;
  7228. oper.F_IsDelete = 0;
  7229. operBLL.Add(oper);
  7230. #endregion
  7231. trans.Complete();
  7232. }
  7233. return Success("操作成功");
  7234. }
  7235. else
  7236. {
  7237. return Error("操作失败");
  7238. }
  7239. }
  7240. else
  7241. {
  7242. return Error("权限不足");
  7243. }
  7244. }
  7245. /// <summary>
  7246. /// 修改退回审核信息
  7247. /// </summary>
  7248. /// <returns></returns>
  7249. [Authority]
  7250. public ActionResult EditAuditDelayByAdmin()
  7251. {
  7252. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7253. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7254. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7255. {
  7256. string reason = RequestString.GetFormString("reason");
  7257. //DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime"));
  7258. int delayid = RequestString.GetInt("id", 0);
  7259. Model.T_Bus_DelayTime modelT_Bus_DelayTime = new BLL.T_Bus_DelayTime().GetModel(delayid);
  7260. if (modelT_Bus_DelayTime != null )
  7261. {
  7262. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(modelT_Bus_DelayTime.F_AssignedId.Value);
  7263. using (TransactionScope trans = new TransactionScope())
  7264. {
  7265. #region 保存延时审核信息
  7266. modelT_Bus_DelayTime.F_RefuseReason = reason;
  7267. //modelT_Bus_DelayTime.F_AgreeTime = newlimittime;
  7268. new BLL.T_Bus_DelayTime().Update(modelT_Bus_DelayTime);
  7269. #endregion
  7270. #region 插入操作记录
  7271. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7272. oper.F_WorkOrderId = modelT_Bus_DelayTime.F_WorkOrderId;
  7273. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7274. oper.F_Message = userinfo + " 修改了工单延时审核信息";
  7275. oper.F_CreateUser = userModel.F_UserCode;
  7276. oper.F_CreateTime = DateTime.Now;
  7277. oper.F_IsDelete = 0;
  7278. operBLL.Add(oper);
  7279. #endregion
  7280. trans.Complete();
  7281. }
  7282. return Success("操作成功");
  7283. }
  7284. else
  7285. {
  7286. return Error("操作失败");
  7287. }
  7288. }
  7289. else
  7290. {
  7291. return Error("权限不足");
  7292. }
  7293. }
  7294. #endregion
  7295. #region 县级对接
  7296. /// <summary>
  7297. /// 获取网点列表
  7298. /// </summary>
  7299. /// <param name="code"></param>
  7300. /// <param name="name"></param>
  7301. /// <returns></returns>
  7302. [Authority]
  7303. public ActionResult GetCityList(string code, string name)
  7304. {
  7305. string signcode = Configs.GetValue("CityOutSignCode");
  7306. string url = Configs.GetValue("CityOutUrl");
  7307. string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityList", signcode);
  7308. string strparams = "?code=" + code + "&name=" + name + "&signcode=" + outsigncode;
  7309. string result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityList" + strparams);
  7310. return Content(result);
  7311. }
  7312. /// <summary>
  7313. /// 获取网点详情
  7314. /// </summary>
  7315. /// <param name="code"></param>
  7316. /// <returns></returns>
  7317. [Authority]
  7318. public ActionResult GetCityDetail(string code)
  7319. {
  7320. string signcode = Configs.GetValue("CityOutSignCode");
  7321. string url = Configs.GetValue("CityOutUrl");
  7322. string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityDetail", signcode);
  7323. string strparams = "?code=" + code + "&signcode=" + outsigncode;
  7324. string result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityDetail" + strparams);
  7325. return Content(result);
  7326. }
  7327. /// <summary>
  7328. /// 转派工单到县级
  7329. /// </summary>
  7330. /// <returns></returns>
  7331. [Authority]
  7332. public ActionResult TurnWorkOrder()
  7333. {
  7334. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7335. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7336. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLYGLY" || userModel.F_RoleCode == "GLY")
  7337. {
  7338. string workorderid = RequestString.GetFormString("workorderid");
  7339. string citycode = RequestString.GetFormString("citycode");
  7340. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  7341. if (modelT_Bus_WorkOrder != null && modelT_Bus_WorkOrder.F_WorkState == 1)
  7342. {
  7343. using (TransactionScope trans = new TransactionScope())
  7344. {
  7345. trans.Complete();
  7346. }
  7347. return Success("操作成功");
  7348. }
  7349. else
  7350. {
  7351. return Error("操作失败");
  7352. }
  7353. }
  7354. else
  7355. {
  7356. return Success("权限不足");
  7357. }
  7358. }
  7359. /// <summary>
  7360. /// 退回市工单
  7361. /// </summary>
  7362. /// <returns></returns>
  7363. [Authority]
  7364. public ActionResult RefuseCityWorkOrder()
  7365. {
  7366. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7367. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7368. string workorderid = RequestString.GetFormString("workorderid");
  7369. string reson = RequestString.GetFormString("reson");
  7370. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  7371. Model.T_Bus_CityTurn modelT_Bus_CityTurn = new BLL.T_Bus_CityTurn().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
  7372. if (modelT_Bus_WorkOrder != null && modelT_Bus_CityTurn != null && modelT_Bus_CityTurn.F_IsSure != 2)
  7373. {
  7374. using (TransactionScope trans = new TransactionScope())
  7375. {
  7376. string signcode = Configs.GetValue("CityOutSignCode");
  7377. string url = Configs.GetValue("CityOutUrl");
  7378. string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityDetail", signcode);
  7379. string strparams = "?code=" + modelT_Bus_CityTurn.F_CityCode + "&signcode=" + outsigncode;
  7380. var result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityDetail" + strparams).ToJObject();
  7381. if (result["state"].ToString() == "success")
  7382. {
  7383. var model = result["data"].ToString().ToJObject();
  7384. string turnsigncode = model["F_Sign"].ToString();
  7385. string turnurl = model["F_Url"].ToString();
  7386. string turnoutsigncode = CommonHelper.getsigncode("CountyBusiness", "RefuseCityWorkOrder", turnsigncode);
  7387. string turnstrparams = "workorderid=" + modelT_Bus_CityTurn.F_CityWorkOrderId + "&reson=" + reson + "&signcode=" + turnoutsigncode;
  7388. string turnresultstr = HttpMethods.HttpPost(turnurl + "/CountyBusiness/RefuseCityWorkOrder", turnstrparams);
  7389. var turnresult = turnresultstr.ToJObject();
  7390. if (turnresult["state"].ToString() != "success")
  7391. {
  7392. return Content(turnresultstr);
  7393. }
  7394. }
  7395. modelT_Bus_WorkOrder.F_IsDelete = 1;
  7396. modelT_Bus_WorkOrder.F_DeleteTime = DateTime.Now;
  7397. if (modelT_Bus_WorkOrder.F_IsEnabled == 0)
  7398. {
  7399. modelT_Bus_WorkOrder.F_IsEnabled = 1;
  7400. modelT_Bus_WorkOrder.F_EnableTime = DateTime.Now;
  7401. }
  7402. workorderBLL.Update(modelT_Bus_WorkOrder);
  7403. modelT_Bus_CityTurn.F_IsSure = 2;
  7404. modelT_Bus_CityTurn.F_SureUser = userModel.F_UserCode;
  7405. modelT_Bus_CityTurn.F_SureTime = DateTime.Now;
  7406. modelT_Bus_CityTurn.F_Reson = reson;
  7407. new BLL.T_Bus_CityTurn().Update(modelT_Bus_CityTurn);
  7408. #region 插入操作记录
  7409. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7410. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7411. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7412. oper.F_Message = userinfo + " 退回了" + modelT_Bus_CityTurn.F_CityName + "工单";
  7413. oper.F_CreateUser = userModel.F_UserCode;
  7414. oper.F_CreateTime = DateTime.Now;
  7415. oper.F_IsDelete = 0;
  7416. operBLL.Add(oper);
  7417. #endregion
  7418. trans.Complete();
  7419. }
  7420. return Success("操作成功");
  7421. }
  7422. else
  7423. {
  7424. return Error("操作失败");
  7425. }
  7426. }
  7427. #endregion
  7428. }
  7429. }