Açıklama Yok

WorkOrderController.cs 425KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920
  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) WHEN F_WorkState = 8 then dbo.GetGapTime (F_LimitTime) WHEN F_WorkState = 9 then dbo.GetGapTime (F_LimitTime) else '-' end as GapTime, AssignedTime = (select top 1 F_CreateTime from T_Bus_AssignedInfo where F_WorkOrderId = c.F_WorkOrderId order by F_Id desc ) ,SureTime = (select top 1 F_SureTime from T_Bus_AssignedInfo where F_WorkOrderId = c.F_WorkOrderId and F_IsSure = 1 order by F_Id desc ) ,FeedbackTime = (select top 1 F_CreateTime from T_Bus_Feedback where F_State = 1 and F_Type = 3 and F_IsDelete = 0 and F_WorkOrderId = c.F_WorkOrderId order by F_Id desc)from T_Bus_WorkOrder c ";
  176. if (isexpt >0)
  177. {
  178. var dtdc = DbHelperSQL.Query(expt + " where 1=1 " + sql+ "ORDER BY F_CreateTime DESC").Tables[0];
  179. NPOIHelper npoi = new NPOIHelper();
  180. if (npoi.ExportToExcel("工单列表", dtdc, col()) == "")
  181. {
  182. return Success("导出成功");
  183. }
  184. else
  185. {
  186. return Error("导出失败");
  187. }
  188. }
  189. if (isdc > 0)
  190. {
  191. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  192. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  193. if (msg == "")
  194. {
  195. return Success("导出成功");
  196. }
  197. else
  198. {
  199. return Error("导出失败");
  200. }
  201. }
  202. int recordCount = 0;
  203. dt = BLL.PagerBLL.GetListPager(
  204. "T_Bus_WorkOrder",
  205. "F_WorkOrderId",
  206. cols,
  207. sql,
  208. "ORDER BY F_CreateTime DESC",
  209. pagesize,
  210. pageindex,
  211. true,
  212. out recordCount);
  213. #region 声音文件和交办超时
  214. dt.Columns.Add("OverState", typeof(string));//超时状态
  215. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  216. dt.Columns.Add("GapTime", typeof(string));//时间差
  217. dt.Columns.Add("FilePath", typeof(string));//语音文件路径
  218. dt.Columns.Add("Buttons", typeof(object));//操作按钮
  219. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  220. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  221. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  222. foreach (DataRow dr in dt.Rows)
  223. {
  224. //获取最新交办信息
  225. string iszbdw = "0";
  226. int state = Int32.Parse(dr["F_WorkState"].ToString());
  227. if (state > 1)
  228. {
  229. if (dr["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  230. if (state < 6 || state == 8)
  231. {
  232. var lt = dr["F_LimitTime"].ToString();//限制时间
  233. dr["LimitTime"] = lt;
  234. if (!string.IsNullOrWhiteSpace(lt))
  235. {
  236. var ltime = DateTime.Parse(lt);
  237. TimeSpan ts = ltime.Subtract(DateTime.Now);
  238. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  239. if (tss < 0) { tss = -tss; }
  240. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  241. if (ltime > DateTime.Now)
  242. {
  243. if (configcs != null)
  244. {
  245. int cs = Int32.Parse(configcs.F_ParamValue);
  246. if (ts.TotalHours > cs)
  247. {
  248. dr["OverState"] = 1;
  249. }
  250. else
  251. {
  252. dr["OverState"] = 2;
  253. }
  254. }
  255. dr["GapTime"] = "剩余" + gshsj;
  256. }
  257. else
  258. {
  259. dr["OverState"] = 3;
  260. dr["GapTime"] = "超时" + gshsj;
  261. }
  262. }
  263. }
  264. if (state == 9)
  265. {
  266. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  267. var dttime = DateTime.Now;
  268. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  269. else dttime = DateTime.Parse(dr["F_CloseTime"].ToString());
  270. var lt = dr["F_LimitTime"].ToString();//限制时间
  271. dr["LimitTime"] = lt;
  272. if (!string.IsNullOrWhiteSpace(lt))
  273. {
  274. var ltime = DateTime.Parse(lt);
  275. TimeSpan ts = ltime.Subtract(dttime);
  276. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  277. if (tss < 0) { tss = -tss; }
  278. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  279. if (ltime < dttime)
  280. {
  281. dr["OverState"] = 3;
  282. dr["GapTime"] = "超时" + gshsj;
  283. }
  284. }
  285. }
  286. }
  287. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  288. {
  289. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  290. }
  291. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  292. {
  293. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  294. }
  295. dr["Buttons"] = ButtonGroup.GetButtons(isobservation.ToString(),dr["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(),dr["F_IsResult"].ToString(),iszbdw, userModel.F_RoleCode.ToUpper());
  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) WHEN F_WorkState = 8 then dbo.GetGapTime (F_LimitTime) WHEN F_WorkState = 9 then dbo.GetGapTime (F_LimitTime) else '-' end as GapTime, AssignedTime = (select top 1 F_CreateTime from T_Bus_AssignedInfo where F_WorkOrderId = c.F_WorkOrderId order by F_Id desc ) ,SureTime = (select top 1 F_SureTime from T_Bus_AssignedInfo where F_WorkOrderId = c.F_WorkOrderId and F_IsSure = 1 order by F_Id desc ) ,FeedbackTime = (select top 1 F_CreateTime from T_Bus_Feedback where F_State = 1 and F_Type = 3 and F_IsDelete = 0 and F_WorkOrderId = c.F_WorkOrderId order by F_Id desc)from T_Bus_WorkOrder c";
  841. if (isexpt > 0)
  842. {
  843. var dtdc = DbHelperSQL.Query(expt + " where 1=1 " + sql+ "ORDER BY F_CreateTime DESC").Tables[0];
  844. NPOIHelper npoi = new NPOIHelper();
  845. if (npoi.ExportToExcel("工单列表", dtdc, col()) == "")
  846. {
  847. return Success("导出成功");
  848. }
  849. else
  850. {
  851. return Error("导出失败");
  852. }
  853. }
  854. if (isdc > 0)
  855. {
  856. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  857. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  858. if (msg == "")
  859. {
  860. return Success("导出成功");
  861. }
  862. else
  863. {
  864. return Error("导出失败");
  865. }
  866. }
  867. int recordCount = 0;
  868. dt = BLL.PagerBLL.GetListPager(
  869. "T_Bus_WorkOrder",
  870. "F_WorkOrderId",
  871. cols,
  872. sql,
  873. "ORDER BY F_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) WHEN F_WorkState = 8 then dbo.GetGapTime (F_LimitTime) WHEN F_WorkState = 9 then dbo.GetGapTime (F_LimitTime) else '-' end as GapTime, AssignedTime = (select top 1 F_CreateTime from T_Bus_AssignedInfo where F_WorkOrderId = c.F_WorkOrderId order by F_Id desc ) ,SureTime = (select top 1 F_SureTime from T_Bus_AssignedInfo where F_WorkOrderId = c.F_WorkOrderId and F_IsSure = 1 order by F_Id desc ) ,FeedbackTime = (select top 1 F_CreateTime from T_Bus_Feedback where F_State = 1 and F_Type = 3 and F_IsDelete = 0 and F_WorkOrderId = c.F_WorkOrderId order by F_Id desc)from T_Bus_WorkOrder c";
  2254. if (isexpt > 0)
  2255. {
  2256. var dtdc = DbHelperSQL.Query(expt + " where 1=1 " + sql+ "ORDER BY F_CreateTime DESC").Tables[0];
  2257. NPOIHelper npoi = new NPOIHelper();
  2258. if (npoi.ExportToExcel("工单列表", dtdc, col()) == "")
  2259. {
  2260. return Success("导出成功");
  2261. }
  2262. else
  2263. {
  2264. return Error("导出失败");
  2265. }
  2266. }
  2267. if (isdc > 0)
  2268. {
  2269. var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Bus_WorkOrder where 1=1 " + sql).Tables[0];
  2270. var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
  2271. if (msg == "")
  2272. {
  2273. return Success("导出成功");
  2274. }
  2275. else
  2276. {
  2277. return Error("导出失败");
  2278. }
  2279. }
  2280. int recordCount = 0;
  2281. dt = BLL.PagerBLL.GetListPager(
  2282. "T_Bus_WorkOrder",
  2283. "F_WorkOrderId",
  2284. cols,
  2285. sql,
  2286. "ORDER BY F_CreateTime DESC",
  2287. pagesize,
  2288. pageindex,
  2289. true,
  2290. out recordCount);
  2291. #region 声音文件
  2292. dt.Columns.Add("OverState", typeof(string));//超时状态
  2293. dt.Columns.Add("LimitTime", typeof(string));//限制时间
  2294. dt.Columns.Add("GapTime", typeof(string));//时间差
  2295. dt.Columns.Add("FilePath", typeof(string));
  2296. dt.Columns.Add("Buttons", typeof(object));
  2297. var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
  2298. var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
  2299. var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
  2300. foreach (DataRow dr in dt.Rows)
  2301. {
  2302. int state = Int32.Parse(dr["F_WorkState"].ToString());
  2303. if (state > 1 )
  2304. {
  2305. var lt = dr["F_LimitTime"].ToString();//限制时间
  2306. dr["LimitTime"] = lt;
  2307. if (state < 6 || state == 8)
  2308. {
  2309. if (!string.IsNullOrWhiteSpace(lt))
  2310. {
  2311. var ltime = DateTime.Parse(lt);
  2312. TimeSpan ts = ltime.Subtract(DateTime.Now);
  2313. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  2314. if (tss < 0) { tss = -tss; }
  2315. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  2316. if (ltime > DateTime.Now)
  2317. {
  2318. if (configcs != null)
  2319. {
  2320. int cs = Int32.Parse(configcs.F_ParamValue);
  2321. if (ts.TotalHours > cs)
  2322. {
  2323. dr["OverState"] = 1;
  2324. }
  2325. else
  2326. {
  2327. dr["OverState"] = 2;
  2328. }
  2329. }
  2330. dr["GapTime"] = "剩余" + gshsj;
  2331. }
  2332. else
  2333. {
  2334. dr["OverState"] = 3;
  2335. dr["GapTime"] = "超时" + gshsj;
  2336. }
  2337. }
  2338. }
  2339. if (state == 9)
  2340. {
  2341. var closetime = dr["F_DealTime"].ToString();//关闭工单时间
  2342. var dttime = DateTime.Now;
  2343. if (!string.IsNullOrWhiteSpace(closetime)) { dttime = DateTime.Parse(closetime); }
  2344. else dttime = DateTime.Parse(dr["F_CloseTime"].ToString());
  2345. if (!string.IsNullOrWhiteSpace(lt))
  2346. {
  2347. var ltime = DateTime.Parse(lt);
  2348. TimeSpan ts = ltime.Subtract(dttime);
  2349. int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
  2350. if (tss < 0) { tss = -tss; }
  2351. string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
  2352. if (ltime < dttime)
  2353. {
  2354. dr["OverState"] = 3;
  2355. dr["GapTime"] = "超时" + gshsj;
  2356. }
  2357. }
  2358. }
  2359. }
  2360. if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
  2361. {
  2362. dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  2363. }
  2364. else if (dr["F_CallRecordId"] != null && dr["F_CallRecordId"].ToString() != "")
  2365. {
  2366. dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
  2367. }
  2368. List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
  2369. btns.Add(ButtonGroup.query());
  2370. dr["Buttons"] = btns;
  2371. }
  2372. #endregion
  2373. var obj = new
  2374. {
  2375. state = "success",
  2376. message = "成功",
  2377. rows = dt,
  2378. total = recordCount
  2379. };
  2380. return Content(obj.ToJson());
  2381. }
  2382. /// <summary>
  2383. /// 获取媒体工单列表
  2384. /// </summary>
  2385. /// <returns></returns>
  2386. [Authority]
  2387. public ActionResult GetMediaList(int isdc = 0)
  2388. {
  2389. DataTable dt = new DataTable();
  2390. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  2391. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  2392. string sql = " and F_IsDelete=0";
  2393. string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
  2394. string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
  2395. string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
  2396. string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
  2397. string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
  2398. string strworkid = HttpUtility.UrlDecode(RequestString.GetQueryString("workid"));
  2399. string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
  2400. int isobservation = RequestString.GetInt("isobservation", -1);//是否添加观察件
  2401. int source = RequestString.GetInt("source", 0);
  2402. int keyid = RequestString.GetInt("keyid", 0);
  2403. int type = RequestString.GetInt("type", 0);
  2404. int bigtype = RequestString.GetInt("bigtype", 0);
  2405. int smalltype = RequestString.GetInt("smalltype", 0);
  2406. int sourcearea = RequestString.GetInt("sourcearea", 0);
  2407. int deptid = RequestString.GetInt("deptid", 0);
  2408. string strpageindex = RequestString.GetQueryString("page");
  2409. int pageindex = 1;
  2410. string strpagesize = RequestString.GetQueryString("pagesize");
  2411. int pagesize = 10;
  2412. sql += " and isnull(F_IsRelease,0) =1 ";
  2413. if (strworkid.Trim() != "" && strworkid != "undefined")
  2414. {
  2415. sql += " and F_WorkOrderId like '%" + strworkid + "%' ";
  2416. }
  2417. if (strname.Trim() != "" && strname != "undefined")
  2418. {
  2419. sql += " and F_CusName like '%" + strname + "%' ";
  2420. }
  2421. if (strtel.Trim() != "" && strtel != "undefined")
  2422. {
  2423. sql += " and (F_CusPhone like '%" + strtel + "%' or F_ConPhone like '%" + strtel + "%') ";
  2424. }
  2425. if (strkey.Trim() != "" && strkey != "undefined")
  2426. {
  2427. sql += " and ( F_ComTitle like '%" + strkey + "%' 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 cbsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
  3142. + "from T_Bus_Additional where F_State=1 and F_IsDelete=0 and F_WorkOrderId ='" + strworkorderid + "' order by F_CreateTime";
  3143. #region 声音文件
  3144. dt.Columns.Add("FilePath", typeof(string));
  3145. if (dt.Rows[0]["F_LeaveRecordId"] != null)
  3146. {
  3147. dt.Rows[0]["FilePath"] = GetLeavePath(dt.Rows[0]["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  3148. }
  3149. else if (dt.Rows[0]["F_CallRecordId"] != null)
  3150. {
  3151. dt.Rows[0]["FilePath"] = GetCallPath(dt.Rows[0]["F_CallRecordId"].ToString(), config.F_ParamValue);
  3152. }
  3153. #endregion
  3154. #region 附件
  3155. if (configfj != null)
  3156. {
  3157. dt = BindFileData(dt, configfj.F_ParamValue);
  3158. }
  3159. #endregion
  3160. #region 监察信息
  3161. var jcdt = DbHelperSQL.Query(jcsql).Tables[0];
  3162. if (configfj != null)
  3163. {
  3164. jcdt = BindFileData(jcdt, configfj.F_ParamValue);
  3165. }
  3166. #endregion
  3167. #region 批示信息
  3168. var psdt = DbHelperSQL.Query(pssql).Tables[0];
  3169. if (configfj != null)
  3170. {
  3171. psdt = BindFileData(psdt, configfj.F_ParamValue);
  3172. }
  3173. #endregion
  3174. #region 指示信息
  3175. var zsdt = DbHelperSQL.Query(zssql).Tables[0];
  3176. if (configfj != null)
  3177. {
  3178. zsdt = BindFileData(zsdt, configfj.F_ParamValue);
  3179. }
  3180. #endregion
  3181. #region 回退信息
  3182. var htdt = DbHelperSQL.Query(htsql).Tables[0];
  3183. #endregion
  3184. #region 督办信息
  3185. var dbdt = DbHelperSQL.Query(dbsql).Tables[0];
  3186. if (configfj != null)
  3187. {
  3188. dbdt = BindFileData(dbdt, configfj.F_ParamValue);
  3189. }
  3190. #endregion
  3191. #region 交办信息
  3192. var jbdt = DbHelperSQL.Query(jbsql).Tables[0];
  3193. if (configfj != null)
  3194. {
  3195. jbdt = BindFileData(jbdt, configfj.F_ParamValue);
  3196. }
  3197. #endregion
  3198. #region 退回信息
  3199. var thdt = DbHelperSQL.Query(thsql).Tables[0];
  3200. #endregion
  3201. #region 延时信息
  3202. var ysdt = DbHelperSQL.Query(yssql).Tables[0];
  3203. #endregion
  3204. #region 办理情况
  3205. var bldt = DbHelperSQL.Query(blsql).Tables[0];
  3206. if (configfj != null)
  3207. {
  3208. bldt = BindFileData(bldt, configfj.F_ParamValue);
  3209. }
  3210. #endregion
  3211. #region 回访信息
  3212. var hfdt = DbHelperSQL.Query(hfsql).Tables[0];
  3213. hfdt.Columns.Add("FilePath", typeof(string));
  3214. foreach (DataRow bldr in hfdt.Rows)
  3215. {
  3216. if (bldr["F_CallRecordId"] != null && config != null)
  3217. {
  3218. bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
  3219. }
  3220. }
  3221. #endregion
  3222. #region 市民催单
  3223. var cbdt = DbHelperSQL.Query(cbsql).Tables[0];
  3224. cbdt.Columns.Add("FilePath", typeof(string));
  3225. foreach (DataRow bldr in cbdt.Rows)
  3226. {
  3227. if (bldr["F_CallRecordId"] != null && config != null)
  3228. {
  3229. bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
  3230. }
  3231. }
  3232. #endregion
  3233. #region 办理过程
  3234. var gcdt = DbHelperSQL.Query(gcsql).Tables[0];
  3235. gcdt.Columns.Add("File", typeof(object));
  3236. gcdt.Columns.Add("FilePath", typeof(string));
  3237. if (configfj != null || configly != null || config != null)
  3238. {
  3239. foreach (DataRow bldr in gcdt.Rows)
  3240. {
  3241. if (bldr["F_File"] != null && bldr["F_File"].ToString() != "" && configfj != null)
  3242. {
  3243. bldr["File"] = GetFileData(bldr["F_File"].ToString(), configfj.F_ParamValue);
  3244. }
  3245. if (bldr["F_LeaveRecordId"] != null && configly != null)
  3246. {
  3247. bldr["FilePath"] = GetLeavePath(bldr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
  3248. }
  3249. else if (bldr["F_CallRecordId"] != null && config != null)
  3250. {
  3251. bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
  3252. }
  3253. }
  3254. }
  3255. #endregion
  3256. #region 流程显示
  3257. var lcdt = new DataTable();
  3258. lcdt.Columns.Add("step", typeof(int));
  3259. lcdt.Columns.Add("name", typeof(string));
  3260. lcdt.Columns.Add("dept", typeof(string));
  3261. lcdt.Columns.Add("time", typeof(string));
  3262. DataRow dr1 = lcdt.NewRow();
  3263. dr1["step"] = 1;
  3264. if (dt.Rows[0]["F_CreateUser"] != null)
  3265. {
  3266. var lruser = new BLL.T_Sys_UserAccount().GetModel(dt.Rows[0]["F_CreateUser"].ToString());
  3267. if (lruser != null)
  3268. {
  3269. dr1["name"] = lruser.F_UserName;
  3270. dr1["dept"] = lruser.depname;
  3271. }
  3272. else
  3273. {
  3274. dr1["name"] = dt.Rows[0]["F_CreateUser"].ToString();
  3275. dr1["dept"] = "";
  3276. }
  3277. }
  3278. dr1["time"] = dt.Rows[0]["F_CreateTime"];
  3279. lcdt.Rows.Add(dr1);
  3280. int state = Int32.Parse(dt.Rows[0]["F_WorkState"].ToString());
  3281. if (state >= 1) {
  3282. if (jbdt.Rows.Count > 0)
  3283. {
  3284. var newjb = jbdt.Rows[jbdt.Rows.Count - 1];
  3285. DataRow dr2 = lcdt.NewRow();
  3286. dr2["step"] = 2;
  3287. var jbuser = new BLL.T_Sys_UserAccount().GetModel(newjb["F_CreateUser"].ToString());
  3288. if (jbuser != null)
  3289. {
  3290. dr2["name"] = jbuser.F_UserName;
  3291. dr2["dept"] = jbuser.depname;
  3292. }
  3293. else
  3294. {
  3295. dr2["name"] = newjb["F_CreateUser"].ToString();
  3296. dr2["dept"] = "";
  3297. }
  3298. dr2["time"] = newjb["F_CreateTime"];
  3299. lcdt.Rows.Add(dr2);
  3300. }
  3301. }
  3302. if (state >= 6)
  3303. {
  3304. if (bldt.Rows.Count > 0)
  3305. {
  3306. var newbl = bldt.Rows[bldt.Rows.Count - 1];
  3307. DataRow dr3 = lcdt.NewRow();
  3308. dr3["step"] = 3;
  3309. var jbuser = new BLL.T_Sys_UserAccount().GetModel(newbl["F_CreateUser"].ToString());
  3310. if (jbuser != null)
  3311. {
  3312. dr3["name"] = jbuser.F_UserName;
  3313. dr3["dept"] = jbuser.depname;
  3314. }
  3315. else
  3316. {
  3317. dr3["name"] = newbl["F_CreateUser"].ToString();
  3318. dr3["dept"] = "";
  3319. }
  3320. dr3["time"] = newbl["F_CreateTime"];
  3321. lcdt.Rows.Add(dr3);
  3322. }
  3323. }
  3324. if (state >= 7)
  3325. {
  3326. if (hfdt.Rows.Count > 0)
  3327. {
  3328. var newhf = hfdt.Rows[hfdt.Rows.Count - 1];
  3329. DataRow dr4 = lcdt.NewRow();
  3330. dr4["step"] = 4;
  3331. var jbuser = new BLL.T_Sys_UserAccount().GetModel(newhf["F_CreateUser"].ToString());
  3332. if (jbuser != null)
  3333. {
  3334. dr4["name"] = jbuser.F_UserName;
  3335. dr4["dept"] = jbuser.depname;
  3336. }
  3337. else
  3338. {
  3339. dr4["name"] = newhf["F_CreateUser"].ToString();
  3340. dr4["dept"] = "";
  3341. }
  3342. dr4["time"] = newhf["F_CreateTime"];
  3343. lcdt.Rows.Add(dr4);
  3344. }
  3345. }
  3346. if (state == 9)
  3347. {
  3348. DataRow dr5 = lcdt.NewRow();
  3349. dr5["step"] = 5;
  3350. var enduser = new BLL.T_Sys_UserAccount().GetModel(dt.Rows[0]["F_CloseUser"].ToString());
  3351. if (enduser != null)
  3352. {
  3353. dr5["name"] = enduser.F_UserName;
  3354. dr5["dept"] = enduser.depname;
  3355. }
  3356. else
  3357. {
  3358. dr5["name"] = dt.Rows[0]["F_CloseUser"].ToString();
  3359. dr5["dept"] = "";
  3360. }
  3361. dr5["time"] = dt.Rows[0]["F_CloseTime"];
  3362. lcdt.Rows.Add(dr5);
  3363. }
  3364. #endregion
  3365. #region 操作按钮
  3366. var btns = new List<ButtonGroup.button>();
  3367. if (jbdt.Rows.Count > 0)
  3368. {
  3369. var jbzx = jbdt.Rows[jbdt.Rows.Count - 1];
  3370. string iszbdw = "0";
  3371. string fmd = jbzx["F_MainDeptId"].ToString();
  3372. string fod = jbzx["F_OtherDeptIds"] == null ? "" : jbzx["F_OtherDeptIds"].ToString();
  3373. if (fmd == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
  3374. else if (fod != "" && fod.Split(',').Contains(userModel.F_DeptId.ToString()))
  3375. {
  3376. iszbdw = "2";
  3377. }
  3378. if (!(userModel.F_RoleCode == "WLDW" && iszbdw == "0"))
  3379. {
  3380. btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), iszbdw);
  3381. }
  3382. }
  3383. else
  3384. {
  3385. btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), "0");
  3386. }
  3387. #endregion
  3388. #region 其他权限
  3389. int issend = 0;
  3390. if (dt.Rows[0]["F_IsRelease"] != null && (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
  3391. {
  3392. if (dt.Rows[0]["F_IsRelease"].ToString() != "1")
  3393. {
  3394. issend = 1;
  3395. }
  3396. }
  3397. int isnotice = 0;
  3398. if (dt.Rows[0]["F_IsNotice"] != null && (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
  3399. {
  3400. if (dt.Rows[0]["F_IsNotice"].ToString() != "1")
  3401. {
  3402. isnotice = 1;
  3403. }
  3404. }
  3405. int isedit = 0;
  3406. if (dt.Rows[0]["F_IsRelease"] != null && (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY"))
  3407. {
  3408. isedit = 1;
  3409. }
  3410. #endregion
  3411. var obj = new
  3412. {
  3413. data = dt,
  3414. jcdata = jcdt,
  3415. psdata = psdt,
  3416. zsdata = zsdt,
  3417. htdata = htdt,
  3418. dbdata = dbdt,
  3419. jbdata = jbdt,
  3420. thdata = thdt,
  3421. ysdata = ysdt,
  3422. bldata = bldt,
  3423. hfdata = hfdt,
  3424. cbdata = cbdt,
  3425. gcdata = gcdt,
  3426. lcdata= lcdt,
  3427. issend = issend,
  3428. isedit = isedit,
  3429. isnotice = isnotice,
  3430. btndata = btns
  3431. };
  3432. return Success("获取成功", obj);
  3433. }
  3434. else
  3435. {
  3436. return Error("获取失败");
  3437. }
  3438. }
  3439. else
  3440. {
  3441. return Error("参数传输失败");
  3442. }
  3443. }
  3444. /// <summary>
  3445. /// 获取草稿信息
  3446. /// </summary>
  3447. /// <returns></returns>
  3448. [Authority]
  3449. public ActionResult GetDraftInfo()
  3450. {
  3451. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3452. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3453. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3454. int type = RequestString.GetInt("type", 0);//1交办信息2反馈信息3回访信息
  3455. if (!string.IsNullOrEmpty(strworkorderid) && type != 0)
  3456. {
  3457. string sql = string.Empty;
  3458. switch (type)
  3459. {
  3460. case 1: sql = "select top 1 *,dbo.GetDeptName(F_MainDeptId) as DeptName,dbo.GetDeptNames(F_OtherDeptIds) as OtherDeptName from T_Bus_AssignedInfo"; break;
  3461. case 2: sql = "select top 1 * from T_Bus_Feedback"; break;
  3462. case 3: sql = "select top 1 * from T_Bus_VisitResult"; break;
  3463. }
  3464. sql += " where F_WorkOrderId='" + strworkorderid + "' and F_State=0 and F_IsDelete=0 and F_CreateUser=" + userModel.F_UserCode + " order by F_CreateTime desc";
  3465. var dt = DbHelperSQL.Query(sql).Tables[0];
  3466. if (dt.Rows.Count > 0)
  3467. {
  3468. #region 附件
  3469. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3470. if (!string.IsNullOrEmpty(configfj.F_ParamValue))
  3471. {
  3472. BindFileData(dt, configfj.F_ParamValue);
  3473. }
  3474. #endregion
  3475. }
  3476. return Success("获取成功", dt);
  3477. }
  3478. else
  3479. {
  3480. return Error("参数传输失败");
  3481. }
  3482. }
  3483. /// <summary>
  3484. /// 获取审核信息
  3485. /// </summary>
  3486. /// <returns></returns>
  3487. [Authority]
  3488. public ActionResult GetAuditInfo()
  3489. {
  3490. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3491. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3492. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3493. int type = RequestString.GetInt("type", 0);//1退回信息2延时信息
  3494. if (!string.IsNullOrEmpty(strworkorderid) && type != 0)
  3495. {
  3496. string sql = string.Empty;
  3497. switch (type)
  3498. {
  3499. case 1: sql = "select top 1 * from T_Bus_Feedback where F_Type=3 and"; break;
  3500. case 2: sql = "select top 1 * from T_Bus_DelayTime where"; break;
  3501. }
  3502. sql += " F_WorkOrderId='" + strworkorderid + "' and F_State=1 and F_IsDelete=0 and F_IsAudit=0 order by F_CreateTime desc";
  3503. var dt = DbHelperSQL.Query(sql).Tables[0];
  3504. if (dt.Rows.Count > 0)
  3505. {
  3506. #region 附件
  3507. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3508. if (!string.IsNullOrEmpty(configfj.F_ParamValue))
  3509. {
  3510. BindFileData(dt, configfj.F_ParamValue);
  3511. }
  3512. #endregion
  3513. }
  3514. return Success("获取成功", dt);
  3515. }
  3516. else
  3517. {
  3518. return Error("参数传输失败");
  3519. }
  3520. }
  3521. /// <summary>
  3522. /// 获取所有交办单位
  3523. /// </summary>
  3524. /// <returns></returns>
  3525. [Authority]
  3526. public ActionResult GetAllAssignDept()
  3527. {
  3528. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3529. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3530. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3531. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(strworkorderid);
  3532. if (modelT_Bus_WorkOrder != null)
  3533. {
  3534. string ids = string.Empty;
  3535. var Assigns = assignBLL.GetModelList(" F_WorkOrderId='" + strworkorderid + "' and F_IsDelete=0 and F_IsSure in (0,1,2) ");
  3536. foreach (var assign in Assigns)
  3537. {
  3538. if (string.IsNullOrEmpty(ids))
  3539. {
  3540. ids = assign.F_MainDeptId.Value.ToString();
  3541. if (!string.IsNullOrEmpty(assign.F_OtherDeptIds))
  3542. {
  3543. ids += "," + assign.F_OtherDeptIds;
  3544. }
  3545. }
  3546. else
  3547. {
  3548. ids += ","+ assign.F_MainDeptId.Value.ToString();
  3549. if (!string.IsNullOrEmpty(assign.F_OtherDeptIds))
  3550. {
  3551. ids += "," + assign.F_OtherDeptIds;
  3552. }
  3553. }
  3554. }
  3555. if (string.IsNullOrEmpty(ids))
  3556. {
  3557. ids = "0";
  3558. }
  3559. var dt = new BLL.T_Sys_Department().GetModelList(" F_DeptId in ( " + ids + " ) ");
  3560. return Success("获取成功", dt);
  3561. }
  3562. else
  3563. {
  3564. return Error("操作失败");
  3565. }
  3566. }
  3567. /// <summary>
  3568. /// 获取二级单位处理信息
  3569. /// </summary>
  3570. /// <returns></returns>
  3571. [Authority]
  3572. public ActionResult GetSecondDealInfo()
  3573. {
  3574. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3575. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3576. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3577. if (!string.IsNullOrEmpty(strworkorderid))
  3578. {
  3579. //string sql = "SELECT an.F_Id, an.F_WorkOrderId, an.F_MainDeptId, an.F_OtherDeptIds, an.F_AssignedOpinion, an.F_Remark, an.F_CreateUser, an.F_CreateTime, an.F_IsSure, an.F_State, ";
  3580. //sql += " an.F_SureTime, an.F_IsDelete, an.F_DeleteUser, an.F_DeleteTime, an.F_SureUser, an.F_FeedbackTime, an.F_LimitTime, an.F_IsOverdue, an.F_IsSatisfie, ";
  3581. //sql += " an.F_IsReload, an.F_ReloadUser, an.F_ReloadTime, an.F_File, an.F_IsNotice, an.F_NoticeUser, an.F_NoticeTime, fn.F_AssignedId, ";
  3582. //sql += " fn.F_Result, fn.F_CreateDeptId, fn.F_IsFeedEnd, fn.F_IsAudit, fn.F_AuditUser, fn.F_AuditTime, fn.F_AuditReason ";
  3583. //sql += " FROM T_Bus_AssignedInfo_Next AS an LEFT OUTER JOIN T_Bus_Feedback_Next AS fn ON an.F_Id = fn.F_AssignedId AND an.F_IsDelete = 0 AND fn.F_IsDelete = 0";
  3584. //sql += " where an.F_WorkOrderId='" + strworkorderid + "' order by F_CreateTime desc";
  3585. //var dt = DbHelperSQL.Query(sql).Tables[0];
  3586. string sql = "select top 1 * from T_Bus_AssignedInfo_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 order by F_CreateTime desc";
  3587. string sql1 = "select * from T_Bus_Feedback_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 ";
  3588. var bldt = DbHelperSQL.Query(sql1).Tables[0];
  3589. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3590. if (configfj != null)
  3591. {
  3592. bldt = BindFileData(bldt, configfj.F_ParamValue);
  3593. }
  3594. var obj = new
  3595. {
  3596. pdinfo = DbHelperSQL.Query(sql).Tables[0],
  3597. fkinfo = bldt
  3598. };
  3599. return Success("获取成功", obj);
  3600. }
  3601. else
  3602. {
  3603. return Error("参数传输失败");
  3604. }
  3605. }
  3606. /// <summary>
  3607. /// 获取二级单位最新处理信息
  3608. /// </summary>
  3609. /// <returns></returns>
  3610. [Authority]
  3611. public ActionResult GetNewSecondDealInfo()
  3612. {
  3613. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3614. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3615. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  3616. if (!string.IsNullOrEmpty(strworkorderid))
  3617. {
  3618. string sql = "select top 1 * from T_Bus_Feedback_Next where F_WorkOrderId='" + strworkorderid + "' and F_IsDelete = 0 order by F_CreateTime desc";
  3619. var bldt = DbHelperSQL.Query(sql).Tables[0];
  3620. var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
  3621. if (configfj != null)
  3622. {
  3623. bldt = BindFileData(bldt, configfj.F_ParamValue);
  3624. }
  3625. return Success("获取成功", bldt);
  3626. }
  3627. else
  3628. {
  3629. return Error("参数传输失败");
  3630. }
  3631. }
  3632. #endregion
  3633. #region 新增工单
  3634. /// <summary>
  3635. /// 上传附件
  3636. /// </summary>
  3637. /// <returns></returns>
  3638. [Authority]
  3639. public ActionResult UploadFile()
  3640. {
  3641. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3642. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3643. #region 单个上传 no use
  3644. //string path = string.Empty;
  3645. //HttpPostedFile _upfile = RequestString.GetFile("upFile");
  3646. //if (_upfile != null)
  3647. //{
  3648. // //byte[] buffer = new Byte[(int)_upfile.InputStream.Length]; //声明文件长度的二进制类型
  3649. // //_upfile.InputStream.Read(buffer, 0, buffer.Length); //将文件转成二进制
  3650. // string name = string.Empty;
  3651. // FileUp fu = new FileUp();
  3652. // var model = configBll.GetModelList(" F_ParamCode='FilePath' ").FirstOrDefault();
  3653. // if (model != null)
  3654. // {
  3655. // name = fu.Upload(_upfile, model.F_ParamValue);
  3656. // Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
  3657. // model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
  3658. // model_T_Sys_Accessories.F_FileName = name;//附件名称
  3659. // model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(_upfile.FileName);//附件类型
  3660. // model_T_Sys_Accessories.F_FileUrl = model.F_ParamValue + name;//附件地址
  3661. // model_T_Sys_Accessories.F_Size = _upfile.ContentLength;
  3662. // model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
  3663. // int p_fuId = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
  3664. // return Success("成功", model_T_Sys_Accessories);
  3665. // }
  3666. // else
  3667. // {
  3668. // return Error("上传失败");
  3669. // }
  3670. //}
  3671. //else
  3672. //{
  3673. // return Error("请选择要上传的文件");
  3674. //}
  3675. #endregion
  3676. #region 多个上传
  3677. HttpFileCollection files = RequestString.GetFiles();
  3678. if (files.Count > 0)
  3679. {
  3680. List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
  3681. string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd") + "/";
  3682. for (int i = 0; i < files.Count; i++)
  3683. {
  3684. HttpPostedFile file = files[i];
  3685. FileUp fu = new FileUp();
  3686. string name = fu.Upload(file, path);
  3687. Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
  3688. model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
  3689. model_T_Sys_Accessories.F_FileName = name;//附件名称
  3690. model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
  3691. model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
  3692. model_T_Sys_Accessories.F_Size = file.ContentLength;
  3693. model_T_Sys_Accessories.F_UserCode = userModel.F_UserCode;//上传人
  3694. int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
  3695. model_T_Sys_Accessories.F_FileId = id;
  3696. acs.Add(model_T_Sys_Accessories);
  3697. }
  3698. return Success("成功", acs);
  3699. }
  3700. else
  3701. {
  3702. return Error("请选择要上传的文件");
  3703. }
  3704. #endregion
  3705. }
  3706. /// <summary>
  3707. /// 添加工单信息
  3708. /// </summary>
  3709. /// <returns></returns>
  3710. [Authority]
  3711. public ActionResult AddWorkOrder()
  3712. {
  3713. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3714. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3715. // 15:01 2019/10/9 中心领导 和 中心领导管理员 添加工单的权限 - 永城市12345修改
  3716. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY" || userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY")
  3717. {
  3718. int source = RequestString.GetInt("source", 0);
  3719. string cusname = RequestString.GetFormString("cusname");
  3720. string cussex = RequestString.GetFormString("cussex");
  3721. string cusphone = RequestString.GetFormString("cusphone");
  3722. string cusaddress = RequestString.GetFormString("cusaddress");
  3723. string email = RequestString.GetFormString("email");
  3724. string zipcode = RequestString.GetFormString("zipcode");
  3725. string conname = RequestString.GetFormString("conname");
  3726. string conphone = RequestString.GetFormString("conphone");
  3727. string title = RequestString.GetFormString("title");
  3728. string content = RequestString.GetFormString("content");
  3729. string files = RequestString.GetFormString("files");
  3730. int sourcearea = RequestString.GetInt("sourcearea", 0);
  3731. string sourceaddress = RequestString.GetFormString("sourceaddress");
  3732. int isresult = RequestString.GetInt("isresult", 0);
  3733. string result = RequestString.GetFormString("result");
  3734. string keys = RequestString.GetFormString("keys");
  3735. string splituser = RequestString.GetFormString("splituser");
  3736. int type = RequestString.GetInt("type", 0);
  3737. int bigtype = RequestString.GetInt("bigtype", 0);
  3738. int smalltype = RequestString.GetInt("smalltype", 0);
  3739. int isprotect = RequestString.GetInt("isprotect", 0);
  3740. int level = RequestString.GetInt("level", 0);
  3741. int issubmit = RequestString.GetInt("issubmit", 0);
  3742. string callid = RequestString.GetFormString("callid");
  3743. using (TransactionScope trans = new TransactionScope())
  3744. {
  3745. #region 保存工单信息
  3746. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
  3747. modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(userModel.F_UserCode);
  3748. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  3749. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  3750. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  3751. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  3752. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  3753. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  3754. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  3755. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  3756. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  3757. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  3758. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  3759. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  3760. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  3761. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  3762. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  3763. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  3764. modelT_Bus_WorkOrder.F_File = files;//附件
  3765. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  3766. modelT_Bus_WorkOrder.F_Key = keys;
  3767. modelT_Bus_WorkOrder.F_SplitUser = splituser;
  3768. modelT_Bus_WorkOrder.F_Level = level;
  3769. //是否直办(即时答复)0:,否1: 是
  3770. modelT_Bus_WorkOrder.F_IsResult = isresult;
  3771. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  3772. modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
  3773. modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
  3774. modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
  3775. modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
  3776. modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
  3777. modelT_Bus_WorkOrder.F_IsDelete = 0;//是否删除(0:否,1:是)
  3778. modelT_Bus_WorkOrder.F_ISObservation = 0;//是否删除(0:否,1:是)
  3779. //如果选择即刻答复:是,即为直办,工单结束
  3780. if (isresult == 1)
  3781. {
  3782. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  3783. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  3784. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  3785. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  3786. modelT_Bus_WorkOrder.F_IsClosed = 1;
  3787. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  3788. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  3789. }
  3790. else if (issubmit == 1)
  3791. {
  3792. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  3793. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  3794. }
  3795. if (!string.IsNullOrEmpty(callid))
  3796. {
  3797. modelT_Bus_WorkOrder.F_CallId = callid;
  3798. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  3799. if (rd != null)
  3800. {
  3801. rd.IsExitWorkOrder = true;
  3802. new BLL.T_Call_CallRecords().Update(rd);
  3803. modelT_Bus_WorkOrder.F_CallRecordId = rd.CallRecordsId;
  3804. }
  3805. }
  3806. workorderBLL.Add(modelT_Bus_WorkOrder);
  3807. #endregion
  3808. #region 插入操作记录
  3809. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  3810. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  3811. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  3812. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  3813. oper.F_File = modelT_Bus_WorkOrder.F_File;
  3814. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  3815. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  3816. {
  3817. oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3818. }
  3819. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  3820. {
  3821. oper.F_Message = userinfo + " 登记并提交了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3822. }
  3823. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  3824. {
  3825. oper.F_Message = userinfo + " 登记并结案了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3826. }
  3827. oper.F_CreateUser = userModel.F_UserCode;
  3828. oper.F_CreateTime = DateTime.Now;
  3829. oper.F_IsDelete = 0;
  3830. operBLL.Add(oper);
  3831. //推送消息表
  3832. if (modelT_Bus_WorkOrder.F_WorkState != 0)
  3833. {
  3834. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  3835. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  3836. foreach (var u in users)
  3837. {
  3838. msg.AddInternalMessagesInfo("工单消息", oper.F_Message, u.F_UserCode, userModel.F_UserCode);
  3839. }
  3840. }
  3841. #endregion
  3842. trans.Complete();
  3843. }
  3844. return Success("操作成功");
  3845. }
  3846. else
  3847. {
  3848. return Error("权限不足");
  3849. }
  3850. }
  3851. /// <summary>
  3852. /// 添加工单信息
  3853. /// </summary>
  3854. /// <returns></returns>
  3855. public string AddWorkOrderBySource(int source, string cusname, string cussex, string cusphone, string cusaddress, string email,
  3856. string zipcode, string conname, string conphone, string title, string content, int sourcearea, string sourceaddress,
  3857. string keys, string splituser, int type, int bigtype, int smalltype, int isprotect, int level, string files=null)
  3858. {
  3859. string workorderid = string.Empty;
  3860. using (TransactionScope trans = new TransactionScope())
  3861. {
  3862. #region 保存工单信息
  3863. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
  3864. modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(source.ToString().PadLeft(4, '0'));
  3865. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  3866. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  3867. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  3868. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  3869. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  3870. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  3871. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  3872. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  3873. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  3874. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  3875. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  3876. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  3877. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  3878. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  3879. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  3880. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  3881. modelT_Bus_WorkOrder.F_File = files;//附件
  3882. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  3883. modelT_Bus_WorkOrder.F_Key = keys;
  3884. modelT_Bus_WorkOrder.F_SplitUser = splituser;
  3885. modelT_Bus_WorkOrder.F_Level = level;
  3886. //modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
  3887. modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
  3888. modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
  3889. modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
  3890. modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
  3891. modelT_Bus_WorkOrder.F_IsDelete = 1;//是否删除(0:否,1:是)
  3892. modelT_Bus_WorkOrder.F_IsEnabled = 0;//是否处理
  3893. workorderBLL.Add(modelT_Bus_WorkOrder);
  3894. workorderid = modelT_Bus_WorkOrder.F_WorkOrderId;
  3895. #endregion
  3896. #region 插入操作记录
  3897. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  3898. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  3899. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  3900. string userinfo = "";
  3901. var sourceinfo = new BLL.T_Sys_DictionaryValue().GetModel(source);
  3902. if (sourceinfo != null) { userinfo = "由 " + sourceinfo.F_Value; }
  3903. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  3904. {
  3905. oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  3906. }
  3907. //oper.F_CreateUser = userModel.F_UserCode;
  3908. oper.F_CreateTime = DateTime.Now;
  3909. oper.F_IsDelete = 0;
  3910. operBLL.Add(oper);
  3911. #endregion
  3912. trans.Complete();
  3913. }
  3914. return workorderid;
  3915. }
  3916. /// <summary>
  3917. /// 添加工单信息留言
  3918. /// </summary>
  3919. /// <returns></returns>
  3920. [Authority]
  3921. public ActionResult AddWorkOrderByLY()
  3922. {
  3923. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  3924. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  3925. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  3926. {
  3927. int source = RequestString.GetInt("source", 0);
  3928. string cusname = RequestString.GetFormString("cusname");
  3929. string cussex = RequestString.GetFormString("cussex");
  3930. string cusphone = RequestString.GetFormString("cusphone");
  3931. string cusaddress = RequestString.GetFormString("cusaddress");
  3932. string email = RequestString.GetFormString("email");
  3933. string zipcode = RequestString.GetFormString("zipcode");
  3934. string conname = RequestString.GetFormString("conname");
  3935. string conphone = RequestString.GetFormString("conphone");
  3936. string title = RequestString.GetFormString("title");
  3937. string content = RequestString.GetFormString("content");
  3938. string files = RequestString.GetFormString("files");
  3939. int sourcearea = RequestString.GetInt("sourcearea", 0);
  3940. string sourceaddress = RequestString.GetFormString("sourceaddress");
  3941. int isresult = RequestString.GetInt("isresult", 0);
  3942. string result = RequestString.GetFormString("result");
  3943. string keys = RequestString.GetFormString("keys");
  3944. string splituser = RequestString.GetFormString("splituser");
  3945. int type = RequestString.GetInt("type", 0);
  3946. int bigtype = RequestString.GetInt("bigtype", 0);
  3947. int smalltype = RequestString.GetInt("smalltype", 0);
  3948. int isprotect = RequestString.GetInt("isprotect", 0);
  3949. int level = RequestString.GetInt("level", 0);
  3950. int issubmit = RequestString.GetInt("issubmit", 0);
  3951. int lyid = RequestString.GetInt("lyid", 0);
  3952. using (TransactionScope trans = new TransactionScope())
  3953. {
  3954. #region 保存工单信息
  3955. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new Model.T_Bus_WorkOrder();
  3956. modelT_Bus_WorkOrder.F_WorkOrderId = workorderBLL.GetNewWorkOrderID(userModel.F_UserCode);
  3957. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  3958. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  3959. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  3960. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  3961. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  3962. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  3963. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  3964. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  3965. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  3966. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  3967. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  3968. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  3969. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  3970. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  3971. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  3972. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  3973. modelT_Bus_WorkOrder.F_File = files;//附件
  3974. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  3975. modelT_Bus_WorkOrder.F_Key = keys;
  3976. modelT_Bus_WorkOrder.F_Level = level;
  3977. //是否直办(即时答复)0:,否1: 是
  3978. modelT_Bus_WorkOrder.F_IsResult = isresult;
  3979. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  3980. modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;//登记人工号
  3981. modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;//登记时间
  3982. modelT_Bus_WorkOrder.F_WorkState = 0;//工单状态0登记中
  3983. modelT_Bus_WorkOrder.F_IsClosed = 0;//工单是否关闭
  3984. modelT_Bus_WorkOrder.F_IsOverdue = 0;//是否逾期(0:否,1:是)
  3985. modelT_Bus_WorkOrder.F_IsDelete = 0;//是否删除(0:否,1:是)
  3986. //如果选择即刻答复:是,即为直办,工单结束
  3987. if (isresult == 1)
  3988. {
  3989. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  3990. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  3991. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  3992. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  3993. modelT_Bus_WorkOrder.F_IsClosed = 1;
  3994. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  3995. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  3996. }
  3997. else if (issubmit == 1)
  3998. {
  3999. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4000. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  4001. }
  4002. if (lyid != 0)
  4003. {
  4004. var rd = new BLL.T_Call_LeaveRecord().GetModel(lyid);
  4005. if (rd != null)
  4006. {
  4007. rd.F_Status = 1;
  4008. rd.F_DealTime = DateTime.Now;
  4009. rd.F_UserCode = userModel.F_UserCode;
  4010. rd.F_UserName = userModel.F_UserName;
  4011. rd.F_UserId= userModel.F_UserId;
  4012. new BLL.T_Call_LeaveRecord().Update(rd);
  4013. modelT_Bus_WorkOrder.F_LeaveRecordId = rd.F_Id;
  4014. }
  4015. }
  4016. workorderBLL.Add(modelT_Bus_WorkOrder);
  4017. #endregion
  4018. #region 插入操作记录
  4019. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4020. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4021. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4022. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  4023. oper.F_File = modelT_Bus_WorkOrder.F_File;
  4024. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4025. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4026. {
  4027. oper.F_Message = userinfo + " 登记了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  4028. }
  4029. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4030. {
  4031. oper.F_Message = userinfo + " 登记并提交了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  4032. }
  4033. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  4034. {
  4035. oper.F_Message = userinfo + " 登记并结案了工单,工单编号:" + modelT_Bus_WorkOrder.F_WorkOrderId;
  4036. }
  4037. oper.F_CreateUser = userModel.F_UserCode;
  4038. oper.F_CreateTime = DateTime.Now;
  4039. oper.F_IsDelete = 0;
  4040. operBLL.Add(oper);
  4041. //推送消息表
  4042. if (modelT_Bus_WorkOrder.F_WorkState != 0)
  4043. {
  4044. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4045. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4046. foreach (var u in users)
  4047. {
  4048. msg.AddInternalMessagesInfo("工单消息", oper.F_Message, u.F_UserCode, userModel.F_UserCode);
  4049. }
  4050. }
  4051. #endregion
  4052. trans.Complete();
  4053. }
  4054. return Success("操作成功");
  4055. }
  4056. else
  4057. {
  4058. return Error("权限不足");
  4059. }
  4060. }
  4061. /// <summary>
  4062. /// 添加工单信息
  4063. /// </summary>
  4064. /// <returns></returns>
  4065. [Authority]
  4066. public ActionResult AddWorkOrderByAPP()
  4067. {
  4068. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4069. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4070. int source = RequestString.GetInt("source", 6);
  4071. string cusname = RequestString.GetFormString("cusname");
  4072. string cussex = RequestString.GetFormString("cussex");
  4073. string cusphone = RequestString.GetFormString("cusphone");
  4074. string cusaddress = RequestString.GetFormString("cusaddress");
  4075. string email = RequestString.GetFormString("email");
  4076. string zipcode = RequestString.GetFormString("zipcode");
  4077. string conname = RequestString.GetFormString("conname");
  4078. string conphone = RequestString.GetFormString("conphone");
  4079. string title = RequestString.GetFormString("title");
  4080. string content = RequestString.GetFormString("content");
  4081. string files = RequestString.GetFormString("files");
  4082. int sourcearea = RequestString.GetInt("sourcearea", 0);
  4083. string sourceaddress = RequestString.GetFormString("sourceaddress");
  4084. int isresult = RequestString.GetInt("isresult", 0);
  4085. string result = RequestString.GetFormString("result");
  4086. string keys = RequestString.GetFormString("keys");
  4087. string splituser = RequestString.GetFormString("splituser");
  4088. int type = RequestString.GetInt("type", 0);
  4089. int bigtype = RequestString.GetInt("bigtype", 0);
  4090. int smalltype = RequestString.GetInt("smalltype", 0);
  4091. int isprotect = RequestString.GetInt("isprotect", 0);
  4092. int level = RequestString.GetInt("level", 0);
  4093. string workorderid = AddWorkOrderBySource(6, cusname, cussex, cusphone, cusaddress, email, zipcode, conname,
  4094. conphone, title, content, sourcearea, sourceaddress, keys, splituser, type, bigtype, smalltype, isprotect, level);
  4095. if (!string.IsNullOrEmpty(workorderid))
  4096. {
  4097. using (TransactionScope trans = new TransactionScope())
  4098. {
  4099. #region 保存用户工单信息
  4100. var model = new BLL.T_Sys_Users().GetModel(userModel.F_UserCode);
  4101. if (model == null)
  4102. {
  4103. model = new Model.T_Sys_Users();
  4104. model.F_OpenId = userModel.F_UserCode;
  4105. model.F_Type = 3;
  4106. model.F_CreateTime = DateTime.Now;
  4107. model.F_Id=new BLL.T_Sys_Users().Add(model);
  4108. }
  4109. Model.T_Bus_UserWorkOrder tbu = new Model.T_Bus_UserWorkOrder();
  4110. tbu.F_UserId = model.F_Id;
  4111. tbu.F_WorkOrderId = workorderid;
  4112. new BLL.T_Bus_UserWorkOrder().Add(tbu);
  4113. #endregion
  4114. trans.Complete();
  4115. }
  4116. return Success("操作成功");
  4117. }
  4118. else
  4119. {
  4120. return Error("操作失败");
  4121. }
  4122. }
  4123. #endregion
  4124. #region 操作工单
  4125. /// <summary>
  4126. /// 修改工单信息
  4127. /// </summary>
  4128. /// <returns></returns>
  4129. [Authority]
  4130. public ActionResult EditWorkOrder()
  4131. {
  4132. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4133. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4134. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  4135. {
  4136. string workorderid = RequestString.GetFormString("workorderid");
  4137. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4138. if (modelT_Bus_WorkOrder != null && (modelT_Bus_WorkOrder.F_WorkState == 1 || modelT_Bus_WorkOrder.F_WorkState == 0))
  4139. {
  4140. int source = RequestString.GetInt("source", 0);
  4141. string cusname = RequestString.GetFormString("cusname");
  4142. string cussex = RequestString.GetFormString("cussex");
  4143. string cusphone = RequestString.GetFormString("cusphone");
  4144. string cusaddress = RequestString.GetFormString("cusaddress");
  4145. string email = RequestString.GetFormString("email");
  4146. string zipcode = RequestString.GetFormString("zipcode");
  4147. string conname = RequestString.GetFormString("conname");
  4148. string conphone = RequestString.GetFormString("conphone");
  4149. string title = RequestString.GetFormString("title");
  4150. string content = RequestString.GetFormString("content");
  4151. string files = RequestString.GetFormString("files");
  4152. int sourcearea = RequestString.GetInt("sourcearea", 0);
  4153. string sourceaddress = RequestString.GetFormString("sourceaddress");
  4154. int isresult = RequestString.GetInt("isresult", 0);
  4155. string result = RequestString.GetFormString("result");
  4156. string keys = RequestString.GetFormString("keys");
  4157. string splituser = RequestString.GetFormString("splituser");
  4158. int type = RequestString.GetInt("type", 0);
  4159. int bigtype = RequestString.GetInt("bigtype", 0);
  4160. int smalltype = RequestString.GetInt("smalltype", 0);
  4161. int isprotect = RequestString.GetInt("isprotect", 0);
  4162. int level = RequestString.GetInt("level", 0);
  4163. int issubmit = RequestString.GetInt("issubmit", 0);
  4164. using (TransactionScope trans = new TransactionScope())
  4165. {
  4166. #region 保存工单信息
  4167. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  4168. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  4169. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  4170. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  4171. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  4172. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  4173. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  4174. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  4175. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  4176. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  4177. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  4178. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  4179. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  4180. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  4181. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  4182. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  4183. modelT_Bus_WorkOrder.F_File = files;//附件
  4184. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  4185. modelT_Bus_WorkOrder.F_Key = keys;
  4186. modelT_Bus_WorkOrder.F_Level = level;
  4187. //是否直办(即时答复)0:,否1: 是
  4188. modelT_Bus_WorkOrder.F_IsResult = isresult;
  4189. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  4190. //如果选择即刻答复:是,即为直办,工单结束
  4191. if (isresult == 1)
  4192. {
  4193. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  4194. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  4195. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  4196. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  4197. modelT_Bus_WorkOrder.F_IsClosed = 1;
  4198. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  4199. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  4200. }
  4201. else if (issubmit == 1)
  4202. {
  4203. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4204. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  4205. }
  4206. workorderBLL.Update(modelT_Bus_WorkOrder);
  4207. #endregion
  4208. #region 插入操作记录
  4209. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4210. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4211. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4212. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  4213. oper.F_File = modelT_Bus_WorkOrder.F_File;
  4214. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4215. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4216. {
  4217. oper.F_Message = userinfo + " 修改了工单";
  4218. }
  4219. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4220. {
  4221. oper.F_Message = userinfo + " 修改并提交了工单";
  4222. }
  4223. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  4224. {
  4225. oper.F_Message = userinfo + " 修改并结案了工单";
  4226. }
  4227. oper.F_CreateUser = userModel.F_UserCode;
  4228. oper.F_CreateTime = DateTime.Now;
  4229. oper.F_IsDelete = 0;
  4230. operBLL.Add(oper);
  4231. //推送消息表
  4232. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4233. {
  4234. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4235. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4236. foreach (var u in users)
  4237. {
  4238. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4239. }
  4240. }
  4241. #endregion
  4242. trans.Complete();
  4243. }
  4244. return Success("操作成功");
  4245. }
  4246. else
  4247. {
  4248. return Error("操作失败");
  4249. }
  4250. }
  4251. else
  4252. {
  4253. return Success("权限不足");
  4254. }
  4255. }
  4256. /// <summary>
  4257. /// 修改工单信息
  4258. /// </summary>
  4259. /// <returns></returns>
  4260. [Authority]
  4261. public ActionResult EditWorkOrderBySource()
  4262. {
  4263. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4264. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4265. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  4266. {
  4267. string workorderid = RequestString.GetFormString("workorderid");
  4268. int source = RequestString.GetInt("source", 0);
  4269. string cusname = RequestString.GetFormString("cusname");
  4270. string cussex = RequestString.GetFormString("cussex");
  4271. string cusphone = RequestString.GetFormString("cusphone");
  4272. string cusaddress = RequestString.GetFormString("cusaddress");
  4273. string email = RequestString.GetFormString("email");
  4274. string zipcode = RequestString.GetFormString("zipcode");
  4275. string conname = RequestString.GetFormString("conname");
  4276. string conphone = RequestString.GetFormString("conphone");
  4277. string title = RequestString.GetFormString("title");
  4278. string content = RequestString.GetFormString("content");
  4279. string files = RequestString.GetFormString("files");
  4280. int sourcearea = RequestString.GetInt("sourcearea", 0);
  4281. string sourceaddress = RequestString.GetFormString("sourceaddress");
  4282. int isresult = RequestString.GetInt("isresult", 0);
  4283. string result = RequestString.GetFormString("result");
  4284. string keys = RequestString.GetFormString("keys");
  4285. string splituser = RequestString.GetFormString("splituser");
  4286. int type = RequestString.GetInt("type", 0);
  4287. int bigtype = RequestString.GetInt("bigtype", 0);
  4288. int smalltype = RequestString.GetInt("smalltype", 0);
  4289. int isprotect = RequestString.GetInt("isprotect", 0);
  4290. int level = RequestString.GetInt("level", 0);
  4291. int issubmit = RequestString.GetInt("issubmit", 0);
  4292. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4293. if (modelT_Bus_WorkOrder != null)
  4294. {
  4295. using (TransactionScope trans = new TransactionScope())
  4296. {
  4297. #region 保存工单信息
  4298. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  4299. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  4300. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  4301. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  4302. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  4303. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  4304. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  4305. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  4306. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  4307. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  4308. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  4309. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  4310. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  4311. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  4312. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  4313. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  4314. modelT_Bus_WorkOrder.F_File = files;//附件
  4315. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  4316. modelT_Bus_WorkOrder.F_Key = keys;
  4317. modelT_Bus_WorkOrder.F_Level = level;
  4318. //是否直办(即时答复)0:,否1: 是
  4319. modelT_Bus_WorkOrder.F_IsResult = isresult;
  4320. modelT_Bus_WorkOrder.F_Result = result;//处理结果
  4321. //如果选择即刻答复:是,即为直办,工单结束
  4322. if (isresult == 1)
  4323. {
  4324. modelT_Bus_WorkOrder.F_WorkState = 9;//已结案
  4325. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  4326. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  4327. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  4328. modelT_Bus_WorkOrder.F_IsClosed = 1;
  4329. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  4330. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  4331. }
  4332. else if (issubmit == 1)
  4333. {
  4334. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4335. modelT_Bus_WorkOrder.F_WorkState = 1;//提交领导
  4336. }
  4337. modelT_Bus_WorkOrder.F_CreateUser = userModel.F_UserCode;
  4338. modelT_Bus_WorkOrder.F_IsEnabled = 1;
  4339. modelT_Bus_WorkOrder.F_EnableTime = DateTime.Now;
  4340. modelT_Bus_WorkOrder.F_IsDelete = 0;
  4341. workorderBLL.Update(modelT_Bus_WorkOrder);
  4342. #endregion
  4343. #region 保存转单记录
  4344. Model.T_Bus_CityTurn modelT_Bus_CityTurn = new BLL.T_Bus_CityTurn().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
  4345. if (modelT_Bus_CityTurn != null && modelT_Bus_CityTurn.F_IsSure == 0)
  4346. {
  4347. modelT_Bus_CityTurn.F_IsSure = 1;
  4348. modelT_Bus_CityTurn.F_SureUser = userModel.F_UserCode;
  4349. modelT_Bus_CityTurn.F_SureTime = DateTime.Now;
  4350. new BLL.T_Bus_CityTurn().Update(modelT_Bus_CityTurn);
  4351. }
  4352. #endregion
  4353. #region 插入操作记录
  4354. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4355. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4356. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4357. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  4358. oper.F_File = modelT_Bus_WorkOrder.F_File;
  4359. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4360. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4361. {
  4362. oper.F_Message = userinfo + " 处理了工单";
  4363. }
  4364. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4365. {
  4366. oper.F_Message = userinfo + " 处理并提交了工单";
  4367. }
  4368. if (modelT_Bus_WorkOrder.F_WorkState == 9)
  4369. {
  4370. oper.F_Message = userinfo + " 处理并结案了工单";
  4371. }
  4372. oper.F_CreateUser = userModel.F_UserCode;
  4373. oper.F_CreateTime = DateTime.Now;
  4374. oper.F_IsDelete = 0;
  4375. operBLL.Add(oper);
  4376. //推送消息表
  4377. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4378. {
  4379. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4380. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4381. foreach (var u in users)
  4382. {
  4383. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4384. }
  4385. }
  4386. #endregion
  4387. trans.Complete();
  4388. }
  4389. return Success("操作成功");
  4390. }
  4391. else
  4392. {
  4393. return Error("操作失败");
  4394. }
  4395. }
  4396. else
  4397. {
  4398. return Success("权限不足");
  4399. }
  4400. }
  4401. /// <summary>
  4402. /// 提交工单
  4403. /// </summary>
  4404. /// <param name="ids"></param>
  4405. /// <returns></returns>
  4406. [Authority]
  4407. public ActionResult SubmitWorkOrder(string[] ids)
  4408. {
  4409. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4410. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4411. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  4412. {
  4413. if (ids != null && ids.Length > 0)
  4414. {
  4415. foreach (string str in ids)
  4416. {
  4417. using (TransactionScope trans = new TransactionScope())
  4418. {
  4419. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(str);
  4420. if (modelT_Bus_WorkOrder != null)
  4421. {
  4422. if (modelT_Bus_WorkOrder.F_WorkState == 0)
  4423. {
  4424. #region 保存工单信息
  4425. modelT_Bus_WorkOrder.F_SubmitTime = DateTime.Now;
  4426. modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
  4427. workorderBLL.Update(modelT_Bus_WorkOrder);
  4428. #endregion
  4429. #region 插入操作记录
  4430. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4431. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4432. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4433. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4434. oper.F_Message = userinfo + " 提交了工单";
  4435. oper.F_CreateUser = userModel.F_UserCode;
  4436. oper.F_CreateTime = DateTime.Now;
  4437. oper.F_IsDelete = 0;
  4438. operBLL.Add(oper);
  4439. //推送消息表
  4440. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4441. {
  4442. var role = new BLL.T_Sys_RoleInfo().GetModelList(" (F_RoleCode='ZXLD' or F_RoleCode='ZXLDGLY') ").Select(p => p.F_RoleId);
  4443. var users = userBLL.GetModelList(" F_RoleId in (" + string.Join(",", role) + ") ");
  4444. foreach (var u in users)
  4445. {
  4446. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4447. }
  4448. }
  4449. #endregion
  4450. }
  4451. }
  4452. trans.Complete();
  4453. }
  4454. }
  4455. return Success("操作成功");
  4456. }
  4457. else
  4458. {
  4459. return Error("操作失败");
  4460. }
  4461. }
  4462. else
  4463. {
  4464. return Error("权限不足");
  4465. }
  4466. }
  4467. /// <summary>
  4468. /// 回退工单
  4469. /// </summary>
  4470. /// <returns></returns>
  4471. [Authority]
  4472. public ActionResult ReturnWorkOrder()
  4473. {
  4474. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4475. Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
  4476. string workorderid = RequestString.GetFormString("workorderid");
  4477. string backuser = RequestString.GetFormString("backuser");
  4478. string backreason = RequestString.GetFormString("backreason");
  4479. string files = RequestString.GetFormString("files");
  4480. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
  4481. if (modelT_Bus_WorkOrder != null)
  4482. {
  4483. if (modelT_Bus_WorkOrder.F_WorkState == 1 || (modelT_Bus_WorkOrder.F_WorkState == 9 && modelT_Bus_WorkOrder.F_IsResult==1))
  4484. {
  4485. using (TransactionScope trans = new TransactionScope())
  4486. {
  4487. #region 保存工单信息
  4488. modelT_Bus_WorkOrder.F_WorkState = 0;
  4489. modelT_Bus_WorkOrder.F_IsResult = 0;
  4490. modelT_Bus_WorkOrder.F_IsReturn = 1;
  4491. modelT_Bus_WorkOrder.F_LimitTime = null;
  4492. modelT_Bus_WorkOrder.F_IsOverdue = 0;
  4493. modelT_Bus_WorkOrder.F_MainDeptId = null;
  4494. modelT_Bus_WorkOrder.F_OtherDeptIds = "";
  4495. modelT_Bus_WorkOrder.F_DealDeptId = null;
  4496. modelT_Bus_WorkOrder.F_DealUser = "";
  4497. modelT_Bus_WorkOrder.F_DealTime = null;
  4498. modelT_Bus_WorkOrder.F_AssignUser= userModel.F_UserCode;
  4499. modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
  4500. workorderBLL.Update(modelT_Bus_WorkOrder);
  4501. #endregion
  4502. #region 插入批示记录
  4503. //批示记录
  4504. Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new Model.T_Bus_SubmitSuper();
  4505. model_T_Bus_SubmitSuper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
  4506. model_T_Bus_SubmitSuper.F_Type = 3;//1领导批示 2市长指示 3回退
  4507. model_T_Bus_SubmitSuper.F_BatchReason = backuser;//批示人
  4508. model_T_Bus_SubmitSuper.F_SuperOpinion = backreason;//批示内容
  4509. model_T_Bus_SubmitSuper.F_File = files;//附件
  4510. model_T_Bus_SubmitSuper.F_CreateUser = userModel.F_UserCode;//呈批人
  4511. model_T_Bus_SubmitSuper.F_CreateTime = DateTime.Now;//呈批时间
  4512. model_T_Bus_SubmitSuper.F_IsDelete = 0;
  4513. model_T_Bus_SubmitSuper.F_State = 1;//审批状态(0:未处理,1:通过)
  4514. new BLL.T_Bus_SubmitSuper().Add(model_T_Bus_SubmitSuper);
  4515. #endregion
  4516. #region 插入操作记录
  4517. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4518. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4519. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4520. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4521. oper.F_Message = userinfo + " 回退了工单";
  4522. oper.F_CreateUser = userModel.F_UserCode;
  4523. oper.F_CreateTime = DateTime.Now;
  4524. oper.F_IsDelete = 0;
  4525. operBLL.Add(oper);
  4526. #endregion
  4527. trans.Complete();
  4528. }
  4529. return Success("操作成功");
  4530. }
  4531. else
  4532. {
  4533. return Error("已经处理过了");
  4534. }
  4535. }
  4536. else
  4537. {
  4538. return Error("操作失败");
  4539. }
  4540. }
  4541. /// <summary>
  4542. /// 领导批示/市长指示
  4543. /// </summary>
  4544. /// <param name="ids"></param>
  4545. /// <returns></returns>
  4546. [Authority]
  4547. public ActionResult SuperWorkOrder()
  4548. {
  4549. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4550. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4551. string workorderid = RequestString.GetFormString("workorderid");
  4552. int type = RequestString.GetInt("type", 0);//1领导批示 2市长指示
  4553. string superuser = RequestString.GetFormString("superuser");
  4554. string superopinion = RequestString.GetFormString("superopinion");
  4555. string files = RequestString.GetFormString("files");
  4556. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4557. if (modelT_Bus_WorkOrder != null)
  4558. {
  4559. using (TransactionScope trans = new TransactionScope())
  4560. {
  4561. #region 保存工单信息 no use
  4562. //modelT_Bus_WorkOrder.F_WorkState = 2;//领导批示
  4563. //workorderBLL.Update(modelT_Bus_WorkOrder);
  4564. #endregion
  4565. #region 插入批示记录
  4566. //批示记录
  4567. Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new Model.T_Bus_SubmitSuper();
  4568. model_T_Bus_SubmitSuper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
  4569. model_T_Bus_SubmitSuper.F_Type = type;//1领导批示 2市长指示
  4570. model_T_Bus_SubmitSuper.F_BatchReason = superuser;//批示人
  4571. model_T_Bus_SubmitSuper.F_SuperOpinion = superopinion;//批示内容
  4572. model_T_Bus_SubmitSuper.F_File = files;//附件
  4573. model_T_Bus_SubmitSuper.F_CreateUser = userModel.F_UserCode;//呈批人
  4574. model_T_Bus_SubmitSuper.F_CreateTime = DateTime.Now;//呈批时间
  4575. model_T_Bus_SubmitSuper.F_IsDelete = 0;
  4576. model_T_Bus_SubmitSuper.F_State = 1;//审批状态(0:未处理,1:通过)
  4577. new BLL.T_Bus_SubmitSuper().Add(model_T_Bus_SubmitSuper);
  4578. #endregion
  4579. #region 插入操作记录
  4580. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4581. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4582. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4583. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4584. oper.F_Message = userinfo + " 批示了工单";
  4585. oper.F_CreateUser = userModel.F_UserCode;
  4586. oper.F_CreateTime = DateTime.Now;
  4587. oper.F_IsDelete = 0;
  4588. operBLL.Add(oper);
  4589. #endregion
  4590. trans.Complete();
  4591. }
  4592. return Success("操作成功");
  4593. }
  4594. else
  4595. {
  4596. return Error("操作失败");
  4597. }
  4598. }
  4599. public ActionResult GetWorkorderSimp()
  4600. {
  4601. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4602. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4603. string strworkorderid = HttpUtility.UrlDecode(RequestString.GetQueryString("workorderid"));
  4604. if (!string.IsNullOrEmpty(strworkorderid))
  4605. {
  4606. string sql = "select F_WorkOrderId,F_CreateTime,F_ComTitle,F_Result,dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetDeptName(F_MainDeptId) deptname "
  4607. + " from T_Bus_WorkOrder WITH(NOLOCK) where F_WorkOrderId ='" + strworkorderid + "'";
  4608. var dt = DbHelperSQL.Query(sql).Tables[0];
  4609. if (dt.Rows.Count > 0)
  4610. {
  4611. return Success("成功", dt);
  4612. }
  4613. return Error("获取失败");
  4614. }
  4615. return Error("参数错误");
  4616. }
  4617. /// <summary>
  4618. /// 交办工单
  4619. /// </summary>
  4620. /// <returns></returns>
  4621. [Authority]
  4622. public ActionResult AssignWorkOrder()
  4623. {
  4624. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4625. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4626. Model.T_Sys_RoleInfo RoleInfoModel = new BLL.T_Sys_RoleInfo().GetModel(userModel.F_RoleId );
  4627. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  4628. {
  4629. string workorderid = RequestString.GetFormString("workorderid");
  4630. int state = RequestString.GetInt("state", 0);
  4631. int assignid = RequestString.GetInt("assignid", 0);
  4632. int maindeptid = RequestString.GetInt("maindeptid", 0);
  4633. string otherdeptids = RequestString.GetFormString("otherdeptids");
  4634. DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime")+" 23:59:59");
  4635. string assignedopinion = RequestString.GetFormString("assignedopinion");
  4636. if (!string.IsNullOrEmpty(otherdeptids))
  4637. {
  4638. if (otherdeptids.Split(',').Contains(maindeptid.ToString()))
  4639. {
  4640. return Error("主办单位不能出现在协办单位");
  4641. }
  4642. }
  4643. if (limittime < DateTime.Now)
  4644. {
  4645. return Error("办理时限不能小于当前时间");
  4646. }
  4647. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4648. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = new Model.T_Bus_AssignedInfo();
  4649. var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
  4650. if (modelT_Bus_WorkOrder != null && deptinfo != null)
  4651. {
  4652. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  4653. {
  4654. int aid = 0;
  4655. using (TransactionScope trans = new TransactionScope())
  4656. {
  4657. if (assignid == 0)
  4658. {
  4659. #region 插入交办记录
  4660. modelT_Bus_AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4661. modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
  4662. modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
  4663. modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
  4664. // var mag = RoleInfoModel.F_RoleName + ":" + userModel.F_UserName + "(" + userModel.F_Mobile + ")" +
  4665. //DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  4666. var mag = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  4667. modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion+" "+ mag;//交办意见
  4668. modelT_Bus_AssignedInfo.F_State = state;//0草稿 1正式
  4669. modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
  4670. modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
  4671. modelT_Bus_AssignedInfo.F_IsDelete = 0;
  4672. modelT_Bus_AssignedInfo.F_IsOverdue = 0;
  4673. modelT_Bus_AssignedInfo.F_IsSure = 0;
  4674. modelT_Bus_AssignedInfo.F_IsReload = 0;
  4675. aid = assignBLL.Add(modelT_Bus_AssignedInfo);
  4676. #endregion
  4677. }
  4678. else
  4679. {
  4680. #region 修改交办记录
  4681. modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
  4682. if (modelT_Bus_AssignedInfo != null)
  4683. {
  4684. modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
  4685. modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
  4686. modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
  4687. modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion;//交办意见
  4688. modelT_Bus_AssignedInfo.F_State = state;//0草稿 1正式
  4689. modelT_Bus_AssignedInfo.F_CreateUser = userModel.F_UserCode;
  4690. modelT_Bus_AssignedInfo.F_CreateTime = DateTime.Now;
  4691. assignBLL.Update(modelT_Bus_AssignedInfo);
  4692. aid = modelT_Bus_AssignedInfo.F_Id;
  4693. }
  4694. #endregion
  4695. }
  4696. if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_State == 1)
  4697. {
  4698. #region 保存工单信息
  4699. modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
  4700. modelT_Bus_WorkOrder.F_LimitTime = limittime;
  4701. modelT_Bus_WorkOrder.F_MainDeptId = maindeptid;
  4702. modelT_Bus_WorkOrder.F_OtherDeptIds = otherdeptids;
  4703. modelT_Bus_WorkOrder.F_AssignUser = userModel.F_UserCode;
  4704. modelT_Bus_WorkOrder.F_AssignTime = DateTime.Now;
  4705. workorderBLL.Update(modelT_Bus_WorkOrder);
  4706. #endregion
  4707. #region 删除草稿信息
  4708. var cglist = assignBLL.GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  4709. foreach (var cg in cglist)
  4710. {
  4711. cg.F_IsDelete = 1;
  4712. cg.F_DeleteUser = userModel.F_UserCode;
  4713. cg.F_DeleteTime = DateTime.Now;
  4714. assignBLL.Update(cg);
  4715. }
  4716. #endregion
  4717. #region 插入操作记录
  4718. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4719. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4720. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4721. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4722. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4723. oper.F_Message = userinfo + " 交办了工单,主办单位:" + deptinfo.F_DeptName;
  4724. if (!string.IsNullOrEmpty(otherdeptids))
  4725. {
  4726. string sql = "select dbo.GetDeptNames('" + otherdeptids + "')";
  4727. oper.F_Message += ",协办单位:" + DbHelperSQL.GetSingle(sql);
  4728. }
  4729. oper.F_CreateUser = userModel.F_UserCode;
  4730. oper.F_CreateTime = DateTime.Now;
  4731. oper.F_IsDelete = 0;
  4732. operBLL.Add(oper);
  4733. //推送消息表
  4734. var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
  4735. foreach (var u in users)
  4736. {
  4737. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  4738. }
  4739. #endregion
  4740. }
  4741. trans.Complete();
  4742. }
  4743. return Success("操作成功", modelT_Bus_AssignedInfo.F_Id);
  4744. }
  4745. else
  4746. {
  4747. return Error("已经交办过了");
  4748. }
  4749. }
  4750. else
  4751. {
  4752. return Error("操作失败");
  4753. }
  4754. }
  4755. else
  4756. {
  4757. return Error("权限不足");
  4758. }
  4759. }
  4760. /// <summary>
  4761. /// 收回工单
  4762. /// </summary>
  4763. /// <returns></returns>
  4764. [Authority]
  4765. public ActionResult TakeBackWorkOrder()
  4766. {
  4767. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4768. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4769. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  4770. {
  4771. string workorderid = RequestString.GetFormString("workorderid");
  4772. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4773. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4774. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  4775. {
  4776. if (modelT_Bus_AssignedInfo.F_IsSure == 0 || (modelT_Bus_AssignedInfo.F_IsSure == 1 && modelT_Bus_WorkOrder.F_WorkState == 4))
  4777. {
  4778. using (TransactionScope trans = new TransactionScope())
  4779. {
  4780. #region 插入交办记录
  4781. Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
  4782. AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4783. AssignedInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;//办理时限
  4784. AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
  4785. AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
  4786. AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
  4787. AssignedInfo.F_State = 0;//0草稿 1正式
  4788. AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
  4789. AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
  4790. AssignedInfo.F_IsDelete = 0;
  4791. AssignedInfo.F_IsOverdue = 0;
  4792. AssignedInfo.F_IsSure = 0;
  4793. AssignedInfo.F_IsReload = 0;
  4794. assignBLL.Add(AssignedInfo);
  4795. #endregion
  4796. #region 保存工单信息
  4797. modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
  4798. modelT_Bus_WorkOrder.F_MainDeptId = null;
  4799. modelT_Bus_WorkOrder.F_OtherDeptIds = "";
  4800. workorderBLL.Update(modelT_Bus_WorkOrder);
  4801. #endregion
  4802. #region 删除交办信息
  4803. modelT_Bus_AssignedInfo.F_IsDelete = 1;//删除
  4804. modelT_Bus_AssignedInfo.F_DeleteUser = userModel.F_UserCode;
  4805. modelT_Bus_AssignedInfo.F_DeleteTime = DateTime.Now;
  4806. assignBLL.Update(modelT_Bus_AssignedInfo);
  4807. #endregion
  4808. #region 插入操作记录
  4809. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4810. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4811. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4812. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4813. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4814. oper.F_Message = userinfo + " 收回了工单";
  4815. oper.F_CreateUser = userModel.F_UserCode;
  4816. oper.F_CreateTime = DateTime.Now;
  4817. oper.F_IsDelete = 0;
  4818. operBLL.Add(oper);
  4819. #endregion
  4820. trans.Complete();
  4821. }
  4822. return Success("操作成功");
  4823. }
  4824. else
  4825. {
  4826. return Error("单位已查收,不能收回");
  4827. }
  4828. }
  4829. else
  4830. {
  4831. return Error("操作失败");
  4832. }
  4833. }
  4834. else
  4835. {
  4836. return Error("权限不足");
  4837. }
  4838. }
  4839. /// <summary>
  4840. /// 查收工单
  4841. /// </summary>
  4842. /// <returns></returns>
  4843. [Authority]
  4844. public ActionResult ReceiveWorkOrder()
  4845. {
  4846. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4847. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4848. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  4849. {
  4850. string workorderid = RequestString.GetFormString("workorderid");
  4851. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4852. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4853. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId
  4854. && (modelT_Bus_WorkOrder.F_WorkState == 2 || modelT_Bus_WorkOrder.F_WorkState == 8))
  4855. {
  4856. if (modelT_Bus_AssignedInfo.F_IsSure == 0 )
  4857. {
  4858. using (TransactionScope trans = new TransactionScope())
  4859. {
  4860. #region 保存工单信息
  4861. modelT_Bus_WorkOrder.F_WorkState = 4;//办理中
  4862. workorderBLL.Update(modelT_Bus_WorkOrder);
  4863. #endregion
  4864. #region 保存查收信息
  4865. modelT_Bus_AssignedInfo.F_IsSure = 1;//查收
  4866. modelT_Bus_AssignedInfo.F_SureUser = userModel.F_UserCode;
  4867. modelT_Bus_AssignedInfo.F_SureTime = DateTime.Now;
  4868. assignBLL.Update(modelT_Bus_AssignedInfo);
  4869. #endregion
  4870. #region 保存明细信息
  4871. if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds))
  4872. {
  4873. string[] strids = modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',');
  4874. foreach (string strid in strids)
  4875. {
  4876. Model.T_Bus_AssignedItemInfo modelT_Bus_AssignedItemInfo = new Model.T_Bus_AssignedItemInfo();
  4877. modelT_Bus_AssignedItemInfo.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4878. modelT_Bus_AssignedItemInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;
  4879. modelT_Bus_AssignedItemInfo.F_DeptId = Int32.Parse(strid);
  4880. modelT_Bus_AssignedItemInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;
  4881. modelT_Bus_AssignedItemInfo.F_Remark = modelT_Bus_AssignedInfo.F_Remark;
  4882. modelT_Bus_AssignedItemInfo.F_State = 1;
  4883. modelT_Bus_AssignedItemInfo.F_Type = 2;
  4884. modelT_Bus_AssignedItemInfo.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  4885. modelT_Bus_AssignedItemInfo.F_IsSure = 0;
  4886. modelT_Bus_AssignedItemInfo.F_CreateTime = DateTime.Now;
  4887. modelT_Bus_AssignedItemInfo.F_CreateUser = userModel.F_UserCode;
  4888. modelT_Bus_AssignedItemInfo.F_IsDelete = 0;
  4889. new BLL.T_Bus_AssignedItemInfo().Add(modelT_Bus_AssignedItemInfo);
  4890. }
  4891. }
  4892. #endregion
  4893. #region 插入操作记录
  4894. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4895. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4896. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4897. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4898. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4899. oper.F_Message = userinfo + " 查收了工单";
  4900. oper.F_CreateUser = userModel.F_UserCode;
  4901. oper.F_CreateTime = DateTime.Now;
  4902. oper.F_IsDelete = 0;
  4903. operBLL.Add(oper);
  4904. #endregion
  4905. trans.Complete();
  4906. }
  4907. return Success("操作成功");
  4908. }
  4909. else
  4910. {
  4911. return Error("单位已查收,不能再次查收");
  4912. }
  4913. }
  4914. else
  4915. {
  4916. return Error("操作失败");
  4917. }
  4918. }
  4919. else
  4920. {
  4921. return Error("权限不足");
  4922. }
  4923. }
  4924. /// <summary>
  4925. /// 退回工单
  4926. /// </summary>
  4927. /// <returns></returns>
  4928. [Authority]
  4929. public ActionResult RebackWorkOrder()
  4930. {
  4931. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  4932. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  4933. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  4934. {
  4935. string workorderid = RequestString.GetFormString("workorderid");
  4936. string backreason = RequestString.GetFormString("backreason");
  4937. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  4938. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  4939. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  4940. {
  4941. if (modelT_Bus_AssignedInfo.F_IsSure == 0)
  4942. {
  4943. using (TransactionScope trans = new TransactionScope())
  4944. {
  4945. #region 保存工单信息
  4946. modelT_Bus_WorkOrder.F_WorkState = 3;//退回审核中
  4947. workorderBLL.Update(modelT_Bus_WorkOrder);
  4948. #endregion
  4949. #region 插入退回申请信息
  4950. Model.T_Bus_Feedback model_T_Bus_Feedback = new Model.T_Bus_Feedback();
  4951. model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  4952. model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  4953. model_T_Bus_Feedback.F_Result = backreason;//退回原因
  4954. model_T_Bus_Feedback.F_IsAudit = 0;
  4955. model_T_Bus_Feedback.F_IsDelete = 0;
  4956. model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//退回人
  4957. model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//退回时间
  4958. model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//退回部门
  4959. model_T_Bus_Feedback.F_IsFeedEnd = 1;
  4960. model_T_Bus_Feedback.F_State = 1;
  4961. model_T_Bus_Feedback.F_Type = 3;
  4962. new BLL.T_Bus_Feedback().Add(model_T_Bus_Feedback);
  4963. #endregion
  4964. #region 保存交办信息
  4965. //modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;//办理
  4966. //if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  4967. //{
  4968. // modelT_Bus_AssignedInfo.F_IsOverdue = 1;
  4969. //}
  4970. modelT_Bus_AssignedInfo.F_IsSure = 2;//申请退回
  4971. modelT_Bus_AssignedInfo.F_SureUser = userModel.F_UserCode;
  4972. modelT_Bus_AssignedInfo.F_SureTime = DateTime.Now;
  4973. assignBLL.Update(modelT_Bus_AssignedInfo);
  4974. #endregion
  4975. #region 插入操作记录
  4976. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  4977. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  4978. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  4979. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  4980. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  4981. oper.F_Message = userinfo + " 申请退回了工单";
  4982. oper.F_CreateUser = userModel.F_UserCode;
  4983. oper.F_CreateTime = DateTime.Now;
  4984. oper.F_IsDelete = 0;
  4985. operBLL.Add(oper);
  4986. //推送消息表
  4987. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
  4988. #endregion
  4989. trans.Complete();
  4990. }
  4991. return Success("操作成功");
  4992. }
  4993. else
  4994. {
  4995. return Error("单位已查收,不能退回");
  4996. }
  4997. }
  4998. else
  4999. {
  5000. return Error("操作失败");
  5001. }
  5002. }
  5003. else
  5004. {
  5005. return Error("权限不足");
  5006. }
  5007. }
  5008. /// <summary>
  5009. /// 审核退回工单
  5010. /// </summary>
  5011. /// <returns></returns>
  5012. [Authority]
  5013. public ActionResult AuditRebackWorkOrder()
  5014. {
  5015. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5016. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5017. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  5018. {
  5019. string workorderid = RequestString.GetFormString("workorderid");
  5020. int state = RequestString.GetInt("state", 0);
  5021. string reason = RequestString.GetFormString("reason");
  5022. int rebackid = RequestString.GetInt("rebackid", 0);
  5023. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5024. Model.T_Bus_Feedback modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(rebackid);
  5025. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5026. if (modelT_Bus_WorkOrder != null && modelT_Bus_Feedback != null && modelT_Bus_AssignedInfo != null)
  5027. {
  5028. if (modelT_Bus_Feedback.F_Type == 3 && modelT_Bus_Feedback.F_IsAudit == 0)
  5029. {
  5030. using (TransactionScope trans = new TransactionScope())
  5031. {
  5032. #region 保存查收信息
  5033. modelT_Bus_Feedback.F_IsAudit = state;//审核
  5034. modelT_Bus_Feedback.F_AuditUser = userModel.F_UserCode;
  5035. modelT_Bus_Feedback.F_AuditTime = DateTime.Now;
  5036. modelT_Bus_Feedback.F_AuditReason = reason;
  5037. new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
  5038. #endregion
  5039. string strmsg = "同意";
  5040. if (modelT_Bus_Feedback.F_IsAudit == 1)
  5041. {
  5042. #region 插入交办记录
  5043. Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
  5044. AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5045. AssignedInfo.F_LimitTime = modelT_Bus_AssignedInfo.F_LimitTime;//办理时限
  5046. AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
  5047. AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
  5048. AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
  5049. AssignedInfo.F_State = 0;//0草稿 1正式
  5050. AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
  5051. AssignedInfo.F_CreateTime = modelT_Bus_AssignedInfo.F_CreateTime;
  5052. AssignedInfo.F_IsDelete = 0;
  5053. AssignedInfo.F_IsOverdue = 0;
  5054. AssignedInfo.F_IsSure = 0;
  5055. AssignedInfo.F_IsReload = modelT_Bus_AssignedInfo.F_IsReload;
  5056. assignBLL.Add(AssignedInfo);
  5057. #endregion
  5058. #region 保存交办信息
  5059. modelT_Bus_AssignedInfo.F_IsSure = 3;//退回
  5060. assignBLL.Update(modelT_Bus_AssignedInfo);
  5061. #endregion
  5062. #region 保存工单信息
  5063. modelT_Bus_WorkOrder.F_WorkState = 1;//待交办
  5064. workorderBLL.Update(modelT_Bus_WorkOrder);
  5065. #endregion
  5066. }
  5067. else
  5068. {
  5069. #region 保存工单信息
  5070. modelT_Bus_WorkOrder.F_WorkState = 2;//待查收
  5071. workorderBLL.Update(modelT_Bus_WorkOrder);
  5072. #endregion
  5073. #region 保存交办信息
  5074. //modelT_Bus_AssignedInfo.F_FeedbackTime = null;//反馈时间
  5075. modelT_Bus_AssignedInfo.F_IsSure = 0;
  5076. modelT_Bus_AssignedInfo.F_SureUser = "";
  5077. modelT_Bus_AssignedInfo.F_SureTime = null;
  5078. assignBLL.Update(modelT_Bus_AssignedInfo);
  5079. #endregion
  5080. strmsg = "拒绝";
  5081. }
  5082. #region 插入操作记录
  5083. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5084. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5085. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5086. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5087. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5088. oper.F_Message = userinfo + " " + strmsg + "了工单退回申请";
  5089. oper.F_CreateUser = userModel.F_UserCode;
  5090. oper.F_CreateTime = DateTime.Now;
  5091. oper.F_IsDelete = 0;
  5092. operBLL.Add(oper);
  5093. //推送消息表
  5094. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_Feedback.F_CreateUser, userModel.F_UserCode);
  5095. #endregion
  5096. trans.Complete();
  5097. }
  5098. return Success("操作成功");
  5099. }
  5100. else
  5101. {
  5102. return Error("此审核已经处理");
  5103. }
  5104. }
  5105. else
  5106. {
  5107. return Error("操作失败");
  5108. }
  5109. }
  5110. else
  5111. {
  5112. return Error("权限不足");
  5113. }
  5114. }
  5115. /// <summary>
  5116. /// 申请延时
  5117. /// </summary>
  5118. /// <returns></returns>
  5119. [Authority]
  5120. public ActionResult DelayWorkOrder()
  5121. {
  5122. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5123. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5124. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5125. {
  5126. string workorderid = RequestString.GetFormString("workorderid");
  5127. //int state = RequestString.GetInt("state", 0);
  5128. DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");
  5129. string reason = RequestString.GetFormString("reason");
  5130. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5131. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5132. if (modelT_Bus_WorkOrder!=null )
  5133. {
  5134. if (modelT_Bus_WorkOrder.F_WorkState != 4)
  5135. return Error("非办理中工单不可申请延时!");
  5136. }
  5137. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  5138. {
  5139. if (modelT_Bus_AssignedInfo.F_IsSure == 1)
  5140. {
  5141. using (TransactionScope trans = new TransactionScope())
  5142. {
  5143. #region 保存工单信息
  5144. modelT_Bus_WorkOrder.F_WorkState = 5;//延时审核中
  5145. workorderBLL.Update(modelT_Bus_WorkOrder);
  5146. #endregion
  5147. #region 插入申请延时信息
  5148. Model.T_Bus_DelayTime delay = new Model.T_Bus_DelayTime();
  5149. delay.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5150. //delay.F_State = state;
  5151. delay.F_OldTime = modelT_Bus_AssignedInfo.F_LimitTime;
  5152. delay.F_NewTime = newlimittime;
  5153. delay.F_Reason = reason;
  5154. delay.F_State = 1;
  5155. delay.F_IsAudit = 0;
  5156. delay.F_IsDelete = 0;
  5157. delay.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5158. delay.F_CreateUser = userModel.F_UserCode;
  5159. delay.F_CreateTime = DateTime.Now;
  5160. new BLL.T_Bus_DelayTime().Add(delay);
  5161. #endregion
  5162. #region 插入操作记录
  5163. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5164. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5165. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5166. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5167. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5168. oper.F_Message = userinfo + " 申请了延时处理";
  5169. oper.F_CreateUser = userModel.F_UserCode;
  5170. oper.F_CreateTime = DateTime.Now;
  5171. oper.F_IsDelete = 0;
  5172. operBLL.Add(oper);
  5173. //推送消息表
  5174. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
  5175. #endregion
  5176. trans.Complete();
  5177. }
  5178. return Success("操作成功");
  5179. }
  5180. else
  5181. {
  5182. return Error("操作失敗,已查收");
  5183. }
  5184. }
  5185. else
  5186. {
  5187. return Error("操作失败");
  5188. }
  5189. }
  5190. else
  5191. {
  5192. return Error("权限不足");
  5193. }
  5194. }
  5195. /// <summary>
  5196. /// 审核延时工单
  5197. /// </summary>
  5198. /// <returns></returns>
  5199. [Authority]
  5200. public ActionResult AuditDelayWorkOrder()
  5201. {
  5202. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5203. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5204. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  5205. {
  5206. string workorderid = RequestString.GetFormString("workorderid");
  5207. int state = RequestString.GetInt("state", 0);
  5208. string reason = RequestString.GetFormString("reason");
  5209. DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");
  5210. int delayid = RequestString.GetInt("delayid", 0);
  5211. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5212. Model.T_Bus_DelayTime modelT_Bus_DelayTime = new BLL.T_Bus_DelayTime().GetModel(delayid);
  5213. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5214. if (modelT_Bus_WorkOrder != null && modelT_Bus_DelayTime != null && modelT_Bus_AssignedInfo != null)
  5215. {
  5216. if (modelT_Bus_DelayTime.F_IsAudit == 0)
  5217. {
  5218. using (TransactionScope trans = new TransactionScope())
  5219. {
  5220. #region 保存工单信息
  5221. modelT_Bus_WorkOrder.F_WorkState = 4;//办理中
  5222. if (state == 1)
  5223. {
  5224. modelT_Bus_WorkOrder.F_LimitTime = newlimittime;
  5225. }
  5226. workorderBLL.Update(modelT_Bus_WorkOrder);
  5227. #endregion
  5228. #region 保存审核信息
  5229. modelT_Bus_DelayTime.F_IsAudit = state;//审核
  5230. modelT_Bus_DelayTime.F_AuditUser = userModel.F_UserCode;
  5231. modelT_Bus_DelayTime.F_AuditTime = DateTime.Now;
  5232. modelT_Bus_DelayTime.F_RefuseReason = reason;
  5233. modelT_Bus_DelayTime.F_AgreeTime = newlimittime;
  5234. new BLL.T_Bus_DelayTime().Update(modelT_Bus_DelayTime);
  5235. #endregion
  5236. string type = "同意"; string des = "";
  5237. if (modelT_Bus_DelayTime.F_IsAudit == 1)
  5238. {
  5239. #region 修改交办记录
  5240. modelT_Bus_AssignedInfo.F_LimitTime = modelT_Bus_DelayTime.F_AgreeTime;
  5241. assignBLL.Update(modelT_Bus_AssignedInfo);
  5242. #endregion
  5243. #region 处理协办单位
  5244. var xblist = assignItemBLL.GetModelList(" F_IsDelete=0 and F_State=1 and ISNULL(F_FeedbackTime, '')='' and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  5245. foreach (var xb in xblist)
  5246. {
  5247. //xb.F_LimitTime = DateTime.Now;
  5248. xb.F_LimitTime = modelT_Bus_DelayTime.F_AgreeTime;
  5249. assignItemBLL.Update(xb);
  5250. }
  5251. #endregion
  5252. des = ",原定时间" + modelT_Bus_DelayTime.F_OldTime + ",申请延长到" + modelT_Bus_DelayTime.F_AgreeTime;
  5253. }
  5254. else
  5255. {
  5256. type = "拒绝";
  5257. }
  5258. #region 插入操作记录
  5259. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5260. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5261. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5262. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5263. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5264. oper.F_Message = userinfo + " " + type + "了工单延时申请" + des;
  5265. oper.F_CreateUser = userModel.F_UserCode;
  5266. oper.F_CreateTime = DateTime.Now;
  5267. oper.F_IsDelete = 0;
  5268. operBLL.Add(oper);
  5269. //推送消息表
  5270. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_DelayTime.F_CreateUser, userModel.F_UserCode);
  5271. #endregion
  5272. trans.Complete();
  5273. }
  5274. return Success("操作成功");
  5275. }
  5276. else
  5277. {
  5278. return Error("此审核已经处理");
  5279. }
  5280. }
  5281. else
  5282. {
  5283. return Error("操作失败");
  5284. }
  5285. }
  5286. else
  5287. {
  5288. return Error("权限不足");
  5289. }
  5290. }
  5291. /// <summary>
  5292. /// 办理工单
  5293. /// </summary>
  5294. /// <returns></returns>
  5295. [Authority]
  5296. public ActionResult FeedBackWorkOrder()
  5297. {
  5298. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5299. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5300. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5301. {
  5302. string workorderid = RequestString.GetFormString("workorderid");
  5303. string dealman = RequestString.GetFormString("dealman");
  5304. string result = RequestString.GetFormString("result");
  5305. string files = RequestString.GetFormString("files");
  5306. int state = RequestString.GetInt("state", 0);
  5307. int feedbackid = RequestString.GetInt("feedbackid", 0);
  5308. int isproresult = RequestString.GetInt("isproresult", 0);//是否有处理结果:0默认,1是,2否
  5309. string prosituation = RequestString.GetFormString("prosituation");
  5310. string dealcontact = RequestString.GetFormString("dealcontact");
  5311. string connecttime = RequestString.GetFormString("connecttime");
  5312. string connectmode = RequestString.GetFormString("connectmode");
  5313. string replycontent = RequestString.GetFormString("replycontent");
  5314. int isstaisfied = RequestString.GetInt("isstaisfied", 0);
  5315. string duties = RequestString.GetFormString("duties");
  5316. string situation = RequestString.GetFormString("situation");
  5317. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5318. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5319. Model.T_Bus_Feedback modelT_Bus_Feedback = new Model.T_Bus_Feedback();
  5320. int type = 0;
  5321. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  5322. {
  5323. type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
  5324. if (type > 0)
  5325. {
  5326. //if (modelT_Bus_WorkOrder.F_WorkState == 4)
  5327. if (modelT_Bus_WorkOrder.F_WorkState == 4)
  5328. {
  5329. using (TransactionScope trans = new TransactionScope())
  5330. {
  5331. if (feedbackid == 0)
  5332. {
  5333. #region 插入反馈记录
  5334. modelT_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5335. modelT_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5336. modelT_Bus_Feedback.F_DealUser = dealman;
  5337. modelT_Bus_Feedback.F_Result = result;//反馈内容
  5338. #region 20200114新增字段 zhengbingbing
  5339. modelT_Bus_Feedback.F_IsProResult = isproresult;//是否有处理结果:0默认,1是,2否
  5340. modelT_Bus_Feedback.F_ProSituation = prosituation;//处理情况/方案/进程
  5341. modelT_Bus_Feedback.F_IsProtect = modelT_Bus_WorkOrder.F_IsProtect;//是否保密(0:否1:是)
  5342. modelT_Bus_Feedback.F_DealUserContact = dealcontact;//承办人联系方式
  5343. DateTime contime = DateTime.Now;
  5344. if (connecttime != "" && DateTime.TryParse(connecttime, out contime))
  5345. modelT_Bus_Feedback.F_ConnectTime = DateTime.Parse(connecttime);//沟通时间
  5346. modelT_Bus_Feedback.F_ConnectMode = connectmode;//沟通方式
  5347. modelT_Bus_Feedback.F_ReplyContent = replycontent;//答复内容
  5348. modelT_Bus_Feedback.F_IsSatisfied = isstaisfied;//是否满意:0未评价,1满意,2基本满意,3不满意
  5349. modelT_Bus_Feedback.F_Duties = duties;//职务
  5350. modelT_Bus_Feedback.F_Situation = situation;
  5351. #endregion
  5352. modelT_Bus_Feedback.F_File = files;
  5353. modelT_Bus_Feedback.F_IsAudit = 0;
  5354. modelT_Bus_Feedback.F_IsDelete = 0;
  5355. modelT_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5356. modelT_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5357. modelT_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5358. modelT_Bus_Feedback.F_IsFeedEnd = 1;
  5359. modelT_Bus_Feedback.F_State = state;
  5360. modelT_Bus_Feedback.F_Type = type;
  5361. new BLL.T_Bus_Feedback().Add(modelT_Bus_Feedback);
  5362. #endregion
  5363. }
  5364. else
  5365. {
  5366. #region 修改反馈记录
  5367. modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
  5368. if (modelT_Bus_Feedback != null)
  5369. {
  5370. modelT_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5371. modelT_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5372. modelT_Bus_Feedback.F_DealUser = dealman;
  5373. modelT_Bus_Feedback.F_Result = result;//反馈内容
  5374. modelT_Bus_Feedback.F_File = files;
  5375. #region 20200114新增字段 zhengbingbing
  5376. modelT_Bus_Feedback.F_IsProResult = isproresult;//是否有处理结果:0默认,1是,2否
  5377. modelT_Bus_Feedback.F_ProSituation = prosituation;//处理情况/方案/进程
  5378. modelT_Bus_Feedback.F_IsProtect = modelT_Bus_WorkOrder.F_IsProtect;//是否保密(0:否1:是)
  5379. modelT_Bus_Feedback.F_DealUserContact = dealcontact;//承办人联系方式
  5380. DateTime contime = DateTime.Now;
  5381. if (connecttime != "" && DateTime.TryParse(connecttime, out contime))
  5382. modelT_Bus_Feedback.F_ConnectTime = DateTime.Parse(connecttime);//沟通时间
  5383. modelT_Bus_Feedback.F_ConnectMode = connectmode;//沟通方式
  5384. modelT_Bus_Feedback.F_ReplyContent = replycontent;//答复内容
  5385. modelT_Bus_Feedback.F_IsSatisfied = isstaisfied;//是否满意:0未评价,1满意,2基本满意,3不满意
  5386. modelT_Bus_Feedback.F_Duties = duties;//职务
  5387. modelT_Bus_Feedback.F_Situation = situation;
  5388. #endregion
  5389. modelT_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5390. modelT_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5391. modelT_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5392. modelT_Bus_Feedback.F_IsFeedEnd = 1;
  5393. modelT_Bus_Feedback.F_State = state;
  5394. if (modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  5395. {
  5396. modelT_Bus_Feedback.F_Type = 1;
  5397. }
  5398. else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(userModel.F_DeptId.ToString()))
  5399. {
  5400. modelT_Bus_Feedback.F_Type = 2;
  5401. }
  5402. new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
  5403. }
  5404. #endregion
  5405. }
  5406. if (modelT_Bus_Feedback != null && modelT_Bus_Feedback.F_State == 1)
  5407. {
  5408. string typemsg = "办理";
  5409. if (type == 1)
  5410. {
  5411. int iscs = 0;
  5412. if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  5413. {
  5414. iscs = 1;
  5415. }
  5416. #region 保存工单信息
  5417. //modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
  5418. modelT_Bus_WorkOrder.F_WorkState =6;//待回访
  5419. modelT_Bus_WorkOrder.F_Result = result;
  5420. modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  5421. modelT_Bus_WorkOrder.F_DealUser = userModel.F_UserCode;
  5422. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  5423. modelT_Bus_WorkOrder.F_IsOverdue = iscs;
  5424. workorderBLL.Update(modelT_Bus_WorkOrder);
  5425. #endregion
  5426. #region 保存交办信息
  5427. modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
  5428. if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  5429. {
  5430. modelT_Bus_AssignedInfo.F_IsOverdue = 1;
  5431. }
  5432. assignBLL.Update(modelT_Bus_AssignedInfo);
  5433. #endregion
  5434. #region 删除草稿信息
  5435. 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 + "'");
  5436. foreach (var cg in cglist)
  5437. {
  5438. cg.F_IsDelete = 1;
  5439. cg.F_DeleteUser = userModel.F_UserCode;
  5440. cg.F_DeleteTime = DateTime.Now;
  5441. new BLL.T_Bus_Feedback().Update(cg);
  5442. }
  5443. #endregion
  5444. #region 删除二级单位未办理信息
  5445. var ejlist = new BLL.T_Bus_AssignedInfo_Next().GetModelList(" F_IsDelete=0 and isnull(F_FeedbackTime,'')='' and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  5446. foreach (var ej in ejlist)
  5447. {
  5448. ej.F_IsDelete = 1;
  5449. ej.F_DeleteUser = userModel.F_UserCode;
  5450. ej.F_DeleteTime = DateTime.Now;
  5451. new BLL.T_Bus_AssignedInfo_Next().Update(ej);
  5452. }
  5453. #endregion
  5454. #region 处理协办单位
  5455. 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 + "'");
  5456. foreach (var xb in xblist)
  5457. {
  5458. xb.F_State = 2;
  5459. xb.F_SureUser = userModel.F_UserCode;
  5460. xb.F_SureTime = DateTime.Now;
  5461. new BLL.T_Bus_AssignedItemInfo().Update(xb);
  5462. }
  5463. #endregion
  5464. typemsg = "主办";
  5465. }
  5466. else if (type == 2)
  5467. {
  5468. #region 保存明细信息
  5469. 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();
  5470. modelT_Bus_AssignedItemInfo.F_FeedbackTime = DateTime.Now;
  5471. if (modelT_Bus_AssignedItemInfo.F_LimitTime < DateTime.Now)
  5472. {
  5473. modelT_Bus_AssignedItemInfo.F_IsOverdue = 1;
  5474. }
  5475. new BLL.T_Bus_AssignedItemInfo().Update(modelT_Bus_AssignedItemInfo);
  5476. #endregion
  5477. #region 删除草稿信息
  5478. 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 + "'");
  5479. foreach (var cg in cglist)
  5480. {
  5481. cg.F_IsDelete = 1;
  5482. cg.F_DeleteUser = userModel.F_UserCode;
  5483. cg.F_DeleteTime = DateTime.Now;
  5484. new BLL.T_Bus_Feedback().Update(cg);
  5485. }
  5486. #endregion
  5487. typemsg = "协办";
  5488. }
  5489. #region 插入操作记录
  5490. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5491. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5492. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5493. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5494. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5495. oper.F_Message = userinfo + " " + typemsg + "了工单";
  5496. oper.F_CreateUser = userModel.F_UserCode;
  5497. oper.F_CreateTime = DateTime.Now;
  5498. oper.F_IsDelete = 0;
  5499. operBLL.Add(oper);
  5500. //推送消息表
  5501. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode, 1);
  5502. #endregion
  5503. }
  5504. trans.Complete();
  5505. }
  5506. return Success("操作成功", modelT_Bus_Feedback.F_Id);
  5507. }
  5508. else
  5509. {
  5510. return Error("已经办理过了");
  5511. }
  5512. }
  5513. else
  5514. {
  5515. return Error("权限不足");
  5516. }
  5517. }
  5518. else
  5519. {
  5520. return Error("操作失败");
  5521. }
  5522. }
  5523. else
  5524. {
  5525. return Error("权限不足");
  5526. }
  5527. }
  5528. ///// <summary>
  5529. ///// 办理工单
  5530. ///// </summary>
  5531. ///// <returns></returns>
  5532. //[Authority]
  5533. //public ActionResult FeedBackWorkOrder()
  5534. //{
  5535. // int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5536. // Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5537. // if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5538. // {
  5539. // string workorderid = RequestString.GetFormString("workorderid");
  5540. // string dealman = RequestString.GetFormString("dealman");
  5541. // string result = RequestString.GetFormString("result");
  5542. // string files = RequestString.GetFormString("files");
  5543. // int state = RequestString.GetInt("state", 0);
  5544. // int feedbackid = RequestString.GetInt("feedbackid", 0);
  5545. // Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5546. // Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5547. // Model.T_Bus_Feedback model_T_Bus_Feedback = new Model.T_Bus_Feedback();
  5548. // int type = 0;
  5549. // if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  5550. // {
  5551. // type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
  5552. // if (type > 0)
  5553. // {
  5554. // if (modelT_Bus_WorkOrder.F_WorkState == 4)
  5555. // {
  5556. // using (TransactionScope trans = new TransactionScope())
  5557. // {
  5558. // if (feedbackid == 0)
  5559. // {
  5560. // #region 插入反馈记录
  5561. // model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5562. // model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5563. // model_T_Bus_Feedback.F_DealUser = dealman;
  5564. // model_T_Bus_Feedback.F_Result = result;//反馈内容
  5565. // model_T_Bus_Feedback.F_File = files;
  5566. // model_T_Bus_Feedback.F_IsAudit = 0;
  5567. // model_T_Bus_Feedback.F_IsDelete = 0;
  5568. // model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5569. // model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5570. // model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5571. // model_T_Bus_Feedback.F_IsFeedEnd = 1;
  5572. // model_T_Bus_Feedback.F_State = state;
  5573. // model_T_Bus_Feedback.F_Type = type;
  5574. // new BLL.T_Bus_Feedback().Add(model_T_Bus_Feedback);
  5575. // #endregion
  5576. // }
  5577. // else
  5578. // {
  5579. // #region 修改反馈记录
  5580. // model_T_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
  5581. // if (model_T_Bus_Feedback != null)
  5582. // {
  5583. // model_T_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  5584. // model_T_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  5585. // model_T_Bus_Feedback.F_DealUser = dealman;
  5586. // model_T_Bus_Feedback.F_Result = result;//反馈内容
  5587. // model_T_Bus_Feedback.F_File = files;
  5588. // model_T_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  5589. // model_T_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  5590. // model_T_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  5591. // model_T_Bus_Feedback.F_IsFeedEnd = 1;
  5592. // model_T_Bus_Feedback.F_State = state;
  5593. // if (modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  5594. // {
  5595. // model_T_Bus_Feedback.F_Type = 1;
  5596. // }
  5597. // else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(userModel.F_DeptId.ToString()))
  5598. // {
  5599. // model_T_Bus_Feedback.F_Type = 2;
  5600. // }
  5601. // new BLL.T_Bus_Feedback().Update(model_T_Bus_Feedback);
  5602. // }
  5603. // #endregion
  5604. // }
  5605. // if (model_T_Bus_Feedback != null && model_T_Bus_Feedback.F_State == 1)
  5606. // {
  5607. // string typemsg = "办理";
  5608. // if (type == 1)
  5609. // {
  5610. // int iscs = 0;
  5611. // if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  5612. // {
  5613. // iscs = 1;
  5614. // }
  5615. // #region 保存工单信息
  5616. // modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
  5617. // modelT_Bus_WorkOrder.F_DealDeptId = userModel.F_DeptId;
  5618. // modelT_Bus_WorkOrder.F_DealUser= userModel.F_UserCode;
  5619. // modelT_Bus_WorkOrder.F_DealTime= DateTime.Now;
  5620. // modelT_Bus_WorkOrder.F_IsOverdue = iscs;
  5621. // modelT_Bus_WorkOrder.F_Result = result;
  5622. // workorderBLL.Update(modelT_Bus_WorkOrder);
  5623. // #endregion
  5624. // #region 保存交办信息
  5625. // modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
  5626. // modelT_Bus_AssignedInfo.F_IsOverdue = iscs;
  5627. // assignBLL.Update(modelT_Bus_AssignedInfo);
  5628. // #endregion
  5629. // #region 删除草稿信息
  5630. // 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 + "'");
  5631. // foreach (var cg in cglist)
  5632. // {
  5633. // cg.F_IsDelete = 1;
  5634. // cg.F_DeleteUser = userModel.F_UserCode;
  5635. // cg.F_DeleteTime = DateTime.Now;
  5636. // new BLL.T_Bus_Feedback().Update(cg);
  5637. // }
  5638. // #endregion
  5639. // #region 处理协办单位
  5640. // 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 + "'");
  5641. // foreach (var xb in xblist)
  5642. // {
  5643. // xb.F_State = 2;
  5644. // xb.F_SureUser = userModel.F_UserCode;
  5645. // xb.F_SureTime = DateTime.Now;
  5646. // new BLL.T_Bus_AssignedItemInfo().Update(xb);
  5647. // }
  5648. // #endregion
  5649. // typemsg = "主办";
  5650. // }
  5651. // else if (type == 2)
  5652. // {
  5653. // #region 保存明细信息
  5654. // 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();
  5655. // modelT_Bus_AssignedItemInfo.F_FeedbackTime = DateTime.Now;
  5656. // if (modelT_Bus_AssignedItemInfo.F_LimitTime < DateTime.Now)
  5657. // {
  5658. // modelT_Bus_AssignedItemInfo.F_IsOverdue = 1;
  5659. // }
  5660. // new BLL.T_Bus_AssignedItemInfo().Update(modelT_Bus_AssignedItemInfo);
  5661. // #endregion
  5662. // #region 删除草稿信息
  5663. // 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 + "'");
  5664. // foreach (var cg in cglist)
  5665. // {
  5666. // cg.F_IsDelete = 1;
  5667. // cg.F_DeleteUser = userModel.F_UserCode;
  5668. // cg.F_DeleteTime = DateTime.Now;
  5669. // new BLL.T_Bus_Feedback().Update(cg);
  5670. // }
  5671. // #endregion
  5672. // typemsg = "协办";
  5673. // }
  5674. // #region 插入操作记录
  5675. // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5676. // oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5677. // oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5678. // oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5679. // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5680. // oper.F_Message = userinfo + " " + typemsg + "了工单";
  5681. // oper.F_CreateUser = userModel.F_UserCode;
  5682. // oper.F_CreateTime = DateTime.Now;
  5683. // oper.F_IsDelete = 0;
  5684. // operBLL.Add(oper);
  5685. // //推送消息表
  5686. // msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  5687. // #endregion
  5688. // }
  5689. // trans.Complete();
  5690. // }
  5691. // return Success("操作成功", model_T_Bus_Feedback.F_Id);
  5692. // }
  5693. // else
  5694. // {
  5695. // return Error("已经办理过了");
  5696. // }
  5697. // }
  5698. // else
  5699. // {
  5700. // return Error("权限不足");
  5701. // }
  5702. // }
  5703. // else
  5704. // {
  5705. // return Error("操作失败");
  5706. // }
  5707. // }
  5708. // else
  5709. // {
  5710. // return Error("权限不足");
  5711. // }
  5712. //}
  5713. /// <summary>
  5714. /// 派工单
  5715. /// </summary>
  5716. /// <returns></returns>
  5717. [Authority]
  5718. public ActionResult SplitWorkOrder()
  5719. {
  5720. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5721. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5722. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5723. {
  5724. string workorderid = RequestString.GetFormString("workorderid");
  5725. int maindeptid = RequestString.GetInt("maindeptid", 0);
  5726. string otherdeptids = RequestString.GetFormString("otherdeptids");
  5727. DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime") + " 23:59:59");
  5728. string assignedopinion = RequestString.GetFormString("assignedopinion");
  5729. string files = RequestString.GetFormString("files");
  5730. int state = RequestString.GetInt("state", 0);
  5731. int nextid = RequestString.GetInt("nextid", 0);
  5732. if (limittime < DateTime.Now)
  5733. {
  5734. return Error("办理时限不能小于当前时间");
  5735. }
  5736. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5737. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5738. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new Model.T_Bus_AssignedInfo_Next();
  5739. var deptinfo = new BLL.T_Sys_Department().GetModel(maindeptid);
  5740. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && deptinfo != null)
  5741. {
  5742. int type = AssignDeptType(modelT_Bus_AssignedInfo, userModel.F_DeptId);
  5743. if ((type == 1 && modelT_Bus_WorkOrder.F_WorkState == 4) || userModel.F_RoleCode == "GLY")
  5744. {
  5745. if (modelT_Bus_AssignedInfo.F_IsNext == null || modelT_Bus_AssignedInfo.F_IsNext.Value == 0)
  5746. {
  5747. using (TransactionScope trans = new TransactionScope())
  5748. {
  5749. if (nextid == 0)
  5750. {
  5751. #region 插入派单记录
  5752. modelT_Bus_AssignedInfo_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5753. modelT_Bus_AssignedInfo_Next.F_LimitTime = limittime;//办理时限
  5754. modelT_Bus_AssignedInfo_Next.F_MainDeptId = maindeptid;//主办单位id
  5755. modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = otherdeptids;//协办单位id
  5756. modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = assignedopinion;//交办意见
  5757. modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
  5758. modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
  5759. modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
  5760. modelT_Bus_AssignedInfo_Next.F_IsDelete = 0;
  5761. modelT_Bus_AssignedInfo_Next.F_IsOverdue = 0;
  5762. modelT_Bus_AssignedInfo_Next.F_IsSure = 0;
  5763. modelT_Bus_AssignedInfo_Next.F_IsReload = 0;
  5764. modelT_Bus_AssignedInfo_Next.F_Id = new BLL.T_Bus_AssignedInfo_Next().Add(modelT_Bus_AssignedInfo_Next);
  5765. #endregion
  5766. }
  5767. else
  5768. {
  5769. #region 修改派单记录
  5770. modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetModel(nextid);
  5771. if (modelT_Bus_AssignedInfo_Next != null)
  5772. {
  5773. modelT_Bus_AssignedInfo_Next.F_LimitTime = limittime;//办理时限
  5774. modelT_Bus_AssignedInfo_Next.F_MainDeptId = maindeptid;//主办单位id
  5775. modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = otherdeptids;//协办单位id
  5776. modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = assignedopinion;//交办意见
  5777. modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
  5778. modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
  5779. modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
  5780. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5781. }
  5782. #endregion
  5783. }
  5784. if (modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_State == 1)
  5785. {
  5786. #region 保存交办信息
  5787. modelT_Bus_AssignedInfo.F_IsNext = 1;
  5788. modelT_Bus_AssignedInfo.F_NextUser = userModel.F_UserCode;
  5789. modelT_Bus_AssignedInfo.F_NextTime = DateTime.Now;
  5790. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5791. #endregion
  5792. #region 插入操作记录
  5793. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5794. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5795. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  5796. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5797. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5798. oper.F_Message = userinfo + " 派单给单位:" + deptinfo.F_DeptName;
  5799. oper.F_CreateUser = userModel.F_UserCode;
  5800. oper.F_CreateTime = DateTime.Now;
  5801. oper.F_IsDelete = 0;
  5802. operBLL.Add(oper);
  5803. //推送消息表
  5804. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  5805. #endregion
  5806. }
  5807. trans.Complete();
  5808. }
  5809. return Success("操作成功", modelT_Bus_AssignedInfo_Next.F_Id);
  5810. }
  5811. else
  5812. {
  5813. return Error("已经派过单了");
  5814. }
  5815. }
  5816. else
  5817. {
  5818. return Error("操作失败");
  5819. }
  5820. }
  5821. else
  5822. {
  5823. return Error("操作失败");
  5824. }
  5825. }
  5826. else
  5827. {
  5828. return Error("权限不足");
  5829. }
  5830. }
  5831. /// <summary>
  5832. /// 撤回工单
  5833. /// </summary>
  5834. /// <returns></returns>
  5835. [Authority]
  5836. public ActionResult WithdrawWorkOrder()
  5837. {
  5838. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5839. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5840. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  5841. {
  5842. string workorderid = RequestString.GetFormString("workorderid");
  5843. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5844. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5845. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5846. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo.F_MainDeptId == userModel.F_DeptId)
  5847. {
  5848. using (TransactionScope trans = new TransactionScope())
  5849. {
  5850. #region 保存撤单信息
  5851. modelT_Bus_AssignedInfo_Next.F_IsDelete = 1;
  5852. modelT_Bus_AssignedInfo_Next.F_DeleteUser = userModel.F_UserCode;
  5853. modelT_Bus_AssignedInfo_Next.F_DeleteTime = DateTime.Now;
  5854. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5855. #endregion
  5856. #region 删除处理信息
  5857. var cglist = new BLL.T_Bus_Feedback_Next().GetModelList(" F_IsDelete=0 and F_AssignedId='" + modelT_Bus_AssignedInfo_Next.F_Id + "'");
  5858. foreach (var cg in cglist)
  5859. {
  5860. cg.F_IsDelete = 1;
  5861. cg.F_DeleteUser = userModel.F_UserCode;
  5862. cg.F_DeleteTime = DateTime.Now;
  5863. new BLL.T_Bus_Feedback_Next().Update(cg);
  5864. }
  5865. #endregion
  5866. #region 保存交办信息
  5867. modelT_Bus_AssignedInfo.F_IsNext = 0;
  5868. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5869. #endregion
  5870. #region 插入操作记录
  5871. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5872. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5873. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5874. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5875. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5876. oper.F_Message = userinfo + " 撤回了工单";
  5877. oper.F_CreateUser = userModel.F_UserCode;
  5878. oper.F_CreateTime = DateTime.Now;
  5879. oper.F_IsDelete = 0;
  5880. operBLL.Add(oper);
  5881. #endregion
  5882. trans.Complete();
  5883. }
  5884. return Success("操作成功");
  5885. }
  5886. else
  5887. {
  5888. return Error("操作失败");
  5889. }
  5890. }
  5891. else
  5892. {
  5893. return Error("权限不足");
  5894. }
  5895. }
  5896. /// <summary>
  5897. /// 签收工单
  5898. /// </summary>
  5899. /// <returns></returns>
  5900. [Authority]
  5901. public ActionResult SignWorkOrder()
  5902. {
  5903. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5904. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5905. if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
  5906. {
  5907. string workorderid = RequestString.GetFormString("workorderid");
  5908. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5909. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5910. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5911. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId)
  5912. {
  5913. if (modelT_Bus_AssignedInfo_Next.F_IsSure == 0)
  5914. {
  5915. using (TransactionScope trans = new TransactionScope())
  5916. {
  5917. #region 保存签收信息
  5918. modelT_Bus_AssignedInfo_Next.F_IsSure = 1;//签收
  5919. modelT_Bus_AssignedInfo_Next.F_SureUser = userModel.F_UserCode;
  5920. modelT_Bus_AssignedInfo_Next.F_SureTime = DateTime.Now;
  5921. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5922. #endregion
  5923. #region 保存交办信息
  5924. modelT_Bus_AssignedInfo.F_IsNext = 2;
  5925. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5926. #endregion
  5927. #region 插入操作记录
  5928. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5929. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5930. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5931. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5932. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5933. oper.F_Message = userinfo + " 签收了工单";
  5934. oper.F_CreateUser = userModel.F_UserCode;
  5935. oper.F_CreateTime = DateTime.Now;
  5936. oper.F_IsDelete = 0;
  5937. operBLL.Add(oper);
  5938. #endregion
  5939. trans.Complete();
  5940. }
  5941. return Success("操作成功");
  5942. }
  5943. else
  5944. {
  5945. return Error("单位已签收,不能再次签收");
  5946. }
  5947. }
  5948. else
  5949. {
  5950. return Error("操作失败");
  5951. }
  5952. }
  5953. else
  5954. {
  5955. return Error("权限不足");
  5956. }
  5957. }
  5958. /// <summary>
  5959. /// 拒收工单
  5960. /// </summary>
  5961. /// <returns></returns>
  5962. [Authority]
  5963. public ActionResult RefuseWorkOrder()
  5964. {
  5965. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  5966. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  5967. if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
  5968. {
  5969. string workorderid = RequestString.GetFormString("workorderid");
  5970. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  5971. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  5972. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  5973. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo_Next != null && modelT_Bus_AssignedInfo_Next.F_MainDeptId == userModel.F_DeptId)
  5974. {
  5975. if (modelT_Bus_AssignedInfo_Next.F_IsSure == 0)
  5976. {
  5977. using (TransactionScope trans = new TransactionScope())
  5978. {
  5979. #region 保存签收信息
  5980. modelT_Bus_AssignedInfo_Next.F_IsSure = 3;//签收
  5981. modelT_Bus_AssignedInfo_Next.F_SureUser = userModel.F_UserCode;
  5982. modelT_Bus_AssignedInfo_Next.F_SureTime = DateTime.Now;
  5983. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  5984. #endregion
  5985. #region 保存交办信息
  5986. modelT_Bus_AssignedInfo.F_IsNext = 0;
  5987. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  5988. #endregion
  5989. #region 插入操作记录
  5990. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  5991. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  5992. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  5993. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  5994. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  5995. oper.F_Message = userinfo + " 拒收了工单";
  5996. oper.F_CreateUser = userModel.F_UserCode;
  5997. oper.F_CreateTime = DateTime.Now;
  5998. oper.F_IsDelete = 0;
  5999. operBLL.Add(oper);
  6000. #endregion
  6001. trans.Complete();
  6002. }
  6003. return Success("操作成功");
  6004. }
  6005. else
  6006. {
  6007. return Error("单位已签收,不能再次签收");
  6008. }
  6009. }
  6010. else
  6011. {
  6012. return Error("操作失败");
  6013. }
  6014. }
  6015. else
  6016. {
  6017. return Error("权限不足");
  6018. }
  6019. }
  6020. /// <summary>
  6021. /// 处理工单
  6022. /// </summary>
  6023. /// <returns></returns>
  6024. [Authority]
  6025. public ActionResult DealWorkOrder()
  6026. {
  6027. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6028. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6029. if (userModel.F_RoleCode == "EJWLDW" || userModel.F_RoleCode == "GLY")
  6030. {
  6031. string workorderid = RequestString.GetFormString("workorderid");
  6032. string dealman = RequestString.GetFormString("dealman");
  6033. string result = RequestString.GetFormString("result");
  6034. string files = RequestString.GetFormString("files");
  6035. int state = RequestString.GetInt("state", 0);
  6036. int dealid = RequestString.GetInt("dealid", 0);
  6037. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6038. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6039. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new BLL.T_Bus_AssignedInfo_Next().GetNewModelByWorkOrderID(workorderid);
  6040. Model.T_Bus_Feedback_Next modelT_Bus_Feedback_Next = new Model.T_Bus_Feedback_Next();
  6041. 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)
  6042. {
  6043. if (modelT_Bus_WorkOrder.F_WorkState == 4 || modelT_Bus_WorkOrder.F_WorkState == 5)
  6044. {
  6045. if (modelT_Bus_AssignedInfo.F_IsNext == 2)
  6046. {
  6047. using (TransactionScope trans = new TransactionScope())
  6048. {
  6049. if (dealid == 0)
  6050. {
  6051. #region 插入反馈记录
  6052. modelT_Bus_Feedback_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  6053. modelT_Bus_Feedback_Next.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;//交办id
  6054. modelT_Bus_Feedback_Next.F_DealUser = dealman;
  6055. modelT_Bus_Feedback_Next.F_Result = result;//反馈内容
  6056. modelT_Bus_Feedback_Next.F_File = files;
  6057. modelT_Bus_Feedback_Next.F_IsAudit = 0;
  6058. modelT_Bus_Feedback_Next.F_IsDelete = 0;
  6059. modelT_Bus_Feedback_Next.F_CreateUser = userModel.F_UserCode;//办理人
  6060. modelT_Bus_Feedback_Next.F_CreateTime = DateTime.Now;//办理时间
  6061. modelT_Bus_Feedback_Next.F_CreateDeptId = userModel.F_DeptId;//办理部门
  6062. modelT_Bus_Feedback_Next.F_IsFeedEnd = 1;
  6063. modelT_Bus_Feedback_Next.F_State = state;
  6064. modelT_Bus_Feedback_Next.F_Type = 1;
  6065. new BLL.T_Bus_Feedback_Next().Add(modelT_Bus_Feedback_Next);
  6066. #endregion
  6067. }
  6068. else
  6069. {
  6070. #region 修改反馈记录
  6071. modelT_Bus_Feedback_Next = new BLL.T_Bus_Feedback_Next().GetModel(dealid);
  6072. if (modelT_Bus_Feedback_Next != null)
  6073. {
  6074. modelT_Bus_Feedback_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  6075. modelT_Bus_Feedback_Next.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;//交办id
  6076. modelT_Bus_Feedback_Next.F_DealUser = dealman;
  6077. modelT_Bus_Feedback_Next.F_Result = result;//反馈内容
  6078. modelT_Bus_Feedback_Next.F_File = files;
  6079. modelT_Bus_Feedback_Next.F_CreateUser = userModel.F_UserCode;//办理人
  6080. modelT_Bus_Feedback_Next.F_CreateTime = DateTime.Now;//办理时间
  6081. modelT_Bus_Feedback_Next.F_CreateDeptId = userModel.F_DeptId;//办理部门
  6082. modelT_Bus_Feedback_Next.F_IsFeedEnd = 1;
  6083. modelT_Bus_Feedback_Next.F_State = state;
  6084. new BLL.T_Bus_Feedback_Next().Update(modelT_Bus_Feedback_Next);
  6085. }
  6086. #endregion
  6087. }
  6088. if (modelT_Bus_Feedback_Next != null && modelT_Bus_Feedback_Next.F_State == 1)
  6089. {
  6090. #region 保存交办信息
  6091. modelT_Bus_AssignedInfo.F_IsNext = 3;
  6092. new BLL.T_Bus_AssignedInfo().Update(modelT_Bus_AssignedInfo);
  6093. #endregion
  6094. #region 保存派单信息
  6095. modelT_Bus_AssignedInfo_Next.F_FeedbackTime = DateTime.Now;
  6096. if (modelT_Bus_AssignedInfo_Next.F_LimitTime < DateTime.Now)
  6097. {
  6098. modelT_Bus_AssignedInfo_Next.F_IsOverdue = 1;
  6099. }
  6100. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next);
  6101. #endregion
  6102. #region 删除草稿信息
  6103. 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 + "'");
  6104. foreach (var cg in cglist)
  6105. {
  6106. cg.F_IsDelete = 1;
  6107. cg.F_DeleteUser = userModel.F_UserCode;
  6108. cg.F_DeleteTime = DateTime.Now;
  6109. new BLL.T_Bus_Feedback_Next().Update(cg);
  6110. }
  6111. #endregion
  6112. #region 插入操作记录
  6113. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6114. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6115. oper.F_AssignedId = modelT_Bus_AssignedInfo_Next.F_Id;
  6116. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6117. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6118. oper.F_Message = userinfo + " 办理了工单";
  6119. oper.F_CreateUser = userModel.F_UserCode;
  6120. oper.F_CreateTime = DateTime.Now;
  6121. oper.F_IsDelete = 0;
  6122. operBLL.Add(oper);
  6123. //推送消息表
  6124. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  6125. #endregion
  6126. }
  6127. trans.Complete();
  6128. }
  6129. return Success("操作成功", modelT_Bus_AssignedInfo_Next.F_Id);
  6130. }
  6131. else
  6132. {
  6133. return Error("已经办理过了");
  6134. }
  6135. }
  6136. else
  6137. {
  6138. return Error("已经办理过了");
  6139. }
  6140. }
  6141. else
  6142. {
  6143. return Error("操作失败");
  6144. }
  6145. }
  6146. else
  6147. {
  6148. return Error("权限不足");
  6149. }
  6150. }
  6151. /// <summary>
  6152. /// 审核派单
  6153. /// </summary>
  6154. /// <returns></returns>
  6155. [Authority]
  6156. public ActionResult AuditSplitWorkOrder()
  6157. {
  6158. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6159. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6160. if (userModel.F_RoleCode == "WLDW" || userModel.F_RoleCode == "GLY")
  6161. {
  6162. string workorderid = RequestString.GetFormString("workorderid");
  6163. int state = RequestString.GetInt("state", 0);
  6164. string reason = RequestString.GetFormString("reason");
  6165. int backid = RequestString.GetInt("backid", 0);
  6166. string files = RequestString.GetFormString("files");
  6167. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6168. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6169. Model.T_Bus_Feedback_Next modelT_Bus_Feedback_Next = new BLL.T_Bus_Feedback_Next().GetModel(backid);
  6170. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null && modelT_Bus_Feedback_Next != null)
  6171. {
  6172. if (modelT_Bus_Feedback_Next.F_IsAudit.Value == 0)
  6173. {
  6174. using (TransactionScope trans = new TransactionScope())
  6175. {
  6176. modelT_Bus_Feedback_Next.F_IsAudit = state;
  6177. modelT_Bus_Feedback_Next.F_AuditUser = userModel.F_UserCode;
  6178. modelT_Bus_Feedback_Next.F_AuditTime = DateTime.Now;
  6179. modelT_Bus_Feedback_Next.F_AuditReason = reason;
  6180. new BLL.T_Bus_Feedback_Next().Update(modelT_Bus_Feedback_Next);
  6181. string strmsg = "";
  6182. if (state == 1)
  6183. {
  6184. strmsg = "同意";
  6185. #region 插入反馈记录
  6186. Model.T_Bus_Feedback modelT_Bus_Feedback = new Model.T_Bus_Feedback();
  6187. modelT_Bus_Feedback.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单编号
  6188. modelT_Bus_Feedback.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;//交办id
  6189. modelT_Bus_Feedback.F_DealUser = modelT_Bus_Feedback_Next.F_DealUser;
  6190. modelT_Bus_Feedback.F_Result = modelT_Bus_Feedback_Next.F_Result;//反馈内容
  6191. modelT_Bus_Feedback.F_File = modelT_Bus_Feedback_Next.F_File;
  6192. modelT_Bus_Feedback.F_IsAudit = 0;
  6193. modelT_Bus_Feedback.F_IsDelete = 0;
  6194. modelT_Bus_Feedback.F_CreateUser = userModel.F_UserCode;//办理人
  6195. modelT_Bus_Feedback.F_CreateTime = DateTime.Now;//办理时间
  6196. modelT_Bus_Feedback.F_CreateDeptId = userModel.F_DeptId;//办理部门
  6197. modelT_Bus_Feedback.F_IsFeedEnd = 1;
  6198. modelT_Bus_Feedback.F_State = state;
  6199. modelT_Bus_Feedback.F_Type = 1;
  6200. new BLL.T_Bus_Feedback().Add(modelT_Bus_Feedback);
  6201. #endregion
  6202. if (modelT_Bus_AssignedInfo.F_LimitTime < DateTime.Now)
  6203. {
  6204. modelT_Bus_AssignedInfo.F_IsOverdue = 1;
  6205. modelT_Bus_WorkOrder.F_IsOverdue = 1;
  6206. }
  6207. #region 保存工单信息
  6208. modelT_Bus_WorkOrder.F_WorkState = 6;//待回访
  6209. modelT_Bus_WorkOrder.F_Result = modelT_Bus_Feedback_Next.F_Result;
  6210. modelT_Bus_WorkOrder.F_DealDeptId = modelT_Bus_Feedback_Next.F_CreateDeptId;
  6211. modelT_Bus_WorkOrder.F_DealUser = modelT_Bus_Feedback_Next.F_CreateUser;
  6212. modelT_Bus_WorkOrder.F_DealTime = DateTime.Now;
  6213. workorderBLL.Update(modelT_Bus_WorkOrder);
  6214. #endregion
  6215. #region 保存交办信息
  6216. modelT_Bus_AssignedInfo.F_FeedbackTime = DateTime.Now;
  6217. assignBLL.Update(modelT_Bus_AssignedInfo);
  6218. #endregion
  6219. #region 删除草稿信息
  6220. 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 + "'");
  6221. foreach (var cg in cglist)
  6222. {
  6223. cg.F_IsDelete = 1;
  6224. cg.F_DeleteUser = userModel.F_UserCode;
  6225. cg.F_DeleteTime = DateTime.Now;
  6226. new BLL.T_Bus_Feedback().Update(cg);
  6227. }
  6228. #endregion
  6229. #region 处理协办单位
  6230. 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 + "'");
  6231. foreach (var xb in xblist)
  6232. {
  6233. xb.F_State = 2;
  6234. xb.F_SureUser = userModel.F_UserCode;
  6235. xb.F_SureTime = DateTime.Now;
  6236. new BLL.T_Bus_AssignedItemInfo().Update(xb);
  6237. }
  6238. #endregion
  6239. }
  6240. else if (state == 2)
  6241. {
  6242. strmsg = "拒绝";
  6243. Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next1 = new BLL.T_Bus_AssignedInfo_Next().GetModel(modelT_Bus_Feedback_Next.F_AssignedId.Value);
  6244. modelT_Bus_AssignedInfo_Next1.F_FeedbackTime = null;
  6245. new BLL.T_Bus_AssignedInfo_Next().Update(modelT_Bus_AssignedInfo_Next1);
  6246. modelT_Bus_AssignedInfo.F_IsNext = 2;
  6247. assignBLL.Update(modelT_Bus_AssignedInfo);
  6248. //#region 插入派单记录
  6249. //Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next1 = new BLL.T_Bus_AssignedInfo_Next().GetModel(modelT_Bus_Feedback_Next.F_AssignedId.Value);
  6250. //Model.T_Bus_AssignedInfo_Next modelT_Bus_AssignedInfo_Next = new Model.T_Bus_AssignedInfo_Next();
  6251. //modelT_Bus_AssignedInfo_Next.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6252. //modelT_Bus_AssignedInfo_Next.F_LimitTime = modelT_Bus_AssignedInfo_Next1.F_LimitTime;//办理时限
  6253. //modelT_Bus_AssignedInfo_Next.F_MainDeptId = modelT_Bus_AssignedInfo_Next1.F_MainDeptId;//主办单位id
  6254. //modelT_Bus_AssignedInfo_Next.F_OtherDeptIds = modelT_Bus_AssignedInfo_Next1.F_OtherDeptIds;//协办单位id
  6255. //modelT_Bus_AssignedInfo_Next.F_AssignedOpinion = reason;//交办意见
  6256. //modelT_Bus_AssignedInfo_Next.F_State = state;//0草稿 1正式
  6257. //modelT_Bus_AssignedInfo_Next.F_CreateUser = userModel.F_UserCode;
  6258. //modelT_Bus_AssignedInfo_Next.F_CreateTime = DateTime.Now;
  6259. //modelT_Bus_AssignedInfo_Next.F_IsDelete = 0;
  6260. //modelT_Bus_AssignedInfo_Next.F_IsOverdue = 0;
  6261. //modelT_Bus_AssignedInfo_Next.F_IsSure = 0;
  6262. //modelT_Bus_AssignedInfo_Next.F_IsReload = 0;
  6263. //modelT_Bus_AssignedInfo_Next.F_Id = new BLL.T_Bus_AssignedInfo_Next().Add(modelT_Bus_AssignedInfo_Next);
  6264. //#endregion
  6265. }
  6266. #region 插入操作记录
  6267. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6268. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6269. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6270. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6271. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6272. oper.F_Message = userinfo + " " + strmsg + "了此处理";
  6273. oper.F_CreateUser = userModel.F_UserCode;
  6274. oper.F_CreateTime = DateTime.Now;
  6275. oper.F_IsDelete = 0;
  6276. operBLL.Add(oper);
  6277. //推送消息表
  6278. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_WorkOrder.F_CreateUser, userModel.F_UserCode);
  6279. #endregion
  6280. trans.Complete();
  6281. }
  6282. return Success("操作成功");
  6283. }
  6284. else
  6285. {
  6286. return Error("已经审核过了");
  6287. }
  6288. }
  6289. else
  6290. {
  6291. return Error("操作失败");
  6292. }
  6293. }
  6294. else
  6295. {
  6296. return Error("权限不足");
  6297. }
  6298. }
  6299. /// <summary>
  6300. /// 回访工单
  6301. /// </summary>
  6302. /// <returns></returns>
  6303. [Authority]
  6304. public ActionResult VisitWorkOrder()
  6305. {
  6306. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6307. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6308. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY" || userModel.F_RoleCode == "HFZY" )
  6309. {
  6310. string workorderid = RequestString.GetFormString("workorderid");
  6311. string visituser = RequestString.GetFormString("visituser");//回访人
  6312. int type = RequestString.GetInt("type", 0);//回访方式
  6313. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  6314. //DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime"));//不满意,重办的办理时限
  6315. int state = RequestString.GetInt("state", 0);//0保存 1保存并下一步
  6316. int visitid = RequestString.GetInt("visitid", 0);
  6317. string result = RequestString.GetFormString("result");//回访情况
  6318. //int nexttype = RequestString.GetInt("nexttype", 0);//1重办 2结案
  6319. //string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
  6320. //string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
  6321. string callid = RequestString.GetFormString("callid");
  6322. string guid= RequestString.GetFormString("guid");
  6323. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6324. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6325. Model.T_Bus_VisitResult modelT_Bus_VisitResult = new Model.T_Bus_VisitResult();
  6326. if (modelT_Bus_WorkOrder != null)
  6327. {
  6328. if (modelT_Bus_WorkOrder.F_WorkState == 6)
  6329. {
  6330. using (TransactionScope trans = new TransactionScope())
  6331. {
  6332. if (visitid == 0)
  6333. {
  6334. #region 新增回访结果记录
  6335. modelT_Bus_VisitResult.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6336. modelT_Bus_VisitResult.F_AssignedId = 0;
  6337. modelT_Bus_VisitResult.F_VisitUser = visituser;
  6338. modelT_Bus_VisitResult.F_Type = type;
  6339. modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
  6340. modelT_Bus_VisitResult.F_Result = result;
  6341. modelT_Bus_VisitResult.F_State = state;
  6342. if (!string.IsNullOrEmpty(callid))
  6343. {
  6344. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  6345. if (rd != null)
  6346. {
  6347. modelT_Bus_VisitResult.F_CallRecordId = rd.CallRecordsId;
  6348. }
  6349. }
  6350. //modelT_Bus_VisitResult.F_LimitTime = newlimittime;
  6351. modelT_Bus_VisitResult.F_IsDelete = 0;
  6352. modelT_Bus_VisitResult.F_CreateUser = userModel.F_UserCode;
  6353. modelT_Bus_VisitResult.F_CreateTime = DateTime.Now;
  6354. if (modelT_Bus_AssignedInfo != null)
  6355. {
  6356. modelT_Bus_VisitResult.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6357. }
  6358. int id = new BLL.T_Bus_VisitResult().Add(modelT_Bus_VisitResult);
  6359. modelT_Bus_VisitResult.F_Id = id;
  6360. //保存回访记录
  6361. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  6362. #endregion
  6363. }
  6364. else
  6365. {
  6366. #region 修改回访结果记录
  6367. modelT_Bus_VisitResult = new BLL.T_Bus_VisitResult().GetModel(visitid);
  6368. if (modelT_Bus_VisitResult != null)
  6369. {
  6370. modelT_Bus_VisitResult.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6371. modelT_Bus_VisitResult.F_AssignedId = 0;
  6372. modelT_Bus_VisitResult.F_VisitUser = visituser;
  6373. modelT_Bus_VisitResult.F_Type = type;
  6374. modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
  6375. modelT_Bus_VisitResult.F_Result = result;
  6376. modelT_Bus_VisitResult.F_State = state;
  6377. if (!string.IsNullOrEmpty(callid))
  6378. {
  6379. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  6380. if (rd != null)
  6381. {
  6382. modelT_Bus_VisitResult.F_CallRecordId = rd.CallRecordsId;
  6383. }
  6384. }
  6385. //modelT_Bus_VisitResult.F_LimitTime = newlimittime;
  6386. modelT_Bus_VisitResult.F_IsDelete = 0;
  6387. modelT_Bus_VisitResult.F_CreateUser = userModel.F_UserCode;
  6388. modelT_Bus_VisitResult.F_CreateTime = DateTime.Now;
  6389. if (modelT_Bus_AssignedInfo != null)
  6390. {
  6391. modelT_Bus_VisitResult.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6392. }
  6393. int id=new BLL.T_Bus_VisitResult().Add(modelT_Bus_VisitResult);
  6394. modelT_Bus_VisitResult.F_Id = id;
  6395. //保存回访记录
  6396. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  6397. }
  6398. #endregion
  6399. }
  6400. if (modelT_Bus_VisitResult != null && modelT_Bus_VisitResult.F_State == 1)
  6401. {
  6402. #region 保存交办信息
  6403. modelT_Bus_AssignedInfo.F_IsSatisfie = issatisfie;
  6404. assignBLL.Update(modelT_Bus_AssignedInfo);
  6405. #endregion
  6406. #region 保存工单信息
  6407. modelT_Bus_WorkOrder.F_WorkState = 7;//已回访
  6408. workorderBLL.Update(modelT_Bus_WorkOrder);
  6409. #endregion
  6410. #region 删除草稿信息
  6411. var cglist = new BLL.T_Bus_VisitResult().GetModelList(" F_IsDelete=0 and F_State=0 and F_WorkOrderId='" + modelT_Bus_WorkOrder.F_WorkOrderId + "'");
  6412. foreach (var cg in cglist)
  6413. {
  6414. cg.F_IsDelete = 1;
  6415. cg.F_DeleteUser = userModel.F_UserCode;
  6416. cg.F_DeleteTime = DateTime.Now;
  6417. new BLL.T_Bus_VisitResult().Update(cg);
  6418. //保存回访记录
  6419. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  6420. }
  6421. #endregion
  6422. #region 插入操作记录
  6423. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6424. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6425. oper.F_AssignedId = modelT_Bus_VisitResult.F_AssignedId;
  6426. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6427. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6428. oper.F_Message = userinfo + " 回访了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
  6429. oper.F_CreateUser = userModel.F_UserCode;
  6430. oper.F_CreateTime = DateTime.Now;
  6431. oper.F_IsDelete = 0;
  6432. operBLL.Add(oper);
  6433. //推送消息表
  6434. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, modelT_Bus_AssignedInfo.F_CreateUser, userModel.F_UserCode);
  6435. #endregion
  6436. #region 自动语音回访
  6437. if (issatisfie == 1)//如果满意就进行自动语音回访
  6438. {
  6439. var configacb = configBll.GetModelList(" F_ParamCode='AutoCallBack' ").FirstOrDefault();
  6440. if (configacb != null && configacb.F_ParamValue == "1")//如果为1就是开启了自动语音回访,其他都是关闭
  6441. {
  6442. string AutoCallMsg = string.Empty;
  6443. new BLL.T_CTI_Task().AddToAutoVoiceNotice(modelT_Bus_WorkOrder.F_CusPhone, modelT_Bus_WorkOrder.F_WorkOrderId, modelT_Bus_AssignedInfo.F_Id, out AutoCallMsg);
  6444. }
  6445. }
  6446. #endregion
  6447. }
  6448. trans.Complete();
  6449. }
  6450. return Success("操作成功", modelT_Bus_VisitResult.F_Id);
  6451. }
  6452. else
  6453. {
  6454. return Error("已经回访过了");
  6455. }
  6456. }
  6457. else
  6458. {
  6459. return Error("操作失败");
  6460. }
  6461. }
  6462. else
  6463. {
  6464. return Error("权限不足");
  6465. }
  6466. }
  6467. /// <summary>
  6468. /// 督办或监察工单
  6469. /// </summary>
  6470. /// <returns></returns>
  6471. [Authority]
  6472. public ActionResult RemindWorkOrder()
  6473. {
  6474. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6475. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6476. string workorderid = RequestString.GetFormString("workorderid");
  6477. int type = RequestString.GetInt("type", 0);//1督办 2监察
  6478. string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
  6479. string files = RequestString.GetFormString("files");
  6480. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6481. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6482. if (modelT_Bus_WorkOrder != null && modelT_Bus_AssignedInfo != null)
  6483. {
  6484. using (TransactionScope trans = new TransactionScope())
  6485. {
  6486. #region 插入督办记录
  6487. Model.T_Bus_RemindRecord modelT_Bus_RemindRecord = new Model.T_Bus_RemindRecord();
  6488. modelT_Bus_RemindRecord.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6489. modelT_Bus_RemindRecord.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6490. modelT_Bus_RemindRecord.F_Type = type;
  6491. modelT_Bus_RemindRecord.F_DeptId = modelT_Bus_AssignedInfo.F_MainDeptId;
  6492. modelT_Bus_RemindRecord.F_Content = overseeopinion;
  6493. modelT_Bus_RemindRecord.F_File = files;
  6494. modelT_Bus_RemindRecord.F_State = 1;
  6495. modelT_Bus_RemindRecord.F_IsDelete = 0;
  6496. modelT_Bus_RemindRecord.F_CreateUser = userModel.F_UserCode;
  6497. modelT_Bus_RemindRecord.F_CreateTime = DateTime.Now;
  6498. new BLL.T_Bus_RemindRecord().Add(modelT_Bus_RemindRecord);
  6499. #endregion
  6500. #region 插入操作记录
  6501. string typename = "督办";
  6502. if (type == 2) { typename = "监察"; }
  6503. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6504. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6505. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6506. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6507. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6508. oper.F_Message = userinfo + " " + typename + "了工单";
  6509. oper.F_CreateUser = userModel.F_UserCode;
  6510. oper.F_CreateTime = DateTime.Now;
  6511. oper.F_IsDelete = 0;
  6512. operBLL.Add(oper);
  6513. #endregion
  6514. trans.Complete();
  6515. }
  6516. return Success("操作成功");
  6517. }
  6518. else
  6519. {
  6520. return Error("操作失败");
  6521. }
  6522. }
  6523. /// <summary>
  6524. /// 重办工单
  6525. /// </summary>
  6526. /// <returns></returns>
  6527. [Authority]
  6528. public ActionResult ReloadWorkOrder()
  6529. {
  6530. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6531. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6532. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6533. {
  6534. string workorderid = RequestString.GetFormString("workorderid");
  6535. string overseeopinion = RequestString.GetFormString("overseeopinion");//督办意见
  6536. DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime") + " 23:59:59");//不满意,重办的办理时限
  6537. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6538. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6539. if (modelT_Bus_WorkOrder != null)
  6540. {
  6541. if (modelT_Bus_WorkOrder.F_WorkState == 7)
  6542. {
  6543. using (TransactionScope trans = new TransactionScope())
  6544. {
  6545. #region 插入督办记录
  6546. Model.T_Bus_RemindRecord modelT_Bus_RemindRecord = new Model.T_Bus_RemindRecord();
  6547. modelT_Bus_RemindRecord.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6548. modelT_Bus_RemindRecord.F_AssignedId = 0;
  6549. modelT_Bus_RemindRecord.F_Type = 1;
  6550. if (modelT_Bus_AssignedInfo != null)//转办后重办
  6551. {
  6552. #region 插入交办记录
  6553. 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());
  6554. modelT_Bus_WorkOrder.F_IsReload= n + 1;
  6555. modelT_Bus_WorkOrder.F_LimitTime = newlimittime;
  6556. modelT_Bus_WorkOrder.F_IsOverdue = 0;
  6557. Model.T_Bus_AssignedInfo AssignedInfo = new Model.T_Bus_AssignedInfo();
  6558. AssignedInfo.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6559. AssignedInfo.F_LimitTime = newlimittime;//办理时限
  6560. AssignedInfo.F_MainDeptId = modelT_Bus_AssignedInfo.F_MainDeptId;//主办单位id
  6561. AssignedInfo.F_OtherDeptIds = modelT_Bus_AssignedInfo.F_OtherDeptIds;//协办单位id
  6562. AssignedInfo.F_AssignedOpinion = modelT_Bus_AssignedInfo.F_AssignedOpinion;//交办意见
  6563. AssignedInfo.F_State = 1;//0草稿 1正式
  6564. AssignedInfo.F_CreateUser = modelT_Bus_AssignedInfo.F_CreateUser;
  6565. AssignedInfo.F_CreateTime =DateTime .Now ;
  6566. AssignedInfo.F_IsDelete = 0;
  6567. AssignedInfo.F_IsOverdue = 0;
  6568. AssignedInfo.F_IsSure = 0;
  6569. AssignedInfo.F_IsReload = n + 1;
  6570. AssignedInfo.F_ReloadUser = userModel.F_UserCode;
  6571. AssignedInfo.F_ReloadTime = DateTime.Now;
  6572. assignBLL.Add(AssignedInfo);
  6573. #endregion
  6574. modelT_Bus_RemindRecord.F_AssignedId = AssignedInfo.F_Id;
  6575. modelT_Bus_RemindRecord.F_DeptId = AssignedInfo.F_MainDeptId;
  6576. }
  6577. else if (modelT_Bus_WorkOrder.F_IsResult == 1)//直办后重办
  6578. {
  6579. var cruser = userBLL.GetModel(modelT_Bus_WorkOrder.F_CreateUser);
  6580. if (cruser != null)
  6581. {
  6582. modelT_Bus_RemindRecord.F_DeptId = cruser.F_DeptId;
  6583. }
  6584. }
  6585. modelT_Bus_RemindRecord.F_Content = overseeopinion;
  6586. modelT_Bus_RemindRecord.F_State = 1;
  6587. modelT_Bus_RemindRecord.F_IsDelete = 0;
  6588. modelT_Bus_RemindRecord.F_CreateUser = userModel.F_UserCode;
  6589. modelT_Bus_RemindRecord.F_CreateTime = DateTime.Now;
  6590. new BLL.T_Bus_RemindRecord().Add(modelT_Bus_RemindRecord);
  6591. #endregion
  6592. #region 保存工单信息
  6593. modelT_Bus_WorkOrder.F_WorkState = 8;//重办中
  6594. modelT_Bus_WorkOrder.F_Result = "";
  6595. modelT_Bus_WorkOrder.F_DealDeptId = null;
  6596. modelT_Bus_WorkOrder.F_DealUser = "";
  6597. modelT_Bus_WorkOrder.F_DealTime = null;
  6598. workorderBLL.Update(modelT_Bus_WorkOrder);
  6599. #endregion
  6600. #region 插入操作记录
  6601. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6602. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6603. if (modelT_Bus_AssignedInfo != null)
  6604. {
  6605. oper.F_AssignedId = modelT_Bus_AssignedInfo.F_Id;
  6606. }
  6607. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6608. string deptname = "";
  6609. var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
  6610. if (deptinfo != null) { deptname = deptinfo.F_DeptName; }
  6611. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6612. oper.F_Message = userinfo + " 重办并督办了工单,交办单位:" + deptname;
  6613. oper.F_CreateUser = userModel.F_UserCode;
  6614. oper.F_CreateTime = DateTime.Now;
  6615. oper.F_IsDelete = 0;
  6616. operBLL.Add(oper);
  6617. //推送消息表
  6618. var users = userBLL.GetModelList(" F_DeptId='" + deptinfo.F_DeptId + "' ");
  6619. foreach (var u in users)
  6620. {
  6621. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode);
  6622. }
  6623. #endregion
  6624. trans.Complete();
  6625. }
  6626. return Success("操作成功");
  6627. }
  6628. else
  6629. {
  6630. return Error("已经处理过了");
  6631. }
  6632. }
  6633. else
  6634. {
  6635. return Error("操作失败");
  6636. }
  6637. }
  6638. else
  6639. {
  6640. return Error("权限不足");
  6641. }
  6642. }
  6643. /// <summary>
  6644. /// 结案工单
  6645. /// </summary>
  6646. /// <returns></returns>
  6647. [Authority]
  6648. public ActionResult FinishWorkOrder()
  6649. {
  6650. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6651. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6652. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6653. {
  6654. string workorderid = RequestString.GetFormString("workorderid");
  6655. string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
  6656. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  6657. int isnotice = RequestString.GetInt("isnotice", 0);//0不通告 1通告
  6658. string deptids = RequestString.GetFormString("deptids");//通告单位
  6659. string noticereson = RequestString.GetFormString("noticereson");//通告原因
  6660. int isobservation = RequestString.GetInt("isobservation", 0);//是否添加观察件
  6661. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6662. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6663. if (modelT_Bus_WorkOrder != null)
  6664. {
  6665. if (modelT_Bus_WorkOrder.F_WorkState == 7)
  6666. {
  6667. using (TransactionScope trans = new TransactionScope())
  6668. {
  6669. #region 修改工单记录
  6670. modelT_Bus_WorkOrder.F_WorkState = 9;
  6671. modelT_Bus_WorkOrder.F_IsSatisfie = issatisfie;
  6672. modelT_Bus_WorkOrder.F_IsClosed = 1;
  6673. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  6674. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  6675. modelT_Bus_WorkOrder.F_FinalOpinion = finalopinion;
  6676. modelT_Bus_WorkOrder.F_ISObservation = isobservation;
  6677. if (isnotice == 1)
  6678. {
  6679. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
  6680. modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
  6681. modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6682. modelT_Bus_NoticeCriticism.F_Content = noticereson;
  6683. modelT_Bus_NoticeCriticism.F_State = 1;
  6684. modelT_Bus_NoticeCriticism.F_IsDelete = 0;
  6685. modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
  6686. modelT_Bus_NoticeCriticism.F_CreateUser= userModel.F_UserCode;
  6687. new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
  6688. modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6689. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  6690. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  6691. assignBLL.Update(modelT_Bus_AssignedInfo);
  6692. modelT_Bus_WorkOrder.F_IsNotice = 1;
  6693. modelT_Bus_WorkOrder.F_NoticeDeptIds= deptids;
  6694. }
  6695. workorderBLL.Update(modelT_Bus_WorkOrder);
  6696. #endregion
  6697. #region 插入操作记录
  6698. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6699. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6700. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6701. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6702. oper.F_Message = userinfo + " 结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
  6703. if (isnotice == 1)
  6704. {
  6705. string sql = "select dbo.GetDeptNames('" + deptids + "')";
  6706. oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
  6707. }
  6708. oper.F_CreateUser = userModel.F_UserCode;
  6709. oper.F_CreateTime = DateTime.Now;
  6710. oper.F_IsDelete = 0;
  6711. operBLL.Add(oper);
  6712. #endregion
  6713. trans.Complete();
  6714. }
  6715. return Success("操作成功");
  6716. }
  6717. else
  6718. {
  6719. return Error("已经处理过了");
  6720. }
  6721. }
  6722. else
  6723. {
  6724. return Error("操作失败");
  6725. }
  6726. }
  6727. else
  6728. {
  6729. return Error("权限不足");
  6730. }
  6731. }
  6732. /// <summary>
  6733. /// 结案工单
  6734. /// </summary>
  6735. /// <returns></returns>
  6736. [Authority]
  6737. public ActionResult ForceFinishWorkOrder()
  6738. {
  6739. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6740. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6741. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6742. {
  6743. string workorderid = RequestString.GetFormString("workorderid");
  6744. string result = RequestString.GetFormString("result");//处理结果
  6745. string finalopinion = RequestString.GetFormString("finalopinion");//结案意见
  6746. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  6747. int isnotice = RequestString.GetInt("isnotice", 0);//0不通告 1通告
  6748. string deptids = RequestString.GetFormString("deptids");//通告单位
  6749. string noticereson = RequestString.GetFormString("noticereson");//通告原因
  6750. int isobservation = RequestString.GetInt("isobservation", 0);//是否添加观察件
  6751. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6752. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  6753. if (modelT_Bus_WorkOrder != null)
  6754. {
  6755. using (TransactionScope trans = new TransactionScope())
  6756. {
  6757. #region 修改工单记录
  6758. modelT_Bus_WorkOrder.F_Result = result;
  6759. modelT_Bus_WorkOrder.F_WorkState = 9;
  6760. modelT_Bus_WorkOrder.F_IsSatisfie = issatisfie;
  6761. modelT_Bus_WorkOrder.F_IsClosed = 1;
  6762. modelT_Bus_WorkOrder.F_CloseUser = userModel.F_UserCode;
  6763. modelT_Bus_WorkOrder.F_CloseTime = DateTime.Now;
  6764. modelT_Bus_WorkOrder.F_FinalOpinion = finalopinion;
  6765. modelT_Bus_WorkOrder.F_ISObservation = isobservation;
  6766. if (isnotice == 1)
  6767. {
  6768. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
  6769. modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
  6770. modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6771. modelT_Bus_NoticeCriticism.F_Content = noticereson;
  6772. modelT_Bus_NoticeCriticism.F_State = 1;
  6773. modelT_Bus_NoticeCriticism.F_IsDelete = 0;
  6774. modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
  6775. modelT_Bus_NoticeCriticism.F_CreateUser = userModel.F_UserCode;
  6776. new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
  6777. if (modelT_Bus_AssignedInfo != null)
  6778. {
  6779. modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6780. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  6781. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  6782. assignBLL.Update(modelT_Bus_AssignedInfo);
  6783. }
  6784. modelT_Bus_WorkOrder.F_IsNotice = 1;
  6785. modelT_Bus_WorkOrder.F_NoticeDeptIds = deptids;
  6786. }
  6787. workorderBLL.Update(modelT_Bus_WorkOrder);
  6788. #endregion
  6789. #region 插入操作记录
  6790. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6791. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6792. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6793. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6794. oper.F_Message = userinfo + " 强制结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
  6795. if (isnotice == 1)
  6796. {
  6797. string sql = "select dbo.GetDeptNames('" + deptids + "')";
  6798. oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
  6799. }
  6800. oper.F_CreateUser = userModel.F_UserCode;
  6801. oper.F_CreateTime = DateTime.Now;
  6802. oper.F_IsDelete = 0;
  6803. operBLL.Add(oper);
  6804. #endregion
  6805. trans.Complete();
  6806. }
  6807. return Success("操作成功");
  6808. }
  6809. else
  6810. {
  6811. return Error("操作失败");
  6812. }
  6813. }
  6814. else
  6815. {
  6816. return Error("权限不足");
  6817. }
  6818. }
  6819. /// <summary>
  6820. /// 删除工单
  6821. /// </summary>
  6822. /// <returns></returns>
  6823. public ActionResult DelWorkOrder(string[] ids)
  6824. {
  6825. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6826. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6827. if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" || userModel.F_RoleCode == "GLY")
  6828. {
  6829. //StringBuilder sb = new StringBuilder();
  6830. foreach (var item in ids)
  6831. {
  6832. //sb.Append("'" + item + "',");
  6833. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(item);
  6834. if (modelT_Bus_WorkOrder != null && modelT_Bus_WorkOrder.F_WorkState == 0)
  6835. {
  6836. using (TransactionScope trans = new TransactionScope())
  6837. {
  6838. #region 修改工单记录
  6839. modelT_Bus_WorkOrder.F_IsDelete = 1;
  6840. modelT_Bus_WorkOrder.F_DeleteUser = userModel.F_UserCode;
  6841. modelT_Bus_WorkOrder.F_DeleteTime = DateTime.Now;
  6842. workorderBLL.Update(modelT_Bus_WorkOrder);
  6843. #endregion
  6844. #region 插入操作记录
  6845. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6846. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6847. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6848. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6849. oper.F_Message = userinfo + " 删除了工单";
  6850. oper.F_CreateUser = userModel.F_UserCode;
  6851. oper.F_CreateTime = DateTime.Now;
  6852. oper.F_IsDelete = 0;
  6853. operBLL.Add(oper);
  6854. #endregion
  6855. trans.Complete();
  6856. }
  6857. }
  6858. }
  6859. return Success("删除成功");
  6860. }
  6861. else
  6862. {
  6863. return Error("权限不足");
  6864. }
  6865. }
  6866. /// <summary>
  6867. /// 转媒体工单
  6868. /// </summary>
  6869. /// <returns></returns>
  6870. [Authority]
  6871. public ActionResult ReleaseWorkOrder()
  6872. {
  6873. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6874. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6875. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6876. {
  6877. string workorderid = RequestString.GetFormString("workorderid");
  6878. int isrelease = RequestString.GetInt("isrelease", -1);
  6879. if (isrelease != -1)
  6880. {
  6881. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  6882. if (modelT_Bus_WorkOrder != null)
  6883. {
  6884. using (TransactionScope trans = new TransactionScope())
  6885. {
  6886. #region 修改工单记录
  6887. modelT_Bus_WorkOrder.F_IsRelease = isrelease;
  6888. workorderBLL.Update(modelT_Bus_WorkOrder);
  6889. #endregion
  6890. #region 插入操作记录
  6891. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6892. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  6893. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  6894. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6895. oper.F_Message = userinfo + " " + (isrelease == 1 ? "发布了" : "撤回了发布") + "工单";
  6896. oper.F_CreateUser = userModel.F_UserCode;
  6897. oper.F_CreateTime = DateTime.Now;
  6898. oper.F_IsDelete = 0;
  6899. operBLL.Add(oper);
  6900. #endregion
  6901. trans.Complete();
  6902. }
  6903. return Success("操作成功");
  6904. }
  6905. else
  6906. {
  6907. return Error("操作失败");
  6908. }
  6909. }
  6910. else
  6911. {
  6912. return Error("操作失败");
  6913. }
  6914. }
  6915. else
  6916. {
  6917. return Error("权限不足");
  6918. }
  6919. }
  6920. ///// <summary>
  6921. ///// 通告和撤销通告
  6922. ///// </summary>
  6923. ///// <returns></returns>
  6924. //[Authority]
  6925. //public ActionResult NoticeWorkOrder()
  6926. //{
  6927. // int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  6928. // Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  6929. // if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  6930. // {
  6931. // int assignid = RequestString.GetInt("id", 0);
  6932. // int isnotice = RequestString.GetInt("isnotice", -1);
  6933. // Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
  6934. // if (modelT_Bus_AssignedInfo != null)
  6935. // {
  6936. // if (isnotice == 0 && modelT_Bus_AssignedInfo.F_IsNotice == 1)
  6937. // {
  6938. // using (TransactionScope trans = new TransactionScope())
  6939. // {
  6940. // #region 修改交办记录
  6941. // modelT_Bus_AssignedInfo.F_IsNotice = 0;
  6942. // assignBLL.Update(modelT_Bus_AssignedInfo);
  6943. // #endregion
  6944. // #region 插入操作记录
  6945. // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6946. // oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  6947. // var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
  6948. // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6949. // oper.F_Message = userinfo + " 撤销了通告交办单位:" + (deptinfo != null ? deptinfo.F_DeptName : "");
  6950. // oper.F_CreateUser = userModel.F_UserCode;
  6951. // oper.F_CreateTime = DateTime.Now;
  6952. // oper.F_IsDelete = 0;
  6953. // operBLL.Add(oper);
  6954. // #endregion
  6955. // trans.Complete();
  6956. // }
  6957. // return Success("操作成功");
  6958. // }
  6959. // else if (isnotice == 1 && modelT_Bus_AssignedInfo.F_IsNotice == 0)
  6960. // {
  6961. // using (TransactionScope trans = new TransactionScope())
  6962. // {
  6963. // #region 修改交办记录
  6964. // modelT_Bus_AssignedInfo.F_IsNotice = 1;
  6965. // assignBLL.Update(modelT_Bus_AssignedInfo);
  6966. // #endregion
  6967. // #region 插入操作记录
  6968. // Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  6969. // oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  6970. // var deptinfo = new BLL.T_Sys_Department().GetModel(modelT_Bus_AssignedInfo.F_MainDeptId.Value);
  6971. // string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  6972. // oper.F_Message = userinfo + " 通告了交办单位:" + (deptinfo != null ? deptinfo.F_DeptName : "");
  6973. // oper.F_CreateUser = userModel.F_UserCode;
  6974. // oper.F_CreateTime = DateTime.Now;
  6975. // oper.F_IsDelete = 0;
  6976. // operBLL.Add(oper);
  6977. // #endregion
  6978. // trans.Complete();
  6979. // }
  6980. // return Success("操作成功");
  6981. // }
  6982. // else
  6983. // {
  6984. // return Error("操作失败");
  6985. // }
  6986. // }
  6987. // else
  6988. // {
  6989. // return Error("操作失败");
  6990. // }
  6991. // }
  6992. // else
  6993. // {
  6994. // return Error("权限不足");
  6995. // }
  6996. //}
  6997. /// <summary>
  6998. /// 通告和撤销通告
  6999. /// </summary>
  7000. /// <returns></returns>
  7001. [Authority]
  7002. public ActionResult NoticeWorkOrder()
  7003. {
  7004. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7005. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7006. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7007. {
  7008. string workorderid = RequestString.GetFormString("workorderid");
  7009. int isnotice = RequestString.GetInt("isnotice", -1);
  7010. string deptids = RequestString.GetFormString("deptids");//通告单位
  7011. string noticereson = RequestString.GetFormString("noticereson");//通告原因
  7012. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  7013. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  7014. if (modelT_Bus_WorkOrder != null)
  7015. {
  7016. if (isnotice == 0 && modelT_Bus_WorkOrder.F_IsNotice == 1)
  7017. {
  7018. using (TransactionScope trans = new TransactionScope())
  7019. {
  7020. #region 修改工单记录
  7021. modelT_Bus_WorkOrder.F_IsNotice = 0;
  7022. modelT_Bus_WorkOrder.F_NoticeDeptIds = "";
  7023. workorderBLL.Update(modelT_Bus_WorkOrder);
  7024. #endregion
  7025. if (modelT_Bus_AssignedInfo != null)
  7026. {
  7027. #region 修改交办记录
  7028. modelT_Bus_AssignedInfo.F_IsNotice = 0;
  7029. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  7030. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  7031. assignBLL.Update(modelT_Bus_AssignedInfo);
  7032. #endregion
  7033. }
  7034. #region 修改通告记录
  7035. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new BLL.T_Bus_NoticeCriticism().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
  7036. modelT_Bus_NoticeCriticism.F_IsDelete = 1;
  7037. modelT_Bus_NoticeCriticism.F_DeleteTime = DateTime.Now;
  7038. modelT_Bus_NoticeCriticism.F_DeleteUser = userModel.F_UserCode;
  7039. new BLL.T_Bus_NoticeCriticism().Update(modelT_Bus_NoticeCriticism);
  7040. #endregion
  7041. #region 插入操作记录
  7042. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7043. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7044. string sql = "select dbo.GetDeptNames('" + modelT_Bus_NoticeCriticism.F_DeptIds + "')";
  7045. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7046. oper.F_Message = userinfo + " 撤销了通告交办单位:" + DbHelperSQL.GetSingle(sql).ToString();
  7047. oper.F_CreateUser = userModel.F_UserCode;
  7048. oper.F_CreateTime = DateTime.Now;
  7049. oper.F_IsDelete = 0;
  7050. operBLL.Add(oper);
  7051. #endregion
  7052. trans.Complete();
  7053. }
  7054. return Success("操作成功");
  7055. }
  7056. else if (isnotice == 1 && modelT_Bus_WorkOrder.F_IsNotice == 0)
  7057. {
  7058. using (TransactionScope trans = new TransactionScope())
  7059. {
  7060. #region 修改工单记录
  7061. modelT_Bus_WorkOrder.F_IsNotice = 1;
  7062. modelT_Bus_WorkOrder.F_NoticeDeptIds = deptids;
  7063. workorderBLL.Update(modelT_Bus_WorkOrder);
  7064. #endregion
  7065. if (modelT_Bus_AssignedInfo != null)
  7066. {
  7067. #region 修改交办记录
  7068. modelT_Bus_AssignedInfo.F_IsNotice = 1;
  7069. modelT_Bus_AssignedInfo.F_NoticeUser = userModel.F_UserCode;
  7070. modelT_Bus_AssignedInfo.F_NoticeTime = DateTime.Now;
  7071. assignBLL.Update(modelT_Bus_AssignedInfo);
  7072. #endregion
  7073. }
  7074. #region 新增通告记录
  7075. Model.T_Bus_NoticeCriticism modelT_Bus_NoticeCriticism = new Model.T_Bus_NoticeCriticism();
  7076. modelT_Bus_NoticeCriticism.F_DeptIds = deptids;
  7077. modelT_Bus_NoticeCriticism.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7078. modelT_Bus_NoticeCriticism.F_Content = noticereson;
  7079. modelT_Bus_NoticeCriticism.F_State = 1;
  7080. modelT_Bus_NoticeCriticism.F_IsDelete = 0;
  7081. modelT_Bus_NoticeCriticism.F_CreateTime = DateTime.Now;
  7082. modelT_Bus_NoticeCriticism.F_CreateUser = userModel.F_UserCode;
  7083. new BLL.T_Bus_NoticeCriticism().Add(modelT_Bus_NoticeCriticism);
  7084. #endregion
  7085. #region 插入操作记录
  7086. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7087. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7088. string sql = "select dbo.GetDeptNames('"+ deptids + "')";
  7089. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7090. oper.F_Message = userinfo + " 通告了交办单位:" + DbHelperSQL.GetSingle(sql).ToString();
  7091. oper.F_CreateUser = userModel.F_UserCode;
  7092. oper.F_CreateTime = DateTime.Now;
  7093. oper.F_IsDelete = 0;
  7094. operBLL.Add(oper);
  7095. #endregion
  7096. trans.Complete();
  7097. }
  7098. return Success("操作成功");
  7099. }
  7100. else
  7101. {
  7102. return Error("操作失败");
  7103. }
  7104. }
  7105. else
  7106. {
  7107. return Error("操作失败");
  7108. }
  7109. }
  7110. else
  7111. {
  7112. return Error("权限不足");
  7113. }
  7114. }
  7115. /// <summary>
  7116. /// 市民催单
  7117. /// </summary>
  7118. /// <returns></returns>
  7119. [Authority]
  7120. public ActionResult AdditionalWorkOrder()
  7121. {
  7122. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7123. Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
  7124. string workorderid = RequestString.GetFormString("workorderid");
  7125. string title = RequestString.GetFormString("title");
  7126. string content = RequestString.GetFormString("content");
  7127. string files = RequestString.GetFormString("files");
  7128. string callid = RequestString.GetFormString("callid");
  7129. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = new BLL.T_Bus_WorkOrder().GetModel(workorderid);
  7130. if (modelT_Bus_WorkOrder != null)
  7131. {
  7132. using (TransactionScope trans = new TransactionScope())
  7133. {
  7134. #region 插入附加记录
  7135. //批示记录
  7136. Model.T_Bus_Additional model_T_Bus_Additional = new Model.T_Bus_Additional();
  7137. model_T_Bus_Additional.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;//工单流水号
  7138. model_T_Bus_Additional.F_Title = title;
  7139. model_T_Bus_Additional.F_Content = content;
  7140. if (!string.IsNullOrEmpty(callid))
  7141. {
  7142. model_T_Bus_Additional.F_CallId = callid;
  7143. var rd = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
  7144. if (rd != null)
  7145. {
  7146. model_T_Bus_Additional.F_CallRecordId = rd.CallRecordsId;
  7147. }
  7148. }
  7149. model_T_Bus_Additional.F_File = files;//附件
  7150. model_T_Bus_Additional.F_CreateUser = userModel.F_UserCode;//呈批人
  7151. model_T_Bus_Additional.F_CreateTime = DateTime.Now;//呈批时间
  7152. model_T_Bus_Additional.F_IsDelete = 0;
  7153. model_T_Bus_Additional.F_State = 1;//审批状态(0:未处理,1:通过)
  7154. new BLL.T_Bus_Additional().Add(model_T_Bus_Additional);
  7155. #endregion
  7156. #region 插入操作记录
  7157. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7158. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7159. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  7160. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7161. oper.F_Message = userinfo + " 接到市民催单,内容:" + content;
  7162. oper.F_CreateUser = userModel.F_UserCode;
  7163. oper.F_CreateTime = DateTime.Now;
  7164. oper.F_IsDelete = 0;
  7165. operBLL.Add(oper);
  7166. #endregion
  7167. #region 根据状态不同给出提醒
  7168. var sqlusers = " F_DeleteFlag=0 ";
  7169. #region 获取被提醒人
  7170. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
  7171. if (modelT_Bus_WorkOrder.F_WorkState ==0)
  7172. sqlusers += " and F_UserCode='" + modelT_Bus_WorkOrder.F_CreateUser + "'";//"新工单"向添加人提醒
  7173. if (modelT_Bus_WorkOrder.F_WorkState == 1)
  7174. sqlusers += " and F_RoleId in (select F_RoleId from T_Sys_RoleInfo where F_RoleCode='ZXLD')";//"待交办"向所有调度提醒
  7175. if (modelT_Bus_WorkOrder.F_WorkState == 2)
  7176. {
  7177. if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_MainDeptId != null)
  7178. sqlusers += " and F_DeptId='" + modelT_Bus_AssignedInfo.F_MainDeptId + "' ";//"待查收"向被指派单位的所有人提醒
  7179. }
  7180. if (modelT_Bus_WorkOrder.F_WorkState == 3)
  7181. {
  7182. if (modelT_Bus_AssignedInfo != null)
  7183. sqlusers += " and F_UserCode='" + modelT_Bus_AssignedInfo.F_CreateUser + "' ";//"退回审核中"向指派人提醒
  7184. }
  7185. if (modelT_Bus_WorkOrder.F_WorkState ==4)
  7186. {
  7187. if (modelT_Bus_AssignedInfo != null && !string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_SureUser))
  7188. sqlusers += " and F_UserCode='" + modelT_Bus_AssignedInfo.F_SureUser + "' ";//"办理中"向查收人提醒
  7189. }
  7190. if (modelT_Bus_WorkOrder.F_WorkState == 5)
  7191. {
  7192. if (modelT_Bus_AssignedInfo != null)
  7193. sqlusers += " and F_UserCode='" + modelT_Bus_AssignedInfo.F_CreateUser + "' ";//"延时审核中"
  7194. }
  7195. if (modelT_Bus_WorkOrder.F_WorkState == 6)
  7196. {
  7197. sqlusers += " and F_RoleId in (select F_RoleId from T_Sys_RoleInfo where F_RoleCode='ZJZY')";//"已办理"向所有质检提醒
  7198. }
  7199. if (modelT_Bus_WorkOrder.F_WorkState == 7)
  7200. {
  7201. sqlusers += " and F_RoleId in (select F_RoleId from T_Sys_RoleInfo where F_RoleCode='ZJZY')";//"已回访"向所有质检提醒
  7202. }
  7203. if (modelT_Bus_WorkOrder.F_WorkState ==8)
  7204. {
  7205. if (modelT_Bus_AssignedInfo != null)
  7206. sqlusers += " and F_UserCode='" + modelT_Bus_AssignedInfo.F_CreateUser + "' ";//"重办中"向指派人提醒
  7207. }
  7208. if (modelT_Bus_WorkOrder.F_WorkState ==10)
  7209. {
  7210. sqlusers += " and F_RoleId in (select F_RoleId from T_Sys_RoleInfo where F_RoleCode='ZXBZ')";//"待审核"向坐席班长提醒
  7211. }
  7212. if (modelT_Bus_WorkOrder.F_WorkState == 11)
  7213. {
  7214. if (modelT_Bus_AssignedInfo != null)
  7215. sqlusers += " and F_UserCode='" + modelT_Bus_AssignedInfo.F_CreateUser + "' ";//"重办待交办"向指派人提醒
  7216. }
  7217. if (modelT_Bus_WorkOrder.F_WorkState == 13)
  7218. {
  7219. sqlusers += " and F_RoleId in (select F_RoleId from T_Sys_RoleInfo where F_RoleCode='ZJZY')";//"重办驳回"向所有质检提醒
  7220. }
  7221. #endregion
  7222. var userlists = userBLL.GetModelList(sqlusers);
  7223. //推送消息表
  7224. foreach (var u in userlists)
  7225. {
  7226. msg.AddInternalMessagesInfo("工单消息", oper.F_Message + ",工单编号:" + oper.F_WorkOrderId, u.F_UserCode, userModel.F_UserCode, 4);
  7227. }
  7228. #endregion
  7229. trans.Complete();
  7230. }
  7231. return Success("操作成功");
  7232. }
  7233. else
  7234. {
  7235. return Error("操作失败");
  7236. }
  7237. }
  7238. #endregion
  7239. #region 语音附件其他
  7240. /// <summary>
  7241. /// 验证当前单位是否交办单位
  7242. /// </summary>
  7243. /// <param name="modelT_Bus_AssignedInfo"></param>
  7244. /// <param name="deptid"></param>
  7245. /// <returns></returns>
  7246. public int AssignDeptType(Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo, int deptid)
  7247. {
  7248. int type = 0;
  7249. if (modelT_Bus_AssignedInfo.F_MainDeptId == deptid)
  7250. {
  7251. type = 1;//主办
  7252. }
  7253. else if (!string.IsNullOrEmpty(modelT_Bus_AssignedInfo.F_OtherDeptIds) && modelT_Bus_AssignedInfo.F_OtherDeptIds.Split(',').Contains(deptid.ToString()))
  7254. {
  7255. type = 2;//协办
  7256. }
  7257. return type;
  7258. }
  7259. /// <summary>
  7260. /// 获取留言路径
  7261. /// </summary>
  7262. /// <param name="lid">留言id</param>
  7263. /// <param name="prefix">前缀</param>
  7264. /// <returns></returns>
  7265. public string GetLeavePath(string lid, string prefix)
  7266. {
  7267. string path = string.Empty;
  7268. var liuyan = new BLL.T_Call_LeaveRecord().GetModelList(" F_Id='" + lid + "' ").FirstOrDefault();
  7269. if (liuyan != null)
  7270. {
  7271. if (!string.IsNullOrEmpty(liuyan.F_RecFileUrl))
  7272. {
  7273. path = prefix + liuyan.F_RecFileUrl;
  7274. }
  7275. }
  7276. return path;
  7277. }
  7278. /// <summary>
  7279. /// 获取通话录音路径
  7280. /// </summary>
  7281. /// <param name="cid">通话id</param>
  7282. /// <param name="prefix">前缀</param>
  7283. /// <returns></returns>
  7284. public string GetCallPath(string cid, string prefix)
  7285. {
  7286. string path = string.Empty;
  7287. var luyin = new BLL.T_Call_CallRecords().GetModelList(" CallRecordsId='" + cid + "' ").FirstOrDefault();
  7288. if (luyin != null)
  7289. {
  7290. if (!string.IsNullOrEmpty(luyin.FilePath))
  7291. {
  7292. var ym = prefix;
  7293. ym = ym.Substring(0, ym.Length - 1);
  7294. path = ym + luyin.FilePath.Substring(luyin.FilePath.IndexOf(':') + 1).Replace('\\', '/');
  7295. }
  7296. }
  7297. return path;
  7298. }
  7299. /// <summary>
  7300. /// 获取附件数据
  7301. /// </summary>
  7302. /// <param name="ids">附件id,多个用英文逗号,隔开</param>
  7303. /// <param name="prefix">前缀</param>
  7304. /// <returns></returns>
  7305. public DataTable GetFileData(string ids, string prefix)
  7306. {
  7307. DataTable dt = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + ids + ")").Tables[0];
  7308. foreach (DataRow dr in dt.Rows)
  7309. {
  7310. dr["F_FileUrl"] = prefix + dr["F_FileUrl"].ToString();
  7311. }
  7312. return dt;
  7313. }
  7314. /// <summary>
  7315. /// 绑定附件信息
  7316. /// </summary>
  7317. /// <param name="dt"></param>
  7318. /// <param name="prefix"></param>
  7319. /// <returns></returns>
  7320. public DataTable BindFileData(DataTable dt, string prefix)
  7321. {
  7322. dt.Columns.Add("File", typeof(object));
  7323. foreach (DataRow dr in dt.Rows)
  7324. {
  7325. if (dr["F_File"] != null && dr["F_File"].ToString() != "")
  7326. {
  7327. dr["File"] = GetFileData(dr["F_File"].ToString(), prefix);
  7328. //web站点使用虚拟目录(api站点里面的Upload文件夹)后用下面代码,否则用上面代码
  7329. //dr["File"] = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + dr["F_File"].ToString() + ")").Tables[0];
  7330. }
  7331. }
  7332. return dt;
  7333. }
  7334. #endregion
  7335. #region 修改工单 by admin
  7336. /// <summary>
  7337. /// 获取详情
  7338. /// </summary>
  7339. /// <returns></returns>
  7340. [Authority]
  7341. public ActionResult GetInfoByAdmin(int id,int type)
  7342. {
  7343. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7344. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7345. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7346. {
  7347. //string sql = "select * from ";
  7348. string table = string.Empty;
  7349. switch (type)
  7350. {
  7351. case 1: table = "T_Bus_AssignedInfo"; break;
  7352. case 2: table = "T_Bus_DelayTime"; break;
  7353. case 3: table = "T_Bus_Feedback"; break;
  7354. case 4: table = "T_Bus_RemindRecord"; break;
  7355. case 5: table = "T_Bus_SubmitSuper"; break;
  7356. case 6: table = "T_Bus_VisitResult"; break;
  7357. }
  7358. string sql = "select * from " + table + " where F_IsDelete=0 and F_Id=" + id;
  7359. var dt = DbHelperSQL.Query(sql).Tables[0];
  7360. return Success("操作成功", dt);
  7361. }
  7362. else
  7363. {
  7364. return Error("权限不足");
  7365. }
  7366. }
  7367. /// <summary>
  7368. /// 修改工单信息
  7369. /// </summary>
  7370. /// <returns></returns>
  7371. [Authority]
  7372. public ActionResult EditWorkOrderByAdmin()
  7373. {
  7374. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7375. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7376. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7377. {
  7378. string workorderid = RequestString.GetFormString("workorderid");
  7379. int source = RequestString.GetInt("source", 0);
  7380. string cusname = RequestString.GetFormString("cusname");
  7381. string cussex = RequestString.GetFormString("cussex");
  7382. string cusphone = RequestString.GetFormString("cusphone");
  7383. string cusaddress = RequestString.GetFormString("cusaddress");
  7384. string email = RequestString.GetFormString("email");
  7385. string zipcode = RequestString.GetFormString("zipcode");
  7386. string conname = RequestString.GetFormString("conname");
  7387. string conphone = RequestString.GetFormString("conphone");
  7388. string title = RequestString.GetFormString("title");
  7389. string content = RequestString.GetFormString("content");
  7390. string files = RequestString.GetFormString("files");
  7391. int sourcearea = RequestString.GetInt("sourcearea", 0);
  7392. string sourceaddress = RequestString.GetFormString("sourceaddress");
  7393. //int isresult = RequestString.GetInt("isresult", 0);
  7394. string result = RequestString.GetFormString("result");
  7395. string keys = RequestString.GetFormString("keys");
  7396. string splituser = RequestString.GetFormString("splituser");
  7397. int type = RequestString.GetInt("type", 0);
  7398. int bigtype = RequestString.GetInt("bigtype", 0);
  7399. int smalltype = RequestString.GetInt("smalltype", 0);
  7400. int isprotect = RequestString.GetInt("isprotect", 0);
  7401. int level = RequestString.GetInt("level", 0);
  7402. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  7403. if (modelT_Bus_WorkOrder != null)
  7404. {
  7405. using (TransactionScope trans = new TransactionScope())
  7406. {
  7407. #region 保存工单信息
  7408. modelT_Bus_WorkOrder.F_InfoSource = source;//信息来源
  7409. modelT_Bus_WorkOrder.F_InfoType = type;//信息类别
  7410. modelT_Bus_WorkOrder.F_InfoConBigType = bigtype;//内容大类
  7411. modelT_Bus_WorkOrder.F_InfoConSmallType = smalltype;//内容小类
  7412. modelT_Bus_WorkOrder.F_SourceArea = sourcearea;//反映地域
  7413. modelT_Bus_WorkOrder.F_SourceAddress = sourceaddress;//事发地址
  7414. modelT_Bus_WorkOrder.F_CusName = cusname;//投诉人姓名
  7415. modelT_Bus_WorkOrder.F_CusSex = cussex;//性别
  7416. modelT_Bus_WorkOrder.F_CusPhone = cusphone;//来电号码
  7417. modelT_Bus_WorkOrder.F_CusAddress = cusaddress;//地址
  7418. modelT_Bus_WorkOrder.F_ZipCode = zipcode;//邮编
  7419. modelT_Bus_WorkOrder.F_ConName = conname;//联系人姓名
  7420. modelT_Bus_WorkOrder.F_ConPhone = conphone;//联系人电话
  7421. modelT_Bus_WorkOrder.F_Email = email;//E-mail
  7422. modelT_Bus_WorkOrder.F_ComTitle = title;//标题
  7423. modelT_Bus_WorkOrder.F_ComContent = content;//情况摘要(投诉内容)
  7424. modelT_Bus_WorkOrder.F_File = files;//附件
  7425. modelT_Bus_WorkOrder.F_IsProtect = isprotect;//保密方式0否1是
  7426. modelT_Bus_WorkOrder.F_Result = result;
  7427. modelT_Bus_WorkOrder.F_Key = keys;
  7428. modelT_Bus_WorkOrder.F_Level = level;
  7429. workorderBLL.Update(modelT_Bus_WorkOrder);
  7430. #endregion
  7431. #region 插入操作记录
  7432. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7433. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7434. oper.F_State = modelT_Bus_WorkOrder.F_WorkState;
  7435. oper.F_CallRecordId = modelT_Bus_WorkOrder.F_CallRecordId;
  7436. oper.F_File = modelT_Bus_WorkOrder.F_File;
  7437. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7438. oper.F_Message = userinfo + " 修改了工单基本信息";
  7439. oper.F_CreateUser = userModel.F_UserCode;
  7440. oper.F_CreateTime = DateTime.Now;
  7441. oper.F_IsDelete = 0;
  7442. operBLL.Add(oper);
  7443. #endregion
  7444. trans.Complete();
  7445. }
  7446. return Success("操作成功");
  7447. }
  7448. else
  7449. {
  7450. return Error("操作失败");
  7451. }
  7452. }
  7453. else
  7454. {
  7455. return Success("权限不足");
  7456. }
  7457. }
  7458. /// <summary>
  7459. /// 修改批示信息
  7460. /// </summary>
  7461. /// <returns></returns>
  7462. [Authority]
  7463. public ActionResult EditSuperInfoByAdmin()
  7464. {
  7465. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7466. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7467. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7468. {
  7469. //int type = RequestString.GetInt("type", 0);//1领导批示 2市长指示
  7470. string superuser = RequestString.GetFormString("superuser");
  7471. string superopinion = RequestString.GetFormString("superopinion");
  7472. string files = RequestString.GetFormString("files");
  7473. int id = RequestString.GetInt("id", 0);
  7474. Model.T_Bus_SubmitSuper model_T_Bus_SubmitSuper = new BLL.T_Bus_SubmitSuper().GetModel(id);
  7475. if (model_T_Bus_SubmitSuper != null)
  7476. {
  7477. using (TransactionScope trans = new TransactionScope())
  7478. {
  7479. #region 保存批示信息
  7480. //model_T_Bus_SubmitSuper.F_Type = type;//1领导批示 2市长指示
  7481. model_T_Bus_SubmitSuper.F_BatchReason = superuser;//批示人
  7482. model_T_Bus_SubmitSuper.F_SuperOpinion = superopinion;//批示内容
  7483. model_T_Bus_SubmitSuper.F_File = files;//附件
  7484. new BLL.T_Bus_SubmitSuper().Update(model_T_Bus_SubmitSuper);
  7485. #endregion
  7486. #region 插入操作记录
  7487. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7488. oper.F_WorkOrderId = model_T_Bus_SubmitSuper.F_WorkOrderId;
  7489. oper.F_File = model_T_Bus_SubmitSuper.F_File;
  7490. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7491. oper.F_Message = userinfo + " 修改了工单批示信息";
  7492. oper.F_CreateUser = userModel.F_UserCode;
  7493. oper.F_CreateTime = DateTime.Now;
  7494. oper.F_IsDelete = 0;
  7495. operBLL.Add(oper);
  7496. #endregion
  7497. trans.Complete();
  7498. }
  7499. return Success("操作成功");
  7500. }
  7501. else
  7502. {
  7503. return Error("操作失败");
  7504. }
  7505. }
  7506. else
  7507. {
  7508. return Error("权限不足");
  7509. }
  7510. }
  7511. /// <summary>
  7512. /// 修改交办信息
  7513. /// </summary>
  7514. /// <returns></returns>
  7515. [Authority]
  7516. public ActionResult EditAssignInfoByAdmin()
  7517. {
  7518. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7519. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7520. Model.T_Sys_RoleInfo RoleInfoModel = new BLL.T_Sys_RoleInfo().GetModel(userModel.F_RoleId);
  7521. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7522. {
  7523. int assignid = RequestString.GetInt("id", 0);
  7524. //int maindeptid = RequestString.GetInt("maindeptid", 0);
  7525. //string otherdeptids = RequestString.GetFormString("otherdeptids");
  7526. DateTime limittime = DateTime.Parse(RequestString.GetFormString("limittime"));
  7527. string assignedopinion = RequestString.GetFormString("assignedopinion");
  7528. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(assignid);
  7529. if (modelT_Bus_AssignedInfo != null)
  7530. {
  7531. using (TransactionScope trans = new TransactionScope())
  7532. {
  7533. #region 保存交办信息
  7534. modelT_Bus_AssignedInfo.F_LimitTime = limittime;//办理时限
  7535. //modelT_Bus_AssignedInfo.F_MainDeptId = maindeptid;//主办单位id
  7536. //modelT_Bus_AssignedInfo.F_OtherDeptIds = otherdeptids;//协办单位id
  7537. var mag =
  7538. DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  7539. modelT_Bus_AssignedInfo.F_AssignedOpinion = assignedopinion+" " +mag;//交办意见
  7540. assignBLL.Update(modelT_Bus_AssignedInfo);
  7541. #endregion
  7542. #region 插入操作记录
  7543. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7544. oper.F_WorkOrderId = modelT_Bus_AssignedInfo.F_WorkOrderId;
  7545. oper.F_File = modelT_Bus_AssignedInfo.F_File;
  7546. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7547. oper.F_Message = userinfo + " 修改了工单交办信息";
  7548. oper.F_CreateUser = userModel.F_UserCode;
  7549. oper.F_CreateTime = DateTime.Now;
  7550. oper.F_IsDelete = 0;
  7551. operBLL.Add(oper);
  7552. #endregion
  7553. trans.Complete();
  7554. }
  7555. return Success("操作成功");
  7556. }
  7557. else
  7558. {
  7559. return Error("操作失败");
  7560. }
  7561. }
  7562. else
  7563. {
  7564. return Error("权限不足");
  7565. }
  7566. }
  7567. /// <summary>
  7568. /// 修改办理信息
  7569. /// </summary>
  7570. /// <returns></returns>
  7571. [Authority]
  7572. public ActionResult EditFeedBackInfoByAdmin()
  7573. {
  7574. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7575. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7576. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7577. {
  7578. string dealman = RequestString.GetFormString("dealman");
  7579. string result = RequestString.GetFormString("result");
  7580. string files = RequestString.GetFormString("files");
  7581. int feedbackid = RequestString.GetInt("id", 0);
  7582. Model.T_Bus_Feedback model_T_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(feedbackid);
  7583. if (model_T_Bus_Feedback != null)
  7584. {
  7585. using (TransactionScope trans = new TransactionScope())
  7586. {
  7587. #region 保存办理信息
  7588. model_T_Bus_Feedback.F_DealUser = dealman;
  7589. model_T_Bus_Feedback.F_Result = result;//反馈内容
  7590. model_T_Bus_Feedback.F_File = files;
  7591. new BLL.T_Bus_Feedback().Update(model_T_Bus_Feedback);
  7592. #endregion
  7593. #region 保存工单信息
  7594. 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());
  7595. var assign = assignBLL.GetModel(model_T_Bus_Feedback.F_AssignedId.Value);
  7596. if (maxid == assign.F_Id)
  7597. {
  7598. var order = workorderBLL.GetModel(model_T_Bus_Feedback.F_WorkOrderId);
  7599. order.F_Result = result;//反馈内容
  7600. workorderBLL.Update(order);
  7601. }
  7602. #endregion
  7603. #region 插入操作记录
  7604. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7605. oper.F_WorkOrderId = model_T_Bus_Feedback.F_WorkOrderId;
  7606. oper.F_File = model_T_Bus_Feedback.F_File;
  7607. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7608. oper.F_Message = userinfo + " 修改了工单办理信息";
  7609. oper.F_CreateUser = userModel.F_UserCode;
  7610. oper.F_CreateTime = DateTime.Now;
  7611. oper.F_IsDelete = 0;
  7612. operBLL.Add(oper);
  7613. #endregion
  7614. trans.Complete();
  7615. }
  7616. return Success("操作成功");
  7617. }
  7618. else
  7619. {
  7620. return Error("操作失败");
  7621. }
  7622. }
  7623. else
  7624. {
  7625. return Error("权限不足");
  7626. }
  7627. }
  7628. /// <summary>
  7629. /// 修改回访信息
  7630. /// </summary>
  7631. /// <returns></returns>
  7632. [Authority]
  7633. public ActionResult EditVisitInfoByAdmin()
  7634. {
  7635. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7636. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7637. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7638. {
  7639. string visituser = RequestString.GetFormString("visituser");//回访人
  7640. int type = RequestString.GetInt("type", 0);//回访方式
  7641. int issatisfie = RequestString.GetInt("issatisfie", 0);//0不满意 1满意
  7642. int visitid = RequestString.GetInt("id", 0);
  7643. string result = RequestString.GetFormString("result");//回访情况
  7644. string guid = RequestString.GetFormString("guid");
  7645. Model.T_Bus_VisitResult modelT_Bus_VisitResult = new BLL.T_Bus_VisitResult().GetModel(visitid);
  7646. if (modelT_Bus_VisitResult != null)
  7647. {
  7648. using (TransactionScope trans = new TransactionScope())
  7649. {
  7650. #region 保存回访信息
  7651. modelT_Bus_VisitResult.F_VisitUser = visituser;
  7652. modelT_Bus_VisitResult.F_Type = type;
  7653. modelT_Bus_VisitResult.F_IsSatisfie = issatisfie;
  7654. modelT_Bus_VisitResult.F_Result = result;
  7655. new BLL.T_Bus_VisitResult().Update(modelT_Bus_VisitResult);
  7656. //保存回访记录
  7657. new BLL.T_Bus_VisitResultRecords().AddInfo(modelT_Bus_VisitResult, userModel.F_UserCode, guid);
  7658. #endregion
  7659. #region 插入操作记录
  7660. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7661. oper.F_WorkOrderId = modelT_Bus_VisitResult.F_WorkOrderId;
  7662. oper.F_File = modelT_Bus_VisitResult.F_File;
  7663. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7664. oper.F_Message = userinfo + " 修改了工单回访信息";
  7665. oper.F_CreateUser = userModel.F_UserCode;
  7666. oper.F_CreateTime = DateTime.Now;
  7667. oper.F_IsDelete = 0;
  7668. operBLL.Add(oper);
  7669. #endregion
  7670. trans.Complete();
  7671. }
  7672. return Success("操作成功");
  7673. }
  7674. else
  7675. {
  7676. return Error("操作失败");
  7677. }
  7678. }
  7679. else
  7680. {
  7681. return Error("权限不足");
  7682. }
  7683. }
  7684. /// <summary>
  7685. /// 修改退回审核信息
  7686. /// </summary>
  7687. /// <returns></returns>
  7688. [Authority]
  7689. public ActionResult EditAuditRebackByAdmin()
  7690. {
  7691. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7692. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7693. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7694. {
  7695. string reason = RequestString.GetFormString("reason");
  7696. int rebackid = RequestString.GetInt("id", 0);
  7697. Model.T_Bus_Feedback modelT_Bus_Feedback = new BLL.T_Bus_Feedback().GetModel(rebackid);
  7698. if (modelT_Bus_Feedback != null)
  7699. {
  7700. using (TransactionScope trans = new TransactionScope())
  7701. {
  7702. #region 保存反馈信息
  7703. modelT_Bus_Feedback.F_AuditReason = reason;//交办意见
  7704. new BLL.T_Bus_Feedback().Update(modelT_Bus_Feedback);
  7705. #endregion
  7706. #region 插入操作记录
  7707. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7708. oper.F_WorkOrderId = modelT_Bus_Feedback.F_WorkOrderId;
  7709. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7710. oper.F_Message = userinfo + " 修改了工单退回审核信息";
  7711. oper.F_CreateUser = userModel.F_UserCode;
  7712. oper.F_CreateTime = DateTime.Now;
  7713. oper.F_IsDelete = 0;
  7714. operBLL.Add(oper);
  7715. #endregion
  7716. trans.Complete();
  7717. }
  7718. return Success("操作成功");
  7719. }
  7720. else
  7721. {
  7722. return Error("操作失败");
  7723. }
  7724. }
  7725. else
  7726. {
  7727. return Error("权限不足");
  7728. }
  7729. }
  7730. /// <summary>
  7731. /// 修改退回审核信息
  7732. /// </summary>
  7733. /// <returns></returns>
  7734. [Authority]
  7735. public ActionResult EditAuditDelayByAdmin()
  7736. {
  7737. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7738. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7739. if (userModel.F_RoleCode == "ZXLDGLY" || userModel.F_RoleCode == "GLY")
  7740. {
  7741. string reason = RequestString.GetFormString("reason");
  7742. //DateTime newlimittime = DateTime.Parse(RequestString.GetFormString("newlimittime"));
  7743. int delayid = RequestString.GetInt("id", 0);
  7744. Model.T_Bus_DelayTime modelT_Bus_DelayTime = new BLL.T_Bus_DelayTime().GetModel(delayid);
  7745. if (modelT_Bus_DelayTime != null )
  7746. {
  7747. Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetModel(modelT_Bus_DelayTime.F_AssignedId.Value);
  7748. using (TransactionScope trans = new TransactionScope())
  7749. {
  7750. #region 保存延时审核信息
  7751. modelT_Bus_DelayTime.F_RefuseReason = reason;
  7752. //modelT_Bus_DelayTime.F_AgreeTime = newlimittime;
  7753. new BLL.T_Bus_DelayTime().Update(modelT_Bus_DelayTime);
  7754. #endregion
  7755. #region 插入操作记录
  7756. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7757. oper.F_WorkOrderId = modelT_Bus_DelayTime.F_WorkOrderId;
  7758. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7759. oper.F_Message = userinfo + " 修改了工单延时审核信息";
  7760. oper.F_CreateUser = userModel.F_UserCode;
  7761. oper.F_CreateTime = DateTime.Now;
  7762. oper.F_IsDelete = 0;
  7763. operBLL.Add(oper);
  7764. #endregion
  7765. trans.Complete();
  7766. }
  7767. return Success("操作成功");
  7768. }
  7769. else
  7770. {
  7771. return Error("操作失败");
  7772. }
  7773. }
  7774. else
  7775. {
  7776. return Error("权限不足");
  7777. }
  7778. }
  7779. #endregion
  7780. #region 县级对接
  7781. /// <summary>
  7782. /// 获取网点列表
  7783. /// </summary>
  7784. /// <param name="code"></param>
  7785. /// <param name="name"></param>
  7786. /// <returns></returns>
  7787. [Authority]
  7788. public ActionResult GetCityList(string code, string name)
  7789. {
  7790. string signcode = Configs.GetValue("CityOutSignCode");
  7791. string url = Configs.GetValue("CityOutUrl");
  7792. string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityList", signcode);
  7793. string strparams = "?code=" + code + "&name=" + name + "&signcode=" + outsigncode;
  7794. string result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityList" + strparams);
  7795. return Content(result);
  7796. }
  7797. /// <summary>
  7798. /// 获取网点详情
  7799. /// </summary>
  7800. /// <param name="code"></param>
  7801. /// <returns></returns>
  7802. [Authority]
  7803. public ActionResult GetCityDetail(string code)
  7804. {
  7805. string signcode = Configs.GetValue("CityOutSignCode");
  7806. string url = Configs.GetValue("CityOutUrl");
  7807. string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityDetail", signcode);
  7808. string strparams = "?code=" + code + "&signcode=" + outsigncode;
  7809. string result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityDetail" + strparams);
  7810. return Content(result);
  7811. }
  7812. /// <summary>
  7813. /// 转派工单到县级
  7814. /// </summary>
  7815. /// <returns></returns>
  7816. [Authority]
  7817. public ActionResult TurnWorkOrder()
  7818. {
  7819. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7820. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7821. if (userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLYGLY" || userModel.F_RoleCode == "GLY")
  7822. {
  7823. string workorderid = RequestString.GetFormString("workorderid");
  7824. string citycode = RequestString.GetFormString("citycode");
  7825. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  7826. if (modelT_Bus_WorkOrder != null && modelT_Bus_WorkOrder.F_WorkState == 1)
  7827. {
  7828. using (TransactionScope trans = new TransactionScope())
  7829. {
  7830. trans.Complete();
  7831. }
  7832. return Success("操作成功");
  7833. }
  7834. else
  7835. {
  7836. return Error("操作失败");
  7837. }
  7838. }
  7839. else
  7840. {
  7841. return Success("权限不足");
  7842. }
  7843. }
  7844. /// <summary>
  7845. /// 退回市工单
  7846. /// </summary>
  7847. /// <returns></returns>
  7848. [Authority]
  7849. public ActionResult RefuseCityWorkOrder()
  7850. {
  7851. int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
  7852. Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
  7853. string workorderid = RequestString.GetFormString("workorderid");
  7854. string reson = RequestString.GetFormString("reson");
  7855. Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
  7856. Model.T_Bus_CityTurn modelT_Bus_CityTurn = new BLL.T_Bus_CityTurn().GetModelList(" F_WorkOrderId='" + workorderid + "' and F_IsDelete=0 ").FirstOrDefault();
  7857. if (modelT_Bus_WorkOrder != null && modelT_Bus_CityTurn != null && modelT_Bus_CityTurn.F_IsSure != 2)
  7858. {
  7859. using (TransactionScope trans = new TransactionScope())
  7860. {
  7861. string signcode = Configs.GetValue("CityOutSignCode");
  7862. string url = Configs.GetValue("CityOutUrl");
  7863. string outsigncode = CommonHelper.getsigncode("CountyBranch", "GetCityDetail", signcode);
  7864. string strparams = "?code=" + modelT_Bus_CityTurn.F_CityCode + "&signcode=" + outsigncode;
  7865. var result = HttpMethods.HttpGet(url + "/CountyBranch/GetCityDetail" + strparams).ToJObject();
  7866. if (result["state"].ToString() == "success")
  7867. {
  7868. var model = result["data"].ToString().ToJObject();
  7869. string turnsigncode = model["F_Sign"].ToString();
  7870. string turnurl = model["F_Url"].ToString();
  7871. string turnoutsigncode = CommonHelper.getsigncode("CountyBusiness", "RefuseCityWorkOrder", turnsigncode);
  7872. string turnstrparams = "workorderid=" + modelT_Bus_CityTurn.F_CityWorkOrderId + "&reson=" + reson + "&signcode=" + turnoutsigncode;
  7873. string turnresultstr = HttpMethods.HttpPost(turnurl + "/CountyBusiness/RefuseCityWorkOrder", turnstrparams);
  7874. var turnresult = turnresultstr.ToJObject();
  7875. if (turnresult["state"].ToString() != "success")
  7876. {
  7877. return Content(turnresultstr);
  7878. }
  7879. }
  7880. modelT_Bus_WorkOrder.F_IsDelete = 1;
  7881. modelT_Bus_WorkOrder.F_DeleteTime = DateTime.Now;
  7882. if (modelT_Bus_WorkOrder.F_IsEnabled == 0)
  7883. {
  7884. modelT_Bus_WorkOrder.F_IsEnabled = 1;
  7885. modelT_Bus_WorkOrder.F_EnableTime = DateTime.Now;
  7886. }
  7887. workorderBLL.Update(modelT_Bus_WorkOrder);
  7888. modelT_Bus_CityTurn.F_IsSure = 2;
  7889. modelT_Bus_CityTurn.F_SureUser = userModel.F_UserCode;
  7890. modelT_Bus_CityTurn.F_SureTime = DateTime.Now;
  7891. modelT_Bus_CityTurn.F_Reson = reson;
  7892. new BLL.T_Bus_CityTurn().Update(modelT_Bus_CityTurn);
  7893. #region 插入操作记录
  7894. Model.T_Bus_Operation oper = new Model.T_Bus_Operation();
  7895. oper.F_WorkOrderId = modelT_Bus_WorkOrder.F_WorkOrderId;
  7896. string userinfo = userModel.depname + "-" + userModel.F_UserName + "(" + userModel.F_UserCode + ")";
  7897. oper.F_Message = userinfo + " 退回了" + modelT_Bus_CityTurn.F_CityName + "工单";
  7898. oper.F_CreateUser = userModel.F_UserCode;
  7899. oper.F_CreateTime = DateTime.Now;
  7900. oper.F_IsDelete = 0;
  7901. operBLL.Add(oper);
  7902. #endregion
  7903. trans.Complete();
  7904. }
  7905. return Success("操作成功");
  7906. }
  7907. else
  7908. {
  7909. return Error("操作失败");
  7910. }
  7911. }
  7912. #endregion
  7913. }
  7914. }