| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923 |
- 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 + "%' or F_ComContent like '%" + strkey + "%' )";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (deptid != 0)
- {
- sql += " and F_MainDeptId = '" + deptid + "'";
- }
- if (dealtype != -1)
- {
- sql += " and isnull(F_IsResult,0) = '" + dealtype + "' ";
- }
- if (issend != -1)
- {
- sql += " and isnull(F_IsRelease,0) = '" + issend + "' ";
- }
- if (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,GETDATE() ) WHEN F_WorkState = 8 then dbo.GetGapTime(F_LimitTime, GETDATE()) WHEN F_WorkState = 9 then dbo.GetGapTime(F_LimitTime, case when F_DealTime != null then F_DealTime else F_CloseTime end) 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, userModel.F_RoleCode.ToUpper(), isobservation.ToString());
- }
- #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 + "%' 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";
- 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,GETDATE() ) WHEN F_WorkState = 8 then dbo.GetGapTime(F_LimitTime, GETDATE()) WHEN F_WorkState = 9 then dbo.GetGapTime(F_LimitTime, case when F_DealTime != null then F_DealTime else F_CloseTime end) 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_CloseTime 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 + "%' or F_ComContent like '%" + strkey + "%' )";
- }
- if (strusercode.Trim() != "" && strusercode != "undefined")
- {
- sql += " and F_CreateUser = '" + strusercode + "' ";
- }
- if (source != 0)
- {
- sql += " and F_InfoSource = '" + source + "' ";
- }
- if (keyid != 0)
- {
- sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
- }
- if (type != 0)
- {
- sql += " and F_InfoType = '" + type + "' ";
- }
- if (bigtype != 0)
- {
- sql += " and F_InfoConBigType = '" + bigtype + "' ";
- }
- if (smalltype != 0)
- {
- sql += " and F_InfoConSmallType = '" + smalltype + "' ";
- }
- if (sourcearea != 0)
- {
- sql += " and F_SourceArea = '" + sourcearea + "' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (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 ;
- }
- 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,GETDATE() ) WHEN F_WorkState = 8 then dbo.GetGapTime(F_LimitTime, GETDATE()) WHEN F_WorkState = 9 then dbo.GetGapTime(F_LimitTime, case when F_DealTime != null then F_DealTime else F_CloseTime end) 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 + "%' 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("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 gcsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
- + "from T_Bus_Operation where F_IsDelete=0 and (F_Message LIKE '%登记%' OR F_Message LIKE '%查收%' OR F_Message LIKE '%主办了%' ) 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");
- var mag = 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" || userModel.F_RoleCode == "HFZY" )
- {
- 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 =DateTime .Now ;
- 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 =
- 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
- }
- }
|