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