12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Data;
- using System.Collections;
- using LYFZ.ComponentLibrary;
- using System.Drawing;
- using System.IO;
- using System.ComponentModel;
- using System.Globalization;
- using LYFZ.Helper;
- using System.Windows.Forms.DataVisualization.Charting;
- namespace LYFZ.Software.MainBusiness.DoorCityProcess
- {
- public class PublicGraphics
- {
- /// <summary>
- /// 标题字体笔刷
- /// </summary>
- public static Brush btitle = Brushes.White;
- /// <summary>
- /// 标题分割线笔刷
- /// </summary>
- public static Pen ptitle = new Pen(Brushes.White, 1);
- /// <summary>
- /// 标题
- /// </summary>
- public static Brush backColortitle = Brushes.DarkSlateGray;
- /// <summary>
- /// 边框颜色
- /// </summary>
- public static Pen PenborderColor = new Pen(Brushes.LightSlateGray, 1);
- /// <summary>
- /// 单行填充背景颜色
- /// </summary>
- public static Brush brSingle = Brushes.PapayaWhip;
- /// <summary>
- /// 双行填充背景颜色
- /// </summary>
- public static Brush brDouble = Brushes.PowderBlue;
- }
- /// <summary>
- /// 公共处理类
- /// </summary>
- public class PublicCodeClasses
- {
- static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- static LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
- static LYFZ.BLL.BLL_ErpOrderDigitalStatus orsbll = new BLL.BLL_ErpOrderDigitalStatus();
- public delegate void UpdateControl();
- #region 图表颜色
- public static Color[] myChartsColor = new Color[40] {
- Color.Red,//红
- Color.Blue,//蓝
- Color.Yellow,//黄
- Color.Green, //绿
- Color.Orange, //橙
- Color.Cyan, //青
- Color.Purple, //紫
- Color.Gray, //灰 DeepPink
- Color.DarkRed, //深红
- Color.DarkBlue,//深蓝 Maroon
- Color.Gold,//金(大黄)
- Color.DarkGreen,//深绿
- Color.DarkOrange,//深橙
- Color.DarkCyan,//深青
- Color.MediumPurple,//中紫
- Color.DarkGray,//深灰
- Color.PaleVioletRed,//浅红
- Color.LightBlue,
- Color.LightYellow,
- Color.LightGreen,
- Color.LightCyan,
- Color.LightGray,
- Color.MediumVioletRed,//中红
- Color.MediumBlue ,
- Color.MediumSeaGreen,
- Color.MediumSlateBlue,
- Color.MediumSpringGreen,
- Color.Magenta,
- Color.Navy,
- Color.Olive,
- Color.OliveDrab,
- Color.OrangeRed,
- Color.Orchid,
- Color.PaleGoldenrod,
- Color.PaleGreen,
- Color.Peru,
- Color.Crimson,
- Color.BlueViolet,
- Color.Fuchsia,
- Color.LawnGreen
- };
- #endregion
- #region 农历、公历转换
- /// <summary>
- /// 获取公历转成农历
- /// </summary>
- /// <param name="StrDateTime"></param>
- /// <returns></returns>
- public DateTime GetChineseLunisolarCalendar( string StrDateTime )
- {
- ChineseLunisolarCalendar cls = new ChineseLunisolarCalendar();
- DateTime time = Convert.ToDateTime(StrDateTime);
- //获取年
- int Year = Convert.ToInt32(SDateTime.Now.Year);
- //获取月
- int Mouth = Convert.ToInt32(time.Month);
- //获取日
- int Day = Convert.ToInt32(time.Day);
- try
- {
- return cls.ToDateTime(Year, Mouth, Day, 0, 0, 0, 0);
- }
- catch { return cls.ToDateTime(Year, Mouth, Day - 1, 0, 0, 0, 0); }
- }
- /// <summary>
- /// 农历转公历
- /// </summary>
- /// <param name="StrDateTime">农历日期</param>
- public static string GetLunarCalendarToSolarCalendar( string StrDateTime )
- {
- if ( !string.IsNullOrEmpty(StrDateTime) )
- {
- string[] str = StrDateTime.Split('-');
- System.Globalization.ChineseLunisolarCalendar cls = new System.Globalization.ChineseLunisolarCalendar();
- try
- {
- StrDateTime = cls.ToDateTime(Convert.ToInt32(str[0]), Convert.ToInt32(str[1]), Convert.ToInt32(str[2]), 0, 0, 0, 0).ToString();
- return StrDateTime;
- }
- catch
- {
- }
- }
- return "";
- }
- #endregion
- #region DataGridView、Table 相互转换
- /// <summary>
- /// 把DataGridViewEc 放到DataTable
- /// </summary>
- /// <param name="tbl"></param>
- /// <returns></returns>
- public DataTable GetDataGridViewToTable( DataGridViewEc dgvData )
- {
- DataTable newtbl = new DataTable();
- for ( int i = 0; i < dgvData.Columns.Count; i++ )
- {
- DataColumn dc = new DataColumn(dgvData.Columns[i].Name.ToString());
- newtbl.Columns.Add(dc);
- }
- for ( int i = 0; i < dgvData.Rows.Count; i++ )
- {
- DataRow dr = newtbl.NewRow();
- for ( int j = 0; j < dgvData.Columns.Count; j++ )
- {
- dr[j] = Convert.ToString(dgvData.Rows[i].Cells[j].Value.ToString());
- }
- newtbl.Rows.Add(dr);
- }
- return newtbl;
- }
- /// <summary>
- /// 把一个DataTable 放到别一个DataTable,原因是不不让两个DataTable同步
- /// </summary>
- /// <param name="tbl"></param>
- /// <returns></returns>
- public DataTable GetTableToTable( DataTable tbl )
- {
- DataTable newtbl = new DataTable();
- for ( int i = 0; i < tbl.Columns.Count; i++ )
- {
- DataColumn dc = new DataColumn(tbl.Columns[i].ColumnName.ToString());
- newtbl.Columns.Add(dc);
- }
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- DataRow dr = newtbl.NewRow();
- for ( int j = 0; j < tbl.Columns.Count; j++ )
- {
- dr[j] = Convert.ToString(tbl.Rows[i][j].ToString());
- }
- newtbl.Rows.Add(dr);
- }
- return newtbl;
- }
- /// <summary>
- /// 将套系包含商品DataGridView的列和值遍历放置DataTable去
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataTable GetDgvToTable( DataGridView dgv, string OrderNumber, bool NumberType )
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("OPlist_OrderNumber", typeof(string));
- dt.Columns.Add("OPlist_Type", typeof(string));
- dt.Columns.Add("OPlist_ProdNumber", typeof(string));
- dt.Columns.Add("OPlist_ProdName", typeof(string));
- dt.Columns.Add("OPlist_Batch", typeof(string));
- dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
- dt.Columns.Add("OPlist_ProdQuantity", typeof(string));
- dt.Columns.Add("OPlist_IsExpedited", typeof(string));
- dt.Columns.Add("OPlist_PickupTime", typeof(string));
- for ( int i = 0; i < dgv.Rows.Count; i++ )
- {
- DataRow dr = dt.NewRow();
- dr["OPlist_OrderNumber"] = OrderNumber;
- dr["OPlist_Type"] = "0";// 0为套系包含商品 1为服务
- dr["OPlist_ProdNumber"] = dgv.Rows[i].Cells["T_Column1"].Value.ToString().Trim();
- dr["OPlist_ProdName"] = dgv.Rows[i].Cells["T_Column2"].Value.ToString().Trim();
- dr["OPlist_Batch"] = dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim();
- dr["OPlist_ProdSoldPrice"] = dgv.Rows[i].Cells["T_Column3"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column3"].Value.ToString().Trim();
- dr["OPlist_ProdQuantity"] = dgv.Rows[i].Cells["T_Column4"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column4"].Value.ToString().Trim();
- if ( NumberType )
- {
- dr["OPlist_IsExpedited"] = dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim() == "" || dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim() == "否" ? "0" : "1";
- }
- else
- {
- dr["OPlist_IsExpedited"] = "0";
- }
- dr["OPlist_PickupTime"] = dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim() == "null" ? "" : dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim();
- dt.Rows.Add(dr);
- }
- return dt;
- }
- /// <summary>
- /// 将套系包含商品mlist的列和值遍历放置DataTable去
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataTable GetDgvToTable( List<LYFZ.Model.Model_ErpOrderProductList> pllist, string OrderNumber, bool NumberType )
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("OPlist_OrderNumber", typeof(string));
- dt.Columns.Add("OPlist_Type", typeof(string));
- dt.Columns.Add("OPlist_ProdNumber", typeof(string));
- dt.Columns.Add("OPlist_ProdName", typeof(string));
- dt.Columns.Add("OPlist_Batch", typeof(string));
- dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
- dt.Columns.Add("OPlist_ProdQuantity", typeof(string));
- dt.Columns.Add("OPlist_IsExpedited", typeof(string));
- dt.Columns.Add("OPlist_PickupTime", typeof(string));
- for ( int i = 0; i < pllist.Count; i++ )
- {
- DataRow dr = dt.NewRow();
- dr["OPlist_OrderNumber"] = OrderNumber;
- dr["OPlist_Type"] = "0";// 0为套系包含商品 1为服务
- dr["OPlist_ProdNumber"] = pllist[i].OPlist_ProdNumber;
- dr["OPlist_ProdName"] = pllist[i].OPlist_ProdName;
- dr["OPlist_Batch"] = pllist[i].OPlist_Batch;
- dr["OPlist_ProdSoldPrice"] = pllist[i].OPlist_ProdSoldPrice;
- dr["OPlist_ProdQuantity"] = pllist[i].OPlist_ProdQuantity;
- if ( NumberType )
- {
- dr["OPlist_IsExpedited"] = pllist[i].OPlist_IsExpedited;
- }
- else
- {
- dr["OPlist_IsExpedited"] = "0";
- }
- dr["OPlist_PickupTime"] = pllist[i].OPlist_PickupTime;
- dt.Rows.Add(dr);
- }
- return dt;
- }
- /// <summary>
- /// 将服务DataGridView的列和值遍历放置DataTable去
- /// </summary>
- /// <param name="dgv"></param>
- /// <param name="dt"></param>
- /// <returns></returns>
- public DataTable GetDgvToTable( DataTable ddt, DataTable dt, Hashtable htData )
- {
- if ( dt.Rows.Count <= 0 )
- {
- if ( dt.Columns.Count <= 0 )
- {
- dt.Columns.Add("OPlist_OrderNumber", typeof(string));
- dt.Columns.Add("OPlist_Type", typeof(string));
- dt.Columns.Add("OPlist_ProdNumber", typeof(string));
- dt.Columns.Add("OPlist_ProdName", typeof(string));
- dt.Columns.Add("OPlist_Batch", typeof(string));
- dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
- dt.Columns.Add("OPlist_ProdQuantity", typeof(string));
- dt.Columns.Add("OPlist_IsExpedited", typeof(string));
- dt.Columns.Add("OPlist_PickupTime", typeof(string));
- }
- }
- for ( int i = 0; i < ddt.Rows.Count; i++ )
- {
- DataRow dr = dt.NewRow();
- dr["OPlist_OrderNumber"] = htData["OrderNumber"].ToString().Trim();
- dr["OPlist_Type"] = 0;// 0为套系包含商品 1为服务
- dr["OPlist_ProdNumber"] = ddt.Rows[i]["Prod_Number"].ToString().Trim();
- dr["OPlist_ProdName"] = ddt.Rows[i]["Prod_Name"].ToString().Trim();
- dr["OPlist_Batch"] = ddt.Rows[i]["Prod_Batch"].ToString().Trim();
- dr["OPlist_ProdSoldPrice"] = ddt.Rows[i]["Prod_SalesPrice"].ToString().Trim();
- dr["OPlist_ProdQuantity"] = ddt.Rows[i]["Prod_Quantity"].ToString().Trim();
- if ( htData["ProductVesting"].ToString().Trim() == "1" )
- {
- dr["OPlist_IsExpedited"] = ddt.Rows[i]["Prod_Expedited"].ToString().Trim();
- dr["OPlist_PickupTime"] = "NULL";
- }
- else
- {
- dr["OPlist_IsExpedited"] = "";
- dr["OPlist_PickupTime"] = "";
- }
- dt.Rows.Add(dr);
- }
- return dt;
- }
- /// <summary>
- /// 将服务DataGridView的列和值遍历放置DataTable去
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataTable GetDgvToTable( DataRow dtRow, DataTable Oldtbl, Hashtable htData )
- {
- if ( Oldtbl.Columns.Count <= 0 )
- {
- Oldtbl.Columns.Add("OPlist_OrderNumber", typeof(string));
- Oldtbl.Columns.Add("OPlist_Type", typeof(string));
- Oldtbl.Columns.Add("OPlist_ProdNumber", typeof(string));
- Oldtbl.Columns.Add("OPlist_ProdName", typeof(string));
- Oldtbl.Columns.Add("OPlist_Batch", typeof(string));
- Oldtbl.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
- Oldtbl.Columns.Add("OPlist_ProdQuantity", typeof(string));
- Oldtbl.Columns.Add("OPlist_IsExpedited", typeof(string));
- Oldtbl.Columns.Add("OPlist_PickupTime", typeof(string));
- }
- if ( dtRow != null )
- {
- DataRow dr = Oldtbl.NewRow();
- dr["OPlist_OrderNumber"] = htData["OrderNumber"].ToString().Trim();
- dr["OPlist_Type"] = 0;// 0为套系包含商品 1为服务
- dr["OPlist_ProdNumber"] = dtRow["Prod_Number"].ToString().Trim();
- dr["OPlist_ProdName"] = dtRow["Prod_Name"].ToString().Trim();
- dr["OPlist_Batch"] = dtRow["Prod_Batch"].ToString().Trim();
- dr["OPlist_ProdSoldPrice"] = dtRow["Prod_SalesPrice"].ToString().Trim();
- dr["OPlist_ProdQuantity"] = htData["ProductQuantity"].ToString().Trim();
- if ( htData["ProductVesting"].ToString().Trim() == "1" )
- {
- dr["OPlist_IsExpedited"] = dtRow["Prod_Expedited"].ToString().Trim();
- dr["OPlist_PickupTime"] = "NULL";
- }
- else
- {
- dr["OPlist_IsExpedited"] = "";
- dr["OPlist_PickupTime"] = "";
- }
- Oldtbl.Rows.Add(dr);
- }
- return Oldtbl;
- }
- /// <summary>
- /// 将列表中相同的订单合并为一条(用于拍照客人打印——明细、派工)
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataGridViewEx GetDgvToDgv( DataGridViewEc dgv, bool IsSelect = true )
- {
- DataGridViewEx newDgv = new DataGridViewEx();
- for ( int i = 0; i < dgv.Columns.Count; i++ )
- {
- DataGridViewColumn dgvcl = new DataGridViewColumn();
- dgvcl.HeaderText = dgv.Columns[i].HeaderText;
- dgvcl.Name = dgv.Columns[i].Name;
- newDgv.Columns.Add(dgvcl);
- }
- if ( IsSelect )
- {
- for ( int i = 0; i < dgv.SelectedRows.Count; i++ )
- {
- if ( newDgv.Rows.Count == 0 )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.SelectedRows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- else
- {
- bool IsEnter = true;
- for ( int j = 0; j < newDgv.Rows.Count; j++ )
- {
- try
- {
- if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
- {
- string StrSights = newDgv.Rows[j].Cells["景点"].Value.ToString().Trim();
- newDgv.Rows[j].Cells["景点"].Value = StrSights + "," + dgv.SelectedRows[i].Cells["景点"].Value.ToString().Trim();
- IsEnter = false;
- break;
- }
- }
- catch { }
- try
- {
- if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
- {
- if ( Convert.ToDateTime(newDgv.Rows[j].Cells["取件时间"].Value) > Convert.ToDateTime(dgv.SelectedRows[i].Cells["取件时间"].Value) )
- {
- newDgv.Rows[j].Cells["取件时间"].Value = newDgv.Rows[j].Cells["取件时间"].Value.ToString().Trim();
- }
- else
- {
- newDgv.Rows[j].Cells["取件时间"].Value = dgv.SelectedRows[i].Cells["取件时间"].Value.ToString().Trim();
- }
- IsEnter = false;
- break;
- }
- }
- catch { }
- try
- {
- if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
- {
- if ( Convert.ToDateTime(newDgv.Rows[j].Cells["婚庆时间"].Value) > Convert.ToDateTime(dgv.SelectedRows[i].Cells["婚庆时间"].Value) )
- {
- newDgv.Rows[j].Cells["婚庆时间"].Value = newDgv.Rows[j].Cells["婚庆时间"].Value.ToString().Trim();
- }
- else
- {
- newDgv.Rows[j].Cells["婚庆时间"].Value = dgv.SelectedRows[i].Cells["婚庆时间"].Value.ToString().Trim();
- }
- IsEnter = false;
- break;
- }
- }
- catch { }
- }
- if ( IsEnter )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.SelectedRows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- }
- }
- }
- else
- {
- for ( int i = 0; i < dgv.Rows.Count; i++ )
- {
- if ( newDgv.Rows.Count == 0 )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- else
- {
- bool IsEnter = true;
- for ( int j = 0; j < newDgv.Rows.Count; j++ )
- {
- try
- {
- if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
- {
- string StrSights = newDgv.Rows[j].Cells["景点"].Value.ToString().Trim();
- newDgv.Rows[j].Cells["景点"].Value = StrSights + "," + dgv.Rows[i].Cells["景点"].Value.ToString().Trim();
- IsEnter = false;
- break;
- }
- }
- catch { }
- try
- {
- if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
- {
- if ( Convert.ToDateTime(newDgv.Rows[j].Cells["取件时间"].Value) > Convert.ToDateTime(dgv.Rows[i].Cells["取件时间"].Value) )
- {
- newDgv.Rows[j].Cells["取件时间"].Value = newDgv.Rows[j].Cells["取件时间"].Value.ToString().Trim();
- }
- else
- {
- newDgv.Rows[j].Cells["取件时间"].Value = dgv.Rows[i].Cells["取件时间"].Value.ToString().Trim();
- }
- IsEnter = false;
- break;
- }
- }
- catch { }
- try
- {
- if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
- {
- if ( Convert.ToDateTime(newDgv.Rows[j].Cells["婚庆时间"].Value) > Convert.ToDateTime(dgv.Rows[i].Cells["婚庆时间"].Value) )
- {
- newDgv.Rows[j].Cells["婚庆时间"].Value = newDgv.Rows[j].Cells["婚庆时间"].Value.ToString().Trim();
- }
- else
- {
- newDgv.Rows[j].Cells["婚庆时间"].Value = dgv.Rows[i].Cells["婚庆时间"].Value.ToString().Trim();
- }
- IsEnter = false;
- break;
- }
- }
- catch { }
- }
- if ( IsEnter )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- }
- }
- }
- return newDgv;
- }
- /// <summary>
- /// 返回新的DataGridViewEx
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataGridViewEx GetDgvToNewDgv( DataGridViewEx dgv )
- {
- DataGridViewEx newDgv = new DataGridViewEx();
- for ( int i = 0; i < dgv.Columns.Count; i++ )
- {
- DataGridViewColumn dgvcl = new DataGridViewColumn();
- dgvcl.HeaderText = dgv.Columns[i].HeaderText;
- dgvcl.Name = dgv.Columns[i].Name;
- newDgv.Columns.Add(dgvcl);
- }
- for ( int i = 0; i < dgv.Rows.Count; i++ )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- cell.Tag = dgv.Rows[i].Cells[dgv.Columns[j].Name].Tag;
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- return newDgv;
- }
- /// <summary>
- /// 返回新的DataGridViewEc
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataGridViewEc GetDgvToNewDgv( DataGridViewEc dgv )
- {
- DataGridViewEc newDgv = new DataGridViewEc();
- for ( int i = 0; i < dgv.Columns.Count; i++ )
- {
- DataGridViewColumn dgvcl = new DataGridViewColumn();
- dgvcl.HeaderText = dgv.Columns[i].HeaderText;
- dgvcl.Name = dgv.Columns[i].Name;
- newDgv.Columns.Add(dgvcl);
- }
- for ( int i = 0; i < dgv.Rows.Count; i++ )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- cell.Tag = dgv.Rows[i].Cells[dgv.Columns[j].Name].Tag;
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- return newDgv;
- }
- /// <summary>
- /// 门市流程开单里的套系商品合并相同数据_商品表
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataGridViewEx GetDgvMergeDuplicateNewDgv_Prod( DataGridViewEx dgv )
- {
- DataGridViewEx newDgv = new DataGridViewEx();
- for ( int i = 0; i < dgv.Columns.Count; i++ )
- {
- DataGridViewColumn dgvcl = new DataGridViewColumn();
- dgvcl.HeaderText = dgv.Columns[i].HeaderText;
- dgvcl.Name = dgv.Columns[i].Name;
- newDgv.Columns.Add(dgvcl);
- }
- for ( int i = 0; i < dgv.Rows.Count; i++ )
- {
- if ( newDgv.Rows.Count == 0 )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- else
- {
- bool IsEnter = true;
- for ( int j = 0; j < newDgv.Rows.Count; j++ )
- {
- if ( dgv.Rows[i].Cells["T_Column1"].Value.ToString().Trim() == newDgv.Rows[j].Cells["T_Column1"].Value.ToString().Trim() )
- {
- if ( dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim() == newDgv.Rows[j].Cells["T_Column7"].Value.ToString().Trim() )
- {
- if ( dgv.Columns["T_Column5"] != null )
- {
- newDgv.Rows[j].Cells["T_Column5"].Value = dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim();
- }
- if ( dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim() != "" )
- {
- if ( Convert.ToDateTime(dgv.Rows[i].Cells["T_Column6"].Value) > Convert.ToDateTime(newDgv.Rows[j].Cells["T_Column6"].Value) )
- {
- newDgv.Rows[j].Cells["T_Column6"].Value = dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim();
- }
- }
- newDgv.Rows[j].Cells["T_Column4"].Value = (Convert.ToInt32(newDgv.Rows[j].Cells["T_Column4"].Value) + Convert.ToInt32(dgv.Rows[i].Cells["T_Column4"].Value));
- IsEnter = false;
- break;
- }
- }
- }
- if ( IsEnter )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- }
- }
- return newDgv;
- }
- /// <summary>
- /// 门市流程开单里的套系商品合并相同数据_商品表
- /// </summary>
- /// <param name="dgv"></param>
- /// <returns></returns>
- public DataGridViewEx GetDgvMergeDuplicateNewDgv_Service( DataGridViewEx dgv )
- {
- DataGridViewEx newDgv = new DataGridViewEx();
- for ( int i = 0; i < dgv.Columns.Count; i++ )
- {
- DataGridViewColumn dgvcl = new DataGridViewColumn();
- dgvcl.HeaderText = dgv.Columns[i].HeaderText;
- dgvcl.Name = dgv.Columns[i].Name;
- newDgv.Columns.Add(dgvcl);
- }
- for ( int i = 0; i < dgv.Rows.Count; i++ )
- {
- if ( newDgv.Rows.Count == 0 )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- else
- {
- bool IsEnter = true;
- for ( int j = 0; j < newDgv.Rows.Count; j++ )
- {
- if ( dgv.Rows[i].Cells["H_Column1"].Value.ToString().Trim() == newDgv.Rows[j].Cells["H_Column1"].Value.ToString().Trim() )
- {
- newDgv.Rows[j].Cells["H_Column4"].Value = (Convert.ToInt32(newDgv.Rows[j].Cells["H_Column4"].Value) + Convert.ToInt32(dgv.Rows[i].Cells["H_Column4"].Value));
- IsEnter = false;
- break;
- }
- }
- if ( IsEnter )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewTextBoxCell cell = null;
- for ( int j = 0; j < dgv.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- newDgv.Rows.Add(dgvr);
- }
- }
- }
- return newDgv;
- }
- #endregion
- #region 星期几
- /// <summary>
- /// 星期几
- /// </summary>
- public static string CaculateWeekDay( string StrE_WeekDay )
- {
- switch ( StrE_WeekDay )
- {
- case "Monday":
- StrE_WeekDay = "星期一";
- break;
- case "Tuesday":
- StrE_WeekDay = "星期二";
- break;
- case "Wednesday":
- StrE_WeekDay = "星期三";
- break;
- case "Thursday":
- StrE_WeekDay = "星期四";
- break;
- case "Friday":
- StrE_WeekDay = "星期五";
- break;
- case "Saturday":
- StrE_WeekDay = "星期六";
- break;
- case "Sunday":
- StrE_WeekDay = "星期日";
- break;
- }
- return StrE_WeekDay;
- }
- #endregion
- #region 导入相片
- /// <summary>
- /// 默认选择导出的路径
- /// </summary>
- public static string defaultExportFilePath = "";
- /// <summary>
- /// 默认选择导入的路径
- /// </summary>
- public static string defaultImportFilePath = "";
- /// <summary>
- /// 导入初修片
- /// </summary>
- public static bool ImportRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "")
- {
- bool IsSaveed = false;
- string StrStatus = "2";
- List<CommandInfo> clist = new List<CommandInfo>();
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- DateTime StrTime = SDateTime.Now;
- LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
- frm.processName = "初修";
- if ( pickUpStatus.Contains("OK") )
- {
- frm.chkImport.Enabled = false;
- frm.chkImport.Checked = false;
- frm.chkNotImport.Checked = true;
- }
- frm.IsStatusOK = modelEarlyRepairStatus.Ordv_EarlyRepairStatus == "2" ? true : false;
- frm.StrOrdNumber = StrOrdNumber;
- frm.StrOrdViceNumber = StrViceNumber;
- frm.IsShowPwd = true;
- frm.StrType = "3";
- frm.StrStatusText = "初修";
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- if ( !frm.IsImportStatus )
- {
- StrStatus = "1";
- }
- else
- {
- StrStatus = "2";
- }
- if ( frm.IsImport )
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultExportFilePath != "" )
- {
- if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultExportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultExportFilePath = fbd.SelectedPath;//记录选中的目录
- #region 导入像片
- try
- {
- LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
- System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.EarlyRetouch, StrOrdNumber, SightsName);
- if ( strprht == null )
- {
- return false;
- }
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
- List<string> sPrimitivePhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original);
- List<string> sEarlyPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, BLL.SelectPhotoHandling.PhotoType.Original);
- #region 2017-03-12 杨云奕禁用,修改添加入上传队列
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
- IsSaveed = pe.ImportEarlyRetouchFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
- }, width: 500);
- if ( IsSaveed )
- {
- #region 修改导入修片地址
- LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
- modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, strprht.FullName);
- modelOrder.Ord_PhotoBackupPath = "NEW";
- modelOrder.Ord_UpdateDateTime = StrTime;
- modelOrder.Ord_UpdateName = StrUserName;
- clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
- #endregion
- }
- else
- {
- return false;
- }
- }
- else
- {
- LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel()
- {
- service_Path = strprht.FullName.Trim(),
- erpOrder = ord_model,
- directoryType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch,
- erpDigOrder = vmodel,
- sPh = sPh,
- OrdNumber = StrOrdNumber,
- OrdViceNumber = StrViceNumber,
- StrStatus = StrStatus,
- takenName = SightsName,
- comeDirectoryPath = fbd.SelectedPath.ToString().Trim(),
- CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID,
- importGenerateThumbnails = true,//frm.IsSmallMap,
- FrmClist = frm.clist
- };
-
- if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckImportFileByEarlyRetouch(importFileMod) )
- {
- List<string> importedPhotoList = importFileMod.sPh.GetLocalPhotoList(fbd.SelectedPath.ToString().Trim());
- foreach ( string str in importedPhotoList )
- {
- importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel()
- {
- success = false,
- local_Path = str,
- upload_Msg = "",
- user_Time = 0
- });
- }
- string upFileInfo = "";
- ///检查相同订单中是否存在相同的图片
- if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.EarlyRetouch, ref upFileInfo) )
- {
- ///执行导入
- MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod);
- MessageBoxCustom.Show("成功加入导片队列;");
- IsSaveed = true;
- }
- else
- {
- LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo);
- importWarning.TopMost = true;
- importWarning.SbtnContinueImport.Visible = false;
- importWarning.ShowDialog();
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- #endregion
- }
- catch
- {
- MessageBoxCustom.Show("相片初修片路径的访问被拒绝");
- return false;
- }
- #endregion
- }
- else
- {
- return false;
- }
- }
- LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- if ( modelDigital.Ordv_EarlyRepairStatus.Trim() != "2" )
- {
- modelDigital.Ordv_EarlyRepairName = StrUserName;
- modelDigital.Ordv_EarlyRepairTime = StrTime;
- modelDigital.Ordv_EarlyRepairStatus = StrStatus;
- }
- modelDigital.Ordv_UpdateDateTime = StrTime;
- modelDigital.Ordv_UpdateName = StrUserName;
- clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
- DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigitalStatus", StrWhere: "Ords_OrdNumber = '" + StrOrdNumber + "' And Ords_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "*").Tables[0];
- LYFZ.Model.Model_ErpOrderDigitalStatus modelStatus = null;
- if ( dt.Rows.Count > 0 )
- {
- modelStatus = orsbll.DataRowToModel(dt.Rows[0]);
- if ( modelStatus.Ords_OutSendEarlyRepairStatus.Trim() == "已发" || modelStatus.Ords_OutSendEarlyRepairStatus.Trim() == "已回" )
- {
- modelStatus.Ords_OutSendEarlyRepairName = StrUserName;
- modelStatus.Ords_OutSendEarlyRepairStatus = "已回";
- modelStatus.Ords_OutSendEarlyRepairTime = StrTime;
- clist.Add(orsbll.GetUpdateCommandInfo(modelStatus));
- }
- }
- clist.AddRange(frm.clist);
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
- {
- IsSaveed = false;
- MessageBoxCustom.Show("导入失败;");
- }
- else
- {
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- if ( frm.itemEx != null )
- {
- frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.EarlyRetouch);
- }
- }
- MessageBoxCustom.Show("导入成功;");
- }
- _modelDigital = modelDigital;
- IsSaveed = true;
- }
- return IsSaveed;
- }
- /// <summary>
- /// 导入精修片
- /// </summary>
- /// <param name="StrOrdNumber"></param>
- /// <param name="StrViceNumber"></param>
- /// <param name="SightsName"></param>
- /// <returns></returns>
- public static bool ImportRefinedRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName,
- ref LYFZ.Model.Model_ErpOrderDigital _modelDigital,
- string pickUpStatus = "" )
- {
- bool IsSaveed = false;
- string StrStatus = "2";
- List<CommandInfo> clist = new List<CommandInfo>();
- string MainOrderNumber = StrOrdNumber;
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- DateTime StrTime = SDateTime.Now;
- LYFZ.Model.Model_ErpOrderDigital modelRefinedRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
- frm.processName = "精修";
- if ( pickUpStatus.Contains("OK") )
- {
- frm.chkImport.Enabled = false;
- frm.chkImport.Checked = false;
- frm.chkNotImport.Checked = true;
- }
- frm.IsStatusOK = modelRefinedRepairStatus.Ordv_RefinementStatus == "2" ? true : false;
- frm.StrOrdNumber = MainOrderNumber;
- frm.StrOrdViceNumber = StrViceNumber;
- frm.StrStatusText = "精修";
- frm.StrType = "5";
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- if ( !frm.IsImportStatus )
- {
- StrStatus = "1";
- }
- else
- {
- StrStatus = "2";
- }
- if ( frm.IsImport )
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultExportFilePath != "" )
- {
- if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultExportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultExportFilePath = fbd.SelectedPath;
- try
- {
- LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
- System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.FineRetouch, MainOrderNumber, SightsName);
- if ( strprht != null )
- {
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- #region 精修修改 2017-03-12 杨云奕
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
- IsSaveed = pe.ImportFineRetouchFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
- }, width: 500);
- #region 修改
- if ( IsSaveed )
- {
- LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
- modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.FineRetouch, strprht.FullName);
- modelOrder.Ord_PhotoBackupPath = "NEW";
- modelOrder.Ord_UpdateDateTime = StrTime;
- modelOrder.Ord_UpdateName = StrUserName;
- clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
- }
- else
- {
- return false;
- }
- #endregion
- }
- else
- {
- LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel()
- {
- service_Path = strprht.FullName.Trim(),
- erpOrder = ord_model,
- directoryType = Model.Model_ErpOrder.DirectoryType.FineRetouch,
- erpDigOrder = vmodel,
- sPh = sPh,
- OrdNumber = StrOrdNumber,
- OrdViceNumber = StrViceNumber,
- StrStatus = StrStatus,
- takenName = SightsName,
- comeDirectoryPath = fbd.SelectedPath.ToString().Trim(),
- CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID,
- importGenerateThumbnails = true,//frm.IsSmallMap,
- FrmClist = frm.clist
- };
-
- if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckRefinedRepairPiece(importFileMod) )
- {
- string Ordpg_Sights = "";
- if ( sPh.PhotoModel != null )
- {
- Ordpg_Sights = sPh.PhotoModel.Ordpg_Sights.Trim();
- }
- string currentShootingName = Ordpg_Sights;
- string sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(importFileMod.comeDirectoryPath);
- if ( currentShootingName.Length > 0 )
- {
- //选择的来源目录下的目录集合,不含子目录
- string[] tempShootingNameDirectoryNames = System.IO.Directory.GetDirectories(sourceDirectory);
- //判断要导入的源目录下的子目录名是否为当前拍摄阶段名
- bool isCurrentTakenNameInDirName = false;
- if ( tempShootingNameDirectoryNames.Length > 0 )
- {
- string tempDirPath = "";
- foreach ( string dirPath in tempShootingNameDirectoryNames )
- {
- string tempdirName = System.IO.Path.GetFileName(dirPath);
- if ( tempdirName.ToLower() == currentShootingName.ToLower() )
- {
- tempDirPath = dirPath;
- isCurrentTakenNameInDirName = true;
- break;
- }
- }
- if ( isCurrentTakenNameInDirName && tempShootingNameDirectoryNames.Length > 1 )
- {
- sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(tempDirPath);
- }
- }
- }
- List<string> sourcFileList = importFileMod.sPh.GetLocalPhotoList(sourceDirectory);
- foreach ( string str in sourcFileList )
- {
- importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel()
- {
- success = false,
- local_Path = str,
- upload_Msg = "",
- user_Time = 0
- });
- }
- string upFileInfo = "";
- ///检查相同订单中是否存在相同的图片
- if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.FineRetouch, ref upFileInfo) )
- {
- ///执行导入
- MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod);
- MessageBoxCustom.Show("成功加入导片队列;");
- }
- else
- {
- LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo);
- importWarning.TopMost = true;
- importWarning.SbtnContinueImport.Visible = false;
- importWarning.ShowDialog();
- return false;
- }
- }
- else
- {
- return false;
- }
- #endregion
- }
- }
- }
- catch
- {
- MessageBoxCustom.Show("相片精修片路径的访问被拒绝");
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- _modelDigital = modelDigital;
- if ( modelDigital.Ordv_RefinementStatus.Trim() != "2" )
- {
- modelDigital.Ordv_RefinementName = StrUserName;
- modelDigital.Ordv_RefinementStatus = StrStatus;
- modelDigital.Ordv_RefinementTime = StrTime;
- }
- modelDigital.Ordv_UpdateDateTime = StrTime;
- modelDigital.Ordv_UpdateName = StrUserName;
- clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
- clist.AddRange(frm.clist);
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
- {
- MessageBoxCustom.Show("导入失败;");
- }
- else
- {
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- if ( frm.itemEx != null )
- {
- frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.FineRetouch);
- }
- }
- }
- IsSaveed = true;
- }
- return IsSaveed;
- }
- /// <summary>
- /// 导入设计片
- /// </summary>
- /// <param name="StrOrdNumber"></param>
- /// <param name="StrViceNumber"></param>
- /// <param name="SightsName"></param>
- /// <returns></returns>
- public static bool ImportDesignPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "" )
- {
- string StrStatus = "2";
- List<CommandInfo> clist = new List<CommandInfo>();
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- DateTime StrTime = SDateTime.Now;
- LYFZ.Model.Model_ErpOrderDigital modelDesignStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
- if ( pickUpStatus.Contains("OK") )
- {
- frm.chkImport.Enabled = false;
- frm.chkImport.Checked = false;
- frm.chkNotImport.Checked = true;
- }
- frm.IsStatusOK = modelDesignStatus.Ordv_DesignerStatus == "2" ? true : false;
- frm.StrOrdNumber = StrOrdNumber;
- frm.StrOrdViceNumber = StrViceNumber;
- frm.StrType = "4";
- frm.StrStatusText = "设计";
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- if ( !frm.IsImportStatus )
- {
- StrStatus = "1";
- }
- else
- {
- StrStatus = "2";
- }
- if ( frm.IsImport )
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultExportFilePath != "" )
- {
- if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultExportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultExportFilePath = fbd.SelectedPath;
- try
- {
- LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
- System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.DesignPiece, StrOrdNumber, SightsName);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- #region 导入设计 2017-3-12 杨云奕 添加
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
- IsImp = pe.ImportDesignFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
- }, width: 500);
- if ( !IsImp )
- {
- return false;
- }
- LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
- modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName);
- modelOrder.Ord_PhotoBackupPath = "NEW";
- modelOrder.Ord_UpdateDateTime = StrTime;
- modelOrder.Ord_UpdateName = StrUserName;
- clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
- }
- else
- {
- LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel()
- {
- service_Path = strprht.FullName.Trim(),
- erpOrder = ord_model,
- directoryType = Model.Model_ErpOrder.DirectoryType.DesignPiece,
- erpDigOrder = vmodel,
- sPh = sPh,
- OrdNumber = StrOrdNumber,
- OrdViceNumber = StrViceNumber,
- StrStatus = StrStatus,
- takenName = SightsName,
- comeDirectoryPath = fbd.SelectedPath.ToString().Trim(),
- CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID,
- importGenerateThumbnails = true,//frm.IsSmallMap,
- FrmClist = frm.clist
- };
- string msg = "";
- if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckDesignPiece(importFileMod, ref msg) )
- {
- importFileMod.okActive = msg;
- string Ordpg_Sights = "";
- if ( sPh.PhotoModel != null )
- {
- Ordpg_Sights = sPh.PhotoModel.Ordpg_Sights.Trim();
- }
- string currentShootingName = Ordpg_Sights;
- string sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(importFileMod.comeDirectoryPath);
- if ( currentShootingName.Length > 0 )
- {
- //选择的来源目录下的目录集合,不含子目录
- string[] tempShootingNameDirectoryNames = System.IO.Directory.GetDirectories(sourceDirectory);
- //判断要导入的源目录下的子目录名是否为当前拍摄阶段名
- bool isCurrentTakenNameInDirName = false;
- if ( tempShootingNameDirectoryNames.Length > 0 )
- {
- string tempDirPath = "";
- foreach ( string dirPath in tempShootingNameDirectoryNames )
- {
- string tempdirName = System.IO.Path.GetFileName(dirPath);
- if ( tempdirName.ToLower() == currentShootingName.ToLower() )
- {
- tempDirPath = dirPath;
- isCurrentTakenNameInDirName = true;
- break;
- }
- }
- if ( isCurrentTakenNameInDirName && tempShootingNameDirectoryNames.Length > 1 )
- {
- sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(tempDirPath);
- }
- }
- }
- List<string> sourcFileList = importFileMod.sPh.GetLocalPhotoList(sourceDirectory);
- foreach ( string str in sourcFileList )
- {
- importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel()
- {
- success = false,
- local_Path = str,
- upload_Msg = "",
- user_Time = 0
- });
- }
- string upFileInfo = "";
- ///检查相同订单中是否存在相同的图片
- if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.DesignPiece, ref upFileInfo) )
- {
- ///执行导入
- MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod);
- LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
- modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName);
- modelOrder.Ord_PhotoBackupPath = "NEW";
- modelOrder.Ord_UpdateDateTime = StrTime;
- modelOrder.Ord_UpdateName = StrUserName;
- clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
- }
- else
- {
- LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo);
- importWarning.TopMost = true;
- importWarning.SbtnContinueImport.Visible = false;
- importWarning.ShowDialog();
- return false;
- }
- }
- else
- {
- return false;
- }
- //return true;
- #endregion
- }
- }
- catch
- {
- MessageBoxCustom.Show("设计相片路径的访问被拒绝");
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- _modelDigital = modelDigital;
- if ( modelDigital.Ordv_DesignerStatus.Trim() != "2" )
- {
- modelDigital.Ordv_DesignerName = StrUserName;
- modelDigital.Ordv_DesignerTime = StrTime;
- modelDigital.Ordv_DesignerStatus = StrStatus;
- }
- modelDigital.Ordv_UpdateDateTime = StrTime;
- modelDigital.Ordv_UpdateName = StrUserName;
- clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
- modelDigital = _modelDigital;
- #region 导入设计片时,完成所有外发片
- if ( StrStatus.Trim() == "2" )
- {
- LYFZ.BLL.BLL_ErpOrderOutSendDesignList outbll = new BLL.BLL_ErpOrderOutSendDesignList();
- List<LYFZ.Model.Model_ErpOrderOutSendDesignList> mlist = outbll.GetModelList("Odlst_OrdNumber = '" + StrOrdNumber + "' and Odlst_ViceNumber = '" + StrViceNumber + "' and Odlst_SendVendor != ''");
- for ( int i = 0; i < mlist.Count; i++ )
- {
- if ( mlist[i].Odlst_CompletedStatus != "1" )
- {
- mlist[i].Odlst_CompletedStatus = "1";
- mlist[i].Odlst_CompletedTime = StrTime;
- mlist[i].Odlst_CompletedName = StrUserName;
- mlist[i].Odlst_CreateDatetime = StrTime;
- mlist[i].Odlst_CreateName = StrUserName;
- clist.Add(outbll.GetUpdateCommandInfo(mlist[i]));
- }
- }
- }
- #endregion
- clist.AddRange(frm.clist);
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
- {
- MessageBoxCustom.Show("导入失败;");
- return false;
- }
- else
- {
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- if ( frm.itemEx != null )
- {
- frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.DesignPiece);
- }
- }
- }
- return true;
- }
- return false;
- }
- public static bool ImportN8UserPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
- {
- string StrStatus = "2";
- List<CommandInfo> clist = new List<CommandInfo>();
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- DateTime StrTime = SDateTime.Now;
- LYFZ.Model.Model_ErpOrderDigital modelDesignStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
- frm.IsStatusOK = modelDesignStatus.Ordv_DesignerStatus == "2" ? true : false;
- frm.StrOrdNumber = StrOrdNumber;
- frm.StrOrdViceNumber = StrViceNumber;
- frm.StrType = "4";
- frm.StrStatusText = "设计";
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- if ( !frm.IsImportStatus )
- {
- StrStatus = "1";
- }
- else
- {
- StrStatus = "2";
- }
- if ( frm.IsImport )
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultExportFilePath != "" )
- {
- if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultExportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultExportFilePath = fbd.SelectedPath;
- try
- {
- LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
- System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.NemoN8UserDirectory, StrOrdNumber, SightsName);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
- #region 获取N8是否存在已选版完成目录;
- string strN8HasFinishXml = "";
- StringBuilder strN8HasFinishDirectory = new StringBuilder();
- // N8共享目录;
- strN8HasFinishDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory);
- // 是否是儿童订单;
- if ( (EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type) == EnumPublic.OrderType.儿童订单 )
- {
- // 订单号;
- strN8HasFinishDirectory.Append(StrOrdNumber);
- strN8HasFinishDirectory.Append("\\[已选]" + SightsName);
- strN8HasFinishXml = string.Format("{0}{1}_[已选]{2}.xml", LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory, StrOrdNumber, SightsName);
- }
- else
- {
- // 订单号;
- strN8HasFinishDirectory.Append("[已选]" + StrOrdNumber);
- strN8HasFinishXml = string.Format("{0}[已选]{1}.xml", LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory, StrOrdNumber);
- }
- if ( Directory.Exists(strN8HasFinishDirectory.ToString()) )
- {
- if ( MessageBoxCustom.Show("该选版已存在并已完成选版,继续导入将会删除已完成的选片,是否删除重新导入?", "重复提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- return false;
- }
- else
- {
- LYFZ.ExtendControlLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- try
- {
- LYFZ.Network.FileOperations.FileOperation.DeleteDir(strN8HasFinishDirectory.ToString(), true);
- File.Delete(strN8HasFinishXml);
- }
- catch
- {
- }
- });
- }
- }
- #endregion
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
- IsImp = pe.ImportN8UserFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
- }, width: 500);
- if ( !IsImp )
- {
- return false;
- }
- LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
- modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName);
- modelOrder.Ord_PhotoBackupPath = "NEW";
- modelOrder.Ord_UpdateDateTime = StrTime;
- modelOrder.Ord_UpdateName = StrUserName;
- clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
- }
- catch ( Exception ex )
- {
- MessageBoxCustom.Show("N8选版用户目录的访问被拒绝:" + ex.Message);
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- if ( modelDigital.Ordv_DesignerStatus.Trim() != "2" )
- {
- modelDigital.Ordv_DesignerName = StrUserName;
- modelDigital.Ordv_DesignerTime = StrTime;
- modelDigital.Ordv_DesignerStatus = StrStatus;
- }
- modelDigital.Ordv_UpdateDateTime = StrTime;
- modelDigital.Ordv_UpdateName = StrUserName;
- clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
- #region 导入设计片时,完成所有外发片
- if ( StrStatus.Trim() == "2" )
- {
- LYFZ.BLL.BLL_ErpOrderOutSendDesignList outbll = new BLL.BLL_ErpOrderOutSendDesignList();
- List<LYFZ.Model.Model_ErpOrderOutSendDesignList> mlist = outbll.GetModelList("Odlst_OrdNumber = '" + StrOrdNumber + "' and Odlst_ViceNumber = '" + StrViceNumber + "' and Odlst_SendVendor != ''");
- for ( int i = 0; i < mlist.Count; i++ )
- {
- if ( mlist[i].Odlst_CompletedStatus != "1" )
- {
- mlist[i].Odlst_CompletedStatus = "1";
- mlist[i].Odlst_CompletedTime = StrTime;
- mlist[i].Odlst_CompletedName = StrUserName;
- mlist[i].Odlst_CreateDatetime = StrTime;
- mlist[i].Odlst_CreateName = StrUserName;
- clist.Add(outbll.GetUpdateCommandInfo(mlist[i]));
- }
- }
- }
- #endregion
- clist.AddRange(frm.clist);
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
- {
- MessageBoxCustom.Show("导入失败;");
- return false;
- }
- else
- {
- if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
- {
- if ( frm.itemEx != null )
- {
- frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.PrimitivePicture);
- }
- }
- }
- return true;
- }
- return false;
- }
- /// <summary>
- /// 导出原片
- /// </summary>
- /// <param name="StrOrdNumber"></param>
- /// <param name="StrViceNumber"></param>
- /// <param name="SightsName"></param>
- /// <returns></returns>
- public static void ExportOriginalPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
- {
- try
- {
- bool IsSaveed = false;
- DataTable tbl = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "Ordpg_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "Ordpg_Sights").Tables[0];
- bool bZip = false;
- string item = "";
- if ( tbl.Rows.Count > 0 )
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.PhotographedStatusConfirmedSuperSmallForm frm = new SuperSmallForm.PhotographedStatusConfirmedSuperSmallForm();
- frm.tbl = tbl;
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- if ( frm.IsSaveed && frm.Strlist.Count > 0 )
- {
- SightsName = frm.Strlist[0];
- }
- if(IsSaveed)
- {
- bZip = frm.chkZip.Checked;
- }
- }
- if ( IsSaveed )
- {
- LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
- LYFZ.Model.Model_ErpOrderDigital Vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, Vmodel);
- BLL.BLL_ErpCustomer bLL_ErpCustomer = new BLL.BLL_ErpCustomer();
- List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original, SightsName);
- if ( sPhotoList.Count == 0 )
- {
- sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.RawData, SightsName);
- if ( sPhotoList.Count == 0 )
- {
- MessageBoxCustom.Show("此单或景点未导片");
- return;
- }
- }
- if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
- {
- return;
- }
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultImportFilePath != "" )
- {
- if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultImportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, Vmodel);
- IsImp = pe.ExportOriginalFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker);
- //item = model.Ord_Number + "("+ sPh+")";
- }, width: 500);
- item = model.Ord_Number + "("+bLL_ErpCustomer.GetCustomerNameList(model.Ord_Number)+"原片)";
- if ( !IsImp )
- {
- return;
- }
- else
- {
- if(bZip)
- {
- defaultImportFilePath = defaultImportFilePath + "\\" + item;
- if (Directory.Exists(defaultImportFilePath))
- {
- DirectoryInfo info = new DirectoryInfo(defaultImportFilePath);
- if (info is DirectoryInfo)
- {
- LYFZ.CompressionProgress.FormCompressionProgress frm = new CompressionProgress.FormCompressionProgress(
- defaultImportFilePath,
- fbd.SelectedPath + "\\"+ item + ".zip",
- defaultImportFilePath,"",false);
- if (!frm.IsDisposed)
- {
- if (frm.ShowDialog() == DialogResult.No)
- {
- MessageBoxCustom.Show("压缩失败!");
- }
- else
- {
- if (!string.IsNullOrEmpty(item))
- {
- if (System.IO.Directory.Exists(item))
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0, "压缩完成,正在删除缓存......");
- System.IO.Directory.Delete(item, true);
- });
- }
- }
- }
- }
- }
- }
- }
- MessageBoxCustom.Show("导出完毕");
- return;
- }
- }
- }
- }
- catch
- {
- MessageBoxCustom.Show("导片出错");
- }
- }
- static bool ISExportRaw = true;
- /// <summary>
- /// 导出选好的片
- /// </summary>
- /// <returns></returns>
- public static void ExportSelectionPiece( string StrOrdNumber, string StrViceNumber )
- {
- try
- {
- if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
- {
- return;
- }
- LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ExportCategorySuperSmallForm frm12 = new SuperSmallForm.ExportCategorySuperSmallForm();
- frm12.cbxISRaw.Checked = ISExportRaw;
- frm12.ExportDirectoryType = vmodel.GetSelectPhotoDirectoryType();
- frm12.ShowDialog();
- bool isExportRAW = frm12.cbxISRaw.Checked;
- ISExportRaw = isExportRAW;
- if ( frm12.IsSaveed )
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultImportFilePath != "" )
- {
- if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultImportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
- string ExportSelectedToDirPath = "";
- string ShopName = "";
- string cusName = "";
- string showOrderNumber = "";
- bool IsSaveed = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
- // bool IsSaveed = pe.ExportSelectedPhotoFile(fbd.SelectedPath.ToString().Trim(), frm12.IsOriginalFilm, backgroundWorker, true, !frm12.IsProductName, isbarode: frm12.ExportBarcode, isExportRaw: isExportRAW);
- IsSaveed = pe.ExportSelectedFineRetouchPhotoFile(fbd.SelectedPath.ToString().Trim(), frm12.ExportDirectoryType, backgroundWorker, !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ExportedSelectPhotoGenerateZIP, !frm12.IsProductName, isbarode: frm12.ExportBarcode, isExportRaw: isExportRAW);
- if ( IsSaveed )
- {
- ExportSelectedToDirPath = pe.sPhotoHandling.ExportSelectedToDirPath;
- if (String.IsNullOrWhiteSpace(vmodel.Ordv_SelectionShopID))
- {
- vmodel.Ordv_SelectionShopID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID;
- }
- ShopName = LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyIDToShopName(vmodel.Ordv_SelectionShopID);
- cusName = new BLL.BLL_ErpCustomer().GetCustomerNameList(model.Ord_Number, "&");
- showOrderNumber = pe.sPhotoHandling.ShowOrderNumber;
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.相片导入导出, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name + "导出精修数据,订单号:" + StrOrdNumber + "场景编号:" + StrViceNumber, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
-
- }
- }, width: 500);
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ExportedSelectPhotoGenerateZIP)
- {
- if (IsSaveed)
- {
- LYFZ.CompressionProgress.CompressZipPak compressZipPak = new CompressionProgress.CompressZipPak();
- compressZipPak.SourceDirectoryPath = ExportSelectedToDirPath;
- compressZipPak.ToTargetDirectoryPath = fbd.SelectedPath.ToString().Trim();
- compressZipPak.TargetArchFileName = String.Format("{0}_{1}_{2}.zip", ShopName, cusName, showOrderNumber);
- if (compressZipPak.ShowDialog() == DialogResult.OK)
- {
- MessageBoxCustom.Show("已选相片Zip压缩包已生成完成");
- }
- }
- }
- }
- }
- }
- catch
- {
- MessageBoxCustom.Show("导片出错");
- }
- }
-
- /// <summary>
- /// 导出先好的片,用于发片取件
- /// </summary>
- /// <param name="StrOrdNumber"></param>
- /// <param name="StrViceNumber"></param>
- public static void ExportSelectionPiece( string StrOrdNumber, string StrViceNumber, List<LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece> ExportList )
- {
- try
- {
- if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
- {
- return;
- }
- LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ExportCategorySuperSmallForm frm12 = new SuperSmallForm.ExportCategorySuperSmallForm();
- frm12.cbxISRaw.Checked = ISExportRaw;
- frm12.ExportDirectoryType = vmodel.GetSelectPhotoDirectoryType();
- frm12.ShowDialog();
- bool isExportRAW = frm12.cbxISRaw.Checked;
- ISExportRaw = isExportRAW;
- if ( frm12.IsSaveed )
- {
- IEnumerable<IGrouping<string, LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece>> GroupList = ExportList.GroupBy(n => n.StrPath);
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
- List<string> StrExportOkPath = new List<string>();
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- foreach ( IGrouping<string, LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece> item in GroupList )
- {
- List<string> UidList = new List<string>();
- foreach ( LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece value in item )
- {
- UidList.Add(value.StrUID);
- }
- string StrNewPath = item.Key + "_" + model.Ord_SinceOrderNumber + "_发片外发";
- if ( pe.ExportSelectedPhotoFile(StrNewPath, frm12.IsOriginalFilm, backgroundWorker, false, !frm12.IsProductName, isbarode: frm12.ExportBarcode, _UniquelyIdentityList: UidList, isExportRaw: isExportRAW) )
- {
- StrExportOkPath.Add(StrNewPath);
- }
- }
- }, width: 500);
- if ( StrExportOkPath.Count > 0 )
- {
- foreach ( string item in StrExportOkPath )
- {
- if ( Directory.GetDirectories(item).Length > 0 )
- {
- string StrDirectPath = Directory.GetDirectories(item)[0];
- if ( Directory.Exists(StrDirectPath) )
- {
- DirectoryInfo info = new DirectoryInfo(StrDirectPath);
- if ( info is DirectoryInfo )
- {
- LYFZ.CompressionProgress.FormCompressionProgress frm = new CompressionProgress.FormCompressionProgress(StrDirectPath, item + ".zip");
- if ( !frm.IsDisposed )
- {
- if ( frm.ShowDialog() == DialogResult.No )
- {
- MessageBoxCustom.Show("压缩失败!");
- }
- else
- {
- if ( !string.IsNullOrEmpty(item) )
- {
- if ( System.IO.Directory.Exists(item) )
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- backgroundWorker.ReportProgress(0, "压缩完成,正在删除缓存......");
- System.IO.Directory.Delete(item, true);
- });
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- catch
- {
- MessageBoxCustom.Show("导片出错");
- }
- }
- /// <summary>
- /// 导出精修片
- /// </summary>
- public static void ExportRefinedRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
- {
- try
- {
- LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel);
- List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.FineRetouch, BLL.SelectPhotoHandling.PhotoType.Original, SightsName);
- if ( sPhotoList.Count == 0 )
- {
- MessageBoxCustom.Show("此单未导片");
- return;
- }
- if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
- {
- return;
- }
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultImportFilePath != "" )
- {
- if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultImportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
- IsImp = pe.ExportFineRetouchFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker);
- }, width: 500);
- if ( IsImp )
- {
- vmodel.Ordv_ExportRefinement = "已导出";
- new BLL.BLL_ErpOrderDigital().Update(vmodel);
- MessageBoxCustom.Show("导出完毕");
- return;
- }
- }
- }
- catch
- {
- MessageBoxCustom.Show("导片出错");
- }
- }
- /// <summary>
- /// 导出设计片
- /// </summary>
- public static void ExportDesignPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
- {
- try
- {
- LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel);
- List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.DesignPiece, BLL.SelectPhotoHandling.PhotoType.Original, SightsName);
- if ( sPhotoList.Count == 0 )
- {
- MessageBoxCustom.Show("此单未导片");
- return;
- }
- if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
- {
- return;
- }
- LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- string StrLookDesign = Enum.GetName(typeof(LYFZ.EnumPublic.LookDesignStatusEnum), Convert.ToInt32(modelEarlyRepairStatus.Ordv_LookDesignStatus));
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultImportFilePath != "" )
- {
- if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultImportFilePath;
- }
- }
- if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.未看.ToString().Trim() && modelEarlyRepairStatus.GetSelectPhotoDirectoryType() != Model.Model_ErpOrder.DirectoryType.DesignPiece )
- {
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
- IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker);
- }, width: 500);
- if ( !IsImp )
- {
- return;
- }
- else
- {
- vmodel.Ordv_ExportDesign = "已导出";
- new BLL.BLL_ErpOrderDigital().Update(vmodel);
- MessageBoxCustom.Show("设计片导出完毕");
- return;
- }
- }
- }
- else
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.DesignExportOptionSuperSmallForm frm = new SuperSmallForm.DesignExportOptionSuperSmallForm();
- if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.OK.ToString().Trim() )
- {
- frm.IntEditDesign_Visible = false;
- }
- else
- {
- frm.IntEditDesign_Visible = true;
- }
- if ( modelEarlyRepairStatus.GetSelectPhotoDirectoryType() == Model.Model_ErpOrder.DirectoryType.DesignPiece )
- {
- frm.IntSelectDesign_Visible = true;
- }
- else
- {
- frm.IntSelectDesign_Visible = false;
- }
- frm.ShowDialog();
- if ( !frm.IsSave )
- {
- return;
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
- if ( frm.OutOption == "Design" )
- {
- IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker);
- }
- else if ( frm.OutOption == "EditDesign" )
- {
- IsImp = pe.ExportSelectedDesignFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker);
- }
- else if ( frm.OutOption == "LookOk" )
- {
- IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), true, backgroundWorker);
- }
- else if ( frm.OutOption == "SelectDesign" )
- {
- IsImp = pe.ExportSelectedDesignPhotoFile(fbd.SelectedPath.ToString().Trim(), backgroundWorker, true, frm.IsCreateProductFolder, isbarode: frm.ExportBarcode);
- }
- }, width: 500);
- if ( !IsImp )
- {
- return;
- }
- else
- {
- if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.OK.ToString().Trim() )
- {
- vmodel.Ordv_ExportDesign = "已导出";
- new BLL.BLL_ErpOrderDigital().Update(vmodel);
- MessageBoxCustom.Show("已确认设计片导出完毕");
- return;
- }
- }
- }
- }
- }
- catch { MessageBoxCustom.Show("导片出错"); }
- }
- public static void ExportN8Piece( string StrOrdNumber, string StrViceNumber, string SightsName )
- {
- try
- {
- LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel);
- #region 判断是否已经完成N8选版,若完成才能导出;
- // 判断是否是儿童订单;
- StringBuilder strN8HasFinishUserDirectory = new StringBuilder();
- if ( (EnumPublic.OrderType)Convert.ToInt32(model.Ord_Type) == EnumPublic.OrderType.儿童订单 )
- {
- strN8HasFinishUserDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory);
- strN8HasFinishUserDirectory.Append(StrOrdNumber);
- strN8HasFinishUserDirectory.Append("\\[已选]" + SightsName);
- }
- else
- {
- strN8HasFinishUserDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory);
- strN8HasFinishUserDirectory.Append("[已选]" + StrOrdNumber);
- }
- if ( !Directory.Exists(strN8HasFinishUserDirectory.ToString()) )
- {
- MessageBoxCustom.Show("该选版未完成,不能导出");
- return;
- }
- #endregion
- if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
- {
- return;
- }
- LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
- string StrLookDesign = Enum.GetName(typeof(LYFZ.EnumPublic.LookDesignStatusEnum), Convert.ToInt32(modelEarlyRepairStatus.Ordv_LookDesignStatus));
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- if ( defaultImportFilePath != "" )
- {
- if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
- {
- fbd.SelectedPath = defaultImportFilePath;
- }
- }
- if ( fbd.ShowDialog() == DialogResult.OK )
- {
- defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
- bool IsImp = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
- {
- LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
- IsImp = pe.ExportN8Film(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker);
- }, width: 500);
- if ( !IsImp )
- {
- return;
- }
- else
- {
- MessageBoxCustom.Show("N8选版导出完毕");
- return;
- }
- }
- }
- catch { MessageBoxCustom.Show("导片出错"); }
- }
- #endregion
- #region 解
- /// <summary>
- /// 给外部调用的DES算法解密。
- /// </summary>
- public static string DecryptDES( string decryptString )
- {
- return DecryptDES(decryptString, "cust-stu");
- }
- /// <summary>
- /// DES解密字符串
- /// </summary>
- /// <param name="decryptString">待解密的字符串</param>
- /// <param name="decryptKey">解密密钥,要求为8位,和加密密钥相同</param>
- /// <returns>解密成功返回解密后的字符串,失败返源串</returns>
- private static string DecryptDES( string decryptString, string decryptKey )
- {
- try
- {
- byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey);
- byte[] rgbIV = DesKeys;
- byte[] inputByteArray = Convert.FromBase64String(decryptString);
- System.Security.Cryptography.DESCryptoServiceProvider DCSP = new System.Security.Cryptography.DESCryptoServiceProvider();
- System.IO.MemoryStream mStream = new System.IO.MemoryStream();
- System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), System.Security.Cryptography.CryptoStreamMode.Write);
- cStream.Write(inputByteArray, 0, inputByteArray.Length);
- cStream.FlushFinalBlock();
- return Encoding.UTF8.GetString(mStream.ToArray());
- }
- catch
- {
- return decryptString;
- }
- }
- #endregion
- #region 接单人控件
- /// <summary>
- /// 接单人员
- /// </summary>
- /// <param name="txtPersonnel">接单人员控件</param>
- /// <param name="IsShowType">是否显示接单类型</param>
- /// <param name="IsShowResign">是否显示离职人员</param>
- public void txtOrdersPerson( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, bool IsShowType = true, bool IsShowResign = false )
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm frm = new SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm();
- frm.txtPersonnel = txtPersonnel;
- frm.IsShowType = IsShowType;
- frm.IsShowResign = IsShowResign;
- frm.ShowDialog();
- txtPersonnel.Text = frm.txtPersonnel.Text;
- txtPersonnel.Tag = frm.txtPersonnel.Tag;
- }
- /// <summary>
- /// 接单人员
- /// </summary>
- /// <param name="txtPersonnel">接单人员控件</param>
- /// <param name="IsShowType">是否显示接单类型</param>
- /// <param name="IsShowResign">是否显示离职人员</param>
- public string txtOrdersPerson( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, string strJsonData, bool IsShowType = true, bool IsShowResign = false )
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm frm = new SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm(strJsonData);
- frm.txtPersonnel = txtPersonnel;
- frm.IsShowType = IsShowType;
- frm.IsShowResign = IsShowResign;
- frm.cbxAchievement.Visible = false;
- frm.ShowDialog();
- txtPersonnel.Text = frm.txtPersonnel.Text;
- txtPersonnel.Tag = frm.txtPersonnel.Tag;
- strJsonData = "";
- if ( frm.cbxAchievement.Checked )
- {
- strJsonData = frm.ratioBll.ToString();
- }
- return strJsonData;
- }
- /// <summary>
- /// 接单人员——获取Value(员工编号) 或 Tag(主或副门市)
- /// </summary>
- /// <param name="txtPersonnel">接单人员控件</param>
- /// <param name="bl">True:(员工编号),False:Tag(主或副门市)</param>
- /// <returns></returns>
- public string txtOrdersPersonGetValueOrTag( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, bool bl = true )
- {
- if ( txtPersonnel.Tag != null )
- {
- if ( bl )
- {
- string[] StrValue = txtPersonnel.Tag.ToString().Trim().Split('|');
- return StrValue[0].Trim();
- }
- else
- {
- string[] StrTag = txtPersonnel.Tag.ToString().Trim().Split('|');
- return StrTag[1].Trim();
- }
- }
- return "";
- }
- #endregion
- #region 控件值的优化
- /// <summary>
- /// 获取自定义控件的Text值(去掉空格后的值)
- /// </summary>
- /// <param name="maskedTextBoxEx">自定义控件</param>
- /// <returns></returns>
- public static string MaskedTextBoxExGetText( MaskedTextBoxEx maskedTextBoxEx )
- {
- //char[] charList = maskedTextBoxEx.Text.ToCharArray();
- //string StrChar = "";
- //for (int i = 0; i < charList.Length; i++)
- //{
- // if (charList[i].ToString().Trim() != "")
- // { StrChar += charList[i].ToString().Trim(); }
- //}
- //return StrChar;
- return maskedTextBoxEx.Text.Trim().Replace(" ", "");
- }
- /// <summary>
- /// 写日志
- /// </summary>
- /// <param name="txt">日志内容</param>
- /// <param name="fullPath">日志文件全路径</param>
- public static void WriteLogs( string txt, string fullPath )
- {
- if ( fullPath.LastIndexOf(@"\") == (fullPath.Length - 1) )
- {
- fullPath = fullPath + "new.txt";
- }
- else
- {
- fullPath = fullPath + "\\new.txt";
- }
- using ( System.IO.StreamWriter sw = new System.IO.StreamWriter(fullPath, true, Encoding.UTF8) )
- {
- sw.WriteLine(txt);
- sw.Flush();
- sw.Close();
- }
- }
- /// <summary>
- /// 隐藏电话号码控件字符
- /// </summary>
- /// <param name="objValue"></param>
- public static void HidePhoneControls( LYFZ.ComponentLibrary.MaskedTextBoxEx objValue )
- {
- bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
- if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
- {
- objValue.PasswordChar = '*';
- }
- }
- /// <summary>
- /// 隐藏电话号码控件字符
- /// </summary>
- /// <param name="objValue"></param>
- public static void HidePhoneControls( LYFZ.ComponentLibrary.TextBoxEx objValue )
- {
- bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
- if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
- {
- objValue.PassChar = '*';
- }
- }
- /// <summary>
- /// 隐藏电话号码控件字符
- /// </summary>
- /// <param name="objValue"></param>
- public static void HidePhoneControls( LYFZ.ComponentLibrary.TextBoxBasicEx objValue )
- {
- bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
- if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
- {
- objValue.PasswordChar = '*';
- }
- }
- /// <summary>
- /// 隐藏电话号码控件字符
- /// </summary>
- /// <param name="objValue"></param>
- public static string HidePhoneControls( object objValue )
- {
- if ( !string.IsNullOrEmpty(objValue.ToString().Trim()) )
- {
- bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
- if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
- {
- return LYFZ.Command.Command_Validate.HidePhone(objValue);
- }
- else
- {
- return objValue.ToString().Trim();
- }
- }
- return "";
- }
- #endregion
- #region 计件提成点绑定
- /// <summary>
- /// 计件提成点绑定
- /// </summary>
- /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
- /// <param name="treev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="StrWhere">查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等</param>
- public static void BindTreeView_PieceCommission( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx treev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" )
- {
- string ExecuteSql = orbll.GetView_CustomReturnExecuteSql("tb_ErpSystemCategory", StrWhere: StrWhere, ShowColumnName: "ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID");
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("tb_ErpWageCommissionSet", StrWhere: "", ShowColumnName: "Wcs_TypeCode,Wcs_Percentage");
- DataSet dtSet = orbll.GetView_Custom(ExecuteSql);
- DataTable tbl = dtSet.Tables["ds"];
- DataTable tbl2 = dtSet.Tables["ds1"];
- treev.Nodes.Clear();
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- TreeNode root = null;
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- treev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- DataRow[] dtRow3 = tbl.Select("Sc_ClassParentID = '" + dtRow2[i]["ID"].ToString().Trim() + "'");
- if ( dtRow3.Length > 0 )
- {
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- CreateTreeViewPieceCommission(root, dtRow2[i]["ID"].ToString(), tbl, tbl2, dtRow3);
- }
- else
- {
- DataRow[] dtRow4 = tbl2.Select("Wcs_TypeCode = '" + dtRow2[i]["Sc_ClassCode"].ToString().Trim() + "'");
- if ( dtRow4.Length > 0 )
- {
- root.Text = dtRow2[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow2[i]["Sc_ClassName"].ToString(), 0) + dtRow4[0]["Wcs_Percentage"].ToString().Trim();
- }
- else
- {
- root.Text = dtRow2[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow2[i]["Sc_ClassName"].ToString(), 0) + "0";
- }
- }
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- treev.Nodes.Add(root);
- }
- treev.ExpandAll();
- }
- }
- /// <summary>
- /// 第二级绑定
- /// </summary>
- /// <param name="nodes">父节点</param>
- /// <param name="ClassParentID">父节点的ID</param>
- /// <param name="tbl">当前数据源</param>
- private static void CreateTreeViewPieceCommission( TreeNode nodes, string ClassParentID, DataTable tbl, DataTable tbl2, DataRow[] dtRow )
- {
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- DataRow[] dtRow1 = tbl.Select("Sc_ClassParentID = '" + dtRow[i]["ID"].ToString().Trim() + "'");
- if ( dtRow1.Length > 0 )
- {
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- CreateTreeViewPieceCommission(node, dtRow[i]["ID"].ToString(), tbl, tbl2, dtRow1);
- }
- else
- {
- DataRow[] dtRow4 = tbl2.Select("Wcs_TypeCode = '" + dtRow[i]["Sc_ClassCode"].ToString().Trim() + "'");
- if ( dtRow4.Length > 0 )
- {
- node.Text = dtRow[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow[i]["Sc_ClassName"].ToString(), 1) + dtRow4[0]["Wcs_Percentage"].ToString().Trim();
- }
- else
- {
- node.Text = dtRow[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow[i]["Sc_ClassName"].ToString(), 1) + "0";
- }
- }
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- nodes.Nodes.Add(node);
- //CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl);
- }
- }
- }
- private static string AddEmpty( string StrText, int Intlevel, int EmptyCount = 40 )
- {
- string StrEmpty = "";
- int TextCount = 0;
- char[] strArray = StrText.ToCharArray();
- for ( int i = 0; i < strArray.Length; i++ )
- {
- //TextCount += 2;
- if ( LYFZ.Command.Command_Validate.IsChinese(strArray[i].ToString()) )
- {
- TextCount += 2;
- }
- else
- {
- TextCount++;
- }
- }
- EmptyCount -= TextCount;
- if ( Intlevel == 1 )
- {
- EmptyCount -= 3;
- }
- for ( int i = 0; i < EmptyCount; i++ )
- {
- StrEmpty += " ";
- }
- return StrEmpty;
- }
- #endregion
- #region 系统类别设置绑定
- /// <summary>
- /// 系统设置的绑定数据
- /// </summary>
- /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
- /// <param name="treev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="StrWhere">查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等</param>
- public static void BindTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx treev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" )
- {
- DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0];
- treev.Nodes.Clear();
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- TreeNode root = null;
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- treev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- CreateTreeView(root, dtRow2[i]["ID"].ToString(), tbl);
- treev.Nodes.Add(root);
- }
- treev.ExpandAll();
- }
- }
- /// <summary>
- /// 第二级绑定
- /// </summary>
- /// <param name="nodes">父节点</param>
- /// <param name="ClassParentID">父节点的ID</param>
- /// <param name="tbl">当前数据源</param>
- private static void CreateTreeView( TreeNode nodes, string ClassParentID, DataTable tbl )
- {
- DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- nodes.Nodes.Add(node);
- CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl);
- }
- }
- }
- #endregion
- #region 产品查看图片
- /// <summary>
- /// 产品查看图片
- /// </summary>
- /// <param name="StrProductNumber"></param>
- public static void ProductViewPhoto( string StrProductNumber )
- {
- DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: " Prod_Number = '" + StrProductNumber + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
- if ( tbl.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()) )
- {
- try
- {
- LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- frm.FrmImage = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
- //frm.WindowState = FormWindowState.Maximized;
- frm.ShowDialog();
- }
- catch
- {
- MessageBoxCustom.Show("获取图片出错!");
- }
- }
- else
- {
- MessageBoxCustom.Show("未上传图片!");
- }
- }
- }
- #endregion
- #region QQ与电话呼叫
- /// <summary>
- /// QQ呼叫
- /// </summary>
- /// <param name="StrQQ"></param>
- public static void QQCall( string StrQQ )
- {
- if ( StrQQ.Trim() != "" )
- {
- WebBrowser wb = new WebBrowser();
- wb.Url = new Uri("http://wpa.qq.com/msgrd?v=3&uin=" + StrQQ + "&site=qq&menu=yes");
- }
- else
- {
- MessageBoxCustom.Show("请输入要联系的QQ帐号!");
- }
- }
- /// <summary>
- /// 电话呼叫
- /// </summary>
- /// <param name="mskText"></param>
- public static void PhoneCall( LYFZ.ComponentLibrary.MaskedTextBoxEx mskText )
- {
- try
- {
- LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(PublicCodeClasses.MaskedTextBoxExGetText(mskText));
- if ( !string.IsNullOrEmpty(PublicCodeClasses.MaskedTextBoxExGetText(mskText)) && LYFZ.Command.Command_Validate.IsMobilePhone(PublicCodeClasses.MaskedTextBoxExGetText(mskText)) &&
- cwbll.ProgramStarts() == true )
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.CallPhoneMessage callPhone = new SetSmallForm.CallPhoneMessage();
- callPhone.phoneNumber = PublicCodeClasses.MaskedTextBoxExGetText(mskText);
- callPhone.ShowDialog();
- }
- }
- catch ( Exception ex )
- {
- MessageBoxCustom.Show(ex.Message);
- }
- }
- /// <summary>
- /// 电话呼叫
- /// </summary>
- /// <param name="mskText"></param>
- public static void PhoneCall( object obj )
- {
- try
- {
- if ( string.IsNullOrEmpty(obj.ToString().Trim()) )
- {
- return;
- }
- if ( !LYFZ.Command.Command_Validate.IsMobilePhone(obj.ToString()) )
- {
- MessageBoxCustom.Show("请输入完整呼叫号码!");
- return;
- }
- LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
- if ( cwbll.ProgramStarts() == false )
- {
- MessageBoxCustom.Show("来电精灵未启动,请启动");
- return;
- }
- cwbll.GetCPhone(obj.ToString());
- }
- catch ( Exception ex )
- {
- }
- }
- #endregion
- #region 处理像片,处理于像片保到数据库与从数据库中拿放到PictureBox中去
- /// <summary>
- /// 获取图片,将图片转成Byte[],用于存入数据库
- /// </summary>
- /// <returns></returns>
- public static byte[] ImageDatabytes( PictureBox pict )
- {
- byte[] Photo_Byte = null;
- if ( pict.Image != null )
- {
- using ( MemoryStream ms = new MemoryStream() )
- {
- try
- {
- Bitmap bmp = new Bitmap(pict.Image);
- bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
- Photo_Byte = new byte[ms.Length];
- ms.Position = 0;
- ms.Read(Photo_Byte, 0, Convert.ToInt32(ms.Length));
- bmp.Dispose();
- }
- catch { }
- }
- }
- return Photo_Byte;
- }
- /// <summary>
- /// 获取图片,将图片转成Byte[],用于存入数据库
- /// </summary>
- /// <returns></returns>
- public static byte[] ImageDatabytes( string StrPath )
- {
- if ( !File.Exists(StrPath) )
- return null;
- byte[] bmpBytes = File.ReadAllBytes(StrPath);
- return bmpBytes;
- }
- /// <summary>
- /// 把Byte[]转成Image图片显示(数据库字段类型为:Image)
- /// </summary>
- /// <param name="ImageDatas"></param>
- /// <returns></returns>
- public static Bitmap GetImage( byte[] ImageDatas )
- {
- try
- {
- using ( MemoryStream ImageMS = new MemoryStream() )
- {
- ImageMS.Write(ImageDatas, 0, ImageDatas.Length);
- Bitmap resultBitmap = new Bitmap(ImageMS);
- return resultBitmap;
- }
- }
- catch
- {
- return null;
- }
- }
- /// <summary>
- /// 把字节型转换成十六进制字符串
- /// </summary>
- /// <param name="bytes"></param>
- /// <returns></returns>
- public static string ToHexString( byte[] bytes )
- {
- string hexString = string.Empty;
- if ( bytes != null )
- {
- StringBuilder strB = new StringBuilder();
- for ( int i = 0; i < bytes.Length; i++ )
- {
- strB.Append(bytes[i].ToString("X2"));
- }
- hexString = strB.ToString();
- }
- return hexString;
- }
- /// <summary>
- /// 把十六进制字符串转换成字节型
- /// </summary>
- /// <param name="InString"></param>
- /// <returns></returns>
- public static byte[] StringToByte( string hexString )
- {
- hexString = hexString.Replace(" ", "");
- if ( (hexString.Length % 2) != 0 )
- hexString += " ";
- byte[] returnBytes = new byte[hexString.Length / 2];
- for ( int i = 0; i < returnBytes.Length; i++ )
- returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
- return returnBytes;
- }
- #endregion
- #region 下拉框绑定
- /// <summary>
- /// 下拉框绑定
- /// </summary>
- /// <param name="cmb"></param>
- /// <param name="StrBindData"></param>
- public static void BindCombox( LYFZ.ComponentLibrary.ComboBoxEx cmb, string StrBindData, bool IsFirstNodeNull = false )
- {
- cmb.Items.Clear();
- if ( !string.IsNullOrEmpty(StrBindData.Trim()) )
- {
- string[] StrArray = StrBindData.Split(',');
- for ( int i = 0; i < StrArray.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- cmb.Items.Add("");
- }
- }
- if ( !string.IsNullOrEmpty(StrArray[i].Trim()) )
- {
- cmb.Items.Add(StrArray[i].Trim());
- }
- }
- }
- }
- /// <summary>
- /// 下拉树绑定
- /// </summary>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="StrBindData">字符串数据</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="IsSplit">每组中是否要再次分割(Tag:数组0;Text:数组1)</param>
- /// <param name="IsFirstNodeName">要分割的分割符</param>
- public static void BindComboxTreeView( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrBindData, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsSplit = false, char StrSplitSymbol = ':' )
- {
- cmbtreev.Nodes.Clear();
- if ( !string.IsNullOrEmpty(StrBindData.Trim()) )
- {
- string[] StrArray = StrBindData.Split(',');
- TreeNode root = null;
- for ( int i = 0; i < StrArray.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- if ( !string.IsNullOrEmpty(StrArray[i].Trim()) )
- {
- root = new TreeNode();
- if ( IsSplit )
- {
- string[] StrSplitArray = StrArray[i].Trim().Split(StrSplitSymbol);
- root.Text = StrSplitArray[1].Trim();
- root.Tag = StrSplitArray[0].Trim();
- }
- else
- {
- root.Text = StrArray[i].Trim();
- root.Tag = StrArray[i].Trim();
- }
- root.Name = StrArray[i].Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- }
- }
- #endregion
- #region 部门设置的绑定数据
- /// <summary>
- /// 部门设置的绑定数据
- /// </summary>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="StrWhere">查询条件,比如 ID!='1' 等</param>
- public static void BindComboBoxTreeView_DepartmentSet( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null )
- {
- if ( tbl == null )
- {
- tbl = orbll.GetView_Custom("tb_ErpDepartment", StrWhere: StrWhere, ShowColumnName: "ID,Dt_Name").Tables[0];
- }
- cmbtreev.Nodes.Clear();
- TreeNode root = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Dt_Name"].ToString();
- root.Tag = tbl.Rows[i]["ID"].ToString();
- root.Name = tbl.Rows[i]["ID"].ToString();
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- #endregion
- #region 分店信息绑定数据
- /// <summary>
- /// 分店信息绑定数据
- /// </summary>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="StrWhere">查询条件,比如 ID!='1' 等</param>
- public static void BindComboBoxTreeView_StoreNameSet( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null )
- {
- if ( tbl == null )
- {
- tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
- }
- cmbtreev.Nodes.Clear();
- TreeNode root = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Company_Name"].ToString().Trim();
- root.Tag = tbl.Rows[i]["Company_DividedShop"].ToString().Trim();
- root.Name = tbl.Rows[i]["ID"].ToString().Trim();
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- /// <summary>
- /// 分店信息绑定数据
- /// </summary>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="StrWhere">查询条件,比如 ID!='1' 等</param>
- public static void BindComboBoxTreeView_StoreName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string IsFirstNodeName = " " )
- {
- DataTable tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
- cmbtreev.Nodes.Clear();
- TreeNode root = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 && tbl.Rows.Count > 1 )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Company_Name"].ToString().Trim();
- root.Tag = tbl.Rows[i]["Company_DividedShop"].ToString().Trim();
- root.Name = tbl.Rows[i]["ID"].ToString().Trim();
- cmbtreev.TreeView.Nodes.Add(root);
- }
- if ( tbl.Rows.Count > 1 )
- {
- cmbtreev.TextFindTag(IsFirstNodeName);
- }
- else
- {
- cmbtreev.TagFindText(tbl.Rows[0]["Company_DividedShop"].ToString().Trim());
- }
- }
- #endregion
- #region 套系类别与套系名称绑定
- /// <summary>
- /// 套系类别与套系名称绑定
- /// </summary>
- /// <param name="cmbtreev">控件</param>
- /// <param name="StrParentCode">父节点ID</param>
- /// <param name="IsFirstNodeNull">第一节点是否为空</param>
- /// <param name="IsPackagesNameNull">是要过滤套系类别没有设置套系名称的节点</param>
- public static void BindComboBoxTreeView_PackagesCategoryAndName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrParentCode, bool IsFirstNodeNull = false, bool IsPackagesNameNull = true )
- {
- LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- DataTable tblBigCategory = scbll.GetAllList().Tables[0];
- DataTable tblpak = orbll.GetView_Custom("tb_ErpPackages", StrWhere: "Pak_IsDisable = '0'", ShowColumnName: "ID,Pak_PackagesClass,Pak_Name,Pak_PackagesID,Pak_UnitPrice").Tables[0];
- DataTable tbl = scbll.GetListAccordingToClassCode(StrParentCode).Tables[0];
- cmbtreev.Nodes.Clear();
- if ( tbl.Rows.Count > 0 )
- {
- TreeNode root = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = " ";
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- bool IsRun = false;
- if ( IsPackagesNameNull )
- {
- DataRow[] dtRow = tblBigCategory.Select("Sc_ClassParentID='" + tbl.Rows[i]["ID"].ToString().Trim() + "'");
- if ( dtRow.Length > 0 )
- {
- string Strsql = "";
- for ( int j = 0; j < dtRow.Length; j++ )
- {
- if ( j == 0 )
- {
- Strsql += " Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'";
- }
- else
- {
- Strsql += " or Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'";
- }
- }
- //DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'");
- DataRow[] dtRow2 = tblpak.Select(Strsql);
- if ( dtRow2.Length <= 0 )
- {
- IsRun = true;
- }
- else
- {
- IsRun = false;
- }
- }
- else
- {
- DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + tbl.Rows[i]["Sc_ClassCode"].ToString().Trim() + "'");
- if ( dtRow2.Length <= 0 )
- {
- IsRun = true;
- }
- }
- }
- if ( IsRun )
- {
- continue;
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
- root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
- root.Name = "true";
- CreateTreeViewPackagesCategoryAndName(root, tbl.Rows[i]["ID"].ToString(), tbl.Rows[i]["Sc_ClassCode"].ToString(), tblBigCategory, tblpak, IsPackagesNameNull);
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- }
- /// <summary>
- /// 绑定第二级套系名称
- /// </summary>
- /// <param name="nodes">节点</param>
- /// <param name="ClassParentID">父节点ID</param>
- /// <param name="ClassCode">套系名称编号</param>
- /// <param name="ustbl">套系类别数据源</param>
- /// <param name="tblpak">套系名称数据源</param>
- private static void CreateTreeViewPackagesCategoryAndName( TreeNode nodes, string ClassParentID, string ClassCode, DataTable ustbl, DataTable tblpak, bool IsPackagesNameNull )
- {
- if ( ClassCode != "" )
- {
- if ( ustbl.Rows.Count <= 0 )
- {
- ustbl = new BLL.BLL_ErpSystemCategory().GetAllList().Tables[0];
- }
- DataRow[] dtRow = ustbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- if ( IsPackagesNameNull )
- {
- DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + dtRow[i]["Sc_ClassCode"].ToString() + "'");
- if ( dtRow2.Length <= 0 )
- {
- continue;
- }
- }
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- node.Name = "true";
- nodes.Nodes.Add(node);
- GetPak(node, dtRow[i]["Sc_ClassCode"].ToString(), tblpak);
- }
- }
- else
- {
- if ( IsPackagesNameNull )
- {
- DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + ClassCode + "'");
- if ( dtRow2.Length <= 0 )
- {
- return;
- }
- }
- GetPak(nodes, ClassCode, tblpak);
- }
- }
- }
- /// <summary>
- /// 绑定第三级套系名称
- /// </summary>
- /// <param name="nodes">TreeView的子节点</param>
- /// <param name="ClassCode">编码</param>
- public static void GetPak( TreeNode nodes, string ClassCode, DataTable tblpak )
- {
- if ( tblpak.Rows.Count <= 0 )
- {
- tblpak = new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpPackages", StrWhere: "Pak_IsDisable = '0'", ShowColumnName: "ID,Pak_PackagesClass,Pak_Name,Pak_PackagesID,Pak_UnitPrice,Pak_IsDisable").Tables[0];
- }
- DataRow[] dtRow = tblpak.Select("Pak_PackagesClass = '" + ClassCode + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Pak_Name"].ToString();
- node.Tag = dtRow[i]["Pak_PackagesID"].ToString();
- node.Name = dtRow[i]["Pak_UnitPrice"].ToString();
- nodes.Nodes.Add(node);
- }
- }
- }
- #endregion
- #region 系统类别设置绑定
- /// <summary>
- /// 系统设置的绑定数据
- /// </summary>
- /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
- /// <param name="StrWhere">查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等</param>
- /// <param name="IsBindParent">是否把当前参数StrParentCode做为主级</param>
- public static void BindComboBoxTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null, bool IsBindParent = false, bool IsClearNodes = true )
- {
- if ( tbl == null )
- {
- tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0];
- }
- if ( IsClearNodes )
- {
- cmbtreev.Nodes.Clear();
- }
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode root = null;
- if ( IsBindParent )
- {
- root = new TreeNode();
- root.Text = dtRow[0]["Sc_ClassName"].ToString();
- root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
- root.Name = dtRow[0]["ID"].ToString().Trim();
- CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
- cmbtreev.TreeView.Nodes.Add(root);
- }
- else
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- if ( dtRow2.Length > 0 )
- {
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- root.Name = dtRow2[i]["ID"].ToString();
- CreateTreeViewSystemCategory(root, dtRow2[i]["ID"].ToString(), tbl);
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- else
- {
- root = new TreeNode();
- root.Text = dtRow[0]["Sc_ClassName"].ToString();
- root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
- root.Name = dtRow[0]["ID"].ToString().Trim();
- CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- }
- }
- /// <summary>
- /// 第二级绑定
- /// </summary>
- /// <param name="nodes">父节点</param>
- /// <param name="ClassParentID">父节点的ID</param>
- /// <param name="tbl">当前数据源</param>
- private static void CreateTreeViewSystemCategory( TreeNode nodes, string ClassParentID, DataTable tbl )
- {
- DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- node.Name = dtRow[i]["ID"].ToString();
- nodes.Nodes.Add(node);
- CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl);
- }
- }
- }
- #endregion
- #region 系统类别与产品绑定
- private static DataTable _tbl_Product = new DataTable();
- /// <summary>
- /// 产品
- /// </summary>
- public static DataTable Tbl_Product
- {
- get
- {
- return PublicCodeClasses._tbl_Product;
- }
- set
- {
- PublicCodeClasses._tbl_Product = value;
- }
- }
- /// <summary>
- /// 系统类别与产品绑定
- /// </summary>
- /// <param name="StrParentCode">系统类别</param>
- /// <param name="cmbtreev">控件</param>
- /// <param name="IsFirstNodeNull">第一节点是否为空</param>
- /// <param name="IsDividedShop">是否显示所有店的产品</param>
- public static void BindComboBoxTreeView_Product( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false )
- {
- DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0];
- cmbtreev.Nodes.Clear();
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- if ( dtRow2.Length > 0 )
- {
- TreeNode root = null;
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode(" ");
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- root.Name = "System";
- DataRow[] dtRow3 = tbl.Select("Sc_ClassParentID='" + dtRow2[i]["ID"].ToString() + "'");
- if ( dtRow3.Length > 0 )
- {
- CreateTreeViewSystemCategoryProduct(root, tbl, dtRow3);
- }
- else
- {
- GetProduct(root, dtRow2[i]["Sc_ClassCode"].ToString());
- }
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- }
- }
- /// <summary>
- /// 第二级绑定
- /// </summary>
- /// <param name="nodes">父节点</param>
- /// <param name="ClassParentID">父节点的ID</param>
- /// <param name="tbl">当前数据源</param>
- private static void CreateTreeViewSystemCategoryProduct( TreeNode nodes, DataTable tbl, DataRow[] dtRow )
- {
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- node.Name = "System";
- nodes.Nodes.Add(node);
- DataRow[] dtRow1 = tbl.Select("Sc_ClassParentID='" + dtRow[i]["ID"].ToString() + "'");
- if ( dtRow1.Length > 0 )
- {
- CreateTreeViewSystemCategoryProduct(node, tbl, dtRow1);
- }
- else
- {
- GetProduct(node, dtRow[i]["Sc_ClassCode"].ToString());
- }
- }
- }
- }
- /// <summary>
- /// 第三级绑定
- /// </summary>
- /// <param name="nodes">节点</param>
- /// <param name="ClassCode">父节点ID</param>
- /// <param name="IsDividedShop">是否显示所有店的产品</param>
- public static void GetProduct( TreeNode nodes, string ClassCode )
- {
- if ( Tbl_Product.Rows.Count <= 0 )
- {
- Tbl_Product = new BLL.BLL_ErpProduct().GetAllList().Tables[0];
- }
- DataRow[] dtRow = Tbl_Product.Select(" Prod_Class='" + ClassCode + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Prod_Name"].ToString();
- node.Tag = dtRow[i]["Prod_Number"].ToString();
- node.Name = "Product";
- nodes.Nodes.Add(node);
- }
- }
- }
- #endregion
- #region 部门与人员绑定
- /// <summary>
- /// 部门
- /// </summary>
- public static DataTable Tbl_Department
- {
- get
- {
- return LYFZ.DAL.DAL_ErpUser.GetUser_Department();
- //new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpDepartment", ShowColumnName: "ID,Dt_Name,Dt_DividedShop").Tables[0];
- }
- }
- /// <summary>
- /// 部门
- /// </summary>
- public static DataTable Tbl_StoreName
- {
- get
- {
- return new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpCompanyInfo", ShowColumnName: "Company_DividedShop,Company_Name").Tables[0];
- }
- }
- /// <summary>
- /// 部门、员工绑定
- /// </summary>
- /// <param name="cmbtreev">控件</param>
- /// <param name="IsFirstNodeNull">第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时所显示的Text</param>
- /// <param name="IsShowResign">是否显示离职</param>
- /// <param name="IsShowAdmin">是否显示Admin</param>
- /// <param name="IsHaveAllTreeNode">显示全部</param>
- public static void BindComboBoxTreeView_StoreDepartment( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsShowResign = true, bool IsShowAdmin = false, bool IsHaveAllTreeNode = false )
- {
- TreeNode root = null;
- TreeNode nodes = null;
- cmbtreev.Nodes.Clear();
- if ( IsHaveAllTreeNode )
- {
- root = new TreeNode();
- root.Text = "全部";
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- DataTable tbl = Tbl_Department;
- DataTable dtStore = Tbl_StoreName;
- if ( dtStore.Rows.Count > 0 )
- {
- for ( int i = 0; i < dtStore.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtStore.Rows[i]["Company_Name"].ToString();
- root.Tag = dtStore.Rows[i]["Company_DividedShop"].ToString().Trim();
- root.Name = "StoreName";
- DataRow[] departRows = tbl.Select(" Dt_DividedShop = '" + dtStore.Rows[i]["Company_DividedShop"].ToString().Trim() + "' ");
- for ( int j = 0; j < departRows.Length; j++ )
- {
- nodes = new TreeNode();
- nodes.Text = departRows[j]["Dt_Name"].ToString();
- nodes.Tag = departRows[j]["ID"].ToString().Trim();
- nodes.Name = "Department";
- root.Nodes.Add(nodes);
- }
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- else
- {
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Dt_Name"].ToString();
- root.Tag = tbl.Rows[i]["ID"].ToString().Trim();
- root.Name = "Department";
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- }
- /// <summary>
- /// 部门、员工绑定
- /// </summary>
- /// <param name="cmbtreev">控件</param>
- /// <param name="IsFirstNodeNull">第一节点是否为空</param>
- /// <param name="IsFirstNodeName">显示第一节点是否为空时所显示的Text</param>
- /// <param name="IsShowResign">是否显示离职</param>
- /// <param name="IsShowAdmin">是否显示Admin</param>
- /// <param name="IsHaveAllTreeNode">显示全部</param>
- public static void BindComboBoxTreeView_DepartmentAndEmployee( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsShowResign = false, bool IsShowAdmin = false, DataTable tb_User = null, bool IsHaveAllTreeNode = false )
- {
- if ( tb_User == null )
- {
- tb_User = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: IsShowResign, IsShowAdmin: IsShowAdmin);
- }
- TreeNode root = null;
- TreeNode nodes = null;
- cmbtreev.Nodes.Clear();
- if ( IsHaveAllTreeNode )
- {
- root = new TreeNode();
- root.Text = "全部";
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- DataTable tbl = Tbl_Department;
- DataTable dtStore = Tbl_StoreName;
- if ( dtStore.Rows.Count > 1 )
- {
- for ( int i = 0; i < dtStore.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtStore.Rows[i]["Company_Name"].ToString();
- root.Tag = dtStore.Rows[i]["Company_DividedShop"].ToString().Trim();
- root.Name = "StoreName";
- for ( int j = 0; j < tbl.Rows.Count; j++ )
- {
- DataRow[] dtRow = tb_User.Select("User_Department='" + tbl.Rows[j]["ID"].ToString().Trim() + "' And User_DividedShop = '" + dtStore.Rows[i]["Company_DividedShop"].ToString().Trim() + "'");
- if ( dtRow.Length <= 0 )
- {
- continue;
- }
- nodes = new TreeNode();
- nodes.Text = tbl.Rows[j]["Dt_Name"].ToString();
- nodes.Tag = tbl.Rows[j]["ID"].ToString().Trim();
- nodes.Name = "Department";
- CreateTreeViewDepartmentUser(nodes, tbl.Rows[j]["ID"].ToString(), tb_User, IsShowResign, dtStore.Rows[i]["Company_DividedShop"].ToString().Trim());
- root.Nodes.Add(nodes);
- }
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- else
- {
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- DataRow[] dtRow = tb_User.Select("User_Department='" + tbl.Rows[i]["ID"].ToString().Trim() + "'");
- if ( dtRow.Length <= 0 )
- {
- continue;
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Dt_Name"].ToString();
- root.Tag = tbl.Rows[i]["ID"].ToString().Trim();
- root.Name = "Department";
- CreateTreeViewDepartmentUser(root, tbl.Rows[i]["ID"].ToString(), tb_User, IsShowResign);
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- }
- /// <summary>
- /// 绑定第二级人员
- /// </summary>
- /// <param name="nodes">TreeView的节点集合</param>
- /// <param name="dataSource">数据源</param>
- /// <param name="parentid"></param>
- private static void CreateTreeViewDepartmentUser( TreeNode nodes, string ClassCode, DataTable tb_User, bool IsShowResign, string SotreNumber = "SSN001" )
- {
- if ( ClassCode != "" )
- {
- DataRow[] dtRow = tb_User.Select("User_Department='" + ClassCode + "' And User_DividedShop = '" + SotreNumber + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- if ( dtRow[i]["User_Status"].ToString() != "离职" || IsShowResign )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["User_Name"].ToString();
- node.Tag = dtRow[i]["User_EmployeeID"].ToString();
- node.Name = "User";
- nodes.Nodes.Add(node);
- }
- }
- }
- }
- }
- #endregion
- #region 制作商绑定
- /// <summary>
- /// 制作商
- /// </summary>
- /// <param name="cmbtreev">要操作的控件</param>
- /// <param name="tbl">要操作的数据源,如果数据源为NULL,则会去获取</param>
- /// <param name="StrNameValue">要给Tag指定值的字段名</param>
- public static void BindComboBoxTreeView_Vendor( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, DataTable tbl = null, string StrTagNameValue = "Vd_Number" )
- {
- if ( tbl == null )
- {
- tbl = new BLL.BLL_ErpVendor().GetAllList().Tables[0];
- }
- cmbtreev.Nodes.Clear();
- TreeNode root = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- if ( i == 0 )
- {
- root = new TreeNode(" ");
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Vd_Name"].ToString();
- root.Tag = tbl.Rows[i][StrTagNameValue].ToString();
- root.Name = tbl.Rows[i]["ID"].ToString();
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- #endregion
- #region 支付方式绑定
- /// <summary>
- /// 支付方式绑定
- /// </summary>
- /// <param name="cmbtreev">控件</param>
- /// <param name="IsShowAll">是否显示所有</param>
- /// <param name="tbl">数据源</param>
- public static void BindComboBoxTreeView_PaymentMethod( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsShowAll = true, DataTable tbl = null, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" )
- {
- cmbtreev.Nodes.Clear();
- string[] numMemberNotShowPaymentMethod = System.Enum.GetNames(typeof(EnumPublic.MemberNotShowPaymentMethod));
- if ( tbl == null )
- {
- tbl = new BLL.BLL_ErpSystemCategory().GetList(StrWhere).Tables[0];
- }
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = 'BEBACCAFCCEAGAIHH'");
- if ( dtRow.Length > 0 )
- {
- TreeNode root = null;
- DataRow[] dtRow2 = tbl.Select(" Sc_ClassParentID ='" + dtRow[0]["ID"].ToString().Trim() + "'");
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- bool Isbl = true;
- if ( !IsShowAll )
- {
- for ( int j = 0; j < numMemberNotShowPaymentMethod.Length; j++ )
- {
- if ( dtRow2[i]["Sc_ClassName"].ToString().Trim() == numMemberNotShowPaymentMethod[j].Trim() )
- {
- Isbl = false;
- break;
- }
- }
- }
- if ( Isbl )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- root.Name = dtRow2[i]["ID"].ToString();
- CreateTreeViewPaymentMethod(root, dtRow2[i]["ID"].ToString().Trim(), tbl);
- cmbtreev.TreeView.Nodes.Add(root);
- }
- }
- }
- }
- /// <summary>
- /// 绑定第二级人员
- /// </summary>
- /// <param name="nodes">TreeView的节点</param>
- /// <param name="ClassCode">父节点ID</param>
- /// <param name="tbl">数据源</param>
- private static void CreateTreeViewPaymentMethod( TreeNode nodes, string ClassCode, DataTable tbl )
- {
- if ( ClassCode != "" )
- {
- DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassCode + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- node.Name = dtRow[i]["ID"].ToString();
- nodes.Nodes.Add(node);
- CreateTreeViewPaymentMethod(node, dtRow[i]["ID"].ToString().Trim(), tbl);
- }
- }
- }
- }
- #endregion
- #region 新开单页面绑定客户来源下拉树
- /// <summary>
- /// 新开单页面绑定客户来源下拉树
- /// </summary>
- /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">第一节点是否为空</param>
- /// <param name="strHideFiled">要隐藏的节点编号,多个时中间用','分割</param>
- public static void BindComboBoxTreeView_ClientSourec( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string strHideFiled = "", string IsFirstNodeName = " ", DataTable tbl = null )
- {
- string[] strHide = null;
- if ( strHideFiled != "" )
- {
- strHide = strHideFiled.Split(',');
- }
- cmbtreev.Nodes.Clear();
- if ( tbl == null )
- {
- tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0];
- }
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- TreeNode root = null;
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode(IsFirstNodeName);
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- if ( strHideFiled != "" )
- {
- bool Isbl = false;
- for ( int j = 0; j < strHide.Length; j++ )
- {
- if ( strHide[j].Trim() == dtRow2[i]["Sc_ClassCode"].ToString() )
- {
- Isbl = true;
- break;
- }
- }
- if ( Isbl )
- {
- continue;
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- root.Name = dtRow2[i]["ID"].ToString();
- CreateTreeViewClientSourec(root, dtRow2[i]["ID"].ToString(), tbl);
- cmbtreev.Nodes.Add(root);
- }
- }
- }
- private static void CreateTreeViewClientSourec( TreeNode nodes, string ClassParentID, DataTable tbl )
- {
- DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- node.Name = dtRow[i]["ID"].ToString();
- nodes.Nodes.Add(node);
- CreateTreeViewClientSourec(node, dtRow[i]["ID"].ToString(), tbl);
- }
- }
- }
- #endregion
- #region 团队PK
- /// <summary>
- /// 活动名称
- /// </summary>
- public static void BindComboBoxTreeView_TeamActivityName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev )
- {
- cmbtreev.Nodes.Clear();
- DataTable dtActivity = orbll.GetView_Custom("tb_ErpTeamActiveSet", StrWhere: "Tas_IsEnabled = 1", ShowColumnName: "Tas_Number,Tas_Name", filedOrder: "ID").Tables[0];
- TreeNode root = null;
- for ( int i = 0; i < dtActivity.Rows.Count; i++ )
- {
- root = new TreeNode();
- root.Tag = dtActivity.Rows[i]["Tas_Number"].ToString().Trim();
- root.Name = dtActivity.Rows[i]["Tas_Number"].ToString().Trim();
- root.Text = dtActivity.Rows[i]["Tas_Name"].ToString().Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- /// <summary>
- /// 大队名称(大队名称设置表,获取表:tb_ErpTeamMaxNameSet)
- /// </summary>
- /// <param name="cmbtreev"></param>
- public static void BindComboBoxTreeView_TeamMaxName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev )
- {
- cmbtreev.SetTextAndTag_ValueNull();
- cmbtreev.Nodes.Clear();
- DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxNameSet", StrWhere: "", ShowColumnName: "Tmxn_Number,Tmxn_Name", filedOrder: "ID DESC").Tables[0];
- TreeNode root = null;
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- root = new TreeNode();
- root.Tag = dt.Rows[i]["Tmxn_Number"].ToString().Trim();
- root.Name = dt.Rows[i]["Tmxn_Number"].ToString().Trim();
- root.Text = dt.Rows[i]["Tmxn_Name"].ToString().Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- /// <summary>
- /// 大队名称(根据活动编号获取大队名称任务表,获取表:tb_ErpTeamMaxTaskSet Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmxt_TmxnNumber)
- /// </summary>
- /// <param name="cmbtreev"></param>
- public static void BindComboBoxTreeView_TeamMaxTaskName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrActivityNumber, bool IsFirstNodeNull = false, string IsFirstNodeName = " " )
- {
- cmbtreev.SetTextAndTag_ValueNull();
- cmbtreev.Nodes.Clear();
- string StrWhere = "Tmxt_TasNumber = '" + StrActivityNumber + "'";
- DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxTaskSet Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmxt_TmxnNumber", StrWhere: StrWhere, ShowColumnName: "Tmxt_Number,Tmxt_TmxnNumber,Tmxn_Name", filedOrder: "tb_ErpTeamMaxTaskSet.ID DESC").Tables[0];
- TreeNode root = null;
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Tag = "";
- root.Name = "";
- root.Text = IsFirstNodeName;
- cmbtreev.Nodes.Add(root);
- }
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- root = new TreeNode();
- root.Tag = dt.Rows[i]["Tmxt_TmxnNumber"].ToString().Trim();
- root.Name = dt.Rows[i]["Tmxt_Number"].ToString().Trim();
- root.Text = dt.Rows[i]["Tmxn_Name"].ToString().Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- /// <summary>
- /// 小组名称(小组名称设置表,获取表:tb_ErpTeamMinNameSet)
- /// </summary>
- /// <param name="cmbtreev"></param>
- public static void BindComboBoxTreeView_TeamMinName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " " )
- {
- cmbtreev.SetTextAndTag_ValueNull();
- cmbtreev.Nodes.Clear();
- DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinNameSet", StrWhere: "", ShowColumnName: "Tmin_Number,Tmin_Name", filedOrder: "ID DESC").Tables[0];
- TreeNode root = null;
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Tag = "";
- root.Name = "";
- root.Text = IsFirstNodeName;
- cmbtreev.Nodes.Add(root);
- }
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- root = new TreeNode();
- root.Tag = dt.Rows[i]["Tmin_Number"].ToString().Trim();
- root.Name = dt.Rows[i]["Tmin_Number"].ToString().Trim();
- root.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- /// <summary>
- /// 小组名称(根据活动编号获取小组名称任务表,获取表:tb_ErpTeamMinTaskSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber)
- /// </summary>
- /// <param name="cmbtreev"></param>
- public static void BindComboBoxTreeView_TeamMinTaskName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrActivityNumber, string StrMaxNumber, bool IsFirstNodeNull = false, string IsFirstNodeName = " " )
- {
- cmbtreev.SetTextAndTag_ValueNull();
- cmbtreev.Nodes.Clear();
- DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinTaskSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber", StrWhere: "Tmit_TasNumber = '" + StrActivityNumber + "' And Tmit_TmxnNumber = '" + StrMaxNumber + "'", ShowColumnName: "Tmit_Number,Tmit_TminNumber,Tmin_Name", filedOrder: "tb_ErpTeamMinTaskSet.ID").Tables[0];
- TreeNode root = null;
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Tag = "";
- root.Name = "";
- root.Text = IsFirstNodeName;
- cmbtreev.Nodes.Add(root);
- }
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- root = new TreeNode();
- root.Tag = dt.Rows[i]["Tmit_TminNumber"].ToString().Trim();
- root.Name = dt.Rows[i]["Tmit_Number"].ToString().Trim();
- root.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- #endregion
- #region 客户关系
- /// <summary>
- /// 客户关系
- /// </summary>
- /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
- /// <param name="cmbtreev">当前下拉树</param>
- /// <param name="IsFirstNodeNull">第一节点是否为空</param>
- public static void BindComboBoxTreeView_ClientRelation( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false )
- {
- cmbtreev.Nodes.Clear();
- DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0];
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- TreeNode root = null;
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode(" ");
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- root.Name = dtRow2[i]["ID"].ToString();
- CreateTreeViewClientRelation(root, dtRow2[i]["ID"].ToString(), tbl);
- cmbtreev.Nodes.Add(root);
- }
- }
- }
- private static void CreateTreeViewClientRelation( TreeNode nodes, string ClassParentID, DataTable tbl )
- {
- DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode node;
- for ( int i = 0; i < dtRow.Length; i++ )
- {
- node = new TreeNode();
- node.Text = dtRow[i]["Sc_ClassName"].ToString();
- node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
- node.Name = dtRow[i]["ID"].ToString();
- nodes.Nodes.Add(node);
- CreateTreeViewClientRelation(node, dtRow[i]["ID"].ToString(), tbl);
- }
- }
- }
- #endregion
- #region 获取订单版本权限
- /// <summary>
- /// 获取系统版本
- /// </summary>
- public static void GetSystemVersion( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion )
- {
- bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
- chkKidsVersion.Visible = false;//儿童
- chkDressVersion.Visible = false;//婚纱
- chkPortraitVersion.Visible = false;//写真
- switch ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
- {
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版:
- chkKidsVersion.Visible = true;
- chkDressVersion.Visible = true;
- if ( IsPortrait )
- {
- chkPortraitVersion.Visible = true;
- }
- break;
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
- chkDressVersion.Visible = true;
- if ( IsPortrait )
- {
- chkPortraitVersion.Visible = true;
- }
- break;
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
- chkKidsVersion.Visible = true;
- if ( IsPortrait )
- {
- chkPortraitVersion.Visible = true;
- }
- break;
- }
- }
- #endregion
- #region 获取版本 (用于门市流程查询报表)
- /// <summary>
- /// 获取版本(用于门市流程查询报表)
- /// </summary>
- /// <returns></returns>
- public static string GetVersion( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion )
- {
- string RetValue = "";
- bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
- if ( !IsPortrait )
- {
- if ( chkPortraitVersion.Checked )
- {
- RetValue = "2";
- }
- else if ( chkDressVersion.Checked || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
- {
- if ( IsPortrait && !chkDressVersion.Checked )
- {
- RetValue = "-1";
- }
- else
- {
- RetValue = "0";
- }
- }
- else if ( chkKidsVersion.Checked || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
- {
- if ( IsPortrait && !chkKidsVersion.Checked )
- {
- RetValue = "-1";
- }
- else
- {
- RetValue = "1";
- }
- }
- else
- {
- RetValue = "-1";
- }
- }
- else if ( IsPortrait )
- {
- RetValue = "-1";
- }
- return RetValue;
- }
- #endregion
- #region 根据时间字段 返回时间段
- /// <summary>
- /// 根据时间字段 返回时间段
- /// </summary>
- /// <param name="StrFieldName">字段名称</param>
- /// <param name="StartDateTime">开始时间</param>
- /// <param name="EndDateTime">结束时间(结束时间可以等于开始时间)</param>
- /// <param name="DateAddDays">开始时间与结束时间相同时,结束时间或以退后时间,默认为1天</param>
- /// <param name="ConnectWord">连接关键字,默认为'And'</param>
- /// <returns></returns>
- public static string GetDateTime( string StrFieldName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" )
- {
- string StrWhere = "";
- if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" )
- {
- StrWhere = " (" + StrFieldName + " between '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + Convert.ToDateTime(EndDateTime).AddDays(DateAddDays).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')";
- }
- else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" )
- {
- StrWhere = StrFieldName + " = '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
- }
- else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" )
- {
- StrWhere = StrFieldName + " = '" + Convert.ToDateTime(EndDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
- }
- if ( !string.IsNullOrEmpty(StrWhere) && !string.IsNullOrEmpty(ConnectWord) )
- {
- StrWhere = " " + ConnectWord + " " + StrWhere;
- }
- return StrWhere;
- }
- /// <summary>
- /// 根据时间字段 返回时间段(通用于DataTable的查找)
- /// </summary>
- /// <param name="StrFieldName">字段名称</param>
- /// <param name="StartDateTime">开始时间</param>
- /// <param name="EndDateTime">结束时间(结束时间可以等于开始时间)</param>
- /// <param name="DateAddDays">开始时间与结束时间相同时,结束时间或以退后时间,默认为1天</param>
- /// <param name="ConnectWord">连接关键字,默认为'And'</param>
- /// <returns></returns>
- public static string GetDateTime2( string StrFieldName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" )
- {
- string StrWhere = "";
- if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" )
- {
- StrWhere = " (" + StrFieldName + " >= '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "' and " + StrFieldName + " <= '" + Convert.ToDateTime(EndDateTime).AddDays(DateAddDays).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')";
- }
- else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" )
- {
- StrWhere = StrFieldName + " = '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
- }
- else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" )
- {
- StrWhere = StrFieldName + " = '" + Convert.ToDateTime(EndDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
- }
- if ( !string.IsNullOrEmpty(StrWhere) && !string.IsNullOrEmpty(ConnectWord) )
- {
- StrWhere = " " + ConnectWord + " " + StrWhere;
- }
- return StrWhere;
- }
- /// <summary>
- /// 获取今年的时间段
- /// </summary>
- /// <param name="StrName"></param>
- /// <param name="StartDateTime"></param>
- /// <param name="EndDateTime"></param>
- /// <param name="DateAddDays"></param>
- /// <param name="ConnectWord"></param>
- /// <returns></returns>
- public static string GetDateTimeNowYear( string StrName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" )
- {
- string StrValue = "";
- if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" )
- {
- StrValue = " " + ConnectWord + " (" + StrName + " between '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(StartDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(EndDateTime).ToString("-MM-dd")).AddDays(DateAddDays).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')";
- }
- else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" )
- {
- StrValue = " " + ConnectWord + " " + StrName + " = '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(StartDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'";
- }
- else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" )
- {
- StrValue = " " + ConnectWord + " " + StrName + " = '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(EndDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'";
- }
- return StrValue;
- }
- /// <summary>
- /// 获取sql查询条件
- /// </summary>
- /// <param name="StrWhere">当前要添加的where条件</param>
- /// <param name="StrSQLWhere">已经组串好的SQL查询条件语句</param>
- /// <returns></returns>
- public static void GetSQLWhere( string StrWhere, ref string StrSQLWhere )
- {
- if ( !string.IsNullOrEmpty(StrSQLWhere) )
- {
- StrSQLWhere += " And " + StrWhere;
- }
- else
- {
- StrSQLWhere += StrWhere;
- }
- }
- #endregion
- #region 获取查询条件
- /// <summary>
- /// 获取版本查询sql
- /// </summary>
- /// <param name="chkPortraitVersion">写真</param>
- /// <param name="chkDressVersion">婚纱</param>
- /// <param name="chkKidsVersion">儿童</param>
- /// <param name="chkServiceVersion">服务</param>
- /// <param name="chkWeddingCelebration">婚庆</param>
- /// <param name="StrOrdType">订单类型串,用逗号分开</param>
- /// <returns></returns>
- public static string GetVersionQuerySQL( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion, LYFZ.ComponentLibrary.CheckBoxEx chkServiceVersion = null, LYFZ.ComponentLibrary.CheckBoxEx chkWeddingCelebration = null, string StrOrdType = "" )
- {
- string StrWhere = "";
- bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
- if ( chkDressVersion.Checked )
- {
- StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "'";
- }
- else if ( chkKidsVersion.Checked )
- {
- StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "'";
- }
- else if ( chkPortraitVersion.Checked )
- {
- StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "'";
- }
- else if ( chkWeddingCelebration != null && chkWeddingCelebration.Checked )
- {
- StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚庆订单) + "'";
- }
- else if ( chkServiceVersion != null && chkServiceVersion.Checked )
- {
- StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.服务订单) + "'";
- }
- else if ( !string.IsNullOrEmpty(StrOrdType) )
- {
- string[] StrSpilt = StrOrdType.Split(',');
- StrWhere = " And Ord_Type in (";
- for ( int i = 0; i < StrSpilt.Length; i++ )
- {
- StrWhere += "'" + StrSpilt[i].Trim() + "',";
- }
- StrWhere = StrWhere.TrimEnd(',') + ")";
- }
- return StrWhere;
- }
- /// <summary>
- /// 获取门市流程文本框搜索的条件获取查询条件语句
- /// </summary>
- /// <param name="StrText"></param>
- /// <returns></returns>
- public static string GetQueryTextQueryCondition( string StrText )
- {
- string StrWhere = "";
- if ( !string.IsNullOrEmpty(StrText.Trim()) )
- {
- StrText = StrText.Trim().ToLower();
- if ( LYFZ.Command.Command_Validate.IsChinese(StrText.Replace("/", "")) )
- {
- StrWhere = " And Cus_Name like '%" + StrText.Trim() + "%'";
- }
- else if ( LYFZ.Command.Command_Validate.IsNumber(StrText) )
- {
- if ( LYFZ.MY_LocalSettings.MyLocalSettings.Ordernumbersearch )
- {
- StrWhere = " And (Ord_SinceOrderNumber like '%" + StrText.Trim() + "%' or Cus_Telephone like '%" + StrText.Trim() + "%')";
- }
- else
- {
- StrWhere += " And Cus_Telephone like '%" + StrText.Trim() + "%'";
- }
- }
- else if ( LYFZ.Command.Command_Validate.IsEnglish(StrText.Replace("/", "")) )
- {
- StrWhere = " And Cus_Name_py like '%" + StrText.Trim() + "%'";
- }
- else if ( LYFZ.Command.Command_Validate.IsOrderNumber(StrText) )
- {
- StrWhere = " And Ord_SinceOrderNumber like '" + StrText.Trim() + "%'";
- }
- }
- return StrWhere;
- }
- /// <summary>
- /// 获取菜单树所选择的节点及下级所有节点
- /// </summary>
- /// <param name="treev"></param>
- /// <returns></returns>
- public static void GetTreeViewQueryCondition( ref string StrWhere, LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, string StrFieldName, string ConnectWord = "And" )
- {
- if ( treev.Nodes.Count > 0 )
- {
- if ( treev.SelectedNode != null )
- {
- string classString = "'" + treev.SelectedNode.Tag.ToString().Trim() + "'";
- for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
- {
- if ( treev.SelectedNode.Nodes[i].Nodes.Count > 0 )
- {
- GrtTreeViewNodesCondition(treev.Nodes[i], ref classString);
- }
- else
- {
- classString += ",'" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "'";
- }
- }
- if ( classString.Trim().Length > 0 )
- {
- StrWhere += " " + ConnectWord + " " + StrFieldName + " in(" + classString + ")";
- }
- }
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="root"></param>
- /// <param name="StrWhere"></param>
- static void GrtTreeViewNodesCondition( TreeNode root, ref string StrWhere )
- {
- for ( int i = 0; i < root.Nodes.Count; i++ )
- {
- if ( root.Nodes[i].Nodes.Count > 0 )
- {
- GrtTreeViewNodesCondition(root.Nodes[i], ref StrWhere);
- }
- else
- {
- StrWhere += ",'" + root.Nodes[i].Tag.ToString().Trim() + "'";
- }
- }
- }
- /// <summary>
- /// 获取选中的下拉员工树员工,以模糊查询做为条件
- /// </summary>
- /// <param name="treev"></param>
- /// <param name="StrWhere"></param>
- /// <param name="StrFieldName"></param>
- /// <param name="ConnectWord"></param>
- public static void GetTreeViewSelectPersonTagQueryConditionLike( LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, ref string StrWhere, string StrFieldName, string ConnectWord = "And" )
- {
- if ( treev.Tag != null )
- {
- if ( treev.StrGetName.Trim() == "User" )
- {
- StrWhere = ConnectWord + " (" + StrFieldName + " like '%" + treev.Tag.ToString().Trim() + "%')";
- }
- else if ( treev.StrGetName.Trim() == "Department" )
- {
- for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
- {
- StrWhere += " " + StrFieldName + " like '%" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "%' or";
- }
- if ( !string.IsNullOrEmpty(StrWhere) )
- {
- StrWhere = ConnectWord + " (" + StrWhere.TrimEnd('r').TrimEnd('o') + ")";
- }
- }
- else if ( treev.StrGetName.Trim() == "StoreName" )
- {
- for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
- {
- if ( treev.SelectedNode.Nodes[i].Name.Trim() == "Department" && treev.SelectedNode.Nodes[i].Nodes.Count > 0 )
- {
- for ( int j = 0; j < treev.SelectedNode.Nodes[i].Nodes.Count; j++ )
- {
- StrWhere += " " + StrFieldName + " like '%" + treev.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "%' or";
- }
- }
- }
- if ( !string.IsNullOrEmpty(StrWhere) )
- {
- StrWhere = ConnectWord + " (" + StrWhere.TrimEnd('r').TrimEnd('o') + ")";
- }
- }
- }
- }
- /// <summary>
- /// 获取选中的下拉员工树员工,以in ('','')查询做为条件
- /// </summary>
- /// <param name="treev"></param>
- /// <param name="StrWhere"></param>
- /// <param name="StrFieldName"></param>
- /// <param name="ConnectWord"></param>
- public static void GetTreeViewSelectPersonTagQueryConditionEqual( LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, ref string StrWhere, string StrFieldName, string ConnectWord = "And" )
- {
- string StrOrdersPerson = "";
- if ( treev.Tag != null )
- {
- if ( treev.StrGetName.Trim() == "User" )
- {
- StrWhere = ConnectWord + " " + StrFieldName + " = '" + treev.Tag.ToString().Trim() + "'";
- }
- else if ( treev.StrGetName.Trim() == "Department" )
- {
- for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
- {
- StrOrdersPerson += "'" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "',";
- }
- if ( !string.IsNullOrEmpty(StrOrdersPerson) )
- {
- StrWhere = ConnectWord + " " + StrFieldName + " in (" + StrOrdersPerson.TrimEnd(',') + ")";
- }
- }
- else if ( treev.StrGetName.Trim() == "StoreName" )
- {
- for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
- {
- if ( treev.SelectedNode.Nodes[i].Name.Trim() == "Department" && treev.SelectedNode.Nodes[i].Nodes.Count > 0 )
- {
- for ( int j = 0; j < treev.SelectedNode.Nodes[i].Nodes.Count; j++ )
- {
- StrOrdersPerson += "'" + treev.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "',";
- }
- }
- }
- if ( !string.IsNullOrEmpty(StrOrdersPerson) )
- {
- StrWhere = ConnectWord + " " + StrFieldName + " in (" + StrOrdersPerson.TrimEnd(',') + ")";
- }
- }
- }
- }
- #endregion
- #region 根据数据库的User_EmployeeID 获取User_Name
- /// <summary>
- /// 根据数据库的User_EmployeeID 获取User_Name
- /// </summary>
- /// <param name="User_EmployeeID">员工编号</param>
- /// <returns></returns>
- public static string GetUserName( object User_EmployeeID )
- {
- try
- {
- if ( !string.IsNullOrEmpty(User_EmployeeID.ToString()) )
- {
- DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(User_EmployeeID);
- if ( dtRow != null )
- {
- return dtRow["User_Name"].ToString().Trim();
- }
- }
- }
- catch { }
- return "";
- }
- #endregion
- #region ModelLog
- /// <summary>
- /// 获取写日志对象
- /// </summary>
- /// <param name="type">日志类类</param>
- /// <param name="contents">日志内容</param>
- /// <param name="userID">用户ID</param>
- /// <param name="userName">用户名</param>
- /// <param name="ip">ip 可以为空</param>
- /// <returns></returns>
- public static LYFZ.Model.Model_ErpACVBSYS GetModelLog( string SysType, string StrContent, string StrContentDetails = "", object strTime = null )
- {
- if ( strTime == null )
- {
- strTime = SDateTime.Now.ToString();
- }
- LYFZ.Model.Model_ErpACVBSYS modelsys = new Model.Model_ErpACVBSYS();
- modelsys.ACVBSYS002 = EncryptDES(SysType.ToString());
- modelsys.ACVBSYS003 = EncryptDES(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name);
- modelsys.ACVBSYS004 = EncryptDES(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID);
- modelsys.ACVBSYS005 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP;// EncryptDES(GetCurrentHostIP());
- modelsys.ACVBSYS006 = EncryptDES(StrContent);
- modelsys.ACVBSYS007 = EncryptDES(LYFZ.Command.Command_Validate.DateTimeToString(strTime, "yyyy-MM-dd HH:mm:ss"));
- modelsys.ACVBSYS008 = EncryptDES(StrContentDetails);
- return modelsys;
- }
- static string GetCurrentHostIP()
- {
- System.Net.IPHostEntry ipe = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
- return ipe.HostName.ToString().Trim() + " " + ipe.AddressList[3].ToString().Trim();
- }
- private static byte[] DesKeys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };//默认密钥向量
- /// <summary>
- /// 给外部调用的DES算法加密。
- /// </summary>
- public static string EncryptDES( string decryptString )
- {
- return EncryptDES(decryptString, "cust-stu");
- }
- /// <summary>
- /// DES加密字符串
- /// </summary>
- /// <param name="encryptString">待加密的字符串</param>
- /// <param name="encryptKey">加密密钥,要求为8位</param>
- /// <returns>加密成功返回加密后的字符串,失败返回源串</returns>
- private static string EncryptDES( string encryptString, string encryptKey )
- {
- try
- {
- byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8));
- byte[] rgbIV = DesKeys;
- byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
- System.Security.Cryptography.DESCryptoServiceProvider dCSP = new System.Security.Cryptography.DESCryptoServiceProvider();
- MemoryStream mStream = new MemoryStream();
- System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), System.Security.Cryptography.CryptoStreamMode.Write);
- cStream.Write(inputByteArray, 0, inputByteArray.Length);
- cStream.FlushFinalBlock();
- return Convert.ToBase64String(mStream.ToArray());
- }
- catch
- {
- return encryptString;
- }
- }
- #endregion
- #region 集团
- /// <summary>
- /// 绑定集团名称(像用于门市流程)
- /// </summary>
- /// <param name="cmbtreev">控件</param>
- /// <param name="StrGroupKeyCode">菜单组编号</param>
- /// <param name="StrKeyCode">当前窗体编号</param>
- /// <param name="StrDefaultStoreText">默认值</param>
- /// <param name="IsShowAllText">是否显示'全部'</param>
- public static void BindStoreNameALL( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrDefaultStoreText = "", bool IsShowAllText = true )
- {
- cmbtreev.Nodes.Clear();
- DataTable dt = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
- TreeNode node;
- if ( IsShowAllText )
- {
- if ( dt.Rows.Count > 1 )
- {
- node = new TreeNode();
- node.Text = "全部";
- node.Tag = "";
- node.Name = "0";
- cmbtreev.Nodes.Add(node);
- }
- }
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- node = new TreeNode();
- node.Text = dt.Rows[i]["Company_Name"].ToString().Trim();
- node.Tag = dt.Rows[i]["Company_DividedShop"].ToString().Trim();
- node.Name = dt.Rows[i]["ID"].ToString().Trim();
- cmbtreev.Nodes.Add(node);
- }
- if ( !string.IsNullOrEmpty(StrDefaultStoreText) )
- {
- if ( cmbtreev.GetNodeItem_TextToTag(StrDefaultStoreText) != null )
- {
- cmbtreev.TextFindTag(StrDefaultStoreText);
- }
- }
- if ( string.IsNullOrEmpty(cmbtreev.Text.Trim()) )
- {
- DataRow[] dtRow = dt.Select("Company_DividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'");
- if ( dtRow.Length > 0 )
- {
- cmbtreev.TagFindText(dtRow[0]["Company_DividedShop"]);
- }
- else
- {
- cmbtreev.TagFindText(dt.Rows[0]["Company_DividedShop"]);
- }
- }
- }
- /// <summary>
- /// 绑定集团名称(像用于门市流程)
- /// </summary>
- /// <param name="cmbtreev">控件</param>
- /// <param name="StrGroupKeyCode">菜单组编号</param>
- /// <param name="StrKeyCode">当前窗体编号</param>
- /// <param name="StrDefaultStoreText">默认值</param>
- /// <param name="IsShowAllText">是否显示'全部'</param>
- public static void BindGroupStoreName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrGroupKeyCode = "", string StrKeyCode = "", string StrDefaultStoreText = "",
- bool IsShowAllText = true,bool bhidelocalData=false,bool bHideMainOpenForm=true )
- {
- cmbtreev.Nodes.Clear();
- if ( string.IsNullOrEmpty(StrGroupKeyCode) )
- {
- StrGroupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet();
- }
- List<string> mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(StrGroupKeyCode, StrKeyCode);
- string StrWhere = "";
- for ( int i = 0; i < mlist.Count; i++ )
- {
- StrWhere += "'" + mlist[i].Trim() + "',";
- }
- if ( !string.IsNullOrEmpty(StrWhere) )
- {
- StrWhere = "Company_DividedShop in (" + StrWhere.TrimEnd(',') + ")";
- }
- DataTable dt = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
- TreeNode node;
- if ( IsShowAllText )
- {
- if ( dt.Rows.Count > 1 )
- {
- node = new TreeNode();
- node.Text = "全部";
- node.Tag = "";
- node.Name = "0";
- cmbtreev.Nodes.Add(node);
- }
- }
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- node = new TreeNode();
- node.Text = dt.Rows[i]["Company_Name"].ToString().Trim();
- node.Tag = dt.Rows[i]["Company_DividedShop"].ToString().Trim();
- node.Name = dt.Rows[i]["ID"].ToString().Trim();
- cmbtreev.Nodes.Add(node);
- }
- if ( !string.IsNullOrEmpty(StrDefaultStoreText) )
- {
- if ( cmbtreev.GetNodeItem_TextToTag(StrDefaultStoreText) != null )
- {
- cmbtreev.TextFindTag(StrDefaultStoreText);
- }
- }
- if ( string.IsNullOrEmpty(cmbtreev.Text.Trim()) )
- {
- DataRow[] dtRow = dt.Select("Company_DividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'");
- if ( dtRow.Length > 0 )
- {
- cmbtreev.TagFindText(dtRow[0]["Company_DividedShop"]);
- }
- else
- {
- cmbtreev.TagFindText(dt.Rows[0]["Company_DividedShop"]);
- }
- }
- if (bHideMainOpenForm)
- {
- if (dt.Rows.Count <= 1)
- {
- if (!bhidelocalData)
- {
- cmbtreev.Parent.Visible = false;
- }
- else
- {
- cmbtreev.Visible = false;
- }
- }
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="StrGroupKeyCode"></param>
- /// <param name="StrKeyCode"></param>
- /// <returns></returns>
- public static DataTable BindGroupStoreName( string StrKeyCode, string StrGroupKeyCode = "" )
- {
- if ( string.IsNullOrEmpty(StrGroupKeyCode) )
- {
- StrGroupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet();
- }
- List<string> mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(StrGroupKeyCode, StrKeyCode);
- string StrWhere = "";
- for ( int i = 0; i < mlist.Count; i++ )
- {
- StrWhere += "'" + mlist[i].Trim() + "',";
- }
- if ( !string.IsNullOrEmpty(StrWhere) )
- {
- StrWhere = "Company_DividedShop in (" + StrWhere.TrimEnd(',') + ")";
- }
- return orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
- }
- /// <summary>
- /// 集团店面权限
- /// </summary>
- /// <param name="cmbtreev">集团控件</param>
- /// <param name="moduleBlock">权限模块名</param>
- /// <param name="operatingAuthority">权限名</param>
- /// <returns></returns>
- public static bool GetGroupStoreRights( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string moduleBlock, LYFZ.CustomAttributes.OperatingAuthority operatingAuthority )
- {
- bool IsRights = false;
- if ( !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) )
- {
- IsRights = LYFZ.BLL.BLL_ErpUser.GetGroupRights(moduleBlock, operatingAuthority, cmbtreev.Tag.ToString().Trim());
- }
- else
- {
- for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
- {
- if ( !string.IsNullOrEmpty(cmbtreev.Nodes[i].Tag.ToString().Trim()) )
- {
- IsRights = LYFZ.BLL.BLL_ErpUser.GetGroupRights(moduleBlock, operatingAuthority, cmbtreev.Nodes[i].Tag.ToString().Trim());
- if ( !IsRights )
- {
- break;
- }
- }
- }
- }
- return IsRights;
- }
- /// <summary>
- /// 集团查询获取条件信息
- /// </summary>
- /// <param name="cmbtreev">集团控件</param>
- /// <param name="StrFieldName"></param>
- /// <param name="ConnectWord"></param>
- /// <returns></returns>
- public static string GetGroupQueryWhere( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, string ConnectWord = "And" )
- {
- string StrWhere = "";
- if ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition )
- {
- if ( cmbtreev.Text.Trim() == "全部" )
- {
- string StrSQL = "";
- for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
- {
- if ( cmbtreev.Nodes[i].Text.Trim() != "全部" )
- {
- StrSQL += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',";
- }
- }
- if ( !string.IsNullOrEmpty(StrSQL) )
- {
- StrWhere = StrFieldName + " in (" + StrSQL.TrimEnd(',') + ")";
- }
- }
- else
- {
- StrWhere = StrFieldName + " = '" + cmbtreev.Tag.ToString().Trim() + "'";
- }
- if ( !string.IsNullOrEmpty(ConnectWord) )
- {
- StrWhere = " " + ConnectWord + " " + StrWhere;
- }
- }
- else
- {
- StrWhere = " " + ConnectWord + " 1 = 1";
- }
- return StrWhere;
- }
- /// <summary>
- /// 订单点击查看的分店
- /// </summary>
- /// <param name="cmbtreev"></param>
- /// <param name="StrFieldName"></param>
- /// <param name="ConnectWord"></param>
- /// <returns></returns>
- public static string GetGroupQueryOrderClickWhere( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, string ConnectWord = "And" )
- {
- string StrWhere = "";
- for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
- {
- if ( !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) )
- {
- StrWhere += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',";
- }
- }
- StrWhere = StrFieldName + " in (" + StrWhere.TrimEnd(',') + ")";
- if ( !string.IsNullOrEmpty(ConnectWord) )
- {
- StrWhere = " " + ConnectWord + " " + StrWhere;
- }
- return StrWhere;
- }
- public static Dictionary<string, string> GetGroupQueryOrderClickWhereByDataList( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, ref Dictionary<string, string> dicWhere )
- {
- string StrWhere = "";
- TreeNode treeNode = new TreeNode()
- {
- Tag = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID
- };
- if ( cmbtreev.Tag != null )
- {
- if ( cmbtreev.Tag.ToString().Trim() == "" )
- {
- for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
- {
- StrWhere += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',";
- }
- dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")");
- }
- else
- {
- if ( cmbtreev.Tag != null && !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) )
- {
- StrWhere += "'" + cmbtreev.Tag.ToString().Trim() + "',";
- dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")");
- }
- }
- }
- else
- {
- StrWhere += "'" + treeNode.Tag.ToString().Trim() + "',";
- dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")");
- }
- //StrWhere = StrFieldName + " in (" + StrWhere.TrimEnd(',') + ")";
- //if (!string.IsNullOrEmpty(ConnectWord))
- //{ StrWhere = " " + ConnectWord + " " + StrWhere; }
- return dicWhere;
- }
- #endregion
- #region 礼服相片
- /// <summary>
- /// 获取礼服缩略图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetDressImage_Small( string StrPhoto, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg";
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
- //loadMessage = "加载成功";
- }
- catch ( Exception e )
- {
- //loadMessage = e.Message;
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- //loadMessage = "未找到图片路径,使用系统默认图片";
- }
- return img;
- }
- /// <summary>
- /// 获取礼服缩略图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetDressImage_Small( string StrPhoto, ref string loadMessage, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- loadMessage = "图片数据为Null";
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg";
- string tempFlePath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + strImgPath.Substring(1);
- if ( File.Exists(tempFlePath) )
- {
- img = new Bitmap(Image.FromFile(tempFlePath));
- }
- else
- {
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
- }
- loadMessage = "加载成功";
- }
- catch ( Exception e )
- {
- loadMessage = e.Message;
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- loadMessage = "未找到图片路径,使用系统默认图片";
- }
- return img;
- }
- /// <summary>
- /// 获取礼服原图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetDressImage_Original( string StrPhoto, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\" + StrPhoto;
- if ( string.IsNullOrEmpty(System.IO.Path.GetExtension(StrPhoto)) )
- {
- strImgPath += ".jpg";
- }
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
- }
- catch
- {
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- return img;
- }
- /// <summary>
- /// 上传礼服相片
- /// </summary>
- /// <param name="StrSelectPath">选择的相片路径</param>
- /// <param name="StrDressNumber">礼服的编号</param>
- /// <param name="IsRecursion">是否递归上传失败的相片</param>
- /// <param name="UpdateDressType">上传类型 0:上传缩略图 1:上传原图</param>
- /// <returns></returns>
- public static bool UpdateDressPhoto( string StrSelectPath, string StrDressNumber, bool IsRecursion = false, int UpdateDressType = 0 )
- {
- string[] StrArray = StrSelectPath.Trim().Split('|');
- string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto();
- if ( UpdateDressType == 0 )
- {
- string StrPhotoName = StrDressNumber + "_" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg";
- Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100);
- StrParentPath += @"\Small\" + StrPhotoName;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return UpdateDressPhoto(StrSelectPath, StrDressNumber, IsRecursion);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- else
- {
- string StrPhotoName = StrDressNumber + "_" + System.IO.Path.GetFileName(StrArray[0].Trim());
- Bitmap OriginalMap = null;
- if ( System.IO.Path.GetExtension(StrArray[0].Trim()) == ".gif" )
- {
- OriginalMap = new Bitmap(Image.FromStream(new MemoryStream(System.IO.File.ReadAllBytes(StrArray[0].Trim()))));
- }
- else
- {
- OriginalMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 1080, 720);
- }
- StrParentPath += @"\" + StrPhotoName;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(OriginalMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return UpdateDressPhoto(StrSelectPath, StrDressNumber, IsRecursion);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
- /// <summary>
- /// 删除礼服相片
- /// </summary>
- /// <param name="StrSelectPath"></param>
- /// <param name="IsRecursion"></param>
- /// <returns></returns>
- public static bool DeleteDressPhoto( string StrSelectPath, bool IsRecursion = false, int DeleteDressType = 0 )
- {
- string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto();
- if ( DeleteDressType == 0 )
- {
- StrParentPath += @"\Small\" + StrSelectPath;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return DeleteDressPhoto(StrSelectPath, IsRecursion, DeleteDressType: 0);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- else
- {
- StrParentPath += @"\" + StrSelectPath;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return DeleteDressPhoto(StrSelectPath, IsRecursion, DeleteDressType: 1);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
- #endregion
- #region 其他消费相片
- /// <summary>
- /// 获取其他消费缩略图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetOtherConsumeImage_Small( string StrPhoto, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg";
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
- }
- catch
- {
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- return img;
- }
- /// <summary>
- /// 获取其他消费原图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetOtherConsumeImage_Original( string StrPhoto, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + @"\" + StrPhoto;
- if ( string.IsNullOrEmpty(System.IO.Path.GetExtension(StrPhoto)) )
- {
- strImgPath += ".jpg";
- }
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
- }
- catch
- {
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- return img;
- }
- /// <summary>
- /// 上传其他消费相片
- /// </summary>
- /// <param name="StrSelectPath">选择的相片路径</param>
- /// <param name="StrOtherOrderNumber">其他消费的编号</param>
- /// <param name="IsRecursion">是否递归上传失败的相片</param>
- /// <param name="UpdateDressType">上传类型 0:上传缩略图 1:上传原图</param>
- /// <returns></returns>
- public static bool UpdateOtherConsumePhoto( string StrSelectPath, string StrOtherOrderNumber, bool IsRecursion = false, int UpdateDressType = 0 )
- {
- string[] StrArray = StrSelectPath.Trim().Split('|');
- string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto();
- if ( UpdateDressType == 0 )
- {
- string StrPhotoName = StrOtherOrderNumber + "_" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg";
- Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100);
- StrParentPath += @"\Small\" + StrPhotoName;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return UpdateOtherConsumePhoto(StrSelectPath, StrOtherOrderNumber, IsRecursion);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- else
- {
- string StrPhotoName = StrOtherOrderNumber + "_" + System.IO.Path.GetFileName(StrArray[0].Trim());
- StrParentPath += @"\" + StrPhotoName;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(StrArray[0].Trim(), StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return UpdateOtherConsumePhoto(StrSelectPath, StrOtherOrderNumber, IsRecursion);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
- /// <summary>
- /// 删除其他消费相片
- /// </summary>
- /// <param name="StrSelectPath"></param>
- /// <param name="IsRecursion"></param>
- /// <returns></returns>
- public static bool DeleteOtherConsumePhoto( string StrSelectPath, bool IsRecursion = false, int DeleteDressType = 0 )
- {
- string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto();
- if ( DeleteDressType == 0 )
- {
- StrParentPath += @"\Small\" + StrSelectPath;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return DeleteOtherConsumePhoto(StrSelectPath, IsRecursion, DeleteDressType: 0);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- else
- {
- StrParentPath += @"\" + StrSelectPath;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return DeleteOtherConsumePhoto(StrSelectPath, IsRecursion, DeleteDressType: 1);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
- #endregion
- #region 医院跟踪
- static string StrReminderSettingsArray = "预产期:1,客户生日:2,婚庆日期:3,结婚纪念日:4";
- /// <summary>
- /// 系统自动提醒设置
- /// </summary>
- /// <param name="objValue"></param>
- /// <returns></returns>
- public static string ReminderSettings( string objValue )
- {
- string StrReturn = "满";
- string[] StrArray = StrReminderSettingsArray.Split(',');
- for ( int i = 0; i < StrArray.Length; i++ )
- {
- string[] StrArray2 = StrArray[i].Trim().Split(':');
- if ( objValue.Trim() == StrArray2[0].Trim() )
- {
- StrReturn = "前";
- break;
- }
- if ( objValue.Trim().IndexOf(StrArray2[0].Trim()) != -1 )
- {
- StrReturn = "前";
- break;
- }
- }
- return StrReturn;
- }
- /// <summary>
- /// 系统自动提醒设置
- /// </summary>
- /// <param name="objValue"></param>
- /// <returns></returns>
- public static string ReminderSettings( int objValue )
- {
- string StrReturn = "满";
- string[] StrArray = StrReminderSettingsArray.Split(',');
- for ( int i = 0; i < StrArray.Length; i++ )
- {
- string[] StrArray2 = StrArray[i].Trim().Split(':');
- if ( objValue == Convert.ToInt32(StrArray2[1].Trim()) )
- {
- StrReturn = "前";
- break;
- }
- }
- return StrReturn;
- }
- /// <summary>
- /// 获取医院跟踪缩略图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetHospitalImage_Small( string StrOrdNumber, string StrPhotoPath, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhotoPath) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + "\\" + StrOrdNumber + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhotoPath) + ".jpg";
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, StrPhotoPath);
- }
- catch
- {
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- return img;
- }
- /// <summary>
- /// 获取医院跟踪缩略图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static void GetHospitalImage_Small( LYFZ.ComponentLibrary.ListViewEx listViewData, ImageList mlistImagePhoto, string StrOrdNumber, bool IsShowDefaultPhoto = true )
- {
- listViewData.Items.Clear();
- if ( !string.IsNullOrEmpty(StrOrdNumber) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + @"\" + StrOrdNumber + @"\Small\";
- List<string> StrList = new List<string>();
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.GetDirectoryFileList(out StrList, strImgPath);
- for ( int i = 0; i < StrList.Count; i++ )
- {
- Bitmap img = null;
- retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, StrList[i].Trim());
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- ListViewItem lvi = new ListViewItem();
- lvi.ImageKey = StrList[i].Trim();
- lvi.Text = System.IO.Path.GetFileNameWithoutExtension(StrList[i].Trim());
- lvi.Tag = StrList[i].Trim();
- lvi.ToolTipText = lvi.Text;
- if ( !mlistImagePhoto.Images.Keys.Contains(StrList[i].Trim()) )
- {
- mlistImagePhoto.Images.Add(StrList[i].Trim(), img);
- }
- listViewData.Items.Add(lvi);
- }
- }
- catch
- {
- }
- }
- }
- /// <summary>
- /// 获取医院跟踪原图
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetHospitalImage_Original( string StrOrdNumber, string StrPhoto, bool IsShowDefaultPhoto = true )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + "\\" + StrOrdNumber + @"\" + StrPhoto;
- string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
- }
- catch
- {
- }
- }
- if ( img == null && IsShowDefaultPhoto )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- return img;
- }
- /// <summary>
- /// 上传医院跟踪相片
- /// </summary>
- /// <param name="StrSelectPath">选择的相片路径</param>
- /// <param name="StrOrderNumber">其他消费的编号</param>
- /// <param name="IsRecursion">是否递归上传失败的相片</param>
- /// <param name="UpdateDressType">上传类型 0:上传缩略图 1:上传原图</param>
- /// <returns></returns>
- public static bool UpdateHospitalPhoto( string StrSelectPath, string StrOrderNumber, bool IsRecursion = false, int UpdateDressType = 0 )
- {
- string[] StrArray = StrSelectPath.Trim().Split('|');
- string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + @"\" + StrOrderNumber;
- if ( UpdateDressType == 0 )
- {
- string StrParentPath_Small = StrParentPath + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg";
- Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100);
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath_Small, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return UpdateHospitalPhoto(StrSelectPath, StrOrderNumber, IsRecursion);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- else
- {
- string StrParentPath_Original = StrParentPath + @"\" + System.IO.Path.GetFileName(StrArray[0].Trim());
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(StrArray[0].Trim(), StrParentPath_Original, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return UpdateHospitalPhoto(StrSelectPath, StrOrderNumber, IsRecursion);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
- /// <summary>
- /// 删除其他消费相片
- /// </summary>
- /// <param name="StrSelectPath"></param>
- /// <param name="IsRecursion"></param>
- /// <returns></returns>
- public static bool DeleteHospitalPhoto( string StrSelectPath, string StrOrdNumber, bool IsRecursion = false, int DeleteDressType = 0 )
- {
- string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto();
- if ( DeleteDressType == 0 )
- {
- StrParentPath += "\\" + StrOrdNumber + @"\Small\" + StrSelectPath;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return DeleteHospitalPhoto(StrSelectPath, StrOrdNumber, IsRecursion, DeleteDressType: 0);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- else
- {
- StrParentPath += "\\" + StrOrdNumber + @"\" + StrSelectPath;
- string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
- if ( ret.IndexOf("成功") == -1 )
- {
- if ( !IsRecursion )
- {
- return DeleteHospitalPhoto(StrSelectPath, StrOrdNumber, IsRecursion, DeleteDressType: 1);
- }
- else
- {
- return false;
- }
- }
- else
- {
- return true;
- }
- }
- }
- #endregion
- #region 图片处理
- /// <summary>
- /// 获取产品图片
- /// </summary>
- /// <param name="StrPhoto"></param>
- /// <returns></returns>
- public static Image GetProductImage( string StrPhoto )
- {
- Bitmap img = null;
- if ( !string.IsNullOrEmpty(StrPhoto) )
- {
- try
- {
- img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(StrPhoto));
- }
- catch
- {
- }
- }
- if ( img == null )
- {
- img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
- }
- return img;
- }
- /// <summary>
- /// 下载图片
- /// </summary>
- /// <param name="pict">控件</param>
- /// <param name="StrName">要保存的名字</param>
- public static void DownloadLog( LYFZ.ComponentLibrary.PictureBoxEx pict, string StrName )
- {
- if ( pict.Image != null )
- {
- DownloadLog(pict.Image, StrName + ".jpg");
- //string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- //Bitmap bmp = new Bitmap(pict.Image);
- //bmp.Save(dir + "\\" + StrName + ".jpg");
- //MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面");
- }
- else
- {
- MessageBoxCustom.Show("图片未上传!");
- }
- }
- /// <summary>
- /// 下载图片
- /// </summary>
- /// <param name="Img">图片</param>
- /// <param name="StrName">图片名</param>
- public static void DownloadLog( Image Img, string StrName, bool IsShowPromptOK = true )
- {
- if ( Img != null )
- {
- string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- Bitmap bmp = new Bitmap(Img);
- LYFZ.ImageFunction.ThumbImgae.SaveIamge(Img, 90, dir + "\\" + StrName);
- if ( IsShowPromptOK )
- {
- MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面");
- }
- }
- else
- {
- MessageBoxCustom.Show("图片不存在!");
- }
- }
- /// <summary>
- /// 下载图片
- /// </summary>
- /// <param name="Img">图片</param>
- /// <param name="StrName">图片名</param>
- public static void DownloadToDirectory( Image Img, string StrPath, bool IsShowPromptOK = true )
- {
- if ( Img != null )
- {
- LYFZ.ImageFunction.ThumbImgae.SaveIamge(Img, 90, StrPath);
- if ( IsShowPromptOK )
- {
- MessageBoxCustom.Show("下载成功!下载储存于:\r\n" + System.IO.Path.GetDirectoryName(StrPath));
- }
- }
- else
- {
- MessageBoxCustom.Show("图片不存在!");
- }
- }
- /// <summary>
- /// 图片另存为
- /// </summary>
- public static void DownloadSaveAs( Image Img, string StrFilleName = "", bool IsShowPromptOK = true )
- {
- if ( Img != null )
- {
- SaveFileDialog saveFileDialog1 = new SaveFileDialog();
- saveFileDialog1.InitialDirectory = @"C:\Users\e_teng\Desktop\";
- saveFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";
- saveFileDialog1.Title = "保存图像";
- saveFileDialog1.FileName = StrFilleName;
- if ( saveFileDialog1.ShowDialog() == DialogResult.OK )
- {
- string StrPath = saveFileDialog1.FileName;
- string QStrPath = StrPath.Substring(0, StrPath.IndexOf('.'));//后缀
- string HstrPath = StrPath.Substring(StrPath.IndexOf('.'), StrPath.Length - (StrPath.IndexOf('.')));
- string StrPathNow = QStrPath;
- Img.Save(StrPathNow + HstrPath);
- if ( IsShowPromptOK )
- {
- MessageBoxCustom.Show("保存为完毕");
- }
- }
- }
- }
- #endregion
- #region 礼服处理
- /// <summary>
- /// 礼服是否撞期
- /// </summary>
- public static string IsDressClashDateTime( LYFZ.ComponentLibrary.ListViewEx listViewData, DateTime TakeDressTime )
- {
- Hashtable htData = new Hashtable();
- for ( int i = 0; i < listViewData.Items.Count; i++ )
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)listViewData.Items[i].Tag;
- htData[columnModel] = listViewData.Items[i].SubItems["礼服名称"].Text.Trim();
- }
- return IsDressClashDateTime(htData, TakeDressTime);
- }
- /// <summary>
- /// 礼服是否撞期
- /// </summary>
- /// <param name="htData"></param>
- /// <param name="TakeDressTime"></param>
- /// <returns></returns>
- public static string IsDressClashDateTime( Hashtable htData, DateTime TakeDressTime )
- {
- string StrDressClash = "";
- DataTable dtSaleRental = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail Left Join tb_ErpDressSaleRentalOrder on Dsrd_Number = Dsro_Number", StrWhere: "Dsro_Type='0' and Dsrd_BackStatus='3' And Dsrd_TakeDressTime is not null", ShowColumnName: "Dsrd_DressNumber,DateAdd(d, -CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dsro_TakeDressTime) as '还衣天数取衣日期',DateAdd(d, CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dsro_ReservationBackTime) as '还衣天数加还衣日期'", GroupBy: "Dsrd_DressNumber,Dsro_TakeDressTime,Dsro_ReservationBackTime").Tables[0];
- foreach ( DictionaryEntry item in htData )
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)item.Key;
- bool IsFind = true;
- if ( columnModel.ID > 0 )
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail", StrWhere: "ID = '" + columnModel.ID + "'", ShowColumnName: "Dsrd_TakeDressTime").Tables[0];
- if ( dt.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[0]["Dsrd_TakeDressTime"].ToString().Trim())) )
- {
- IsFind = false;
- }
- }
- }
- if ( IsFind )
- {
- DataRow[] row_DSRD = dtSaleRental.Select("Dsrd_DressNumber = '" + columnModel.StrDressNumber.Trim() + "' ");
- if ( row_DSRD.Length > 0 )
- {
- bool isFind = false;
- for ( int t = 0; t < row_DSRD.Length; t++ )
- {
- if ( TakeDressTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeDressTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]) )
- {
- isFind = true;
- }
- }
- if ( isFind )
- {
- StrDressClash += "礼服编号:" + columnModel.StrDressNumber.Trim() + " " + " 礼服名称:" + item.Value.ToString().Trim() + "\r\n";
- }
- }
- }
- }
- if ( string.IsNullOrEmpty(StrDressClash) )
- {
- DataTable dtSendWash = orbll.GetView_Custom("tb_ErpDressSendWashOrder Left Join tb_ErpDressSendWashDetail on Dswd_Number = Dswo_Number", StrWhere: "Dswd_BackStatus='3'", ShowColumnName: "Dswd_DressNumber,DateAdd(d, -CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dswo_SendWashTime) as '还衣天数取衣日期',DateAdd(d, CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dswo_ReservationBackTime) as '还衣天数加还衣日期'", GroupBy: "Dswd_DressNumber,Dswo_SendWashTime,Dswo_ReservationBackTime").Tables[0];
- foreach ( DictionaryEntry item in htData )
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)item.Key;
- DataRow[] row_DSRD = dtSendWash.Select("Dswd_DressNumber = '" + columnModel.StrDressNumber.Trim() + "' ");
- if ( row_DSRD.Length > 0 )
- {
- bool isFind = false;
- for ( int t = 0; t < row_DSRD.Length; t++ )
- {
- if ( TakeDressTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeDressTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]) )
- {
- isFind = true;
- }
- }
- if ( isFind )
- {
- StrDressClash += "礼服编号:" + columnModel.StrDressNumber.Trim() + " " + " 礼服名称:" + item.Value.ToString().Trim() + "\r\n";
- }
- }
- }
- }
- if ( !string.IsNullOrEmpty(StrDressClash) )
- {
- StrDressClash += "已经撞期,无法租售!";
- }
- return StrDressClash;
- }
- #endregion
- #region 客服任务
- /// <summary>
- /// 获取任务事项
- /// </summary>
- /// <returns></returns>
- public static string GetTaskItem()
- {
- string[] StrEnumArray = Enum.GetNames(typeof(LYFZ.EnumPublic.ClientServiceTaskType));
- return string.Join(",", StrEnumArray).Replace(LYFZ.EnumPublic.ClientServiceTaskType.无分类.ToString(), "").Trim(',');
- }
- /// <summary>
- /// 获取任务事项的具体事项
- /// </summary>
- /// <param name="StrItem">任务事项</param>
- /// <returns></returns>
- public static string GetTaskItemSelect( string StrItem )
- {
- List<string> StrList = new List<string>();
- switch ( (LYFZ.EnumPublic.ClientServiceTaskType)Enum.Parse(typeof(LYFZ.EnumPublic.ClientServiceTaskType), StrItem.Trim()) )
- {
- case EnumPublic.ClientServiceTaskType.摄控确认:
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣服客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.摄控医院客人.ToString());
- break;
- case EnumPublic.ClientServiceTaskType.流程通知:
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已定未拍.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已拍未拍完.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已拍未选.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已修未选.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已设计未看.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.部分回件未取.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.全部回件未取.ToString());
- break;
- case EnumPublic.ClientServiceTaskType.沟通助手:
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.结婚客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.结婚纪念日.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.客户生日.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.宝贝生日.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.转介绍客户.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.会员积分.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.孕妇周期.ToString());
- break;
- case EnumPublic.ClientServiceTaskType.意向跟踪:
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.意向客户.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.订单意向.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.医院意向.ToString());
- break;
- case EnumPublic.ClientServiceTaskType.满意度回访:
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.接单回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务回访.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.其它回访.ToString());
- break;
- }
- if ( StrList.Count > 0 )
- {
- return string.Join(",", StrList).Trim(',');
- }
- else
- {
- return "";
- }
- }
- /// <summary>
- /// 安排客服
- /// </summary>
- /// <param name="dgvData"></param>
- /// <param name="modelClientServiceTask"></param>
- /// <param name="ClientServiceTaskType"></param>
- public static void ClientServiceAnPai(LYFZ.ComponentLibrary.DataGridViewEc dgvData, LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceTaskType )
- {
- string StrWhere = "";
- DateTime StrTime = SDateTime.Now;
- List<LYFZ.Helper.CommandInfo> clist = new List<CommandInfo>();
- LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask();
- LYFZ.Model.Model_ErpClientServiceTask modelCst = null;
- DataTable dtprompt = new DataTable();
- DataTable dt = orbll.GetView_Custom("tb_ErpClientServiceTask", StrWhere: "Cst_TaskItem = '" + ClientServiceTaskType.ToString().Trim() + "' And Cst_TaskTermTime = '" + modelClientServiceTask.StrDateTime + "' And Cst_CompletionIntStatus = 0", ShowColumnName: "*").Tables[0];
- #region 获取查询条件
- switch ( ClientServiceTaskType )
- {
- case EnumPublic.ClientServiceTaskItem.接单回访:
- case EnumPublic.ClientServiceTaskItem.其它回访:
- case EnumPublic.ClientServiceTaskItem.订单意向:
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- StrWhere += "'" + dgvData.SelectedRows[i].Cells["Ord_Number"].Value.ToString().Trim() + "',";
- }
- if ( StrWhere.Trim().Length > 0 )
- {
- StrWhere = "GP_OrderNumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.选衣回访:
- case EnumPublic.ClientServiceTaskItem.拍照回访:
- case EnumPublic.ClientServiceTaskItem.选片回访:
- case EnumPublic.ClientServiceTaskItem.看版回访:
- case EnumPublic.ClientServiceTaskItem.取件回访:
- case EnumPublic.ClientServiceTaskItem.服务回访:
- case EnumPublic.ClientServiceTaskItem.已拍未选:
- case EnumPublic.ClientServiceTaskItem.已修未选:
- case EnumPublic.ClientServiceTaskItem.已设计未看:
- case EnumPublic.ClientServiceTaskItem.部分回件未取:
- case EnumPublic.ClientServiceTaskItem.全部回件未取:
- case EnumPublic.ClientServiceTaskItem.已定未拍:
- case EnumPublic.ClientServiceTaskItem.已拍未拍完:
- case EnumPublic.ClientServiceTaskItem.选衣服客人:
- case EnumPublic.ClientServiceTaskItem.选片客人:
- case EnumPublic.ClientServiceTaskItem.看版客人:
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- StrWhere += "'" + dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim() + "',";
- }
- if ( StrWhere.Trim().Length > 0 )
- {
- StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.拍照客人:
- case EnumPublic.ClientServiceTaskItem.取件客人:
- case EnumPublic.ClientServiceTaskItem.服务客人:
- Hashtable htData = new Hashtable();
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- htData[dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim()] = dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim();
- }
- foreach ( string item in htData.Keys )
- {
- StrWhere += "'" + item + "',";
- }
- if ( StrWhere.Trim().Length > 0 )
- {
- StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.摄控医院客人:
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- StrWhere += "'" + dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() + "',";
- }
- if ( StrWhere.Trim().Length > 0 )
- {
- StrWhere = "tb_ErpHospitalDispatchDoor.ID in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.意向客户:
- string StrClientNumber = "";
- string StrClientGroupNumber = "";
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- StrClientNumber += "'" + dgvData.SelectedRows[i].Cells["客户编号"].Value.ToString().Trim() + "',";
- StrClientGroupNumber += "'" + dgvData.SelectedRows[i].Cells["客户组编号"].Value.ToString().Trim() + "',";
- }
- if ( StrClientNumber.Trim().Length > 0 && StrClientGroupNumber.Trim().Length > 0 )
- {
- StrWhere = "GP_CustomerGroupID in (" + StrClientGroupNumber.TrimEnd(',') + ") And GM_CustomerID in (" + StrClientNumber.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.医院意向:
- case EnumPublic.ClientServiceTaskItem.孕妇周期:
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- StrWhere += "'" + dgvData.SelectedRows[i].Cells["来单批号"].Value.ToString().Trim() + "',";
- }
- if ( StrWhere.Trim().Length > 0 )
- {
- StrWhere = "Hct_Oddnumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.结婚客人:
- case EnumPublic.ClientServiceTaskItem.结婚纪念日:
- case EnumPublic.ClientServiceTaskItem.客户生日:
- case EnumPublic.ClientServiceTaskItem.宝贝生日:
- case EnumPublic.ClientServiceTaskItem.转介绍客户:
- case EnumPublic.ClientServiceTaskItem.会员积分:
- for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
- {
- StrWhere += "'" + dgvData.SelectedRows[i].Cells["客户编号"].Value.ToString().Trim() + "',";
- }
- if ( StrWhere.Trim().Length > 0 )
- {
- StrWhere = "Cus_CustomerNumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- }
- #endregion
- #region 获取保存数据
- switch ( ClientServiceTaskType )
- {
- case EnumPublic.ClientServiceTaskItem.接单回访:
- case EnumPublic.ClientServiceTaskItem.其它回访:
- case EnumPublic.ClientServiceTaskItem.订单意向:
- #region 按订单分
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tempTB_AggregationCustomer Left Join tb_ErpOrder on Ord_Number = GP_OrderNumber", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,Cus_Name,Ord_SeriesName,Ord_SeriesPrice,Ord_SinceOrderNumber,(select stuff((select ',' + Ordpg_Sights from tb_ErpOrdersPhotography where Ordpg_Number = Ord_Number for xml path('')),1,1,'')) AS Ords_SightsName").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 套系名称'" + dtClientGroup.Rows[i]["Ord_SeriesName"].ToString().Trim() + "'(" + LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtClientGroup.Rows[i]["Ord_SeriesPrice"]) + ")\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
- modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim();
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.选衣回访:
- case EnumPublic.ClientServiceTaskItem.拍照回访:
- case EnumPublic.ClientServiceTaskItem.选片回访:
- case EnumPublic.ClientServiceTaskItem.看版回访:
- case EnumPublic.ClientServiceTaskItem.取件回访:
- case EnumPublic.ClientServiceTaskItem.服务回访:
- case EnumPublic.ClientServiceTaskItem.已拍未选:
- case EnumPublic.ClientServiceTaskItem.已修未选:
- case EnumPublic.ClientServiceTaskItem.已设计未看:
- case EnumPublic.ClientServiceTaskItem.部分回件未取:
- case EnumPublic.ClientServiceTaskItem.全部回件未取:
- case EnumPublic.ClientServiceTaskItem.已定未拍:
- case EnumPublic.ClientServiceTaskItem.已拍未拍完:
- case EnumPublic.ClientServiceTaskItem.选衣服客人:
- case EnumPublic.ClientServiceTaskItem.拍照客人:
- case EnumPublic.ClientServiceTaskItem.选片客人:
- case EnumPublic.ClientServiceTaskItem.看版客人:
- case EnumPublic.ClientServiceTaskItem.取件客人:
- case EnumPublic.ClientServiceTaskItem.服务客人:
- #region 按数码分
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tempTB_AggregationCustomer Left Join tb_ErpOrderDigitalStatus on Ords_OrdNumber = GP_OrderNumber Left Join tb_ErpOrder on Ord_Number = GP_OrderNumber", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,Cus_Name,Ords_ViceNumber,Ord_SinceOrderNumber,Ords_SightsName").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 拍摄名称'" + dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim();
- modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim();
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.摄控医院客人:
- #region 摄控医院客人
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpHospitalDispatchDoor Left Join tb_ErpHospitalClient on Hct_Oddnumber = Hdr_Number ", StrWhere: StrWhere, ShowColumnName: "tb_ErpHospitalDispatchDoor.ID,Hct_Oddnumber,Hct_CustomerName,Hct_MyselfMobile").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["ID"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("医院客户'" + dtClientGroup.Rows[i]["Hct_CustomerName"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Hct_MyselfMobile"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["ID"].ToString().Trim();
- modelCst.Cst_SightsName = "派单上门";
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.意向客户:
- #region 意向客户
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomerGroup Left Join tb_ErpCustomerGroupMembers on GM_CustomerGroupID = GP_CustomerGroupID Left Join tb_ErpCustomer on Cus_CustomerNumber = GM_CustomerGroupID", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,GM_CustomerID,Cus_Name,Cus_Telephone").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_ClientGroupNumber = '" + dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["GM_CustomerID"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Cus_Telephone"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- string StrSightsName = "";
- string StrShowOrdNumber = "";
- if ( dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim().Length > 0 )
- {
- DataTable dtOrder = orbll.GetView_Custom("tb_ErpOrder Left Join tb_ErpOrderDigitalStatus on Ords_OrdNumber = Ord_Number", StrWhere: "Ord_Number = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "'", ShowColumnName: "Ord_SinceOrderNumber,Ords_SightsName").Tables[0];
- if ( dtOrder.Rows.Count > 0 )
- {
- StrShowOrdNumber = dtOrder.Rows[0]["Ord_SinceOrderNumber"].ToString().Trim();
- for ( int j = 0; j < dtOrder.Rows.Count; j++ )
- {
- StrSightsName += dtOrder.Rows[0]["Ords_SightsName"].ToString().Trim() + ",";
- }
- }
- }
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["GM_CustomerID"].ToString().Trim();
- modelCst.Cst_SightsName = StrSightsName.TrimEnd(',');
- modelCst.Cst_ShowOrderNumber = StrShowOrdNumber;
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.医院意向:
- case EnumPublic.ClientServiceTaskItem.孕妇周期:
- #region 医院意向
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpHospitalClient", StrWhere: StrWhere, ShowColumnName: "Hct_Oddnumber,Hct_CustomerName,Hct_MyselfMobile").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("医院客户'" + dtClientGroup.Rows[i]["Hct_CustomerName"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Hct_MyselfMobile"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_SightsName = "";
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.结婚客人:
- case EnumPublic.ClientServiceTaskItem.结婚纪念日:
- case EnumPublic.ClientServiceTaskItem.客户生日:
- case EnumPublic.ClientServiceTaskItem.宝贝生日:
- case EnumPublic.ClientServiceTaskItem.转介绍客户:
- #region 结婚客人
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: StrWhere, ShowColumnName: "Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Cus_Telephone"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
- modelCst.Cst_SightsName = "";
- modelCst.Cst_ShowOrderNumber = "";
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.会员积分:
- #region 会员积分
- if ( StrWhere.Trim().Length > 0 )
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomer Left Join tb_ErpMemberCard on Mc_CustomerNumber = Cus_CustomerNumber", StrWhere: StrWhere, ShowColumnName: "Mc_Number,Mc_CradNumber,Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0];
- for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
- {
- DataRow[] dtRows = dt.Select("Cst_ClientGroupNumber = '" + dtClientGroup.Rows[i]["Mc_Number"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim() + "'");
- if ( dtRows.Length > 0 )
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
- {
- continue;
- }
- if ( StrUserName.Trim().Length > 0 )
- {
- if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Cus_Telephone"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- continue;
- }
- }
- modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Mc_Number"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
- modelCst.Cst_SightsName = "";
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Mc_CradNumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- }
- #endregion
- if ( clist.Count > 0 )
- {
- if ( MessageBoxCustom.Show("您确定要安排吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
- {
- return;
- }
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0 )
- {
- MessageBoxCustom.Show("安排成功!");
- }
- else
- {
- MessageBoxCustom.Show("安排失败!");
- }
- }
- else
- {
- MessageBoxCustom.Show("没有可以安排的数据!");
- }
- }
- /// <summary>
- /// 重新安排客户服务任务
- /// </summary>
- /// <param name="dtRow"></param>
- /// <param name="StrTime"></param>
- /// <param name="modelClientServiceTask"></param>
- /// <returns></returns>
- public static LYFZ.Model.Model_ErpClientServiceTask GetClientServiceUpdateModel( DataRow dtRow, DateTime StrTime, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask )
- {
- LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask();
- LYFZ.Model.Model_ErpClientServiceTask modelCst = cstbll.DataRowToModel(dtRow);
- modelCst.Cst_TaskTermTime = Convert.ToDateTime(modelClientServiceTask.StrDateTime);
- modelCst.Cst_ServicePerson = modelClientServiceTask.StrUserID;
- modelCst.Cst_TaskRemark = modelClientServiceTask.StrRemark;
- modelCst.Cst_UpdateDateTime = StrTime;
- modelCst.Cst_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- return modelCst;
- }
- /// <summary>
- /// 添加客户服务任务
- /// </summary>
- /// <param name="StrTime"></param>
- /// <param name="StrMainNumber"></param>
- /// <param name="StrViceNumber"></param>
- /// <param name="StrThreeNumber"></param>
- /// <param name="EnumTaskModule"></param>
- /// <param name="modelClientServiceTask"></param>
- /// <param name="ClientServiceAnPaiType"></param>
- /// <returns></returns>
- public static LYFZ.Model.Model_ErpClientServiceTask GetClientServiceAddModel( LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceAnPaiType )
- {
- LYFZ.Model.Model_ErpClientServiceTask modelCst = new Model.Model_ErpClientServiceTask();
- modelCst.Cst_Number = "CST" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
- modelCst.Cst_TaskModule = EnumTaskModule.ToString().Trim();
- modelCst.Cst_TaskItem = ClientServiceAnPaiType.ToString().Trim();
- modelCst.Cst_TaskTermTime = Convert.ToDateTime(modelClientServiceTask.StrDateTime);
- modelCst.Cst_ServicePerson = modelClientServiceTask.StrUserID;
- modelCst.Cst_TaskRemark = modelClientServiceTask.StrRemark;
- modelCst.Cst_CompletionIntStatus = 0;
- modelCst.Cst_CompletionStatus = "未完成";
- modelCst.Cst_CompletionRemark = "";
- modelCst.Cst_CompletionPerson = "";
- modelCst.Cst_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- return modelCst;
- }
- #endregion
- #region 相片查看输入密码认证
- /// <summary>
- ///
- /// </summary>
- /// <param name="StrViceNumber"></param>
- /// <returns></returns>
- public static bool IsEnterPassword( string StrViceNumber )
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigital", StrWhere: "Ordv_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "Ordv_PhotoPassword").Tables[0];
- if ( dt.Rows.Count > 0 )
- {
- if ( dt.Rows[0]["Ordv_PhotoPassword"].ToString().Trim().Length > 0 )
- {
- LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm frm = new MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm();
- frm.StrWindowText = "请输入相片查看密码";
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- if ( LYFZ.Command.Command_MD5.md5(frm.Pwd) == dt.Rows[0]["Ordv_PhotoPassword"].ToString().Trim() )
- {
- return true;
- }
- MessageBoxCustom.Show("密码输入错误!");
- }
- }
- else
- {
- return true;
- }
- }
- return false;
- }
- #endregion
- /// <summary>
- /// 财务(日、月、年)订单类型
- /// </summary>
- /// <param name="cmbtreev"></param>
- public static void BindFinanceOrderType( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev )
- {
- Hashtable htData = new Hashtable();
- htData["0"] = LYFZ.EnumPublic.OrderNumberPrefixType.婚纱订单.ToString().Trim();
- htData["1"] = LYFZ.EnumPublic.OrderNumberPrefixType.儿童订单.ToString().Trim();
- htData["2"] = LYFZ.EnumPublic.OrderNumberPrefixType.写真订单.ToString().Trim();
- htData["3"] = LYFZ.EnumPublic.OrderNumberPrefixType.服务订单.ToString().Trim();
- htData["4"] = LYFZ.EnumPublic.OrderNumberPrefixType.婚庆订单.ToString().Trim();
- switch ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
- {
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
- htData.Remove("1");
- break;
- case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
- htData.Remove("0");
- break;
- }
- if ( !LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition )
- {
- htData.Remove("2");
- }
- cmbtreev.SetTextAndTag_ValueNull();
- cmbtreev.Nodes.Clear();
- TreeNode root = null;
- if ( htData.Count > 0 )
- {
- root = new TreeNode();
- root.Text = " ";
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- for ( int i = 0; i < 5; i++ )
- {
- if ( htData.ContainsKey("" + i + "") )
- {
- string StrValue = htData["" + i + ""].ToString().Trim();
- root = new TreeNode();
- root.Text = StrValue.Trim();
- root.Tag = StrValue.Trim();
- root.Name = StrValue.Trim();
- cmbtreev.Nodes.Add(root);
- }
- }
- cmbtreev.TagFindText("");
- }
- /// <summary>
- /// 日财务报表双击查看详情
- /// </summary>
- /// <param name="StrID"></param>
- /// <param name="StrType"></param>
- public static void FinanceDayRowsDoubleClick( string StrID, string StrType )
- {
- switch ( StrType )
- {
- case "0":
- case "1":
- case "2":
- case "3":
- case "4":
- LYFZ.Software.MainBusiness.StatisticalInquiry.MonthFinance.FinanceDayDetails frm = new StatisticalInquiry.MonthFinance.FinanceDayDetails();
- frm.StrID = StrID;
- frm.ShowDialog();
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// ListView控件绘制列表单双行
- /// </summary>
- /// <param name="ProcessType"></param>
- public static void ListViewDrawSingleOrDoubleRows( ListViewEx ltView )
- {
- int IntCount = 0;
- if ( ltView.Groups.Count > 0 && ltView.ShowGroups )
- {
- for ( int i = 0; i < ltView.Groups.Count; i++ )
- {
- for ( int j = 0; j < ltView.Groups[i].Items.Count; j++ )
- {
- if ( (IntCount % 2) > 0 )
- {
- ltView.Groups[i].Items[j].BackColor = System.Drawing.Color.PapayaWhip;
- }
- else
- {
- ltView.Groups[i].Items[j].BackColor = System.Drawing.Color.PowderBlue;
- }
- IntCount++;
- }
- }
- }
- else
- {
- for ( int j = 0; j < ltView.Items.Count; j++ )
- {
- if ( (IntCount % 2) > 0 )
- {
- ltView.Items[j].BackColor = System.Drawing.Color.PapayaWhip;
- }
- else
- {
- ltView.Items[j].BackColor = System.Drawing.Color.PowderBlue;
- }
- IntCount++;
- }
- }
- }
- /// <summary>
- /// DataGridView设置列标题显示隐藏字段
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="StrEnabled"></param>
- /// <returns></returns>
- public static bool ShowDataGridViewSetColumn( object sender, string StrEnabled = "" )
- {
- DataGridViewEc dgvNewData = (DataGridViewEc)sender;
- if ( !string.IsNullOrEmpty(dgvNewData.dgvGuidName) && dgvNewData.AllowUserToOrderColumns )
- {
- LYFZ.ComponentLibrary.DataGridViewSetColumn frm = new DataGridViewSetColumn();
- frm.dgvNewData = dgvNewData;
- frm.listEnabled = new List<string>(StrEnabled.Trim().Split(','));
- frm.ShowDialog();
- return frm.IsSaveed;
- }
- return false;
- }
- /// <summary>
- /// 获取订单的人员所相关的数据
- /// </summary>
- /// <param name="StrOrdNumber"></param>
- /// <param name="StrType"></param>
- /// <returns></returns>
- public static Hashtable GetOrderExtractIntoItemHashtable( string StrOrdNumber, string StrOrdViceNumber, string StrType )
- {
- Hashtable htData = new Hashtable();
- htData["StrOrdNumber"] = StrOrdNumber;
- htData["StrOrdViceNumber"] = StrOrdViceNumber;
- htData["StrType"] = StrType;
- htData["tblDepartment"] = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_Department;
- htData["tblUser"] = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: true, IsShowAdmin: false);// LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_User;
- htData["StrUsrID"] = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- return htData;
- }
- internal static void BindComboBoxTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null, bool IsBindParent = false, bool IsClearNodes = true )
- {
- if ( tbl == null )
- {
- tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0];
- }
- if ( IsClearNodes )
- {
- cmbtreev.Nodes.Clear();
- }
- DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
- if ( dtRow.Length > 0 )
- {
- TreeNode root = null;
- if ( IsBindParent )
- {
- root = new TreeNode();
- root.Text = dtRow[0]["Sc_ClassName"].ToString();
- root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
- root.Name = dtRow[0]["ID"].ToString().Trim();
- CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
- cmbtreev.Nodes.Add(root);
- }
- else
- {
- DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
- if ( dtRow2.Length > 0 )
- {
- for ( int i = 0; i < dtRow2.Length; i++ )
- {
- if ( i == 0 )
- {
- if ( IsFirstNodeNull )
- {
- root = new TreeNode();
- root.Text = IsFirstNodeName;
- root.Tag = "";
- root.Name = "";
- cmbtreev.Nodes.Add(root);
- }
- }
- root = new TreeNode();
- root.Text = dtRow2[i]["Sc_ClassName"].ToString();
- root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
- root.Name = dtRow2[i]["ID"].ToString();
- CreateTreeViewSystemCategory(root, dtRow2[i]["ID"].ToString(), tbl);
- cmbtreev.Nodes.Add(root);
- }
- }
- else
- {
- root = new TreeNode();
- root.Text = dtRow[0]["Sc_ClassName"].ToString();
- root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
- root.Name = dtRow[0]["ID"].ToString().Trim();
- CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
- cmbtreev.Nodes.Add(root);
- }
- }
- }
- }
- }
- /// <summary>
- /// DatatTable处理
- /// </summary>
- public class PublicGetVersionDataTable
- {
- static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- /// <summary>
- /// 获取用户数据
- /// </summary>
- /// <param name="IsShowResign">是否显示离职人员</param>
- /// <param name="IsShowAdmin">是否显示Admin帐号</param>
- /// <returns></returns>
- public static DataTable GetUserTable( bool IsShowResign = true, bool IsShowAdmin = false )
- {
- string StrWhere = "";
- if ( !IsShowResign )
- {
- StrWhere = "User_Status != '离职'";
- }
- if ( !IsShowAdmin )
- {
- if ( StrWhere != "" )
- {
- StrWhere += " And ";
- }
- StrWhere += "User_Account != 'admin'";
- }
- return orbll.GetView_Custom("tb_ErpUser", StrWhere: StrWhere, ShowColumnName: "User_Account,User_Name,User_EmployeeID,User_Department,User_Status,User_DividedShop").Tables[0];
- }
- }
- /// <summary>
- /// 处理数据库数据
- /// </summary>
- public static class PublicGetTableName
- {
- /// <summary>
- /// 获取客户数据
- /// </summary>
- /// <param name="tbl_Client"></param>
- /// <param name="ArrayClient"></param>
- /// <param name="StrOrdType"></param>
- /// <returns></returns>
- public static Hashtable GetClientData( DataTable tbl_Client, string[] ArrayClient, string StrOrdType )
- {
- Hashtable htData = new Hashtable();
- htData["strManName"] = "";
- htData["strManPhone"] = "";
- htData["strManSex"] = "";
- htData["strWoManName"] = "";
- htData["strWoManPhone"] = "";
- htData["strWoManSex"] = "";
- for ( int i = 0; i < ArrayClient.Length; i++ )
- {
- if ( !string.IsNullOrEmpty(ArrayClient[i].Trim()) )
- {
- DataRow dtRow = tbl_Client.Rows.Find(ArrayClient[i]);
- if ( StrOrdType == "1" )
- {
- if ( i > 1 )
- {
- break;
- }
- if ( i == 0 )
- {
- htData["strManName"] = dtRow["Cus_Name"].ToString().Trim();
- htData["strManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
- htData["strManSex"] = Convert.ToBoolean(dtRow["Cus_Sex"]) ? "女" : "男";
- }
- else
- {
- htData["strWoManName"] = dtRow["Cus_Name"].ToString().Trim();
- htData["strWoManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
- htData["strWoManSex"] = Convert.ToBoolean(dtRow["Cus_Sex"]) ? "女" : "男";
- }
- }
- else
- {
- if ( StrOrdType == "2" || StrOrdType == "3" )
- {
- if ( i > 0 )
- {
- break;
- }
- }
- if ( !Convert.ToBoolean(dtRow["Cus_Sex"]) )
- {
- htData["strManName"] = dtRow["Cus_Name"].ToString().Trim();
- htData["strManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
- htData["strManSex"] = "男";
- }
- else
- {
- htData["strWoManName"] = dtRow["Cus_Name"].ToString().Trim();
- htData["strWoManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
- htData["strWoManSex"] = "女";
- }
- }
- }
- }
- return htData;
- }
- /// <summary>
- /// 获取景点数据
- /// </summary>
- /// <param name="tbl_Sights"></param>
- /// <param name="StrViceNumber"></param>
- /// <param name="StrOrdType"></param>
- /// <returns></returns>
- public static Hashtable GetSightsData( DataTable tbl_Sights, string StrViceNumber, string StrOrdType )
- {
- Hashtable htData = new Hashtable();
- int NotCount = 0;
- int OkCount = 0;
- int InCount = 0;
- htData["Ordpg_Sights"] = "";
- htData["Ordpg_Photographer"] = "";
- htData["Ordpg_MakeupArtist"] = "";
- htData["Ordpg_PhotographyTimeStart"] = "";
- htData["Ordpg_PhotographyTimeEnd"] = "";
- htData["Ordpg_PhotographyStatus"] = "";
- for ( int i = 0; i < tbl_Sights.Rows.Count; i++ )
- {
- if ( tbl_Sights.Rows[i]["Ordpg_ViceNumber"].ToString().Trim() == StrViceNumber )
- {
- try
- {
- if ( tbl_Sights.Rows[i]["Ordpg_Sights"].ToString().Trim() != "" )
- {
- if ( StrOrdType == "1" )
- {
- htData["Ordpg_Sights"] = tbl_Sights.Rows[i]["Ordpg_Sights"].ToString().Trim();
- }
- }
- }
- catch { }
- try
- {
- if ( tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim() != "" )
- {
- if ( htData["Ordpg_Photographer"].ToString().Trim() == "" )
- {
- htData["Ordpg_Photographer"] += tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim();
- }
- else
- {
- htData["Ordpg_Photographer"] += "," + tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim();
- }
- }
- }
- catch { }
- try
- {
- if ( tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim() != "" )
- {
- if ( htData["Ordpg_MakeupArtist"].ToString().Trim() == "" )
- {
- htData["Ordpg_MakeupArtist"] += tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim();
- }
- else
- {
- htData[".Ordpg_MakeupArtist"] += "," + tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim();
- }
- }
- //开始拍摄日期
- if ( tbl_Sights.Rows[i]["Ordpg_PhotographyTime"].ToString().Trim() != "" )
- {
- if ( htData["Ordpg_PhotographyTimeStart"].ToString().Trim() == "" )
- {
- htData["Ordpg_PhotographyTimeStart"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
- }
- else
- {
- if ( Convert.ToDateTime(htData["Ordpg_PhotographyTimeStart"]) > Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]) )
- {
- htData["Ordpg_PhotographyTimeStart"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
- }
- }
- }
- }
- catch { }
- try
- {
- //最后拍摄日期
- if ( tbl_Sights.Rows[i]["Ordpg_PhotographyTime"].ToString().Trim() != "" )
- {
- if ( htData["Ordpg_PhotographyTimeEnd"].ToString().Trim() == "" )
- {
- htData["Ordpg_PhotographyTimeEnd"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
- }
- else
- {
- if ( Convert.ToDateTime(htData["Ordpg_PhotographyTimeEnd"]) < Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]) )
- {
- htData["Ordpg_PhotographyTimeEnd"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
- }
- }
- }
- }
- catch { }
- try
- {
- if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "0" )
- {
- NotCount++;
- }
- if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "1" )
- {
- OkCount++;
- }
- if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "2" )
- {
- InCount++;
- }
- }
- catch { }
- }
- }
- if ( NotCount > 0 && OkCount == 0 )
- {
- htData["Ordpg_PhotographyStatus"] = "未拍";
- }
- else if ( NotCount > 0 && OkCount > 0 )
- {
- htData["Ordpg_PhotographyStatus"] = "拍摄中";
- }
- else if ( NotCount == 0 && OkCount > 0 )
- {
- htData["Ordpg_PhotographyStatus"] = "OK";
- }
- if ( InCount > 0 )
- {
- htData["Ordpg_PhotographyStatus"] = "拍摄中";
- }
- return htData;
- }
- }
- /// <summary>
- /// 项
- /// </summary>
- public class ListItem
- {
- /// <summary>
- /// 显示的文本
- /// </summary>
- public string StrText
- {
- get; set;
- }
- /// <summary>
- /// 隐藏的值
- /// </summary>
- public object StrValue
- {
- get; set;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="strKey">要显示在页面的值</param>
- /// <param name="strValue">隐藏的值</param>
- public ListItem( string strText, object strValue )
- {
- this.StrText = strText;
- this.StrValue = strValue;
- }
- public override string ToString()
- {
- return this.StrText;
- }
- /// <summary>
- /// 根据ListItem中的Value找到特定的ListItem(仅在ComboBox的Item都为ListItem时有效)
- /// </summary>
- /// <param name="cmb">要查找的ComboBox</param>
- /// <param name="strValue">要查找ListItem的Value</param>
- /// <returns>返回传入的ComboBox中符合条件的第一个ListItem,如果没有找到则返回null.</returns>
- public static ListItem ValueFindByText( ComboBoxEx cmb, string strValue )
- {
- foreach ( ListItem li in cmb.Items )
- {
- if ( li.StrValue.ToString().Trim() == strValue )
- {
- return li;
- }
- }
- return null;
- }
- /// <summary>
- /// 根据ListItem中的Key找到特定的ListItem(仅在ComboBox的Item都为ListItem时有效)
- /// </summary>
- /// <param name="cmb">要查找的ComboBox</param>
- /// <param name="strValue">要查找ListItem的Key</param>
- /// <returns>返回传入的ComboBox中符合条件的第一个ListItem,如果没有找到则返回null.</returns>
- public static ListItem TextFindByValue( ComboBoxEx cmb, string strText )
- {
- foreach ( ListItem li in cmb.Items )
- {
- if ( li.StrText.ToString().Trim() == strText )
- {
- return li;
- }
- }
- return null;
- }
- }
- }
|