Açıklama Yok

WorkOrderController.cs 426KB

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