Aucune description

WorkOrderController.cs 425KB

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