PublicCodeClasses.cs 326 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Forms;
  6. using System.Data;
  7. using System.Collections;
  8. using LYFZ.ComponentLibrary;
  9. using System.Drawing;
  10. using System.IO;
  11. using System.ComponentModel;
  12. using System.Globalization;
  13. using LYFZ.Helper;
  14. using System.Windows.Forms.DataVisualization.Charting;
  15. namespace LYFZ.Software.MainBusiness.DoorCityProcess
  16. {
  17. public class PublicGraphics
  18. {
  19. /// <summary>
  20. /// 标题字体笔刷
  21. /// </summary>
  22. public static Brush btitle = Brushes.White;
  23. /// <summary>
  24. /// 标题分割线笔刷
  25. /// </summary>
  26. public static Pen ptitle = new Pen(Brushes.White, 1);
  27. /// <summary>
  28. /// 标题
  29. /// </summary>
  30. public static Brush backColortitle = Brushes.DarkSlateGray;
  31. /// <summary>
  32. /// 边框颜色
  33. /// </summary>
  34. public static Pen PenborderColor = new Pen(Brushes.LightSlateGray, 1);
  35. /// <summary>
  36. /// 单行填充背景颜色
  37. /// </summary>
  38. public static Brush brSingle = Brushes.PapayaWhip;
  39. /// <summary>
  40. /// 双行填充背景颜色
  41. /// </summary>
  42. public static Brush brDouble = Brushes.PowderBlue;
  43. }
  44. /// <summary>
  45. /// 公共处理类
  46. /// </summary>
  47. public class PublicCodeClasses
  48. {
  49. static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  50. static LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
  51. static LYFZ.BLL.BLL_ErpOrderDigitalStatus orsbll = new BLL.BLL_ErpOrderDigitalStatus();
  52. public delegate void UpdateControl();
  53. #region 图表颜色
  54. public static Color[] myChartsColor = new Color[40] {
  55. Color.Red,//红
  56. Color.Blue,//蓝
  57. Color.Yellow,//黄
  58. Color.Green, //绿
  59. Color.Orange, //橙
  60. Color.Cyan, //青
  61. Color.Purple, //紫
  62. Color.Gray, //灰 DeepPink
  63. Color.DarkRed, //深红
  64. Color.DarkBlue,//深蓝 Maroon
  65. Color.Gold,//金(大黄)
  66. Color.DarkGreen,//深绿
  67. Color.DarkOrange,//深橙
  68. Color.DarkCyan,//深青
  69. Color.MediumPurple,//中紫
  70. Color.DarkGray,//深灰
  71. Color.PaleVioletRed,//浅红
  72. Color.LightBlue,
  73. Color.LightYellow,
  74. Color.LightGreen,
  75. Color.LightCyan,
  76. Color.LightGray,
  77. Color.MediumVioletRed,//中红
  78. Color.MediumBlue ,
  79. Color.MediumSeaGreen,
  80. Color.MediumSlateBlue,
  81. Color.MediumSpringGreen,
  82. Color.Magenta,
  83. Color.Navy,
  84. Color.Olive,
  85. Color.OliveDrab,
  86. Color.OrangeRed,
  87. Color.Orchid,
  88. Color.PaleGoldenrod,
  89. Color.PaleGreen,
  90. Color.Peru,
  91. Color.Crimson,
  92. Color.BlueViolet,
  93. Color.Fuchsia,
  94. Color.LawnGreen
  95. };
  96. #endregion
  97. #region 农历、公历转换
  98. /// <summary>
  99. /// 获取公历转成农历
  100. /// </summary>
  101. /// <param name="StrDateTime"></param>
  102. /// <returns></returns>
  103. public DateTime GetChineseLunisolarCalendar( string StrDateTime )
  104. {
  105. ChineseLunisolarCalendar cls = new ChineseLunisolarCalendar();
  106. DateTime time = Convert.ToDateTime(StrDateTime);
  107. //获取年
  108. int Year = Convert.ToInt32(SDateTime.Now.Year);
  109. //获取月
  110. int Mouth = Convert.ToInt32(time.Month);
  111. //获取日
  112. int Day = Convert.ToInt32(time.Day);
  113. try
  114. {
  115. return cls.ToDateTime(Year, Mouth, Day, 0, 0, 0, 0);
  116. }
  117. catch { return cls.ToDateTime(Year, Mouth, Day - 1, 0, 0, 0, 0); }
  118. }
  119. /// <summary>
  120. /// 农历转公历
  121. /// </summary>
  122. /// <param name="StrDateTime">农历日期</param>
  123. public static string GetLunarCalendarToSolarCalendar( string StrDateTime )
  124. {
  125. if ( !string.IsNullOrEmpty(StrDateTime) )
  126. {
  127. string[] str = StrDateTime.Split('-');
  128. System.Globalization.ChineseLunisolarCalendar cls = new System.Globalization.ChineseLunisolarCalendar();
  129. try
  130. {
  131. StrDateTime = cls.ToDateTime(Convert.ToInt32(str[0]), Convert.ToInt32(str[1]), Convert.ToInt32(str[2]), 0, 0, 0, 0).ToString();
  132. return StrDateTime;
  133. }
  134. catch
  135. {
  136. }
  137. }
  138. return "";
  139. }
  140. #endregion
  141. #region DataGridView、Table 相互转换
  142. /// <summary>
  143. /// 把DataGridViewEc 放到DataTable
  144. /// </summary>
  145. /// <param name="tbl"></param>
  146. /// <returns></returns>
  147. public DataTable GetDataGridViewToTable( DataGridViewEc dgvData )
  148. {
  149. DataTable newtbl = new DataTable();
  150. for ( int i = 0; i < dgvData.Columns.Count; i++ )
  151. {
  152. DataColumn dc = new DataColumn(dgvData.Columns[i].Name.ToString());
  153. newtbl.Columns.Add(dc);
  154. }
  155. for ( int i = 0; i < dgvData.Rows.Count; i++ )
  156. {
  157. DataRow dr = newtbl.NewRow();
  158. for ( int j = 0; j < dgvData.Columns.Count; j++ )
  159. {
  160. dr[j] = Convert.ToString(dgvData.Rows[i].Cells[j].Value.ToString());
  161. }
  162. newtbl.Rows.Add(dr);
  163. }
  164. return newtbl;
  165. }
  166. /// <summary>
  167. /// 把一个DataTable 放到别一个DataTable,原因是不不让两个DataTable同步
  168. /// </summary>
  169. /// <param name="tbl"></param>
  170. /// <returns></returns>
  171. public DataTable GetTableToTable( DataTable tbl )
  172. {
  173. DataTable newtbl = new DataTable();
  174. for ( int i = 0; i < tbl.Columns.Count; i++ )
  175. {
  176. DataColumn dc = new DataColumn(tbl.Columns[i].ColumnName.ToString());
  177. newtbl.Columns.Add(dc);
  178. }
  179. for ( int i = 0; i < tbl.Rows.Count; i++ )
  180. {
  181. DataRow dr = newtbl.NewRow();
  182. for ( int j = 0; j < tbl.Columns.Count; j++ )
  183. {
  184. dr[j] = Convert.ToString(tbl.Rows[i][j].ToString());
  185. }
  186. newtbl.Rows.Add(dr);
  187. }
  188. return newtbl;
  189. }
  190. /// <summary>
  191. /// 将套系包含商品DataGridView的列和值遍历放置DataTable去
  192. /// </summary>
  193. /// <param name="dgv"></param>
  194. /// <returns></returns>
  195. public DataTable GetDgvToTable( DataGridView dgv, string OrderNumber, bool NumberType )
  196. {
  197. DataTable dt = new DataTable();
  198. dt.Columns.Add("OPlist_OrderNumber", typeof(string));
  199. dt.Columns.Add("OPlist_Type", typeof(string));
  200. dt.Columns.Add("OPlist_ProdNumber", typeof(string));
  201. dt.Columns.Add("OPlist_ProdName", typeof(string));
  202. dt.Columns.Add("OPlist_Batch", typeof(string));
  203. dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
  204. dt.Columns.Add("OPlist_ProdQuantity", typeof(string));
  205. dt.Columns.Add("OPlist_IsExpedited", typeof(string));
  206. dt.Columns.Add("OPlist_PickupTime", typeof(string));
  207. for ( int i = 0; i < dgv.Rows.Count; i++ )
  208. {
  209. DataRow dr = dt.NewRow();
  210. dr["OPlist_OrderNumber"] = OrderNumber;
  211. dr["OPlist_Type"] = "0";// 0为套系包含商品 1为服务
  212. dr["OPlist_ProdNumber"] = dgv.Rows[i].Cells["T_Column1"].Value.ToString().Trim();
  213. dr["OPlist_ProdName"] = dgv.Rows[i].Cells["T_Column2"].Value.ToString().Trim();
  214. dr["OPlist_Batch"] = dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim();
  215. dr["OPlist_ProdSoldPrice"] = dgv.Rows[i].Cells["T_Column3"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column3"].Value.ToString().Trim();
  216. dr["OPlist_ProdQuantity"] = dgv.Rows[i].Cells["T_Column4"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column4"].Value.ToString().Trim();
  217. if ( NumberType )
  218. {
  219. dr["OPlist_IsExpedited"] = dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim() == "" || dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim() == "否" ? "0" : "1";
  220. }
  221. else
  222. {
  223. dr["OPlist_IsExpedited"] = "0";
  224. }
  225. dr["OPlist_PickupTime"] = dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim() == "null" ? "" : dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim();
  226. dt.Rows.Add(dr);
  227. }
  228. return dt;
  229. }
  230. /// <summary>
  231. /// 将套系包含商品mlist的列和值遍历放置DataTable去
  232. /// </summary>
  233. /// <param name="dgv"></param>
  234. /// <returns></returns>
  235. public DataTable GetDgvToTable( List<LYFZ.Model.Model_ErpOrderProductList> pllist, string OrderNumber, bool NumberType )
  236. {
  237. DataTable dt = new DataTable();
  238. dt.Columns.Add("OPlist_OrderNumber", typeof(string));
  239. dt.Columns.Add("OPlist_Type", typeof(string));
  240. dt.Columns.Add("OPlist_ProdNumber", typeof(string));
  241. dt.Columns.Add("OPlist_ProdName", typeof(string));
  242. dt.Columns.Add("OPlist_Batch", typeof(string));
  243. dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
  244. dt.Columns.Add("OPlist_ProdQuantity", typeof(string));
  245. dt.Columns.Add("OPlist_IsExpedited", typeof(string));
  246. dt.Columns.Add("OPlist_PickupTime", typeof(string));
  247. for ( int i = 0; i < pllist.Count; i++ )
  248. {
  249. DataRow dr = dt.NewRow();
  250. dr["OPlist_OrderNumber"] = OrderNumber;
  251. dr["OPlist_Type"] = "0";// 0为套系包含商品 1为服务
  252. dr["OPlist_ProdNumber"] = pllist[i].OPlist_ProdNumber;
  253. dr["OPlist_ProdName"] = pllist[i].OPlist_ProdName;
  254. dr["OPlist_Batch"] = pllist[i].OPlist_Batch;
  255. dr["OPlist_ProdSoldPrice"] = pllist[i].OPlist_ProdSoldPrice;
  256. dr["OPlist_ProdQuantity"] = pllist[i].OPlist_ProdQuantity;
  257. if ( NumberType )
  258. {
  259. dr["OPlist_IsExpedited"] = pllist[i].OPlist_IsExpedited;
  260. }
  261. else
  262. {
  263. dr["OPlist_IsExpedited"] = "0";
  264. }
  265. dr["OPlist_PickupTime"] = pllist[i].OPlist_PickupTime;
  266. dt.Rows.Add(dr);
  267. }
  268. return dt;
  269. }
  270. /// <summary>
  271. /// 将服务DataGridView的列和值遍历放置DataTable去
  272. /// </summary>
  273. /// <param name="dgv"></param>
  274. /// <param name="dt"></param>
  275. /// <returns></returns>
  276. public DataTable GetDgvToTable( DataTable ddt, DataTable dt, Hashtable htData )
  277. {
  278. if ( dt.Rows.Count <= 0 )
  279. {
  280. if ( dt.Columns.Count <= 0 )
  281. {
  282. dt.Columns.Add("OPlist_OrderNumber", typeof(string));
  283. dt.Columns.Add("OPlist_Type", typeof(string));
  284. dt.Columns.Add("OPlist_ProdNumber", typeof(string));
  285. dt.Columns.Add("OPlist_ProdName", typeof(string));
  286. dt.Columns.Add("OPlist_Batch", typeof(string));
  287. dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
  288. dt.Columns.Add("OPlist_ProdQuantity", typeof(string));
  289. dt.Columns.Add("OPlist_IsExpedited", typeof(string));
  290. dt.Columns.Add("OPlist_PickupTime", typeof(string));
  291. }
  292. }
  293. for ( int i = 0; i < ddt.Rows.Count; i++ )
  294. {
  295. DataRow dr = dt.NewRow();
  296. dr["OPlist_OrderNumber"] = htData["OrderNumber"].ToString().Trim();
  297. dr["OPlist_Type"] = 0;// 0为套系包含商品 1为服务
  298. dr["OPlist_ProdNumber"] = ddt.Rows[i]["Prod_Number"].ToString().Trim();
  299. dr["OPlist_ProdName"] = ddt.Rows[i]["Prod_Name"].ToString().Trim();
  300. dr["OPlist_Batch"] = ddt.Rows[i]["Prod_Batch"].ToString().Trim();
  301. dr["OPlist_ProdSoldPrice"] = ddt.Rows[i]["Prod_SalesPrice"].ToString().Trim();
  302. dr["OPlist_ProdQuantity"] = ddt.Rows[i]["Prod_Quantity"].ToString().Trim();
  303. if ( htData["ProductVesting"].ToString().Trim() == "1" )
  304. {
  305. dr["OPlist_IsExpedited"] = ddt.Rows[i]["Prod_Expedited"].ToString().Trim();
  306. dr["OPlist_PickupTime"] = "NULL";
  307. }
  308. else
  309. {
  310. dr["OPlist_IsExpedited"] = "";
  311. dr["OPlist_PickupTime"] = "";
  312. }
  313. dt.Rows.Add(dr);
  314. }
  315. return dt;
  316. }
  317. /// <summary>
  318. /// 将服务DataGridView的列和值遍历放置DataTable去
  319. /// </summary>
  320. /// <param name="dgv"></param>
  321. /// <returns></returns>
  322. public DataTable GetDgvToTable( DataRow dtRow, DataTable Oldtbl, Hashtable htData )
  323. {
  324. if ( Oldtbl.Columns.Count <= 0 )
  325. {
  326. Oldtbl.Columns.Add("OPlist_OrderNumber", typeof(string));
  327. Oldtbl.Columns.Add("OPlist_Type", typeof(string));
  328. Oldtbl.Columns.Add("OPlist_ProdNumber", typeof(string));
  329. Oldtbl.Columns.Add("OPlist_ProdName", typeof(string));
  330. Oldtbl.Columns.Add("OPlist_Batch", typeof(string));
  331. Oldtbl.Columns.Add("OPlist_ProdSoldPrice", typeof(string));
  332. Oldtbl.Columns.Add("OPlist_ProdQuantity", typeof(string));
  333. Oldtbl.Columns.Add("OPlist_IsExpedited", typeof(string));
  334. Oldtbl.Columns.Add("OPlist_PickupTime", typeof(string));
  335. }
  336. if ( dtRow != null )
  337. {
  338. DataRow dr = Oldtbl.NewRow();
  339. dr["OPlist_OrderNumber"] = htData["OrderNumber"].ToString().Trim();
  340. dr["OPlist_Type"] = 0;// 0为套系包含商品 1为服务
  341. dr["OPlist_ProdNumber"] = dtRow["Prod_Number"].ToString().Trim();
  342. dr["OPlist_ProdName"] = dtRow["Prod_Name"].ToString().Trim();
  343. dr["OPlist_Batch"] = dtRow["Prod_Batch"].ToString().Trim();
  344. dr["OPlist_ProdSoldPrice"] = dtRow["Prod_SalesPrice"].ToString().Trim();
  345. dr["OPlist_ProdQuantity"] = htData["ProductQuantity"].ToString().Trim();
  346. if ( htData["ProductVesting"].ToString().Trim() == "1" )
  347. {
  348. dr["OPlist_IsExpedited"] = dtRow["Prod_Expedited"].ToString().Trim();
  349. dr["OPlist_PickupTime"] = "NULL";
  350. }
  351. else
  352. {
  353. dr["OPlist_IsExpedited"] = "";
  354. dr["OPlist_PickupTime"] = "";
  355. }
  356. Oldtbl.Rows.Add(dr);
  357. }
  358. return Oldtbl;
  359. }
  360. /// <summary>
  361. /// 将列表中相同的订单合并为一条(用于拍照客人打印——明细、派工)
  362. /// </summary>
  363. /// <param name="dgv"></param>
  364. /// <returns></returns>
  365. public DataGridViewEx GetDgvToDgv( DataGridViewEc dgv, bool IsSelect = true )
  366. {
  367. DataGridViewEx newDgv = new DataGridViewEx();
  368. for ( int i = 0; i < dgv.Columns.Count; i++ )
  369. {
  370. DataGridViewColumn dgvcl = new DataGridViewColumn();
  371. dgvcl.HeaderText = dgv.Columns[i].HeaderText;
  372. dgvcl.Name = dgv.Columns[i].Name;
  373. newDgv.Columns.Add(dgvcl);
  374. }
  375. if ( IsSelect )
  376. {
  377. for ( int i = 0; i < dgv.SelectedRows.Count; i++ )
  378. {
  379. if ( newDgv.Rows.Count == 0 )
  380. {
  381. DataGridViewRow dgvr = new DataGridViewRow();
  382. DataGridViewTextBoxCell cell = null;
  383. for ( int j = 0; j < dgv.Columns.Count; j++ )
  384. {
  385. cell = new DataGridViewTextBoxCell();
  386. cell.Value = dgv.SelectedRows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  387. dgvr.Cells.Add(cell);
  388. }
  389. newDgv.Rows.Add(dgvr);
  390. }
  391. else
  392. {
  393. bool IsEnter = true;
  394. for ( int j = 0; j < newDgv.Rows.Count; j++ )
  395. {
  396. try
  397. {
  398. if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
  399. {
  400. string StrSights = newDgv.Rows[j].Cells["景点"].Value.ToString().Trim();
  401. newDgv.Rows[j].Cells["景点"].Value = StrSights + "," + dgv.SelectedRows[i].Cells["景点"].Value.ToString().Trim();
  402. IsEnter = false;
  403. break;
  404. }
  405. }
  406. catch { }
  407. try
  408. {
  409. if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
  410. {
  411. if ( Convert.ToDateTime(newDgv.Rows[j].Cells["取件时间"].Value) > Convert.ToDateTime(dgv.SelectedRows[i].Cells["取件时间"].Value) )
  412. {
  413. newDgv.Rows[j].Cells["取件时间"].Value = newDgv.Rows[j].Cells["取件时间"].Value.ToString().Trim();
  414. }
  415. else
  416. {
  417. newDgv.Rows[j].Cells["取件时间"].Value = dgv.SelectedRows[i].Cells["取件时间"].Value.ToString().Trim();
  418. }
  419. IsEnter = false;
  420. break;
  421. }
  422. }
  423. catch { }
  424. try
  425. {
  426. if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
  427. {
  428. if ( Convert.ToDateTime(newDgv.Rows[j].Cells["婚庆时间"].Value) > Convert.ToDateTime(dgv.SelectedRows[i].Cells["婚庆时间"].Value) )
  429. {
  430. newDgv.Rows[j].Cells["婚庆时间"].Value = newDgv.Rows[j].Cells["婚庆时间"].Value.ToString().Trim();
  431. }
  432. else
  433. {
  434. newDgv.Rows[j].Cells["婚庆时间"].Value = dgv.SelectedRows[i].Cells["婚庆时间"].Value.ToString().Trim();
  435. }
  436. IsEnter = false;
  437. break;
  438. }
  439. }
  440. catch { }
  441. }
  442. if ( IsEnter )
  443. {
  444. DataGridViewRow dgvr = new DataGridViewRow();
  445. DataGridViewTextBoxCell cell = null;
  446. for ( int j = 0; j < dgv.Columns.Count; j++ )
  447. {
  448. cell = new DataGridViewTextBoxCell();
  449. cell.Value = dgv.SelectedRows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  450. dgvr.Cells.Add(cell);
  451. }
  452. newDgv.Rows.Add(dgvr);
  453. }
  454. }
  455. }
  456. }
  457. else
  458. {
  459. for ( int i = 0; i < dgv.Rows.Count; i++ )
  460. {
  461. if ( newDgv.Rows.Count == 0 )
  462. {
  463. DataGridViewRow dgvr = new DataGridViewRow();
  464. DataGridViewTextBoxCell cell = null;
  465. for ( int j = 0; j < dgv.Columns.Count; j++ )
  466. {
  467. cell = new DataGridViewTextBoxCell();
  468. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  469. dgvr.Cells.Add(cell);
  470. }
  471. newDgv.Rows.Add(dgvr);
  472. }
  473. else
  474. {
  475. bool IsEnter = true;
  476. for ( int j = 0; j < newDgv.Rows.Count; j++ )
  477. {
  478. try
  479. {
  480. if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
  481. {
  482. string StrSights = newDgv.Rows[j].Cells["景点"].Value.ToString().Trim();
  483. newDgv.Rows[j].Cells["景点"].Value = StrSights + "," + dgv.Rows[i].Cells["景点"].Value.ToString().Trim();
  484. IsEnter = false;
  485. break;
  486. }
  487. }
  488. catch { }
  489. try
  490. {
  491. if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
  492. {
  493. if ( Convert.ToDateTime(newDgv.Rows[j].Cells["取件时间"].Value) > Convert.ToDateTime(dgv.Rows[i].Cells["取件时间"].Value) )
  494. {
  495. newDgv.Rows[j].Cells["取件时间"].Value = newDgv.Rows[j].Cells["取件时间"].Value.ToString().Trim();
  496. }
  497. else
  498. {
  499. newDgv.Rows[j].Cells["取件时间"].Value = dgv.Rows[i].Cells["取件时间"].Value.ToString().Trim();
  500. }
  501. IsEnter = false;
  502. break;
  503. }
  504. }
  505. catch { }
  506. try
  507. {
  508. if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() )
  509. {
  510. if ( Convert.ToDateTime(newDgv.Rows[j].Cells["婚庆时间"].Value) > Convert.ToDateTime(dgv.Rows[i].Cells["婚庆时间"].Value) )
  511. {
  512. newDgv.Rows[j].Cells["婚庆时间"].Value = newDgv.Rows[j].Cells["婚庆时间"].Value.ToString().Trim();
  513. }
  514. else
  515. {
  516. newDgv.Rows[j].Cells["婚庆时间"].Value = dgv.Rows[i].Cells["婚庆时间"].Value.ToString().Trim();
  517. }
  518. IsEnter = false;
  519. break;
  520. }
  521. }
  522. catch { }
  523. }
  524. if ( IsEnter )
  525. {
  526. DataGridViewRow dgvr = new DataGridViewRow();
  527. DataGridViewTextBoxCell cell = null;
  528. for ( int j = 0; j < dgv.Columns.Count; j++ )
  529. {
  530. cell = new DataGridViewTextBoxCell();
  531. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  532. dgvr.Cells.Add(cell);
  533. }
  534. newDgv.Rows.Add(dgvr);
  535. }
  536. }
  537. }
  538. }
  539. return newDgv;
  540. }
  541. /// <summary>
  542. /// 返回新的DataGridViewEx
  543. /// </summary>
  544. /// <param name="dgv"></param>
  545. /// <returns></returns>
  546. public DataGridViewEx GetDgvToNewDgv( DataGridViewEx dgv )
  547. {
  548. DataGridViewEx newDgv = new DataGridViewEx();
  549. for ( int i = 0; i < dgv.Columns.Count; i++ )
  550. {
  551. DataGridViewColumn dgvcl = new DataGridViewColumn();
  552. dgvcl.HeaderText = dgv.Columns[i].HeaderText;
  553. dgvcl.Name = dgv.Columns[i].Name;
  554. newDgv.Columns.Add(dgvcl);
  555. }
  556. for ( int i = 0; i < dgv.Rows.Count; i++ )
  557. {
  558. DataGridViewRow dgvr = new DataGridViewRow();
  559. DataGridViewTextBoxCell cell = null;
  560. for ( int j = 0; j < dgv.Columns.Count; j++ )
  561. {
  562. cell = new DataGridViewTextBoxCell();
  563. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  564. cell.Tag = dgv.Rows[i].Cells[dgv.Columns[j].Name].Tag;
  565. dgvr.Cells.Add(cell);
  566. }
  567. newDgv.Rows.Add(dgvr);
  568. }
  569. return newDgv;
  570. }
  571. /// <summary>
  572. /// 返回新的DataGridViewEc
  573. /// </summary>
  574. /// <param name="dgv"></param>
  575. /// <returns></returns>
  576. public DataGridViewEc GetDgvToNewDgv( DataGridViewEc dgv )
  577. {
  578. DataGridViewEc newDgv = new DataGridViewEc();
  579. for ( int i = 0; i < dgv.Columns.Count; i++ )
  580. {
  581. DataGridViewColumn dgvcl = new DataGridViewColumn();
  582. dgvcl.HeaderText = dgv.Columns[i].HeaderText;
  583. dgvcl.Name = dgv.Columns[i].Name;
  584. newDgv.Columns.Add(dgvcl);
  585. }
  586. for ( int i = 0; i < dgv.Rows.Count; i++ )
  587. {
  588. DataGridViewRow dgvr = new DataGridViewRow();
  589. DataGridViewTextBoxCell cell = null;
  590. for ( int j = 0; j < dgv.Columns.Count; j++ )
  591. {
  592. cell = new DataGridViewTextBoxCell();
  593. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  594. cell.Tag = dgv.Rows[i].Cells[dgv.Columns[j].Name].Tag;
  595. dgvr.Cells.Add(cell);
  596. }
  597. newDgv.Rows.Add(dgvr);
  598. }
  599. return newDgv;
  600. }
  601. /// <summary>
  602. /// 门市流程开单里的套系商品合并相同数据_商品表
  603. /// </summary>
  604. /// <param name="dgv"></param>
  605. /// <returns></returns>
  606. public DataGridViewEx GetDgvMergeDuplicateNewDgv_Prod( DataGridViewEx dgv )
  607. {
  608. DataGridViewEx newDgv = new DataGridViewEx();
  609. for ( int i = 0; i < dgv.Columns.Count; i++ )
  610. {
  611. DataGridViewColumn dgvcl = new DataGridViewColumn();
  612. dgvcl.HeaderText = dgv.Columns[i].HeaderText;
  613. dgvcl.Name = dgv.Columns[i].Name;
  614. newDgv.Columns.Add(dgvcl);
  615. }
  616. for ( int i = 0; i < dgv.Rows.Count; i++ )
  617. {
  618. if ( newDgv.Rows.Count == 0 )
  619. {
  620. DataGridViewRow dgvr = new DataGridViewRow();
  621. DataGridViewTextBoxCell cell = null;
  622. for ( int j = 0; j < dgv.Columns.Count; j++ )
  623. {
  624. cell = new DataGridViewTextBoxCell();
  625. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  626. dgvr.Cells.Add(cell);
  627. }
  628. newDgv.Rows.Add(dgvr);
  629. }
  630. else
  631. {
  632. bool IsEnter = true;
  633. for ( int j = 0; j < newDgv.Rows.Count; j++ )
  634. {
  635. if ( dgv.Rows[i].Cells["T_Column1"].Value.ToString().Trim() == newDgv.Rows[j].Cells["T_Column1"].Value.ToString().Trim() )
  636. {
  637. if ( dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim() == newDgv.Rows[j].Cells["T_Column7"].Value.ToString().Trim() )
  638. {
  639. if ( dgv.Columns["T_Column5"] != null )
  640. {
  641. newDgv.Rows[j].Cells["T_Column5"].Value = dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim();
  642. }
  643. if ( dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim() != "" )
  644. {
  645. if ( Convert.ToDateTime(dgv.Rows[i].Cells["T_Column6"].Value) > Convert.ToDateTime(newDgv.Rows[j].Cells["T_Column6"].Value) )
  646. {
  647. newDgv.Rows[j].Cells["T_Column6"].Value = dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim();
  648. }
  649. }
  650. 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));
  651. IsEnter = false;
  652. break;
  653. }
  654. }
  655. }
  656. if ( IsEnter )
  657. {
  658. DataGridViewRow dgvr = new DataGridViewRow();
  659. DataGridViewTextBoxCell cell = null;
  660. for ( int j = 0; j < dgv.Columns.Count; j++ )
  661. {
  662. cell = new DataGridViewTextBoxCell();
  663. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  664. dgvr.Cells.Add(cell);
  665. }
  666. newDgv.Rows.Add(dgvr);
  667. }
  668. }
  669. }
  670. return newDgv;
  671. }
  672. /// <summary>
  673. /// 门市流程开单里的套系商品合并相同数据_商品表
  674. /// </summary>
  675. /// <param name="dgv"></param>
  676. /// <returns></returns>
  677. public DataGridViewEx GetDgvMergeDuplicateNewDgv_Service( DataGridViewEx dgv )
  678. {
  679. DataGridViewEx newDgv = new DataGridViewEx();
  680. for ( int i = 0; i < dgv.Columns.Count; i++ )
  681. {
  682. DataGridViewColumn dgvcl = new DataGridViewColumn();
  683. dgvcl.HeaderText = dgv.Columns[i].HeaderText;
  684. dgvcl.Name = dgv.Columns[i].Name;
  685. newDgv.Columns.Add(dgvcl);
  686. }
  687. for ( int i = 0; i < dgv.Rows.Count; i++ )
  688. {
  689. if ( newDgv.Rows.Count == 0 )
  690. {
  691. DataGridViewRow dgvr = new DataGridViewRow();
  692. DataGridViewTextBoxCell cell = null;
  693. for ( int j = 0; j < dgv.Columns.Count; j++ )
  694. {
  695. cell = new DataGridViewTextBoxCell();
  696. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  697. dgvr.Cells.Add(cell);
  698. }
  699. newDgv.Rows.Add(dgvr);
  700. }
  701. else
  702. {
  703. bool IsEnter = true;
  704. for ( int j = 0; j < newDgv.Rows.Count; j++ )
  705. {
  706. if ( dgv.Rows[i].Cells["H_Column1"].Value.ToString().Trim() == newDgv.Rows[j].Cells["H_Column1"].Value.ToString().Trim() )
  707. {
  708. 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));
  709. IsEnter = false;
  710. break;
  711. }
  712. }
  713. if ( IsEnter )
  714. {
  715. DataGridViewRow dgvr = new DataGridViewRow();
  716. DataGridViewTextBoxCell cell = null;
  717. for ( int j = 0; j < dgv.Columns.Count; j++ )
  718. {
  719. cell = new DataGridViewTextBoxCell();
  720. cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim();
  721. dgvr.Cells.Add(cell);
  722. }
  723. newDgv.Rows.Add(dgvr);
  724. }
  725. }
  726. }
  727. return newDgv;
  728. }
  729. #endregion
  730. #region 星期几
  731. /// <summary>
  732. /// 星期几
  733. /// </summary>
  734. public static string CaculateWeekDay( string StrE_WeekDay )
  735. {
  736. switch ( StrE_WeekDay )
  737. {
  738. case "Monday":
  739. StrE_WeekDay = "星期一";
  740. break;
  741. case "Tuesday":
  742. StrE_WeekDay = "星期二";
  743. break;
  744. case "Wednesday":
  745. StrE_WeekDay = "星期三";
  746. break;
  747. case "Thursday":
  748. StrE_WeekDay = "星期四";
  749. break;
  750. case "Friday":
  751. StrE_WeekDay = "星期五";
  752. break;
  753. case "Saturday":
  754. StrE_WeekDay = "星期六";
  755. break;
  756. case "Sunday":
  757. StrE_WeekDay = "星期日";
  758. break;
  759. }
  760. return StrE_WeekDay;
  761. }
  762. #endregion
  763. #region 导入相片
  764. /// <summary>
  765. /// 默认选择导出的路径
  766. /// </summary>
  767. public static string defaultExportFilePath = "";
  768. /// <summary>
  769. /// 默认选择导入的路径
  770. /// </summary>
  771. public static string defaultImportFilePath = "";
  772. /// <summary>
  773. /// 导入初修片
  774. /// </summary>
  775. public static bool ImportRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "")
  776. {
  777. bool IsSaveed = false;
  778. string StrStatus = "2";
  779. List<CommandInfo> clist = new List<CommandInfo>();
  780. string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  781. DateTime StrTime = SDateTime.Now;
  782. LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
  783. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
  784. frm.processName = "初修";
  785. if ( pickUpStatus.Contains("OK") )
  786. {
  787. frm.chkImport.Enabled = false;
  788. frm.chkImport.Checked = false;
  789. frm.chkNotImport.Checked = true;
  790. }
  791. frm.IsStatusOK = modelEarlyRepairStatus.Ordv_EarlyRepairStatus == "2" ? true : false;
  792. frm.StrOrdNumber = StrOrdNumber;
  793. frm.StrOrdViceNumber = StrViceNumber;
  794. frm.IsShowPwd = true;
  795. frm.StrType = "3";
  796. frm.StrStatusText = "初修";
  797. frm.ShowDialog();
  798. if ( frm.IsSaveed )
  799. {
  800. if ( !frm.IsImportStatus )
  801. {
  802. StrStatus = "1";
  803. }
  804. else
  805. {
  806. StrStatus = "2";
  807. }
  808. if ( frm.IsImport )
  809. {
  810. FolderBrowserDialog fbd = new FolderBrowserDialog();
  811. if ( defaultExportFilePath != "" )
  812. {
  813. if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
  814. {
  815. fbd.SelectedPath = defaultExportFilePath;
  816. }
  817. }
  818. if ( fbd.ShowDialog() == DialogResult.OK )
  819. {
  820. defaultExportFilePath = fbd.SelectedPath;//记录选中的目录
  821. #region 导入像片
  822. try
  823. {
  824. LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
  825. 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);
  826. if ( strprht == null )
  827. {
  828. return false;
  829. }
  830. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
  831. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
  832. List<string> sPrimitivePhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original);
  833. List<string> sEarlyPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, BLL.SelectPhotoHandling.PhotoType.Original);
  834. #region 2017-03-12 杨云奕禁用,修改添加入上传队列
  835. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  836. {
  837. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  838. {
  839. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
  840. IsSaveed = pe.ImportEarlyRetouchFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
  841. }, width: 500);
  842. if ( IsSaveed )
  843. {
  844. #region 修改导入修片地址
  845. LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
  846. modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, strprht.FullName);
  847. modelOrder.Ord_PhotoBackupPath = "NEW";
  848. modelOrder.Ord_UpdateDateTime = StrTime;
  849. modelOrder.Ord_UpdateName = StrUserName;
  850. clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
  851. #endregion
  852. }
  853. else
  854. {
  855. return false;
  856. }
  857. }
  858. else
  859. {
  860. LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel()
  861. {
  862. service_Path = strprht.FullName.Trim(),
  863. erpOrder = ord_model,
  864. directoryType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch,
  865. erpDigOrder = vmodel,
  866. sPh = sPh,
  867. OrdNumber = StrOrdNumber,
  868. OrdViceNumber = StrViceNumber,
  869. StrStatus = StrStatus,
  870. takenName = SightsName,
  871. comeDirectoryPath = fbd.SelectedPath.ToString().Trim(),
  872. CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID,
  873. importGenerateThumbnails = true,//frm.IsSmallMap,
  874. FrmClist = frm.clist
  875. };
  876. if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckImportFileByEarlyRetouch(importFileMod) )
  877. {
  878. List<string> importedPhotoList = importFileMod.sPh.GetLocalPhotoList(fbd.SelectedPath.ToString().Trim());
  879. foreach ( string str in importedPhotoList )
  880. {
  881. importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel()
  882. {
  883. success = false,
  884. local_Path = str,
  885. upload_Msg = "",
  886. user_Time = 0
  887. });
  888. }
  889. string upFileInfo = "";
  890. ///检查相同订单中是否存在相同的图片
  891. if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.EarlyRetouch, ref upFileInfo) )
  892. {
  893. ///执行导入
  894. MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod);
  895. MessageBoxCustom.Show("成功加入导片队列;");
  896. IsSaveed = true;
  897. }
  898. else
  899. {
  900. LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo);
  901. importWarning.TopMost = true;
  902. importWarning.SbtnContinueImport.Visible = false;
  903. importWarning.ShowDialog();
  904. return false;
  905. }
  906. }
  907. else
  908. {
  909. return false;
  910. }
  911. }
  912. #endregion
  913. }
  914. catch
  915. {
  916. MessageBoxCustom.Show("相片初修片路径的访问被拒绝");
  917. return false;
  918. }
  919. #endregion
  920. }
  921. else
  922. {
  923. return false;
  924. }
  925. }
  926. LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  927. if ( modelDigital.Ordv_EarlyRepairStatus.Trim() != "2" )
  928. {
  929. modelDigital.Ordv_EarlyRepairName = StrUserName;
  930. modelDigital.Ordv_EarlyRepairTime = StrTime;
  931. modelDigital.Ordv_EarlyRepairStatus = StrStatus;
  932. }
  933. modelDigital.Ordv_UpdateDateTime = StrTime;
  934. modelDigital.Ordv_UpdateName = StrUserName;
  935. clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
  936. DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigitalStatus", StrWhere: "Ords_OrdNumber = '" + StrOrdNumber + "' And Ords_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "*").Tables[0];
  937. LYFZ.Model.Model_ErpOrderDigitalStatus modelStatus = null;
  938. if ( dt.Rows.Count > 0 )
  939. {
  940. modelStatus = orsbll.DataRowToModel(dt.Rows[0]);
  941. if ( modelStatus.Ords_OutSendEarlyRepairStatus.Trim() == "已发" || modelStatus.Ords_OutSendEarlyRepairStatus.Trim() == "已回" )
  942. {
  943. modelStatus.Ords_OutSendEarlyRepairName = StrUserName;
  944. modelStatus.Ords_OutSendEarlyRepairStatus = "已回";
  945. modelStatus.Ords_OutSendEarlyRepairTime = StrTime;
  946. clist.Add(orsbll.GetUpdateCommandInfo(modelStatus));
  947. }
  948. }
  949. clist.AddRange(frm.clist);
  950. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
  951. {
  952. IsSaveed = false;
  953. MessageBoxCustom.Show("导入失败;");
  954. }
  955. else
  956. {
  957. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  958. {
  959. if ( frm.itemEx != null )
  960. {
  961. frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.EarlyRetouch);
  962. }
  963. }
  964. MessageBoxCustom.Show("导入成功;");
  965. }
  966. _modelDigital = modelDigital;
  967. IsSaveed = true;
  968. }
  969. return IsSaveed;
  970. }
  971. /// <summary>
  972. /// 导入精修片
  973. /// </summary>
  974. /// <param name="StrOrdNumber"></param>
  975. /// <param name="StrViceNumber"></param>
  976. /// <param name="SightsName"></param>
  977. /// <returns></returns>
  978. public static bool ImportRefinedRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName,
  979. ref LYFZ.Model.Model_ErpOrderDigital _modelDigital,
  980. string pickUpStatus = "" )
  981. {
  982. bool IsSaveed = false;
  983. string StrStatus = "2";
  984. List<CommandInfo> clist = new List<CommandInfo>();
  985. string MainOrderNumber = StrOrdNumber;
  986. string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  987. DateTime StrTime = SDateTime.Now;
  988. LYFZ.Model.Model_ErpOrderDigital modelRefinedRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
  989. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
  990. frm.processName = "精修";
  991. if ( pickUpStatus.Contains("OK") )
  992. {
  993. frm.chkImport.Enabled = false;
  994. frm.chkImport.Checked = false;
  995. frm.chkNotImport.Checked = true;
  996. }
  997. frm.IsStatusOK = modelRefinedRepairStatus.Ordv_RefinementStatus == "2" ? true : false;
  998. frm.StrOrdNumber = MainOrderNumber;
  999. frm.StrOrdViceNumber = StrViceNumber;
  1000. frm.StrStatusText = "精修";
  1001. frm.StrType = "5";
  1002. frm.ShowDialog();
  1003. if ( frm.IsSaveed )
  1004. {
  1005. if ( !frm.IsImportStatus )
  1006. {
  1007. StrStatus = "1";
  1008. }
  1009. else
  1010. {
  1011. StrStatus = "2";
  1012. }
  1013. if ( frm.IsImport )
  1014. {
  1015. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1016. if ( defaultExportFilePath != "" )
  1017. {
  1018. if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
  1019. {
  1020. fbd.SelectedPath = defaultExportFilePath;
  1021. }
  1022. }
  1023. if ( fbd.ShowDialog() == DialogResult.OK )
  1024. {
  1025. defaultExportFilePath = fbd.SelectedPath;
  1026. try
  1027. {
  1028. LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1029. 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);
  1030. if ( strprht != null )
  1031. {
  1032. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1033. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
  1034. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  1035. {
  1036. #region 精修修改 2017-03-12 杨云奕
  1037. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1038. {
  1039. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
  1040. IsSaveed = pe.ImportFineRetouchFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
  1041. }, width: 500);
  1042. #region 修改
  1043. if ( IsSaveed )
  1044. {
  1045. LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
  1046. modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.FineRetouch, strprht.FullName);
  1047. modelOrder.Ord_PhotoBackupPath = "NEW";
  1048. modelOrder.Ord_UpdateDateTime = StrTime;
  1049. modelOrder.Ord_UpdateName = StrUserName;
  1050. clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
  1051. }
  1052. else
  1053. {
  1054. return false;
  1055. }
  1056. #endregion
  1057. }
  1058. else
  1059. {
  1060. LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel()
  1061. {
  1062. service_Path = strprht.FullName.Trim(),
  1063. erpOrder = ord_model,
  1064. directoryType = Model.Model_ErpOrder.DirectoryType.FineRetouch,
  1065. erpDigOrder = vmodel,
  1066. sPh = sPh,
  1067. OrdNumber = StrOrdNumber,
  1068. OrdViceNumber = StrViceNumber,
  1069. StrStatus = StrStatus,
  1070. takenName = SightsName,
  1071. comeDirectoryPath = fbd.SelectedPath.ToString().Trim(),
  1072. CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID,
  1073. importGenerateThumbnails = true,//frm.IsSmallMap,
  1074. FrmClist = frm.clist
  1075. };
  1076. if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckRefinedRepairPiece(importFileMod) )
  1077. {
  1078. string Ordpg_Sights = "";
  1079. if ( sPh.PhotoModel != null )
  1080. {
  1081. Ordpg_Sights = sPh.PhotoModel.Ordpg_Sights.Trim();
  1082. }
  1083. string currentShootingName = Ordpg_Sights;
  1084. string sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(importFileMod.comeDirectoryPath);
  1085. if ( currentShootingName.Length > 0 )
  1086. {
  1087. //选择的来源目录下的目录集合,不含子目录
  1088. string[] tempShootingNameDirectoryNames = System.IO.Directory.GetDirectories(sourceDirectory);
  1089. //判断要导入的源目录下的子目录名是否为当前拍摄阶段名
  1090. bool isCurrentTakenNameInDirName = false;
  1091. if ( tempShootingNameDirectoryNames.Length > 0 )
  1092. {
  1093. string tempDirPath = "";
  1094. foreach ( string dirPath in tempShootingNameDirectoryNames )
  1095. {
  1096. string tempdirName = System.IO.Path.GetFileName(dirPath);
  1097. if ( tempdirName.ToLower() == currentShootingName.ToLower() )
  1098. {
  1099. tempDirPath = dirPath;
  1100. isCurrentTakenNameInDirName = true;
  1101. break;
  1102. }
  1103. }
  1104. if ( isCurrentTakenNameInDirName && tempShootingNameDirectoryNames.Length > 1 )
  1105. {
  1106. sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(tempDirPath);
  1107. }
  1108. }
  1109. }
  1110. List<string> sourcFileList = importFileMod.sPh.GetLocalPhotoList(sourceDirectory);
  1111. foreach ( string str in sourcFileList )
  1112. {
  1113. importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel()
  1114. {
  1115. success = false,
  1116. local_Path = str,
  1117. upload_Msg = "",
  1118. user_Time = 0
  1119. });
  1120. }
  1121. string upFileInfo = "";
  1122. ///检查相同订单中是否存在相同的图片
  1123. if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.FineRetouch, ref upFileInfo) )
  1124. {
  1125. ///执行导入
  1126. MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod);
  1127. MessageBoxCustom.Show("成功加入导片队列;");
  1128. }
  1129. else
  1130. {
  1131. LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo);
  1132. importWarning.TopMost = true;
  1133. importWarning.SbtnContinueImport.Visible = false;
  1134. importWarning.ShowDialog();
  1135. return false;
  1136. }
  1137. }
  1138. else
  1139. {
  1140. return false;
  1141. }
  1142. #endregion
  1143. }
  1144. }
  1145. }
  1146. catch
  1147. {
  1148. MessageBoxCustom.Show("相片精修片路径的访问被拒绝");
  1149. return false;
  1150. }
  1151. }
  1152. else
  1153. {
  1154. return false;
  1155. }
  1156. }
  1157. LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1158. _modelDigital = modelDigital;
  1159. if ( modelDigital.Ordv_RefinementStatus.Trim() != "2" )
  1160. {
  1161. modelDigital.Ordv_RefinementName = StrUserName;
  1162. modelDigital.Ordv_RefinementStatus = StrStatus;
  1163. modelDigital.Ordv_RefinementTime = StrTime;
  1164. }
  1165. modelDigital.Ordv_UpdateDateTime = StrTime;
  1166. modelDigital.Ordv_UpdateName = StrUserName;
  1167. clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
  1168. clist.AddRange(frm.clist);
  1169. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
  1170. {
  1171. MessageBoxCustom.Show("导入失败;");
  1172. }
  1173. else
  1174. {
  1175. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  1176. {
  1177. if ( frm.itemEx != null )
  1178. {
  1179. frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.FineRetouch);
  1180. }
  1181. }
  1182. }
  1183. IsSaveed = true;
  1184. }
  1185. return IsSaveed;
  1186. }
  1187. /// <summary>
  1188. /// 导入设计片
  1189. /// </summary>
  1190. /// <param name="StrOrdNumber"></param>
  1191. /// <param name="StrViceNumber"></param>
  1192. /// <param name="SightsName"></param>
  1193. /// <returns></returns>
  1194. public static bool ImportDesignPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "" )
  1195. {
  1196. string StrStatus = "2";
  1197. List<CommandInfo> clist = new List<CommandInfo>();
  1198. string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  1199. DateTime StrTime = SDateTime.Now;
  1200. LYFZ.Model.Model_ErpOrderDigital modelDesignStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
  1201. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
  1202. if ( pickUpStatus.Contains("OK") )
  1203. {
  1204. frm.chkImport.Enabled = false;
  1205. frm.chkImport.Checked = false;
  1206. frm.chkNotImport.Checked = true;
  1207. }
  1208. frm.IsStatusOK = modelDesignStatus.Ordv_DesignerStatus == "2" ? true : false;
  1209. frm.StrOrdNumber = StrOrdNumber;
  1210. frm.StrOrdViceNumber = StrViceNumber;
  1211. frm.StrType = "4";
  1212. frm.StrStatusText = "设计";
  1213. frm.ShowDialog();
  1214. if ( frm.IsSaveed )
  1215. {
  1216. if ( !frm.IsImportStatus )
  1217. {
  1218. StrStatus = "1";
  1219. }
  1220. else
  1221. {
  1222. StrStatus = "2";
  1223. }
  1224. if ( frm.IsImport )
  1225. {
  1226. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1227. if ( defaultExportFilePath != "" )
  1228. {
  1229. if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
  1230. {
  1231. fbd.SelectedPath = defaultExportFilePath;
  1232. }
  1233. }
  1234. if ( fbd.ShowDialog() == DialogResult.OK )
  1235. {
  1236. defaultExportFilePath = fbd.SelectedPath;
  1237. try
  1238. {
  1239. LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1240. 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);
  1241. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1242. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
  1243. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  1244. {
  1245. #region 导入设计 2017-3-12 杨云奕 添加
  1246. bool IsImp = false;
  1247. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1248. {
  1249. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
  1250. IsImp = pe.ImportDesignFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
  1251. }, width: 500);
  1252. if ( !IsImp )
  1253. {
  1254. return false;
  1255. }
  1256. LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
  1257. modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName);
  1258. modelOrder.Ord_PhotoBackupPath = "NEW";
  1259. modelOrder.Ord_UpdateDateTime = StrTime;
  1260. modelOrder.Ord_UpdateName = StrUserName;
  1261. clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
  1262. }
  1263. else
  1264. {
  1265. LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel()
  1266. {
  1267. service_Path = strprht.FullName.Trim(),
  1268. erpOrder = ord_model,
  1269. directoryType = Model.Model_ErpOrder.DirectoryType.DesignPiece,
  1270. erpDigOrder = vmodel,
  1271. sPh = sPh,
  1272. OrdNumber = StrOrdNumber,
  1273. OrdViceNumber = StrViceNumber,
  1274. StrStatus = StrStatus,
  1275. takenName = SightsName,
  1276. comeDirectoryPath = fbd.SelectedPath.ToString().Trim(),
  1277. CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID,
  1278. importGenerateThumbnails = true,//frm.IsSmallMap,
  1279. FrmClist = frm.clist
  1280. };
  1281. string msg = "";
  1282. if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckDesignPiece(importFileMod, ref msg) )
  1283. {
  1284. importFileMod.okActive = msg;
  1285. string Ordpg_Sights = "";
  1286. if ( sPh.PhotoModel != null )
  1287. {
  1288. Ordpg_Sights = sPh.PhotoModel.Ordpg_Sights.Trim();
  1289. }
  1290. string currentShootingName = Ordpg_Sights;
  1291. string sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(importFileMod.comeDirectoryPath);
  1292. if ( currentShootingName.Length > 0 )
  1293. {
  1294. //选择的来源目录下的目录集合,不含子目录
  1295. string[] tempShootingNameDirectoryNames = System.IO.Directory.GetDirectories(sourceDirectory);
  1296. //判断要导入的源目录下的子目录名是否为当前拍摄阶段名
  1297. bool isCurrentTakenNameInDirName = false;
  1298. if ( tempShootingNameDirectoryNames.Length > 0 )
  1299. {
  1300. string tempDirPath = "";
  1301. foreach ( string dirPath in tempShootingNameDirectoryNames )
  1302. {
  1303. string tempdirName = System.IO.Path.GetFileName(dirPath);
  1304. if ( tempdirName.ToLower() == currentShootingName.ToLower() )
  1305. {
  1306. tempDirPath = dirPath;
  1307. isCurrentTakenNameInDirName = true;
  1308. break;
  1309. }
  1310. }
  1311. if ( isCurrentTakenNameInDirName && tempShootingNameDirectoryNames.Length > 1 )
  1312. {
  1313. sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(tempDirPath);
  1314. }
  1315. }
  1316. }
  1317. List<string> sourcFileList = importFileMod.sPh.GetLocalPhotoList(sourceDirectory);
  1318. foreach ( string str in sourcFileList )
  1319. {
  1320. importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel()
  1321. {
  1322. success = false,
  1323. local_Path = str,
  1324. upload_Msg = "",
  1325. user_Time = 0
  1326. });
  1327. }
  1328. string upFileInfo = "";
  1329. ///检查相同订单中是否存在相同的图片
  1330. if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.DesignPiece, ref upFileInfo) )
  1331. {
  1332. ///执行导入
  1333. MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod);
  1334. LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
  1335. modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName);
  1336. modelOrder.Ord_PhotoBackupPath = "NEW";
  1337. modelOrder.Ord_UpdateDateTime = StrTime;
  1338. modelOrder.Ord_UpdateName = StrUserName;
  1339. clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
  1340. }
  1341. else
  1342. {
  1343. LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo);
  1344. importWarning.TopMost = true;
  1345. importWarning.SbtnContinueImport.Visible = false;
  1346. importWarning.ShowDialog();
  1347. return false;
  1348. }
  1349. }
  1350. else
  1351. {
  1352. return false;
  1353. }
  1354. //return true;
  1355. #endregion
  1356. }
  1357. }
  1358. catch
  1359. {
  1360. MessageBoxCustom.Show("设计相片路径的访问被拒绝");
  1361. return false;
  1362. }
  1363. }
  1364. else
  1365. {
  1366. return false;
  1367. }
  1368. }
  1369. LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1370. _modelDigital = modelDigital;
  1371. if ( modelDigital.Ordv_DesignerStatus.Trim() != "2" )
  1372. {
  1373. modelDigital.Ordv_DesignerName = StrUserName;
  1374. modelDigital.Ordv_DesignerTime = StrTime;
  1375. modelDigital.Ordv_DesignerStatus = StrStatus;
  1376. }
  1377. modelDigital.Ordv_UpdateDateTime = StrTime;
  1378. modelDigital.Ordv_UpdateName = StrUserName;
  1379. clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
  1380. modelDigital = _modelDigital;
  1381. #region 导入设计片时,完成所有外发片
  1382. if ( StrStatus.Trim() == "2" )
  1383. {
  1384. LYFZ.BLL.BLL_ErpOrderOutSendDesignList outbll = new BLL.BLL_ErpOrderOutSendDesignList();
  1385. List<LYFZ.Model.Model_ErpOrderOutSendDesignList> mlist = outbll.GetModelList("Odlst_OrdNumber = '" + StrOrdNumber + "' and Odlst_ViceNumber = '" + StrViceNumber + "' and Odlst_SendVendor != ''");
  1386. for ( int i = 0; i < mlist.Count; i++ )
  1387. {
  1388. if ( mlist[i].Odlst_CompletedStatus != "1" )
  1389. {
  1390. mlist[i].Odlst_CompletedStatus = "1";
  1391. mlist[i].Odlst_CompletedTime = StrTime;
  1392. mlist[i].Odlst_CompletedName = StrUserName;
  1393. mlist[i].Odlst_CreateDatetime = StrTime;
  1394. mlist[i].Odlst_CreateName = StrUserName;
  1395. clist.Add(outbll.GetUpdateCommandInfo(mlist[i]));
  1396. }
  1397. }
  1398. }
  1399. #endregion
  1400. clist.AddRange(frm.clist);
  1401. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
  1402. {
  1403. MessageBoxCustom.Show("导入失败;");
  1404. return false;
  1405. }
  1406. else
  1407. {
  1408. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  1409. {
  1410. if ( frm.itemEx != null )
  1411. {
  1412. frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.DesignPiece);
  1413. }
  1414. }
  1415. }
  1416. return true;
  1417. }
  1418. return false;
  1419. }
  1420. public static bool ImportN8UserPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
  1421. {
  1422. string StrStatus = "2";
  1423. List<CommandInfo> clist = new List<CommandInfo>();
  1424. string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  1425. DateTime StrTime = SDateTime.Now;
  1426. LYFZ.Model.Model_ErpOrderDigital modelDesignStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);//
  1427. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm();
  1428. frm.IsStatusOK = modelDesignStatus.Ordv_DesignerStatus == "2" ? true : false;
  1429. frm.StrOrdNumber = StrOrdNumber;
  1430. frm.StrOrdViceNumber = StrViceNumber;
  1431. frm.StrType = "4";
  1432. frm.StrStatusText = "设计";
  1433. frm.ShowDialog();
  1434. if ( frm.IsSaveed )
  1435. {
  1436. if ( !frm.IsImportStatus )
  1437. {
  1438. StrStatus = "1";
  1439. }
  1440. else
  1441. {
  1442. StrStatus = "2";
  1443. }
  1444. if ( frm.IsImport )
  1445. {
  1446. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1447. if ( defaultExportFilePath != "" )
  1448. {
  1449. if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录
  1450. {
  1451. fbd.SelectedPath = defaultExportFilePath;
  1452. }
  1453. }
  1454. if ( fbd.ShowDialog() == DialogResult.OK )
  1455. {
  1456. defaultExportFilePath = fbd.SelectedPath;
  1457. try
  1458. {
  1459. LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1460. 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);
  1461. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1462. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel);
  1463. #region 获取N8是否存在已选版完成目录;
  1464. string strN8HasFinishXml = "";
  1465. StringBuilder strN8HasFinishDirectory = new StringBuilder();
  1466. // N8共享目录;
  1467. strN8HasFinishDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory);
  1468. // 是否是儿童订单;
  1469. if ( (EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type) == EnumPublic.OrderType.儿童订单 )
  1470. {
  1471. // 订单号;
  1472. strN8HasFinishDirectory.Append(StrOrdNumber);
  1473. strN8HasFinishDirectory.Append("\\[已选]" + SightsName);
  1474. strN8HasFinishXml = string.Format("{0}{1}_[已选]{2}.xml", LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory, StrOrdNumber, SightsName);
  1475. }
  1476. else
  1477. {
  1478. // 订单号;
  1479. strN8HasFinishDirectory.Append("[已选]" + StrOrdNumber);
  1480. strN8HasFinishXml = string.Format("{0}[已选]{1}.xml", LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory, StrOrdNumber);
  1481. }
  1482. if ( Directory.Exists(strN8HasFinishDirectory.ToString()) )
  1483. {
  1484. if ( MessageBoxCustom.Show("该选版已存在并已完成选版,继续导入将会删除已完成的选片,是否删除重新导入?", "重复提示", MessageBoxButtons.YesNo) == DialogResult.No )
  1485. {
  1486. return false;
  1487. }
  1488. else
  1489. {
  1490. LYFZ.ExtendControlLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1491. {
  1492. try
  1493. {
  1494. LYFZ.Network.FileOperations.FileOperation.DeleteDir(strN8HasFinishDirectory.ToString(), true);
  1495. File.Delete(strN8HasFinishXml);
  1496. }
  1497. catch
  1498. {
  1499. }
  1500. });
  1501. }
  1502. }
  1503. #endregion
  1504. bool IsImp = false;
  1505. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1506. {
  1507. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel);
  1508. IsImp = pe.ImportN8UserFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap);
  1509. }, width: 500);
  1510. if ( !IsImp )
  1511. {
  1512. return false;
  1513. }
  1514. LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber);
  1515. modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName);
  1516. modelOrder.Ord_PhotoBackupPath = "NEW";
  1517. modelOrder.Ord_UpdateDateTime = StrTime;
  1518. modelOrder.Ord_UpdateName = StrUserName;
  1519. clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder));
  1520. }
  1521. catch ( Exception ex )
  1522. {
  1523. MessageBoxCustom.Show("N8选版用户目录的访问被拒绝:" + ex.Message);
  1524. return false;
  1525. }
  1526. }
  1527. else
  1528. {
  1529. return false;
  1530. }
  1531. }
  1532. LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1533. if ( modelDigital.Ordv_DesignerStatus.Trim() != "2" )
  1534. {
  1535. modelDigital.Ordv_DesignerName = StrUserName;
  1536. modelDigital.Ordv_DesignerTime = StrTime;
  1537. modelDigital.Ordv_DesignerStatus = StrStatus;
  1538. }
  1539. modelDigital.Ordv_UpdateDateTime = StrTime;
  1540. modelDigital.Ordv_UpdateName = StrUserName;
  1541. clist.Add(odbll.GetUpdateCommandInfo(modelDigital));
  1542. #region 导入设计片时,完成所有外发片
  1543. if ( StrStatus.Trim() == "2" )
  1544. {
  1545. LYFZ.BLL.BLL_ErpOrderOutSendDesignList outbll = new BLL.BLL_ErpOrderOutSendDesignList();
  1546. List<LYFZ.Model.Model_ErpOrderOutSendDesignList> mlist = outbll.GetModelList("Odlst_OrdNumber = '" + StrOrdNumber + "' and Odlst_ViceNumber = '" + StrViceNumber + "' and Odlst_SendVendor != ''");
  1547. for ( int i = 0; i < mlist.Count; i++ )
  1548. {
  1549. if ( mlist[i].Odlst_CompletedStatus != "1" )
  1550. {
  1551. mlist[i].Odlst_CompletedStatus = "1";
  1552. mlist[i].Odlst_CompletedTime = StrTime;
  1553. mlist[i].Odlst_CompletedName = StrUserName;
  1554. mlist[i].Odlst_CreateDatetime = StrTime;
  1555. mlist[i].Odlst_CreateName = StrUserName;
  1556. clist.Add(outbll.GetUpdateCommandInfo(mlist[i]));
  1557. }
  1558. }
  1559. }
  1560. #endregion
  1561. clist.AddRange(frm.clist);
  1562. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 )
  1563. {
  1564. MessageBoxCustom.Show("导入失败;");
  1565. return false;
  1566. }
  1567. else
  1568. {
  1569. if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide )
  1570. {
  1571. if ( frm.itemEx != null )
  1572. {
  1573. frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.PrimitivePicture);
  1574. }
  1575. }
  1576. }
  1577. return true;
  1578. }
  1579. return false;
  1580. }
  1581. /// <summary>
  1582. /// 导出原片
  1583. /// </summary>
  1584. /// <param name="StrOrdNumber"></param>
  1585. /// <param name="StrViceNumber"></param>
  1586. /// <param name="SightsName"></param>
  1587. /// <returns></returns>
  1588. public static void ExportOriginalPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
  1589. {
  1590. try
  1591. {
  1592. bool IsSaveed = false;
  1593. DataTable tbl = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "Ordpg_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "Ordpg_Sights").Tables[0];
  1594. bool bZip = false;
  1595. string item = "";
  1596. if ( tbl.Rows.Count > 0 )
  1597. {
  1598. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.PhotographedStatusConfirmedSuperSmallForm frm = new SuperSmallForm.PhotographedStatusConfirmedSuperSmallForm();
  1599. frm.tbl = tbl;
  1600. frm.ShowDialog();
  1601. IsSaveed = frm.IsSaveed;
  1602. if ( frm.IsSaveed && frm.Strlist.Count > 0 )
  1603. {
  1604. SightsName = frm.Strlist[0];
  1605. }
  1606. if(IsSaveed)
  1607. {
  1608. bZip = frm.chkZip.Checked;
  1609. }
  1610. }
  1611. if ( IsSaveed )
  1612. {
  1613. LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1614. LYFZ.Model.Model_ErpOrderDigital Vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1615. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, Vmodel);
  1616. BLL.BLL_ErpCustomer bLL_ErpCustomer = new BLL.BLL_ErpCustomer();
  1617. List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original, SightsName);
  1618. if ( sPhotoList.Count == 0 )
  1619. {
  1620. sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.RawData, SightsName);
  1621. if ( sPhotoList.Count == 0 )
  1622. {
  1623. MessageBoxCustom.Show("此单或景点未导片");
  1624. return;
  1625. }
  1626. }
  1627. if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
  1628. {
  1629. return;
  1630. }
  1631. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1632. if ( defaultImportFilePath != "" )
  1633. {
  1634. if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
  1635. {
  1636. fbd.SelectedPath = defaultImportFilePath;
  1637. }
  1638. }
  1639. if ( fbd.ShowDialog() == DialogResult.OK )
  1640. {
  1641. defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
  1642. bool IsImp = false;
  1643. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1644. {
  1645. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, Vmodel);
  1646. IsImp = pe.ExportOriginalFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker);
  1647. //item = model.Ord_Number + "("+ sPh+")";
  1648. }, width: 500);
  1649. item = model.Ord_Number + "("+bLL_ErpCustomer.GetCustomerNameList(model.Ord_Number)+"原片)";
  1650. if ( !IsImp )
  1651. {
  1652. return;
  1653. }
  1654. else
  1655. {
  1656. if(bZip)
  1657. {
  1658. defaultImportFilePath = defaultImportFilePath + "\\" + item;
  1659. if (Directory.Exists(defaultImportFilePath))
  1660. {
  1661. DirectoryInfo info = new DirectoryInfo(defaultImportFilePath);
  1662. if (info is DirectoryInfo)
  1663. {
  1664. LYFZ.CompressionProgress.FormCompressionProgress frm = new CompressionProgress.FormCompressionProgress(
  1665. defaultImportFilePath,
  1666. fbd.SelectedPath + "\\"+ item + ".zip",
  1667. defaultImportFilePath,"",false);
  1668. if (!frm.IsDisposed)
  1669. {
  1670. if (frm.ShowDialog() == DialogResult.No)
  1671. {
  1672. MessageBoxCustom.Show("压缩失败!");
  1673. }
  1674. else
  1675. {
  1676. if (!string.IsNullOrEmpty(item))
  1677. {
  1678. if (System.IO.Directory.Exists(item))
  1679. {
  1680. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
  1681. {
  1682. backgroundWorker.ReportProgress(0, "压缩完成,正在删除缓存......");
  1683. System.IO.Directory.Delete(item, true);
  1684. });
  1685. }
  1686. }
  1687. }
  1688. }
  1689. }
  1690. }
  1691. }
  1692. MessageBoxCustom.Show("导出完毕");
  1693. return;
  1694. }
  1695. }
  1696. }
  1697. }
  1698. catch
  1699. {
  1700. MessageBoxCustom.Show("导片出错");
  1701. }
  1702. }
  1703. static bool ISExportRaw = true;
  1704. /// <summary>
  1705. /// 导出选好的片
  1706. /// </summary>
  1707. /// <returns></returns>
  1708. public static void ExportSelectionPiece( string StrOrdNumber, string StrViceNumber )
  1709. {
  1710. try
  1711. {
  1712. if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
  1713. {
  1714. return;
  1715. }
  1716. LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1717. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1718. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ExportCategorySuperSmallForm frm12 = new SuperSmallForm.ExportCategorySuperSmallForm();
  1719. frm12.cbxISRaw.Checked = ISExportRaw;
  1720. frm12.ExportDirectoryType = vmodel.GetSelectPhotoDirectoryType();
  1721. frm12.ShowDialog();
  1722. bool isExportRAW = frm12.cbxISRaw.Checked;
  1723. ISExportRaw = isExportRAW;
  1724. if ( frm12.IsSaveed )
  1725. {
  1726. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1727. if ( defaultImportFilePath != "" )
  1728. {
  1729. if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
  1730. {
  1731. fbd.SelectedPath = defaultImportFilePath;
  1732. }
  1733. }
  1734. if ( fbd.ShowDialog() == DialogResult.OK )
  1735. {
  1736. defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
  1737. string ExportSelectedToDirPath = "";
  1738. string ShopName = "";
  1739. string cusName = "";
  1740. string showOrderNumber = "";
  1741. bool IsSaveed = false;
  1742. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1743. {
  1744. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
  1745. // bool IsSaveed = pe.ExportSelectedPhotoFile(fbd.SelectedPath.ToString().Trim(), frm12.IsOriginalFilm, backgroundWorker, true, !frm12.IsProductName, isbarode: frm12.ExportBarcode, isExportRaw: isExportRAW);
  1746. IsSaveed = pe.ExportSelectedFineRetouchPhotoFile(fbd.SelectedPath.ToString().Trim(), frm12.ExportDirectoryType, backgroundWorker, !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ExportedSelectPhotoGenerateZIP, !frm12.IsProductName, isbarode: frm12.ExportBarcode, isExportRaw: isExportRAW);
  1747. if ( IsSaveed )
  1748. {
  1749. ExportSelectedToDirPath = pe.sPhotoHandling.ExportSelectedToDirPath;
  1750. if (String.IsNullOrWhiteSpace(vmodel.Ordv_SelectionShopID))
  1751. {
  1752. vmodel.Ordv_SelectionShopID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID;
  1753. }
  1754. ShopName = LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyIDToShopName(vmodel.Ordv_SelectionShopID);
  1755. cusName = new BLL.BLL_ErpCustomer().GetCustomerNameList(model.Ord_Number, "&");
  1756. showOrderNumber = pe.sPhotoHandling.ShowOrderNumber;
  1757. 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);
  1758. }
  1759. }, width: 500);
  1760. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ExportedSelectPhotoGenerateZIP)
  1761. {
  1762. if (IsSaveed)
  1763. {
  1764. LYFZ.CompressionProgress.CompressZipPak compressZipPak = new CompressionProgress.CompressZipPak();
  1765. compressZipPak.SourceDirectoryPath = ExportSelectedToDirPath;
  1766. compressZipPak.ToTargetDirectoryPath = fbd.SelectedPath.ToString().Trim();
  1767. compressZipPak.TargetArchFileName = String.Format("{0}_{1}_{2}.zip", ShopName, cusName, showOrderNumber);
  1768. if (compressZipPak.ShowDialog() == DialogResult.OK)
  1769. {
  1770. MessageBoxCustom.Show("已选相片Zip压缩包已生成完成");
  1771. }
  1772. }
  1773. }
  1774. }
  1775. }
  1776. }
  1777. catch
  1778. {
  1779. MessageBoxCustom.Show("导片出错");
  1780. }
  1781. }
  1782. /// <summary>
  1783. /// 导出先好的片,用于发片取件
  1784. /// </summary>
  1785. /// <param name="StrOrdNumber"></param>
  1786. /// <param name="StrViceNumber"></param>
  1787. public static void ExportSelectionPiece( string StrOrdNumber, string StrViceNumber, List<LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece> ExportList )
  1788. {
  1789. try
  1790. {
  1791. if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
  1792. {
  1793. return;
  1794. }
  1795. LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1796. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1797. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ExportCategorySuperSmallForm frm12 = new SuperSmallForm.ExportCategorySuperSmallForm();
  1798. frm12.cbxISRaw.Checked = ISExportRaw;
  1799. frm12.ExportDirectoryType = vmodel.GetSelectPhotoDirectoryType();
  1800. frm12.ShowDialog();
  1801. bool isExportRAW = frm12.cbxISRaw.Checked;
  1802. ISExportRaw = isExportRAW;
  1803. if ( frm12.IsSaveed )
  1804. {
  1805. IEnumerable<IGrouping<string, LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece>> GroupList = ExportList.GroupBy(n => n.StrPath);
  1806. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
  1807. List<string> StrExportOkPath = new List<string>();
  1808. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1809. {
  1810. foreach ( IGrouping<string, LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece> item in GroupList )
  1811. {
  1812. List<string> UidList = new List<string>();
  1813. foreach ( LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece value in item )
  1814. {
  1815. UidList.Add(value.StrUID);
  1816. }
  1817. string StrNewPath = item.Key + "_" + model.Ord_SinceOrderNumber + "_发片外发";
  1818. if ( pe.ExportSelectedPhotoFile(StrNewPath, frm12.IsOriginalFilm, backgroundWorker, false, !frm12.IsProductName, isbarode: frm12.ExportBarcode, _UniquelyIdentityList: UidList, isExportRaw: isExportRAW) )
  1819. {
  1820. StrExportOkPath.Add(StrNewPath);
  1821. }
  1822. }
  1823. }, width: 500);
  1824. if ( StrExportOkPath.Count > 0 )
  1825. {
  1826. foreach ( string item in StrExportOkPath )
  1827. {
  1828. if ( Directory.GetDirectories(item).Length > 0 )
  1829. {
  1830. string StrDirectPath = Directory.GetDirectories(item)[0];
  1831. if ( Directory.Exists(StrDirectPath) )
  1832. {
  1833. DirectoryInfo info = new DirectoryInfo(StrDirectPath);
  1834. if ( info is DirectoryInfo )
  1835. {
  1836. LYFZ.CompressionProgress.FormCompressionProgress frm = new CompressionProgress.FormCompressionProgress(StrDirectPath, item + ".zip");
  1837. if ( !frm.IsDisposed )
  1838. {
  1839. if ( frm.ShowDialog() == DialogResult.No )
  1840. {
  1841. MessageBoxCustom.Show("压缩失败!");
  1842. }
  1843. else
  1844. {
  1845. if ( !string.IsNullOrEmpty(item) )
  1846. {
  1847. if ( System.IO.Directory.Exists(item) )
  1848. {
  1849. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1850. {
  1851. backgroundWorker.ReportProgress(0, "压缩完成,正在删除缓存......");
  1852. System.IO.Directory.Delete(item, true);
  1853. });
  1854. }
  1855. }
  1856. }
  1857. }
  1858. }
  1859. }
  1860. }
  1861. }
  1862. }
  1863. }
  1864. }
  1865. catch
  1866. {
  1867. MessageBoxCustom.Show("导片出错");
  1868. }
  1869. }
  1870. /// <summary>
  1871. /// 导出精修片
  1872. /// </summary>
  1873. public static void ExportRefinedRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
  1874. {
  1875. try
  1876. {
  1877. LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1878. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1879. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel);
  1880. List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.FineRetouch, BLL.SelectPhotoHandling.PhotoType.Original, SightsName);
  1881. if ( sPhotoList.Count == 0 )
  1882. {
  1883. MessageBoxCustom.Show("此单未导片");
  1884. return;
  1885. }
  1886. if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
  1887. {
  1888. return;
  1889. }
  1890. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1891. if ( defaultImportFilePath != "" )
  1892. {
  1893. if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
  1894. {
  1895. fbd.SelectedPath = defaultImportFilePath;
  1896. }
  1897. }
  1898. if ( fbd.ShowDialog() == DialogResult.OK )
  1899. {
  1900. defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
  1901. bool IsImp = false;
  1902. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1903. {
  1904. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
  1905. IsImp = pe.ExportFineRetouchFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker);
  1906. }, width: 500);
  1907. if ( IsImp )
  1908. {
  1909. vmodel.Ordv_ExportRefinement = "已导出";
  1910. new BLL.BLL_ErpOrderDigital().Update(vmodel);
  1911. MessageBoxCustom.Show("导出完毕");
  1912. return;
  1913. }
  1914. }
  1915. }
  1916. catch
  1917. {
  1918. MessageBoxCustom.Show("导片出错");
  1919. }
  1920. }
  1921. /// <summary>
  1922. /// 导出设计片
  1923. /// </summary>
  1924. public static void ExportDesignPiece( string StrOrdNumber, string StrViceNumber, string SightsName )
  1925. {
  1926. try
  1927. {
  1928. LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
  1929. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1930. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel);
  1931. List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.DesignPiece, BLL.SelectPhotoHandling.PhotoType.Original, SightsName);
  1932. if ( sPhotoList.Count == 0 )
  1933. {
  1934. MessageBoxCustom.Show("此单未导片");
  1935. return;
  1936. }
  1937. if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
  1938. {
  1939. return;
  1940. }
  1941. LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  1942. string StrLookDesign = Enum.GetName(typeof(LYFZ.EnumPublic.LookDesignStatusEnum), Convert.ToInt32(modelEarlyRepairStatus.Ordv_LookDesignStatus));
  1943. FolderBrowserDialog fbd = new FolderBrowserDialog();
  1944. if ( defaultImportFilePath != "" )
  1945. {
  1946. if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
  1947. {
  1948. fbd.SelectedPath = defaultImportFilePath;
  1949. }
  1950. }
  1951. if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.未看.ToString().Trim() && modelEarlyRepairStatus.GetSelectPhotoDirectoryType() != Model.Model_ErpOrder.DirectoryType.DesignPiece )
  1952. {
  1953. if ( fbd.ShowDialog() == DialogResult.OK )
  1954. {
  1955. defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
  1956. bool IsImp = false;
  1957. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  1958. {
  1959. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
  1960. IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker);
  1961. }, width: 500);
  1962. if ( !IsImp )
  1963. {
  1964. return;
  1965. }
  1966. else
  1967. {
  1968. vmodel.Ordv_ExportDesign = "已导出";
  1969. new BLL.BLL_ErpOrderDigital().Update(vmodel);
  1970. MessageBoxCustom.Show("设计片导出完毕");
  1971. return;
  1972. }
  1973. }
  1974. }
  1975. else
  1976. {
  1977. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.DesignExportOptionSuperSmallForm frm = new SuperSmallForm.DesignExportOptionSuperSmallForm();
  1978. if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.OK.ToString().Trim() )
  1979. {
  1980. frm.IntEditDesign_Visible = false;
  1981. }
  1982. else
  1983. {
  1984. frm.IntEditDesign_Visible = true;
  1985. }
  1986. if ( modelEarlyRepairStatus.GetSelectPhotoDirectoryType() == Model.Model_ErpOrder.DirectoryType.DesignPiece )
  1987. {
  1988. frm.IntSelectDesign_Visible = true;
  1989. }
  1990. else
  1991. {
  1992. frm.IntSelectDesign_Visible = false;
  1993. }
  1994. frm.ShowDialog();
  1995. if ( !frm.IsSave )
  1996. {
  1997. return;
  1998. }
  1999. if ( fbd.ShowDialog() == DialogResult.OK )
  2000. {
  2001. defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
  2002. bool IsImp = false;
  2003. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  2004. {
  2005. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
  2006. if ( frm.OutOption == "Design" )
  2007. {
  2008. IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker);
  2009. }
  2010. else if ( frm.OutOption == "EditDesign" )
  2011. {
  2012. IsImp = pe.ExportSelectedDesignFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker);
  2013. }
  2014. else if ( frm.OutOption == "LookOk" )
  2015. {
  2016. IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), true, backgroundWorker);
  2017. }
  2018. else if ( frm.OutOption == "SelectDesign" )
  2019. {
  2020. IsImp = pe.ExportSelectedDesignPhotoFile(fbd.SelectedPath.ToString().Trim(), backgroundWorker, true, frm.IsCreateProductFolder, isbarode: frm.ExportBarcode);
  2021. }
  2022. }, width: 500);
  2023. if ( !IsImp )
  2024. {
  2025. return;
  2026. }
  2027. else
  2028. {
  2029. if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.OK.ToString().Trim() )
  2030. {
  2031. vmodel.Ordv_ExportDesign = "已导出";
  2032. new BLL.BLL_ErpOrderDigital().Update(vmodel);
  2033. MessageBoxCustom.Show("已确认设计片导出完毕");
  2034. return;
  2035. }
  2036. }
  2037. }
  2038. }
  2039. }
  2040. catch { MessageBoxCustom.Show("导片出错"); }
  2041. }
  2042. public static void ExportN8Piece( string StrOrdNumber, string StrViceNumber, string SightsName )
  2043. {
  2044. try
  2045. {
  2046. LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber);
  2047. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  2048. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel);
  2049. #region 判断是否已经完成N8选版,若完成才能导出;
  2050. // 判断是否是儿童订单;
  2051. StringBuilder strN8HasFinishUserDirectory = new StringBuilder();
  2052. if ( (EnumPublic.OrderType)Convert.ToInt32(model.Ord_Type) == EnumPublic.OrderType.儿童订单 )
  2053. {
  2054. strN8HasFinishUserDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory);
  2055. strN8HasFinishUserDirectory.Append(StrOrdNumber);
  2056. strN8HasFinishUserDirectory.Append("\\[已选]" + SightsName);
  2057. }
  2058. else
  2059. {
  2060. strN8HasFinishUserDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory);
  2061. strN8HasFinishUserDirectory.Append("[已选]" + StrOrdNumber);
  2062. }
  2063. if ( !Directory.Exists(strN8HasFinishUserDirectory.ToString()) )
  2064. {
  2065. MessageBoxCustom.Show("该选版未完成,不能导出");
  2066. return;
  2067. }
  2068. #endregion
  2069. if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) )
  2070. {
  2071. return;
  2072. }
  2073. LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);
  2074. string StrLookDesign = Enum.GetName(typeof(LYFZ.EnumPublic.LookDesignStatusEnum), Convert.ToInt32(modelEarlyRepairStatus.Ordv_LookDesignStatus));
  2075. FolderBrowserDialog fbd = new FolderBrowserDialog();
  2076. if ( defaultImportFilePath != "" )
  2077. {
  2078. if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录
  2079. {
  2080. fbd.SelectedPath = defaultImportFilePath;
  2081. }
  2082. }
  2083. if ( fbd.ShowDialog() == DialogResult.OK )
  2084. {
  2085. defaultImportFilePath = fbd.SelectedPath;//记录选中的目录
  2086. bool IsImp = false;
  2087. LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker )
  2088. {
  2089. LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel);
  2090. IsImp = pe.ExportN8Film(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker);
  2091. }, width: 500);
  2092. if ( !IsImp )
  2093. {
  2094. return;
  2095. }
  2096. else
  2097. {
  2098. MessageBoxCustom.Show("N8选版导出完毕");
  2099. return;
  2100. }
  2101. }
  2102. }
  2103. catch { MessageBoxCustom.Show("导片出错"); }
  2104. }
  2105. #endregion
  2106. #region 解
  2107. /// <summary>
  2108. /// 给外部调用的DES算法解密。
  2109. /// </summary>
  2110. public static string DecryptDES( string decryptString )
  2111. {
  2112. return DecryptDES(decryptString, "cust-stu");
  2113. }
  2114. /// <summary>
  2115. /// DES解密字符串
  2116. /// </summary>
  2117. /// <param name="decryptString">待解密的字符串</param>
  2118. /// <param name="decryptKey">解密密钥,要求为8位,和加密密钥相同</param>
  2119. /// <returns>解密成功返回解密后的字符串,失败返源串</returns>
  2120. private static string DecryptDES( string decryptString, string decryptKey )
  2121. {
  2122. try
  2123. {
  2124. byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey);
  2125. byte[] rgbIV = DesKeys;
  2126. byte[] inputByteArray = Convert.FromBase64String(decryptString);
  2127. System.Security.Cryptography.DESCryptoServiceProvider DCSP = new System.Security.Cryptography.DESCryptoServiceProvider();
  2128. System.IO.MemoryStream mStream = new System.IO.MemoryStream();
  2129. System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), System.Security.Cryptography.CryptoStreamMode.Write);
  2130. cStream.Write(inputByteArray, 0, inputByteArray.Length);
  2131. cStream.FlushFinalBlock();
  2132. return Encoding.UTF8.GetString(mStream.ToArray());
  2133. }
  2134. catch
  2135. {
  2136. return decryptString;
  2137. }
  2138. }
  2139. #endregion
  2140. #region 接单人控件
  2141. /// <summary>
  2142. /// 接单人员
  2143. /// </summary>
  2144. /// <param name="txtPersonnel">接单人员控件</param>
  2145. /// <param name="IsShowType">是否显示接单类型</param>
  2146. /// <param name="IsShowResign">是否显示离职人员</param>
  2147. public void txtOrdersPerson( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, bool IsShowType = true, bool IsShowResign = false )
  2148. {
  2149. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm frm = new SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm();
  2150. frm.txtPersonnel = txtPersonnel;
  2151. frm.IsShowType = IsShowType;
  2152. frm.IsShowResign = IsShowResign;
  2153. frm.ShowDialog();
  2154. txtPersonnel.Text = frm.txtPersonnel.Text;
  2155. txtPersonnel.Tag = frm.txtPersonnel.Tag;
  2156. }
  2157. /// <summary>
  2158. /// 接单人员
  2159. /// </summary>
  2160. /// <param name="txtPersonnel">接单人员控件</param>
  2161. /// <param name="IsShowType">是否显示接单类型</param>
  2162. /// <param name="IsShowResign">是否显示离职人员</param>
  2163. public string txtOrdersPerson( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, string strJsonData, bool IsShowType = true, bool IsShowResign = false )
  2164. {
  2165. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm frm = new SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm(strJsonData);
  2166. frm.txtPersonnel = txtPersonnel;
  2167. frm.IsShowType = IsShowType;
  2168. frm.IsShowResign = IsShowResign;
  2169. frm.cbxAchievement.Visible = false;
  2170. frm.ShowDialog();
  2171. txtPersonnel.Text = frm.txtPersonnel.Text;
  2172. txtPersonnel.Tag = frm.txtPersonnel.Tag;
  2173. strJsonData = "";
  2174. if ( frm.cbxAchievement.Checked )
  2175. {
  2176. strJsonData = frm.ratioBll.ToString();
  2177. }
  2178. return strJsonData;
  2179. }
  2180. /// <summary>
  2181. /// 接单人员——获取Value(员工编号) 或 Tag(主或副门市)
  2182. /// </summary>
  2183. /// <param name="txtPersonnel">接单人员控件</param>
  2184. /// <param name="bl">True:(员工编号),False:Tag(主或副门市)</param>
  2185. /// <returns></returns>
  2186. public string txtOrdersPersonGetValueOrTag( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, bool bl = true )
  2187. {
  2188. if ( txtPersonnel.Tag != null )
  2189. {
  2190. if ( bl )
  2191. {
  2192. string[] StrValue = txtPersonnel.Tag.ToString().Trim().Split('|');
  2193. return StrValue[0].Trim();
  2194. }
  2195. else
  2196. {
  2197. string[] StrTag = txtPersonnel.Tag.ToString().Trim().Split('|');
  2198. return StrTag[1].Trim();
  2199. }
  2200. }
  2201. return "";
  2202. }
  2203. #endregion
  2204. #region 控件值的优化
  2205. /// <summary>
  2206. /// 获取自定义控件的Text值(去掉空格后的值)
  2207. /// </summary>
  2208. /// <param name="maskedTextBoxEx">自定义控件</param>
  2209. /// <returns></returns>
  2210. public static string MaskedTextBoxExGetText( MaskedTextBoxEx maskedTextBoxEx )
  2211. {
  2212. //char[] charList = maskedTextBoxEx.Text.ToCharArray();
  2213. //string StrChar = "";
  2214. //for (int i = 0; i < charList.Length; i++)
  2215. //{
  2216. // if (charList[i].ToString().Trim() != "")
  2217. // { StrChar += charList[i].ToString().Trim(); }
  2218. //}
  2219. //return StrChar;
  2220. return maskedTextBoxEx.Text.Trim().Replace(" ", "");
  2221. }
  2222. /// <summary>
  2223. /// 写日志
  2224. /// </summary>
  2225. /// <param name="txt">日志内容</param>
  2226. /// <param name="fullPath">日志文件全路径</param>
  2227. public static void WriteLogs( string txt, string fullPath )
  2228. {
  2229. if ( fullPath.LastIndexOf(@"\") == (fullPath.Length - 1) )
  2230. {
  2231. fullPath = fullPath + "new.txt";
  2232. }
  2233. else
  2234. {
  2235. fullPath = fullPath + "\\new.txt";
  2236. }
  2237. using ( System.IO.StreamWriter sw = new System.IO.StreamWriter(fullPath, true, Encoding.UTF8) )
  2238. {
  2239. sw.WriteLine(txt);
  2240. sw.Flush();
  2241. sw.Close();
  2242. }
  2243. }
  2244. /// <summary>
  2245. /// 隐藏电话号码控件字符
  2246. /// </summary>
  2247. /// <param name="objValue"></param>
  2248. public static void HidePhoneControls( LYFZ.ComponentLibrary.MaskedTextBoxEx objValue )
  2249. {
  2250. bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
  2251. if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
  2252. {
  2253. objValue.PasswordChar = '*';
  2254. }
  2255. }
  2256. /// <summary>
  2257. /// 隐藏电话号码控件字符
  2258. /// </summary>
  2259. /// <param name="objValue"></param>
  2260. public static void HidePhoneControls( LYFZ.ComponentLibrary.TextBoxEx objValue )
  2261. {
  2262. bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
  2263. if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
  2264. {
  2265. objValue.PassChar = '*';
  2266. }
  2267. }
  2268. /// <summary>
  2269. /// 隐藏电话号码控件字符
  2270. /// </summary>
  2271. /// <param name="objValue"></param>
  2272. public static void HidePhoneControls( LYFZ.ComponentLibrary.TextBoxBasicEx objValue )
  2273. {
  2274. bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
  2275. if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
  2276. {
  2277. objValue.PasswordChar = '*';
  2278. }
  2279. }
  2280. /// <summary>
  2281. /// 隐藏电话号码控件字符
  2282. /// </summary>
  2283. /// <param name="objValue"></param>
  2284. public static string HidePhoneControls( object objValue )
  2285. {
  2286. if ( !string.IsNullOrEmpty(objValue.ToString().Trim()) )
  2287. {
  2288. bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
  2289. if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() )
  2290. {
  2291. return LYFZ.Command.Command_Validate.HidePhone(objValue);
  2292. }
  2293. else
  2294. {
  2295. return objValue.ToString().Trim();
  2296. }
  2297. }
  2298. return "";
  2299. }
  2300. #endregion
  2301. #region 计件提成点绑定
  2302. /// <summary>
  2303. /// 计件提成点绑定
  2304. /// </summary>
  2305. /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
  2306. /// <param name="treev">当前下拉树</param>
  2307. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  2308. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  2309. /// <param name="StrWhere">查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等</param>
  2310. public static void BindTreeView_PieceCommission( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx treev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" )
  2311. {
  2312. string ExecuteSql = orbll.GetView_CustomReturnExecuteSql("tb_ErpSystemCategory", StrWhere: StrWhere, ShowColumnName: "ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID");
  2313. ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("tb_ErpWageCommissionSet", StrWhere: "", ShowColumnName: "Wcs_TypeCode,Wcs_Percentage");
  2314. DataSet dtSet = orbll.GetView_Custom(ExecuteSql);
  2315. DataTable tbl = dtSet.Tables["ds"];
  2316. DataTable tbl2 = dtSet.Tables["ds1"];
  2317. treev.Nodes.Clear();
  2318. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  2319. if ( dtRow.Length > 0 )
  2320. {
  2321. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  2322. TreeNode root = null;
  2323. for ( int i = 0; i < dtRow2.Length; i++ )
  2324. {
  2325. if ( i == 0 )
  2326. {
  2327. if ( IsFirstNodeNull )
  2328. {
  2329. root = new TreeNode();
  2330. root.Text = IsFirstNodeName;
  2331. root.Tag = "";
  2332. root.Name = "";
  2333. treev.Nodes.Add(root);
  2334. }
  2335. }
  2336. root = new TreeNode();
  2337. DataRow[] dtRow3 = tbl.Select("Sc_ClassParentID = '" + dtRow2[i]["ID"].ToString().Trim() + "'");
  2338. if ( dtRow3.Length > 0 )
  2339. {
  2340. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  2341. CreateTreeViewPieceCommission(root, dtRow2[i]["ID"].ToString(), tbl, tbl2, dtRow3);
  2342. }
  2343. else
  2344. {
  2345. DataRow[] dtRow4 = tbl2.Select("Wcs_TypeCode = '" + dtRow2[i]["Sc_ClassCode"].ToString().Trim() + "'");
  2346. if ( dtRow4.Length > 0 )
  2347. {
  2348. root.Text = dtRow2[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow2[i]["Sc_ClassName"].ToString(), 0) + dtRow4[0]["Wcs_Percentage"].ToString().Trim();
  2349. }
  2350. else
  2351. {
  2352. root.Text = dtRow2[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow2[i]["Sc_ClassName"].ToString(), 0) + "0";
  2353. }
  2354. }
  2355. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  2356. treev.Nodes.Add(root);
  2357. }
  2358. treev.ExpandAll();
  2359. }
  2360. }
  2361. /// <summary>
  2362. /// 第二级绑定
  2363. /// </summary>
  2364. /// <param name="nodes">父节点</param>
  2365. /// <param name="ClassParentID">父节点的ID</param>
  2366. /// <param name="tbl">当前数据源</param>
  2367. private static void CreateTreeViewPieceCommission( TreeNode nodes, string ClassParentID, DataTable tbl, DataTable tbl2, DataRow[] dtRow )
  2368. {
  2369. if ( dtRow.Length > 0 )
  2370. {
  2371. TreeNode node;
  2372. for ( int i = 0; i < dtRow.Length; i++ )
  2373. {
  2374. node = new TreeNode();
  2375. DataRow[] dtRow1 = tbl.Select("Sc_ClassParentID = '" + dtRow[i]["ID"].ToString().Trim() + "'");
  2376. if ( dtRow1.Length > 0 )
  2377. {
  2378. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  2379. CreateTreeViewPieceCommission(node, dtRow[i]["ID"].ToString(), tbl, tbl2, dtRow1);
  2380. }
  2381. else
  2382. {
  2383. DataRow[] dtRow4 = tbl2.Select("Wcs_TypeCode = '" + dtRow[i]["Sc_ClassCode"].ToString().Trim() + "'");
  2384. if ( dtRow4.Length > 0 )
  2385. {
  2386. node.Text = dtRow[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow[i]["Sc_ClassName"].ToString(), 1) + dtRow4[0]["Wcs_Percentage"].ToString().Trim();
  2387. }
  2388. else
  2389. {
  2390. node.Text = dtRow[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow[i]["Sc_ClassName"].ToString(), 1) + "0";
  2391. }
  2392. }
  2393. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  2394. nodes.Nodes.Add(node);
  2395. //CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl);
  2396. }
  2397. }
  2398. }
  2399. private static string AddEmpty( string StrText, int Intlevel, int EmptyCount = 40 )
  2400. {
  2401. string StrEmpty = "";
  2402. int TextCount = 0;
  2403. char[] strArray = StrText.ToCharArray();
  2404. for ( int i = 0; i < strArray.Length; i++ )
  2405. {
  2406. //TextCount += 2;
  2407. if ( LYFZ.Command.Command_Validate.IsChinese(strArray[i].ToString()) )
  2408. {
  2409. TextCount += 2;
  2410. }
  2411. else
  2412. {
  2413. TextCount++;
  2414. }
  2415. }
  2416. EmptyCount -= TextCount;
  2417. if ( Intlevel == 1 )
  2418. {
  2419. EmptyCount -= 3;
  2420. }
  2421. for ( int i = 0; i < EmptyCount; i++ )
  2422. {
  2423. StrEmpty += " ";
  2424. }
  2425. return StrEmpty;
  2426. }
  2427. #endregion
  2428. #region 系统类别设置绑定
  2429. /// <summary>
  2430. /// 系统设置的绑定数据
  2431. /// </summary>
  2432. /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
  2433. /// <param name="treev">当前下拉树</param>
  2434. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  2435. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  2436. /// <param name="StrWhere">查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等</param>
  2437. public static void BindTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx treev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" )
  2438. {
  2439. DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0];
  2440. treev.Nodes.Clear();
  2441. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  2442. if ( dtRow.Length > 0 )
  2443. {
  2444. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  2445. TreeNode root = null;
  2446. for ( int i = 0; i < dtRow2.Length; i++ )
  2447. {
  2448. if ( i == 0 )
  2449. {
  2450. if ( IsFirstNodeNull )
  2451. {
  2452. root = new TreeNode();
  2453. root.Text = IsFirstNodeName;
  2454. root.Tag = "";
  2455. root.Name = "";
  2456. treev.Nodes.Add(root);
  2457. }
  2458. }
  2459. root = new TreeNode();
  2460. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  2461. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  2462. CreateTreeView(root, dtRow2[i]["ID"].ToString(), tbl);
  2463. treev.Nodes.Add(root);
  2464. }
  2465. treev.ExpandAll();
  2466. }
  2467. }
  2468. /// <summary>
  2469. /// 第二级绑定
  2470. /// </summary>
  2471. /// <param name="nodes">父节点</param>
  2472. /// <param name="ClassParentID">父节点的ID</param>
  2473. /// <param name="tbl">当前数据源</param>
  2474. private static void CreateTreeView( TreeNode nodes, string ClassParentID, DataTable tbl )
  2475. {
  2476. DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
  2477. if ( dtRow.Length > 0 )
  2478. {
  2479. TreeNode node;
  2480. for ( int i = 0; i < dtRow.Length; i++ )
  2481. {
  2482. node = new TreeNode();
  2483. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  2484. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  2485. nodes.Nodes.Add(node);
  2486. CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl);
  2487. }
  2488. }
  2489. }
  2490. #endregion
  2491. #region 产品查看图片
  2492. /// <summary>
  2493. /// 产品查看图片
  2494. /// </summary>
  2495. /// <param name="StrProductNumber"></param>
  2496. public static void ProductViewPhoto( string StrProductNumber )
  2497. {
  2498. DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: " Prod_Number = '" + StrProductNumber + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
  2499. if ( tbl.Rows.Count > 0 )
  2500. {
  2501. if ( !string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()) )
  2502. {
  2503. try
  2504. {
  2505. LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
  2506. frm.FrmImage = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
  2507. //frm.WindowState = FormWindowState.Maximized;
  2508. frm.ShowDialog();
  2509. }
  2510. catch
  2511. {
  2512. MessageBoxCustom.Show("获取图片出错!");
  2513. }
  2514. }
  2515. else
  2516. {
  2517. MessageBoxCustom.Show("未上传图片!");
  2518. }
  2519. }
  2520. }
  2521. #endregion
  2522. #region QQ与电话呼叫
  2523. /// <summary>
  2524. /// QQ呼叫
  2525. /// </summary>
  2526. /// <param name="StrQQ"></param>
  2527. public static void QQCall( string StrQQ )
  2528. {
  2529. if ( StrQQ.Trim() != "" )
  2530. {
  2531. WebBrowser wb = new WebBrowser();
  2532. wb.Url = new Uri("http://wpa.qq.com/msgrd?v=3&uin=" + StrQQ + "&site=qq&menu=yes");
  2533. }
  2534. else
  2535. {
  2536. MessageBoxCustom.Show("请输入要联系的QQ帐号!");
  2537. }
  2538. }
  2539. /// <summary>
  2540. /// 电话呼叫
  2541. /// </summary>
  2542. /// <param name="mskText"></param>
  2543. public static void PhoneCall( LYFZ.ComponentLibrary.MaskedTextBoxEx mskText )
  2544. {
  2545. try
  2546. {
  2547. LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
  2548. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(PublicCodeClasses.MaskedTextBoxExGetText(mskText));
  2549. if ( !string.IsNullOrEmpty(PublicCodeClasses.MaskedTextBoxExGetText(mskText)) && LYFZ.Command.Command_Validate.IsMobilePhone(PublicCodeClasses.MaskedTextBoxExGetText(mskText)) &&
  2550. cwbll.ProgramStarts() == true )
  2551. {
  2552. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.CallPhoneMessage callPhone = new SetSmallForm.CallPhoneMessage();
  2553. callPhone.phoneNumber = PublicCodeClasses.MaskedTextBoxExGetText(mskText);
  2554. callPhone.ShowDialog();
  2555. }
  2556. }
  2557. catch ( Exception ex )
  2558. {
  2559. MessageBoxCustom.Show(ex.Message);
  2560. }
  2561. }
  2562. /// <summary>
  2563. /// 电话呼叫
  2564. /// </summary>
  2565. /// <param name="mskText"></param>
  2566. public static void PhoneCall( object obj )
  2567. {
  2568. try
  2569. {
  2570. if ( string.IsNullOrEmpty(obj.ToString().Trim()) )
  2571. {
  2572. return;
  2573. }
  2574. if ( !LYFZ.Command.Command_Validate.IsMobilePhone(obj.ToString()) )
  2575. {
  2576. MessageBoxCustom.Show("请输入完整呼叫号码!");
  2577. return;
  2578. }
  2579. LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard();
  2580. if ( cwbll.ProgramStarts() == false )
  2581. {
  2582. MessageBoxCustom.Show("来电精灵未启动,请启动");
  2583. return;
  2584. }
  2585. cwbll.GetCPhone(obj.ToString());
  2586. }
  2587. catch ( Exception ex )
  2588. {
  2589. }
  2590. }
  2591. #endregion
  2592. #region 处理像片,处理于像片保到数据库与从数据库中拿放到PictureBox中去
  2593. /// <summary>
  2594. /// 获取图片,将图片转成Byte[],用于存入数据库
  2595. /// </summary>
  2596. /// <returns></returns>
  2597. public static byte[] ImageDatabytes( PictureBox pict )
  2598. {
  2599. byte[] Photo_Byte = null;
  2600. if ( pict.Image != null )
  2601. {
  2602. using ( MemoryStream ms = new MemoryStream() )
  2603. {
  2604. try
  2605. {
  2606. Bitmap bmp = new Bitmap(pict.Image);
  2607. bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
  2608. Photo_Byte = new byte[ms.Length];
  2609. ms.Position = 0;
  2610. ms.Read(Photo_Byte, 0, Convert.ToInt32(ms.Length));
  2611. bmp.Dispose();
  2612. }
  2613. catch { }
  2614. }
  2615. }
  2616. return Photo_Byte;
  2617. }
  2618. /// <summary>
  2619. /// 获取图片,将图片转成Byte[],用于存入数据库
  2620. /// </summary>
  2621. /// <returns></returns>
  2622. public static byte[] ImageDatabytes( string StrPath )
  2623. {
  2624. if ( !File.Exists(StrPath) )
  2625. return null;
  2626. byte[] bmpBytes = File.ReadAllBytes(StrPath);
  2627. return bmpBytes;
  2628. }
  2629. /// <summary>
  2630. /// 把Byte[]转成Image图片显示(数据库字段类型为:Image)
  2631. /// </summary>
  2632. /// <param name="ImageDatas"></param>
  2633. /// <returns></returns>
  2634. public static Bitmap GetImage( byte[] ImageDatas )
  2635. {
  2636. try
  2637. {
  2638. using ( MemoryStream ImageMS = new MemoryStream() )
  2639. {
  2640. ImageMS.Write(ImageDatas, 0, ImageDatas.Length);
  2641. Bitmap resultBitmap = new Bitmap(ImageMS);
  2642. return resultBitmap;
  2643. }
  2644. }
  2645. catch
  2646. {
  2647. return null;
  2648. }
  2649. }
  2650. /// <summary>
  2651. /// 把字节型转换成十六进制字符串
  2652. /// </summary>
  2653. /// <param name="bytes"></param>
  2654. /// <returns></returns>
  2655. public static string ToHexString( byte[] bytes )
  2656. {
  2657. string hexString = string.Empty;
  2658. if ( bytes != null )
  2659. {
  2660. StringBuilder strB = new StringBuilder();
  2661. for ( int i = 0; i < bytes.Length; i++ )
  2662. {
  2663. strB.Append(bytes[i].ToString("X2"));
  2664. }
  2665. hexString = strB.ToString();
  2666. }
  2667. return hexString;
  2668. }
  2669. /// <summary>
  2670. /// 把十六进制字符串转换成字节型
  2671. /// </summary>
  2672. /// <param name="InString"></param>
  2673. /// <returns></returns>
  2674. public static byte[] StringToByte( string hexString )
  2675. {
  2676. hexString = hexString.Replace(" ", "");
  2677. if ( (hexString.Length % 2) != 0 )
  2678. hexString += " ";
  2679. byte[] returnBytes = new byte[hexString.Length / 2];
  2680. for ( int i = 0; i < returnBytes.Length; i++ )
  2681. returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
  2682. return returnBytes;
  2683. }
  2684. #endregion
  2685. #region 下拉框绑定
  2686. /// <summary>
  2687. /// 下拉框绑定
  2688. /// </summary>
  2689. /// <param name="cmb"></param>
  2690. /// <param name="StrBindData"></param>
  2691. public static void BindCombox( LYFZ.ComponentLibrary.ComboBoxEx cmb, string StrBindData, bool IsFirstNodeNull = false )
  2692. {
  2693. cmb.Items.Clear();
  2694. if ( !string.IsNullOrEmpty(StrBindData.Trim()) )
  2695. {
  2696. string[] StrArray = StrBindData.Split(',');
  2697. for ( int i = 0; i < StrArray.Length; i++ )
  2698. {
  2699. if ( i == 0 )
  2700. {
  2701. if ( IsFirstNodeNull )
  2702. {
  2703. cmb.Items.Add("");
  2704. }
  2705. }
  2706. if ( !string.IsNullOrEmpty(StrArray[i].Trim()) )
  2707. {
  2708. cmb.Items.Add(StrArray[i].Trim());
  2709. }
  2710. }
  2711. }
  2712. }
  2713. /// <summary>
  2714. /// 下拉树绑定
  2715. /// </summary>
  2716. /// <param name="cmbtreev">当前下拉树</param>
  2717. /// <param name="StrBindData">字符串数据</param>
  2718. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  2719. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  2720. /// <param name="IsSplit">每组中是否要再次分割(Tag:数组0;Text:数组1)</param>
  2721. /// <param name="IsFirstNodeName">要分割的分割符</param>
  2722. public static void BindComboxTreeView( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrBindData, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsSplit = false, char StrSplitSymbol = ':' )
  2723. {
  2724. cmbtreev.Nodes.Clear();
  2725. if ( !string.IsNullOrEmpty(StrBindData.Trim()) )
  2726. {
  2727. string[] StrArray = StrBindData.Split(',');
  2728. TreeNode root = null;
  2729. for ( int i = 0; i < StrArray.Length; i++ )
  2730. {
  2731. if ( i == 0 )
  2732. {
  2733. if ( IsFirstNodeNull )
  2734. {
  2735. root = new TreeNode();
  2736. root.Text = IsFirstNodeName;
  2737. root.Tag = "";
  2738. root.Name = "";
  2739. cmbtreev.Nodes.Add(root);
  2740. }
  2741. }
  2742. if ( !string.IsNullOrEmpty(StrArray[i].Trim()) )
  2743. {
  2744. root = new TreeNode();
  2745. if ( IsSplit )
  2746. {
  2747. string[] StrSplitArray = StrArray[i].Trim().Split(StrSplitSymbol);
  2748. root.Text = StrSplitArray[1].Trim();
  2749. root.Tag = StrSplitArray[0].Trim();
  2750. }
  2751. else
  2752. {
  2753. root.Text = StrArray[i].Trim();
  2754. root.Tag = StrArray[i].Trim();
  2755. }
  2756. root.Name = StrArray[i].Trim();
  2757. cmbtreev.Nodes.Add(root);
  2758. }
  2759. }
  2760. }
  2761. }
  2762. #endregion
  2763. #region 部门设置的绑定数据
  2764. /// <summary>
  2765. /// 部门设置的绑定数据
  2766. /// </summary>
  2767. /// <param name="cmbtreev">当前下拉树</param>
  2768. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  2769. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  2770. /// <param name="StrWhere">查询条件,比如 ID!='1' 等</param>
  2771. public static void BindComboBoxTreeView_DepartmentSet( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null )
  2772. {
  2773. if ( tbl == null )
  2774. {
  2775. tbl = orbll.GetView_Custom("tb_ErpDepartment", StrWhere: StrWhere, ShowColumnName: "ID,Dt_Name").Tables[0];
  2776. }
  2777. cmbtreev.Nodes.Clear();
  2778. TreeNode root = null;
  2779. for ( int i = 0; i < tbl.Rows.Count; i++ )
  2780. {
  2781. if ( i == 0 )
  2782. {
  2783. if ( IsFirstNodeNull )
  2784. {
  2785. root = new TreeNode();
  2786. root.Text = IsFirstNodeName;
  2787. root.Tag = "";
  2788. root.Name = "";
  2789. cmbtreev.Nodes.Add(root);
  2790. }
  2791. }
  2792. root = new TreeNode();
  2793. root.Text = tbl.Rows[i]["Dt_Name"].ToString();
  2794. root.Tag = tbl.Rows[i]["ID"].ToString();
  2795. root.Name = tbl.Rows[i]["ID"].ToString();
  2796. cmbtreev.TreeView.Nodes.Add(root);
  2797. }
  2798. }
  2799. #endregion
  2800. #region 分店信息绑定数据
  2801. /// <summary>
  2802. /// 分店信息绑定数据
  2803. /// </summary>
  2804. /// <param name="cmbtreev">当前下拉树</param>
  2805. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  2806. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  2807. /// <param name="StrWhere">查询条件,比如 ID!='1' 等</param>
  2808. public static void BindComboBoxTreeView_StoreNameSet( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null )
  2809. {
  2810. if ( tbl == null )
  2811. {
  2812. tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
  2813. }
  2814. cmbtreev.Nodes.Clear();
  2815. TreeNode root = null;
  2816. for ( int i = 0; i < tbl.Rows.Count; i++ )
  2817. {
  2818. if ( i == 0 )
  2819. {
  2820. if ( IsFirstNodeNull )
  2821. {
  2822. root = new TreeNode();
  2823. root.Text = IsFirstNodeName;
  2824. root.Tag = "";
  2825. root.Name = "";
  2826. cmbtreev.Nodes.Add(root);
  2827. }
  2828. }
  2829. root = new TreeNode();
  2830. root.Text = tbl.Rows[i]["Company_Name"].ToString().Trim();
  2831. root.Tag = tbl.Rows[i]["Company_DividedShop"].ToString().Trim();
  2832. root.Name = tbl.Rows[i]["ID"].ToString().Trim();
  2833. cmbtreev.TreeView.Nodes.Add(root);
  2834. }
  2835. }
  2836. /// <summary>
  2837. /// 分店信息绑定数据
  2838. /// </summary>
  2839. /// <param name="cmbtreev">当前下拉树</param>
  2840. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  2841. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  2842. /// <param name="StrWhere">查询条件,比如 ID!='1' 等</param>
  2843. public static void BindComboBoxTreeView_StoreName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string IsFirstNodeName = " " )
  2844. {
  2845. DataTable tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
  2846. cmbtreev.Nodes.Clear();
  2847. TreeNode root = null;
  2848. for ( int i = 0; i < tbl.Rows.Count; i++ )
  2849. {
  2850. if ( i == 0 && tbl.Rows.Count > 1 )
  2851. {
  2852. root = new TreeNode();
  2853. root.Text = IsFirstNodeName;
  2854. root.Tag = "";
  2855. root.Name = "";
  2856. cmbtreev.Nodes.Add(root);
  2857. }
  2858. root = new TreeNode();
  2859. root.Text = tbl.Rows[i]["Company_Name"].ToString().Trim();
  2860. root.Tag = tbl.Rows[i]["Company_DividedShop"].ToString().Trim();
  2861. root.Name = tbl.Rows[i]["ID"].ToString().Trim();
  2862. cmbtreev.TreeView.Nodes.Add(root);
  2863. }
  2864. if ( tbl.Rows.Count > 1 )
  2865. {
  2866. cmbtreev.TextFindTag(IsFirstNodeName);
  2867. }
  2868. else
  2869. {
  2870. cmbtreev.TagFindText(tbl.Rows[0]["Company_DividedShop"].ToString().Trim());
  2871. }
  2872. }
  2873. #endregion
  2874. #region 套系类别与套系名称绑定
  2875. /// <summary>
  2876. /// 套系类别与套系名称绑定
  2877. /// </summary>
  2878. /// <param name="cmbtreev">控件</param>
  2879. /// <param name="StrParentCode">父节点ID</param>
  2880. /// <param name="IsFirstNodeNull">第一节点是否为空</param>
  2881. /// <param name="IsPackagesNameNull">是要过滤套系类别没有设置套系名称的节点</param>
  2882. public static void BindComboBoxTreeView_PackagesCategoryAndName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrParentCode, bool IsFirstNodeNull = false, bool IsPackagesNameNull = true )
  2883. {
  2884. LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
  2885. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  2886. DataTable tblBigCategory = scbll.GetAllList().Tables[0];
  2887. DataTable tblpak = orbll.GetView_Custom("tb_ErpPackages", StrWhere: "Pak_IsDisable = '0'", ShowColumnName: "ID,Pak_PackagesClass,Pak_Name,Pak_PackagesID,Pak_UnitPrice").Tables[0];
  2888. DataTable tbl = scbll.GetListAccordingToClassCode(StrParentCode).Tables[0];
  2889. cmbtreev.Nodes.Clear();
  2890. if ( tbl.Rows.Count > 0 )
  2891. {
  2892. TreeNode root = null;
  2893. for ( int i = 0; i < tbl.Rows.Count; i++ )
  2894. {
  2895. if ( i == 0 )
  2896. {
  2897. if ( IsFirstNodeNull )
  2898. {
  2899. root = new TreeNode();
  2900. root.Text = " ";
  2901. root.Tag = "";
  2902. root.Name = "";
  2903. cmbtreev.Nodes.Add(root);
  2904. }
  2905. }
  2906. bool IsRun = false;
  2907. if ( IsPackagesNameNull )
  2908. {
  2909. DataRow[] dtRow = tblBigCategory.Select("Sc_ClassParentID='" + tbl.Rows[i]["ID"].ToString().Trim() + "'");
  2910. if ( dtRow.Length > 0 )
  2911. {
  2912. string Strsql = "";
  2913. for ( int j = 0; j < dtRow.Length; j++ )
  2914. {
  2915. if ( j == 0 )
  2916. {
  2917. Strsql += " Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'";
  2918. }
  2919. else
  2920. {
  2921. Strsql += " or Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'";
  2922. }
  2923. }
  2924. //DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'");
  2925. DataRow[] dtRow2 = tblpak.Select(Strsql);
  2926. if ( dtRow2.Length <= 0 )
  2927. {
  2928. IsRun = true;
  2929. }
  2930. else
  2931. {
  2932. IsRun = false;
  2933. }
  2934. }
  2935. else
  2936. {
  2937. DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + tbl.Rows[i]["Sc_ClassCode"].ToString().Trim() + "'");
  2938. if ( dtRow2.Length <= 0 )
  2939. {
  2940. IsRun = true;
  2941. }
  2942. }
  2943. }
  2944. if ( IsRun )
  2945. {
  2946. continue;
  2947. }
  2948. root = new TreeNode();
  2949. root.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
  2950. root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
  2951. root.Name = "true";
  2952. CreateTreeViewPackagesCategoryAndName(root, tbl.Rows[i]["ID"].ToString(), tbl.Rows[i]["Sc_ClassCode"].ToString(), tblBigCategory, tblpak, IsPackagesNameNull);
  2953. cmbtreev.TreeView.Nodes.Add(root);
  2954. }
  2955. }
  2956. }
  2957. /// <summary>
  2958. /// 绑定第二级套系名称
  2959. /// </summary>
  2960. /// <param name="nodes">节点</param>
  2961. /// <param name="ClassParentID">父节点ID</param>
  2962. /// <param name="ClassCode">套系名称编号</param>
  2963. /// <param name="ustbl">套系类别数据源</param>
  2964. /// <param name="tblpak">套系名称数据源</param>
  2965. private static void CreateTreeViewPackagesCategoryAndName( TreeNode nodes, string ClassParentID, string ClassCode, DataTable ustbl, DataTable tblpak, bool IsPackagesNameNull )
  2966. {
  2967. if ( ClassCode != "" )
  2968. {
  2969. if ( ustbl.Rows.Count <= 0 )
  2970. {
  2971. ustbl = new BLL.BLL_ErpSystemCategory().GetAllList().Tables[0];
  2972. }
  2973. DataRow[] dtRow = ustbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
  2974. if ( dtRow.Length > 0 )
  2975. {
  2976. TreeNode node;
  2977. for ( int i = 0; i < dtRow.Length; i++ )
  2978. {
  2979. if ( IsPackagesNameNull )
  2980. {
  2981. DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + dtRow[i]["Sc_ClassCode"].ToString() + "'");
  2982. if ( dtRow2.Length <= 0 )
  2983. {
  2984. continue;
  2985. }
  2986. }
  2987. node = new TreeNode();
  2988. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  2989. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  2990. node.Name = "true";
  2991. nodes.Nodes.Add(node);
  2992. GetPak(node, dtRow[i]["Sc_ClassCode"].ToString(), tblpak);
  2993. }
  2994. }
  2995. else
  2996. {
  2997. if ( IsPackagesNameNull )
  2998. {
  2999. DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + ClassCode + "'");
  3000. if ( dtRow2.Length <= 0 )
  3001. {
  3002. return;
  3003. }
  3004. }
  3005. GetPak(nodes, ClassCode, tblpak);
  3006. }
  3007. }
  3008. }
  3009. /// <summary>
  3010. /// 绑定第三级套系名称
  3011. /// </summary>
  3012. /// <param name="nodes">TreeView的子节点</param>
  3013. /// <param name="ClassCode">编码</param>
  3014. public static void GetPak( TreeNode nodes, string ClassCode, DataTable tblpak )
  3015. {
  3016. if ( tblpak.Rows.Count <= 0 )
  3017. {
  3018. 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];
  3019. }
  3020. DataRow[] dtRow = tblpak.Select("Pak_PackagesClass = '" + ClassCode + "'");
  3021. if ( dtRow.Length > 0 )
  3022. {
  3023. TreeNode node;
  3024. for ( int i = 0; i < dtRow.Length; i++ )
  3025. {
  3026. node = new TreeNode();
  3027. node.Text = dtRow[i]["Pak_Name"].ToString();
  3028. node.Tag = dtRow[i]["Pak_PackagesID"].ToString();
  3029. node.Name = dtRow[i]["Pak_UnitPrice"].ToString();
  3030. nodes.Nodes.Add(node);
  3031. }
  3032. }
  3033. }
  3034. #endregion
  3035. #region 系统类别设置绑定
  3036. /// <summary>
  3037. /// 系统设置的绑定数据
  3038. /// </summary>
  3039. /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
  3040. /// <param name="cmbtreev">当前下拉树</param>
  3041. /// <param name="IsFirstNodeNull">是否显示第一节点是否为空</param>
  3042. /// <param name="IsFirstNodeName">显示第一节点是否为空时的Text显示</param>
  3043. /// <param name="StrWhere">查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等</param>
  3044. /// <param name="IsBindParent">是否把当前参数StrParentCode做为主级</param>
  3045. 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 )
  3046. {
  3047. if ( tbl == null )
  3048. {
  3049. tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0];
  3050. }
  3051. if ( IsClearNodes )
  3052. {
  3053. cmbtreev.Nodes.Clear();
  3054. }
  3055. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  3056. if ( dtRow.Length > 0 )
  3057. {
  3058. TreeNode root = null;
  3059. if ( IsBindParent )
  3060. {
  3061. root = new TreeNode();
  3062. root.Text = dtRow[0]["Sc_ClassName"].ToString();
  3063. root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
  3064. root.Name = dtRow[0]["ID"].ToString().Trim();
  3065. CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
  3066. cmbtreev.TreeView.Nodes.Add(root);
  3067. }
  3068. else
  3069. {
  3070. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  3071. if ( dtRow2.Length > 0 )
  3072. {
  3073. for ( int i = 0; i < dtRow2.Length; i++ )
  3074. {
  3075. if ( i == 0 )
  3076. {
  3077. if ( IsFirstNodeNull )
  3078. {
  3079. root = new TreeNode();
  3080. root.Text = IsFirstNodeName;
  3081. root.Tag = "";
  3082. root.Name = "";
  3083. cmbtreev.Nodes.Add(root);
  3084. }
  3085. }
  3086. root = new TreeNode();
  3087. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  3088. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  3089. root.Name = dtRow2[i]["ID"].ToString();
  3090. CreateTreeViewSystemCategory(root, dtRow2[i]["ID"].ToString(), tbl);
  3091. cmbtreev.TreeView.Nodes.Add(root);
  3092. }
  3093. }
  3094. else
  3095. {
  3096. root = new TreeNode();
  3097. root.Text = dtRow[0]["Sc_ClassName"].ToString();
  3098. root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
  3099. root.Name = dtRow[0]["ID"].ToString().Trim();
  3100. CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
  3101. cmbtreev.TreeView.Nodes.Add(root);
  3102. }
  3103. }
  3104. }
  3105. }
  3106. /// <summary>
  3107. /// 第二级绑定
  3108. /// </summary>
  3109. /// <param name="nodes">父节点</param>
  3110. /// <param name="ClassParentID">父节点的ID</param>
  3111. /// <param name="tbl">当前数据源</param>
  3112. private static void CreateTreeViewSystemCategory( TreeNode nodes, string ClassParentID, DataTable tbl )
  3113. {
  3114. DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
  3115. if ( dtRow.Length > 0 )
  3116. {
  3117. TreeNode node;
  3118. for ( int i = 0; i < dtRow.Length; i++ )
  3119. {
  3120. node = new TreeNode();
  3121. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  3122. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  3123. node.Name = dtRow[i]["ID"].ToString();
  3124. nodes.Nodes.Add(node);
  3125. CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl);
  3126. }
  3127. }
  3128. }
  3129. #endregion
  3130. #region 系统类别与产品绑定
  3131. private static DataTable _tbl_Product = new DataTable();
  3132. /// <summary>
  3133. /// 产品
  3134. /// </summary>
  3135. public static DataTable Tbl_Product
  3136. {
  3137. get
  3138. {
  3139. return PublicCodeClasses._tbl_Product;
  3140. }
  3141. set
  3142. {
  3143. PublicCodeClasses._tbl_Product = value;
  3144. }
  3145. }
  3146. /// <summary>
  3147. /// 系统类别与产品绑定
  3148. /// </summary>
  3149. /// <param name="StrParentCode">系统类别</param>
  3150. /// <param name="cmbtreev">控件</param>
  3151. /// <param name="IsFirstNodeNull">第一节点是否为空</param>
  3152. /// <param name="IsDividedShop">是否显示所有店的产品</param>
  3153. public static void BindComboBoxTreeView_Product( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false )
  3154. {
  3155. DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0];
  3156. cmbtreev.Nodes.Clear();
  3157. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  3158. if ( dtRow.Length > 0 )
  3159. {
  3160. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  3161. if ( dtRow2.Length > 0 )
  3162. {
  3163. TreeNode root = null;
  3164. for ( int i = 0; i < dtRow2.Length; i++ )
  3165. {
  3166. if ( i == 0 )
  3167. {
  3168. if ( IsFirstNodeNull )
  3169. {
  3170. root = new TreeNode(" ");
  3171. root.Tag = "";
  3172. root.Name = "";
  3173. cmbtreev.Nodes.Add(root);
  3174. }
  3175. }
  3176. root = new TreeNode();
  3177. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  3178. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  3179. root.Name = "System";
  3180. DataRow[] dtRow3 = tbl.Select("Sc_ClassParentID='" + dtRow2[i]["ID"].ToString() + "'");
  3181. if ( dtRow3.Length > 0 )
  3182. {
  3183. CreateTreeViewSystemCategoryProduct(root, tbl, dtRow3);
  3184. }
  3185. else
  3186. {
  3187. GetProduct(root, dtRow2[i]["Sc_ClassCode"].ToString());
  3188. }
  3189. cmbtreev.TreeView.Nodes.Add(root);
  3190. }
  3191. }
  3192. }
  3193. }
  3194. /// <summary>
  3195. /// 第二级绑定
  3196. /// </summary>
  3197. /// <param name="nodes">父节点</param>
  3198. /// <param name="ClassParentID">父节点的ID</param>
  3199. /// <param name="tbl">当前数据源</param>
  3200. private static void CreateTreeViewSystemCategoryProduct( TreeNode nodes, DataTable tbl, DataRow[] dtRow )
  3201. {
  3202. if ( dtRow.Length > 0 )
  3203. {
  3204. TreeNode node;
  3205. for ( int i = 0; i < dtRow.Length; i++ )
  3206. {
  3207. node = new TreeNode();
  3208. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  3209. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  3210. node.Name = "System";
  3211. nodes.Nodes.Add(node);
  3212. DataRow[] dtRow1 = tbl.Select("Sc_ClassParentID='" + dtRow[i]["ID"].ToString() + "'");
  3213. if ( dtRow1.Length > 0 )
  3214. {
  3215. CreateTreeViewSystemCategoryProduct(node, tbl, dtRow1);
  3216. }
  3217. else
  3218. {
  3219. GetProduct(node, dtRow[i]["Sc_ClassCode"].ToString());
  3220. }
  3221. }
  3222. }
  3223. }
  3224. /// <summary>
  3225. /// 第三级绑定
  3226. /// </summary>
  3227. /// <param name="nodes">节点</param>
  3228. /// <param name="ClassCode">父节点ID</param>
  3229. /// <param name="IsDividedShop">是否显示所有店的产品</param>
  3230. public static void GetProduct( TreeNode nodes, string ClassCode )
  3231. {
  3232. if ( Tbl_Product.Rows.Count <= 0 )
  3233. {
  3234. Tbl_Product = new BLL.BLL_ErpProduct().GetAllList().Tables[0];
  3235. }
  3236. DataRow[] dtRow = Tbl_Product.Select(" Prod_Class='" + ClassCode + "'");
  3237. if ( dtRow.Length > 0 )
  3238. {
  3239. TreeNode node;
  3240. for ( int i = 0; i < dtRow.Length; i++ )
  3241. {
  3242. node = new TreeNode();
  3243. node.Text = dtRow[i]["Prod_Name"].ToString();
  3244. node.Tag = dtRow[i]["Prod_Number"].ToString();
  3245. node.Name = "Product";
  3246. nodes.Nodes.Add(node);
  3247. }
  3248. }
  3249. }
  3250. #endregion
  3251. #region 部门与人员绑定
  3252. /// <summary>
  3253. /// 部门
  3254. /// </summary>
  3255. public static DataTable Tbl_Department
  3256. {
  3257. get
  3258. {
  3259. return LYFZ.DAL.DAL_ErpUser.GetUser_Department();
  3260. //new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpDepartment", ShowColumnName: "ID,Dt_Name,Dt_DividedShop").Tables[0];
  3261. }
  3262. }
  3263. /// <summary>
  3264. /// 部门
  3265. /// </summary>
  3266. public static DataTable Tbl_StoreName
  3267. {
  3268. get
  3269. {
  3270. return new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpCompanyInfo", ShowColumnName: "Company_DividedShop,Company_Name").Tables[0];
  3271. }
  3272. }
  3273. /// <summary>
  3274. /// 部门、员工绑定
  3275. /// </summary>
  3276. /// <param name="cmbtreev">控件</param>
  3277. /// <param name="IsFirstNodeNull">第一节点是否为空</param>
  3278. /// <param name="IsFirstNodeName">显示第一节点是否为空时所显示的Text</param>
  3279. /// <param name="IsShowResign">是否显示离职</param>
  3280. /// <param name="IsShowAdmin">是否显示Admin</param>
  3281. /// <param name="IsHaveAllTreeNode">显示全部</param>
  3282. public static void BindComboBoxTreeView_StoreDepartment( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsShowResign = true, bool IsShowAdmin = false, bool IsHaveAllTreeNode = false )
  3283. {
  3284. TreeNode root = null;
  3285. TreeNode nodes = null;
  3286. cmbtreev.Nodes.Clear();
  3287. if ( IsHaveAllTreeNode )
  3288. {
  3289. root = new TreeNode();
  3290. root.Text = "全部";
  3291. root.Tag = "";
  3292. root.Name = "";
  3293. cmbtreev.Nodes.Add(root);
  3294. }
  3295. DataTable tbl = Tbl_Department;
  3296. DataTable dtStore = Tbl_StoreName;
  3297. if ( dtStore.Rows.Count > 0 )
  3298. {
  3299. for ( int i = 0; i < dtStore.Rows.Count; i++ )
  3300. {
  3301. if ( i == 0 )
  3302. {
  3303. if ( IsFirstNodeNull )
  3304. {
  3305. root = new TreeNode();
  3306. root.Text = IsFirstNodeName;
  3307. root.Tag = "";
  3308. root.Name = "";
  3309. cmbtreev.Nodes.Add(root);
  3310. }
  3311. }
  3312. root = new TreeNode();
  3313. root.Text = dtStore.Rows[i]["Company_Name"].ToString();
  3314. root.Tag = dtStore.Rows[i]["Company_DividedShop"].ToString().Trim();
  3315. root.Name = "StoreName";
  3316. DataRow[] departRows = tbl.Select(" Dt_DividedShop = '" + dtStore.Rows[i]["Company_DividedShop"].ToString().Trim() + "' ");
  3317. for ( int j = 0; j < departRows.Length; j++ )
  3318. {
  3319. nodes = new TreeNode();
  3320. nodes.Text = departRows[j]["Dt_Name"].ToString();
  3321. nodes.Tag = departRows[j]["ID"].ToString().Trim();
  3322. nodes.Name = "Department";
  3323. root.Nodes.Add(nodes);
  3324. }
  3325. cmbtreev.TreeView.Nodes.Add(root);
  3326. }
  3327. }
  3328. else
  3329. {
  3330. for ( int i = 0; i < tbl.Rows.Count; i++ )
  3331. {
  3332. if ( i == 0 )
  3333. {
  3334. if ( IsFirstNodeNull )
  3335. {
  3336. root = new TreeNode();
  3337. root.Text = IsFirstNodeName;
  3338. root.Tag = "";
  3339. root.Name = "";
  3340. cmbtreev.Nodes.Add(root);
  3341. }
  3342. }
  3343. root = new TreeNode();
  3344. root.Text = tbl.Rows[i]["Dt_Name"].ToString();
  3345. root.Tag = tbl.Rows[i]["ID"].ToString().Trim();
  3346. root.Name = "Department";
  3347. cmbtreev.TreeView.Nodes.Add(root);
  3348. }
  3349. }
  3350. }
  3351. /// <summary>
  3352. /// 部门、员工绑定
  3353. /// </summary>
  3354. /// <param name="cmbtreev">控件</param>
  3355. /// <param name="IsFirstNodeNull">第一节点是否为空</param>
  3356. /// <param name="IsFirstNodeName">显示第一节点是否为空时所显示的Text</param>
  3357. /// <param name="IsShowResign">是否显示离职</param>
  3358. /// <param name="IsShowAdmin">是否显示Admin</param>
  3359. /// <param name="IsHaveAllTreeNode">显示全部</param>
  3360. 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 )
  3361. {
  3362. if ( tb_User == null )
  3363. {
  3364. tb_User = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: IsShowResign, IsShowAdmin: IsShowAdmin);
  3365. }
  3366. TreeNode root = null;
  3367. TreeNode nodes = null;
  3368. cmbtreev.Nodes.Clear();
  3369. if ( IsHaveAllTreeNode )
  3370. {
  3371. root = new TreeNode();
  3372. root.Text = "全部";
  3373. root.Tag = "";
  3374. root.Name = "";
  3375. cmbtreev.Nodes.Add(root);
  3376. }
  3377. DataTable tbl = Tbl_Department;
  3378. DataTable dtStore = Tbl_StoreName;
  3379. if ( dtStore.Rows.Count > 1 )
  3380. {
  3381. for ( int i = 0; i < dtStore.Rows.Count; i++ )
  3382. {
  3383. if ( i == 0 )
  3384. {
  3385. if ( IsFirstNodeNull )
  3386. {
  3387. root = new TreeNode();
  3388. root.Text = IsFirstNodeName;
  3389. root.Tag = "";
  3390. root.Name = "";
  3391. cmbtreev.Nodes.Add(root);
  3392. }
  3393. }
  3394. root = new TreeNode();
  3395. root.Text = dtStore.Rows[i]["Company_Name"].ToString();
  3396. root.Tag = dtStore.Rows[i]["Company_DividedShop"].ToString().Trim();
  3397. root.Name = "StoreName";
  3398. for ( int j = 0; j < tbl.Rows.Count; j++ )
  3399. {
  3400. DataRow[] dtRow = tb_User.Select("User_Department='" + tbl.Rows[j]["ID"].ToString().Trim() + "' And User_DividedShop = '" + dtStore.Rows[i]["Company_DividedShop"].ToString().Trim() + "'");
  3401. if ( dtRow.Length <= 0 )
  3402. {
  3403. continue;
  3404. }
  3405. nodes = new TreeNode();
  3406. nodes.Text = tbl.Rows[j]["Dt_Name"].ToString();
  3407. nodes.Tag = tbl.Rows[j]["ID"].ToString().Trim();
  3408. nodes.Name = "Department";
  3409. CreateTreeViewDepartmentUser(nodes, tbl.Rows[j]["ID"].ToString(), tb_User, IsShowResign, dtStore.Rows[i]["Company_DividedShop"].ToString().Trim());
  3410. root.Nodes.Add(nodes);
  3411. }
  3412. cmbtreev.TreeView.Nodes.Add(root);
  3413. }
  3414. }
  3415. else
  3416. {
  3417. for ( int i = 0; i < tbl.Rows.Count; i++ )
  3418. {
  3419. if ( i == 0 )
  3420. {
  3421. if ( IsFirstNodeNull )
  3422. {
  3423. root = new TreeNode();
  3424. root.Text = IsFirstNodeName;
  3425. root.Tag = "";
  3426. root.Name = "";
  3427. cmbtreev.Nodes.Add(root);
  3428. }
  3429. }
  3430. DataRow[] dtRow = tb_User.Select("User_Department='" + tbl.Rows[i]["ID"].ToString().Trim() + "'");
  3431. if ( dtRow.Length <= 0 )
  3432. {
  3433. continue;
  3434. }
  3435. root = new TreeNode();
  3436. root.Text = tbl.Rows[i]["Dt_Name"].ToString();
  3437. root.Tag = tbl.Rows[i]["ID"].ToString().Trim();
  3438. root.Name = "Department";
  3439. CreateTreeViewDepartmentUser(root, tbl.Rows[i]["ID"].ToString(), tb_User, IsShowResign);
  3440. cmbtreev.TreeView.Nodes.Add(root);
  3441. }
  3442. }
  3443. }
  3444. /// <summary>
  3445. /// 绑定第二级人员
  3446. /// </summary>
  3447. /// <param name="nodes">TreeView的节点集合</param>
  3448. /// <param name="dataSource">数据源</param>
  3449. /// <param name="parentid"></param>
  3450. private static void CreateTreeViewDepartmentUser( TreeNode nodes, string ClassCode, DataTable tb_User, bool IsShowResign, string SotreNumber = "SSN001" )
  3451. {
  3452. if ( ClassCode != "" )
  3453. {
  3454. DataRow[] dtRow = tb_User.Select("User_Department='" + ClassCode + "' And User_DividedShop = '" + SotreNumber + "'");
  3455. if ( dtRow.Length > 0 )
  3456. {
  3457. TreeNode node;
  3458. for ( int i = 0; i < dtRow.Length; i++ )
  3459. {
  3460. if ( dtRow[i]["User_Status"].ToString() != "离职" || IsShowResign )
  3461. {
  3462. node = new TreeNode();
  3463. node.Text = dtRow[i]["User_Name"].ToString();
  3464. node.Tag = dtRow[i]["User_EmployeeID"].ToString();
  3465. node.Name = "User";
  3466. nodes.Nodes.Add(node);
  3467. }
  3468. }
  3469. }
  3470. }
  3471. }
  3472. #endregion
  3473. #region 制作商绑定
  3474. /// <summary>
  3475. /// 制作商
  3476. /// </summary>
  3477. /// <param name="cmbtreev">要操作的控件</param>
  3478. /// <param name="tbl">要操作的数据源,如果数据源为NULL,则会去获取</param>
  3479. /// <param name="StrNameValue">要给Tag指定值的字段名</param>
  3480. public static void BindComboBoxTreeView_Vendor( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, DataTable tbl = null, string StrTagNameValue = "Vd_Number" )
  3481. {
  3482. if ( tbl == null )
  3483. {
  3484. tbl = new BLL.BLL_ErpVendor().GetAllList().Tables[0];
  3485. }
  3486. cmbtreev.Nodes.Clear();
  3487. TreeNode root = null;
  3488. for ( int i = 0; i < tbl.Rows.Count; i++ )
  3489. {
  3490. if ( i == 0 )
  3491. {
  3492. root = new TreeNode(" ");
  3493. root.Tag = "";
  3494. root.Name = "";
  3495. cmbtreev.Nodes.Add(root);
  3496. }
  3497. root = new TreeNode();
  3498. root.Text = tbl.Rows[i]["Vd_Name"].ToString();
  3499. root.Tag = tbl.Rows[i][StrTagNameValue].ToString();
  3500. root.Name = tbl.Rows[i]["ID"].ToString();
  3501. cmbtreev.TreeView.Nodes.Add(root);
  3502. }
  3503. }
  3504. #endregion
  3505. #region 支付方式绑定
  3506. /// <summary>
  3507. /// 支付方式绑定
  3508. /// </summary>
  3509. /// <param name="cmbtreev">控件</param>
  3510. /// <param name="IsShowAll">是否显示所有</param>
  3511. /// <param name="tbl">数据源</param>
  3512. public static void BindComboBoxTreeView_PaymentMethod( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsShowAll = true, DataTable tbl = null, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" )
  3513. {
  3514. cmbtreev.Nodes.Clear();
  3515. string[] numMemberNotShowPaymentMethod = System.Enum.GetNames(typeof(EnumPublic.MemberNotShowPaymentMethod));
  3516. if ( tbl == null )
  3517. {
  3518. tbl = new BLL.BLL_ErpSystemCategory().GetList(StrWhere).Tables[0];
  3519. }
  3520. DataRow[] dtRow = tbl.Select("Sc_ClassCode = 'BEBACCAFCCEAGAIHH'");
  3521. if ( dtRow.Length > 0 )
  3522. {
  3523. TreeNode root = null;
  3524. DataRow[] dtRow2 = tbl.Select(" Sc_ClassParentID ='" + dtRow[0]["ID"].ToString().Trim() + "'");
  3525. for ( int i = 0; i < dtRow2.Length; i++ )
  3526. {
  3527. bool Isbl = true;
  3528. if ( !IsShowAll )
  3529. {
  3530. for ( int j = 0; j < numMemberNotShowPaymentMethod.Length; j++ )
  3531. {
  3532. if ( dtRow2[i]["Sc_ClassName"].ToString().Trim() == numMemberNotShowPaymentMethod[j].Trim() )
  3533. {
  3534. Isbl = false;
  3535. break;
  3536. }
  3537. }
  3538. }
  3539. if ( Isbl )
  3540. {
  3541. if ( i == 0 )
  3542. {
  3543. if ( IsFirstNodeNull )
  3544. {
  3545. root = new TreeNode();
  3546. root.Text = IsFirstNodeName;
  3547. root.Tag = "";
  3548. root.Name = "";
  3549. cmbtreev.Nodes.Add(root);
  3550. }
  3551. }
  3552. root = new TreeNode();
  3553. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  3554. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  3555. root.Name = dtRow2[i]["ID"].ToString();
  3556. CreateTreeViewPaymentMethod(root, dtRow2[i]["ID"].ToString().Trim(), tbl);
  3557. cmbtreev.TreeView.Nodes.Add(root);
  3558. }
  3559. }
  3560. }
  3561. }
  3562. /// <summary>
  3563. /// 绑定第二级人员
  3564. /// </summary>
  3565. /// <param name="nodes">TreeView的节点</param>
  3566. /// <param name="ClassCode">父节点ID</param>
  3567. /// <param name="tbl">数据源</param>
  3568. private static void CreateTreeViewPaymentMethod( TreeNode nodes, string ClassCode, DataTable tbl )
  3569. {
  3570. if ( ClassCode != "" )
  3571. {
  3572. DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassCode + "'");
  3573. if ( dtRow.Length > 0 )
  3574. {
  3575. TreeNode node;
  3576. for ( int i = 0; i < dtRow.Length; i++ )
  3577. {
  3578. node = new TreeNode();
  3579. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  3580. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  3581. node.Name = dtRow[i]["ID"].ToString();
  3582. nodes.Nodes.Add(node);
  3583. CreateTreeViewPaymentMethod(node, dtRow[i]["ID"].ToString().Trim(), tbl);
  3584. }
  3585. }
  3586. }
  3587. }
  3588. #endregion
  3589. #region 新开单页面绑定客户来源下拉树
  3590. /// <summary>
  3591. /// 新开单页面绑定客户来源下拉树
  3592. /// </summary>
  3593. /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
  3594. /// <param name="cmbtreev">当前下拉树</param>
  3595. /// <param name="IsFirstNodeNull">第一节点是否为空</param>
  3596. /// <param name="strHideFiled">要隐藏的节点编号,多个时中间用','分割</param>
  3597. public static void BindComboBoxTreeView_ClientSourec( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string strHideFiled = "", string IsFirstNodeName = " ", DataTable tbl = null )
  3598. {
  3599. string[] strHide = null;
  3600. if ( strHideFiled != "" )
  3601. {
  3602. strHide = strHideFiled.Split(',');
  3603. }
  3604. cmbtreev.Nodes.Clear();
  3605. if ( tbl == null )
  3606. {
  3607. tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0];
  3608. }
  3609. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  3610. if ( dtRow.Length > 0 )
  3611. {
  3612. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  3613. TreeNode root = null;
  3614. for ( int i = 0; i < dtRow2.Length; i++ )
  3615. {
  3616. if ( i == 0 )
  3617. {
  3618. if ( IsFirstNodeNull )
  3619. {
  3620. root = new TreeNode(IsFirstNodeName);
  3621. root.Tag = "";
  3622. root.Name = "";
  3623. cmbtreev.Nodes.Add(root);
  3624. }
  3625. }
  3626. if ( strHideFiled != "" )
  3627. {
  3628. bool Isbl = false;
  3629. for ( int j = 0; j < strHide.Length; j++ )
  3630. {
  3631. if ( strHide[j].Trim() == dtRow2[i]["Sc_ClassCode"].ToString() )
  3632. {
  3633. Isbl = true;
  3634. break;
  3635. }
  3636. }
  3637. if ( Isbl )
  3638. {
  3639. continue;
  3640. }
  3641. }
  3642. root = new TreeNode();
  3643. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  3644. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  3645. root.Name = dtRow2[i]["ID"].ToString();
  3646. CreateTreeViewClientSourec(root, dtRow2[i]["ID"].ToString(), tbl);
  3647. cmbtreev.Nodes.Add(root);
  3648. }
  3649. }
  3650. }
  3651. private static void CreateTreeViewClientSourec( TreeNode nodes, string ClassParentID, DataTable tbl )
  3652. {
  3653. DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
  3654. if ( dtRow.Length > 0 )
  3655. {
  3656. TreeNode node;
  3657. for ( int i = 0; i < dtRow.Length; i++ )
  3658. {
  3659. node = new TreeNode();
  3660. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  3661. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  3662. node.Name = dtRow[i]["ID"].ToString();
  3663. nodes.Nodes.Add(node);
  3664. CreateTreeViewClientSourec(node, dtRow[i]["ID"].ToString(), tbl);
  3665. }
  3666. }
  3667. }
  3668. #endregion
  3669. #region 团队PK
  3670. /// <summary>
  3671. /// 活动名称
  3672. /// </summary>
  3673. public static void BindComboBoxTreeView_TeamActivityName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev )
  3674. {
  3675. cmbtreev.Nodes.Clear();
  3676. DataTable dtActivity = orbll.GetView_Custom("tb_ErpTeamActiveSet", StrWhere: "Tas_IsEnabled = 1", ShowColumnName: "Tas_Number,Tas_Name", filedOrder: "ID").Tables[0];
  3677. TreeNode root = null;
  3678. for ( int i = 0; i < dtActivity.Rows.Count; i++ )
  3679. {
  3680. root = new TreeNode();
  3681. root.Tag = dtActivity.Rows[i]["Tas_Number"].ToString().Trim();
  3682. root.Name = dtActivity.Rows[i]["Tas_Number"].ToString().Trim();
  3683. root.Text = dtActivity.Rows[i]["Tas_Name"].ToString().Trim();
  3684. cmbtreev.Nodes.Add(root);
  3685. }
  3686. }
  3687. /// <summary>
  3688. /// 大队名称(大队名称设置表,获取表:tb_ErpTeamMaxNameSet)
  3689. /// </summary>
  3690. /// <param name="cmbtreev"></param>
  3691. public static void BindComboBoxTreeView_TeamMaxName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev )
  3692. {
  3693. cmbtreev.SetTextAndTag_ValueNull();
  3694. cmbtreev.Nodes.Clear();
  3695. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxNameSet", StrWhere: "", ShowColumnName: "Tmxn_Number,Tmxn_Name", filedOrder: "ID DESC").Tables[0];
  3696. TreeNode root = null;
  3697. for ( int i = 0; i < dt.Rows.Count; i++ )
  3698. {
  3699. root = new TreeNode();
  3700. root.Tag = dt.Rows[i]["Tmxn_Number"].ToString().Trim();
  3701. root.Name = dt.Rows[i]["Tmxn_Number"].ToString().Trim();
  3702. root.Text = dt.Rows[i]["Tmxn_Name"].ToString().Trim();
  3703. cmbtreev.Nodes.Add(root);
  3704. }
  3705. }
  3706. /// <summary>
  3707. /// 大队名称(根据活动编号获取大队名称任务表,获取表:tb_ErpTeamMaxTaskSet Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmxt_TmxnNumber)
  3708. /// </summary>
  3709. /// <param name="cmbtreev"></param>
  3710. public static void BindComboBoxTreeView_TeamMaxTaskName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrActivityNumber, bool IsFirstNodeNull = false, string IsFirstNodeName = " " )
  3711. {
  3712. cmbtreev.SetTextAndTag_ValueNull();
  3713. cmbtreev.Nodes.Clear();
  3714. string StrWhere = "Tmxt_TasNumber = '" + StrActivityNumber + "'";
  3715. 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];
  3716. TreeNode root = null;
  3717. if ( IsFirstNodeNull )
  3718. {
  3719. root = new TreeNode();
  3720. root.Tag = "";
  3721. root.Name = "";
  3722. root.Text = IsFirstNodeName;
  3723. cmbtreev.Nodes.Add(root);
  3724. }
  3725. for ( int i = 0; i < dt.Rows.Count; i++ )
  3726. {
  3727. root = new TreeNode();
  3728. root.Tag = dt.Rows[i]["Tmxt_TmxnNumber"].ToString().Trim();
  3729. root.Name = dt.Rows[i]["Tmxt_Number"].ToString().Trim();
  3730. root.Text = dt.Rows[i]["Tmxn_Name"].ToString().Trim();
  3731. cmbtreev.Nodes.Add(root);
  3732. }
  3733. }
  3734. /// <summary>
  3735. /// 小组名称(小组名称设置表,获取表:tb_ErpTeamMinNameSet)
  3736. /// </summary>
  3737. /// <param name="cmbtreev"></param>
  3738. public static void BindComboBoxTreeView_TeamMinName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " " )
  3739. {
  3740. cmbtreev.SetTextAndTag_ValueNull();
  3741. cmbtreev.Nodes.Clear();
  3742. DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinNameSet", StrWhere: "", ShowColumnName: "Tmin_Number,Tmin_Name", filedOrder: "ID DESC").Tables[0];
  3743. TreeNode root = null;
  3744. if ( IsFirstNodeNull )
  3745. {
  3746. root = new TreeNode();
  3747. root.Tag = "";
  3748. root.Name = "";
  3749. root.Text = IsFirstNodeName;
  3750. cmbtreev.Nodes.Add(root);
  3751. }
  3752. for ( int i = 0; i < dt.Rows.Count; i++ )
  3753. {
  3754. root = new TreeNode();
  3755. root.Tag = dt.Rows[i]["Tmin_Number"].ToString().Trim();
  3756. root.Name = dt.Rows[i]["Tmin_Number"].ToString().Trim();
  3757. root.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim();
  3758. cmbtreev.Nodes.Add(root);
  3759. }
  3760. }
  3761. /// <summary>
  3762. /// 小组名称(根据活动编号获取小组名称任务表,获取表:tb_ErpTeamMinTaskSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber)
  3763. /// </summary>
  3764. /// <param name="cmbtreev"></param>
  3765. public static void BindComboBoxTreeView_TeamMinTaskName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrActivityNumber, string StrMaxNumber, bool IsFirstNodeNull = false, string IsFirstNodeName = " " )
  3766. {
  3767. cmbtreev.SetTextAndTag_ValueNull();
  3768. cmbtreev.Nodes.Clear();
  3769. 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];
  3770. TreeNode root = null;
  3771. if ( IsFirstNodeNull )
  3772. {
  3773. root = new TreeNode();
  3774. root.Tag = "";
  3775. root.Name = "";
  3776. root.Text = IsFirstNodeName;
  3777. cmbtreev.Nodes.Add(root);
  3778. }
  3779. for ( int i = 0; i < dt.Rows.Count; i++ )
  3780. {
  3781. root = new TreeNode();
  3782. root.Tag = dt.Rows[i]["Tmit_TminNumber"].ToString().Trim();
  3783. root.Name = dt.Rows[i]["Tmit_Number"].ToString().Trim();
  3784. root.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim();
  3785. cmbtreev.Nodes.Add(root);
  3786. }
  3787. }
  3788. #endregion
  3789. #region 客户关系
  3790. /// <summary>
  3791. /// 客户关系
  3792. /// </summary>
  3793. /// <param name="StrParentCode">系统类别中的Sc_ClassCode值</param>
  3794. /// <param name="cmbtreev">当前下拉树</param>
  3795. /// <param name="IsFirstNodeNull">第一节点是否为空</param>
  3796. public static void BindComboBoxTreeView_ClientRelation( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false )
  3797. {
  3798. cmbtreev.Nodes.Clear();
  3799. DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0];
  3800. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  3801. if ( dtRow.Length > 0 )
  3802. {
  3803. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  3804. TreeNode root = null;
  3805. for ( int i = 0; i < dtRow2.Length; i++ )
  3806. {
  3807. if ( i == 0 )
  3808. {
  3809. if ( IsFirstNodeNull )
  3810. {
  3811. root = new TreeNode(" ");
  3812. root.Tag = "";
  3813. root.Name = "";
  3814. cmbtreev.Nodes.Add(root);
  3815. }
  3816. }
  3817. root = new TreeNode();
  3818. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  3819. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  3820. root.Name = dtRow2[i]["ID"].ToString();
  3821. CreateTreeViewClientRelation(root, dtRow2[i]["ID"].ToString(), tbl);
  3822. cmbtreev.Nodes.Add(root);
  3823. }
  3824. }
  3825. }
  3826. private static void CreateTreeViewClientRelation( TreeNode nodes, string ClassParentID, DataTable tbl )
  3827. {
  3828. DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'");
  3829. if ( dtRow.Length > 0 )
  3830. {
  3831. TreeNode node;
  3832. for ( int i = 0; i < dtRow.Length; i++ )
  3833. {
  3834. node = new TreeNode();
  3835. node.Text = dtRow[i]["Sc_ClassName"].ToString();
  3836. node.Tag = dtRow[i]["Sc_ClassCode"].ToString();
  3837. node.Name = dtRow[i]["ID"].ToString();
  3838. nodes.Nodes.Add(node);
  3839. CreateTreeViewClientRelation(node, dtRow[i]["ID"].ToString(), tbl);
  3840. }
  3841. }
  3842. }
  3843. #endregion
  3844. #region 获取订单版本权限
  3845. /// <summary>
  3846. /// 获取系统版本
  3847. /// </summary>
  3848. public static void GetSystemVersion( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion )
  3849. {
  3850. bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
  3851. chkKidsVersion.Visible = false;//儿童
  3852. chkDressVersion.Visible = false;//婚纱
  3853. chkPortraitVersion.Visible = false;//写真
  3854. switch ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
  3855. {
  3856. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版:
  3857. chkKidsVersion.Visible = true;
  3858. chkDressVersion.Visible = true;
  3859. if ( IsPortrait )
  3860. {
  3861. chkPortraitVersion.Visible = true;
  3862. }
  3863. break;
  3864. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
  3865. chkDressVersion.Visible = true;
  3866. if ( IsPortrait )
  3867. {
  3868. chkPortraitVersion.Visible = true;
  3869. }
  3870. break;
  3871. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
  3872. chkKidsVersion.Visible = true;
  3873. if ( IsPortrait )
  3874. {
  3875. chkPortraitVersion.Visible = true;
  3876. }
  3877. break;
  3878. }
  3879. }
  3880. #endregion
  3881. #region 获取版本 (用于门市流程查询报表)
  3882. /// <summary>
  3883. /// 获取版本(用于门市流程查询报表)
  3884. /// </summary>
  3885. /// <returns></returns>
  3886. public static string GetVersion( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion )
  3887. {
  3888. string RetValue = "";
  3889. bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
  3890. if ( !IsPortrait )
  3891. {
  3892. if ( chkPortraitVersion.Checked )
  3893. {
  3894. RetValue = "2";
  3895. }
  3896. else if ( chkDressVersion.Checked || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
  3897. {
  3898. if ( IsPortrait && !chkDressVersion.Checked )
  3899. {
  3900. RetValue = "-1";
  3901. }
  3902. else
  3903. {
  3904. RetValue = "0";
  3905. }
  3906. }
  3907. else if ( chkKidsVersion.Checked || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
  3908. {
  3909. if ( IsPortrait && !chkKidsVersion.Checked )
  3910. {
  3911. RetValue = "-1";
  3912. }
  3913. else
  3914. {
  3915. RetValue = "1";
  3916. }
  3917. }
  3918. else
  3919. {
  3920. RetValue = "-1";
  3921. }
  3922. }
  3923. else if ( IsPortrait )
  3924. {
  3925. RetValue = "-1";
  3926. }
  3927. return RetValue;
  3928. }
  3929. #endregion
  3930. #region 根据时间字段 返回时间段
  3931. /// <summary>
  3932. /// 根据时间字段 返回时间段
  3933. /// </summary>
  3934. /// <param name="StrFieldName">字段名称</param>
  3935. /// <param name="StartDateTime">开始时间</param>
  3936. /// <param name="EndDateTime">结束时间(结束时间可以等于开始时间)</param>
  3937. /// <param name="DateAddDays">开始时间与结束时间相同时,结束时间或以退后时间,默认为1天</param>
  3938. /// <param name="ConnectWord">连接关键字,默认为'And'</param>
  3939. /// <returns></returns>
  3940. public static string GetDateTime( string StrFieldName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" )
  3941. {
  3942. string StrWhere = "";
  3943. if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" )
  3944. {
  3945. 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") + "')";
  3946. }
  3947. else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" )
  3948. {
  3949. StrWhere = StrFieldName + " = '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
  3950. }
  3951. else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" )
  3952. {
  3953. StrWhere = StrFieldName + " = '" + Convert.ToDateTime(EndDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
  3954. }
  3955. if ( !string.IsNullOrEmpty(StrWhere) && !string.IsNullOrEmpty(ConnectWord) )
  3956. {
  3957. StrWhere = " " + ConnectWord + " " + StrWhere;
  3958. }
  3959. return StrWhere;
  3960. }
  3961. /// <summary>
  3962. /// 根据时间字段 返回时间段(通用于DataTable的查找)
  3963. /// </summary>
  3964. /// <param name="StrFieldName">字段名称</param>
  3965. /// <param name="StartDateTime">开始时间</param>
  3966. /// <param name="EndDateTime">结束时间(结束时间可以等于开始时间)</param>
  3967. /// <param name="DateAddDays">开始时间与结束时间相同时,结束时间或以退后时间,默认为1天</param>
  3968. /// <param name="ConnectWord">连接关键字,默认为'And'</param>
  3969. /// <returns></returns>
  3970. public static string GetDateTime2( string StrFieldName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" )
  3971. {
  3972. string StrWhere = "";
  3973. if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" )
  3974. {
  3975. 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") + "')";
  3976. }
  3977. else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" )
  3978. {
  3979. StrWhere = StrFieldName + " = '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
  3980. }
  3981. else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" )
  3982. {
  3983. StrWhere = StrFieldName + " = '" + Convert.ToDateTime(EndDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'";
  3984. }
  3985. if ( !string.IsNullOrEmpty(StrWhere) && !string.IsNullOrEmpty(ConnectWord) )
  3986. {
  3987. StrWhere = " " + ConnectWord + " " + StrWhere;
  3988. }
  3989. return StrWhere;
  3990. }
  3991. /// <summary>
  3992. /// 获取今年的时间段
  3993. /// </summary>
  3994. /// <param name="StrName"></param>
  3995. /// <param name="StartDateTime"></param>
  3996. /// <param name="EndDateTime"></param>
  3997. /// <param name="DateAddDays"></param>
  3998. /// <param name="ConnectWord"></param>
  3999. /// <returns></returns>
  4000. public static string GetDateTimeNowYear( string StrName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" )
  4001. {
  4002. string StrValue = "";
  4003. if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" )
  4004. {
  4005. 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") + "')";
  4006. }
  4007. else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" )
  4008. {
  4009. StrValue = " " + ConnectWord + " " + StrName + " = '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(StartDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'";
  4010. }
  4011. else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" )
  4012. {
  4013. StrValue = " " + ConnectWord + " " + StrName + " = '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(EndDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'";
  4014. }
  4015. return StrValue;
  4016. }
  4017. /// <summary>
  4018. /// 获取sql查询条件
  4019. /// </summary>
  4020. /// <param name="StrWhere">当前要添加的where条件</param>
  4021. /// <param name="StrSQLWhere">已经组串好的SQL查询条件语句</param>
  4022. /// <returns></returns>
  4023. public static void GetSQLWhere( string StrWhere, ref string StrSQLWhere )
  4024. {
  4025. if ( !string.IsNullOrEmpty(StrSQLWhere) )
  4026. {
  4027. StrSQLWhere += " And " + StrWhere;
  4028. }
  4029. else
  4030. {
  4031. StrSQLWhere += StrWhere;
  4032. }
  4033. }
  4034. #endregion
  4035. #region 获取查询条件
  4036. /// <summary>
  4037. /// 获取版本查询sql
  4038. /// </summary>
  4039. /// <param name="chkPortraitVersion">写真</param>
  4040. /// <param name="chkDressVersion">婚纱</param>
  4041. /// <param name="chkKidsVersion">儿童</param>
  4042. /// <param name="chkServiceVersion">服务</param>
  4043. /// <param name="chkWeddingCelebration">婚庆</param>
  4044. /// <param name="StrOrdType">订单类型串,用逗号分开</param>
  4045. /// <returns></returns>
  4046. 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 = "" )
  4047. {
  4048. string StrWhere = "";
  4049. bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
  4050. if ( chkDressVersion.Checked )
  4051. {
  4052. StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "'";
  4053. }
  4054. else if ( chkKidsVersion.Checked )
  4055. {
  4056. StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "'";
  4057. }
  4058. else if ( chkPortraitVersion.Checked )
  4059. {
  4060. StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "'";
  4061. }
  4062. else if ( chkWeddingCelebration != null && chkWeddingCelebration.Checked )
  4063. {
  4064. StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚庆订单) + "'";
  4065. }
  4066. else if ( chkServiceVersion != null && chkServiceVersion.Checked )
  4067. {
  4068. StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.服务订单) + "'";
  4069. }
  4070. else if ( !string.IsNullOrEmpty(StrOrdType) )
  4071. {
  4072. string[] StrSpilt = StrOrdType.Split(',');
  4073. StrWhere = " And Ord_Type in (";
  4074. for ( int i = 0; i < StrSpilt.Length; i++ )
  4075. {
  4076. StrWhere += "'" + StrSpilt[i].Trim() + "',";
  4077. }
  4078. StrWhere = StrWhere.TrimEnd(',') + ")";
  4079. }
  4080. return StrWhere;
  4081. }
  4082. /// <summary>
  4083. /// 获取门市流程文本框搜索的条件获取查询条件语句
  4084. /// </summary>
  4085. /// <param name="StrText"></param>
  4086. /// <returns></returns>
  4087. public static string GetQueryTextQueryCondition( string StrText )
  4088. {
  4089. string StrWhere = "";
  4090. if ( !string.IsNullOrEmpty(StrText.Trim()) )
  4091. {
  4092. StrText = StrText.Trim().ToLower();
  4093. if ( LYFZ.Command.Command_Validate.IsChinese(StrText.Replace("/", "")) )
  4094. {
  4095. StrWhere = " And Cus_Name like '%" + StrText.Trim() + "%'";
  4096. }
  4097. else if ( LYFZ.Command.Command_Validate.IsNumber(StrText) )
  4098. {
  4099. if ( LYFZ.MY_LocalSettings.MyLocalSettings.Ordernumbersearch )
  4100. {
  4101. StrWhere = " And (Ord_SinceOrderNumber like '%" + StrText.Trim() + "%' or Cus_Telephone like '%" + StrText.Trim() + "%')";
  4102. }
  4103. else
  4104. {
  4105. StrWhere += " And Cus_Telephone like '%" + StrText.Trim() + "%'";
  4106. }
  4107. }
  4108. else if ( LYFZ.Command.Command_Validate.IsEnglish(StrText.Replace("/", "")) )
  4109. {
  4110. StrWhere = " And Cus_Name_py like '%" + StrText.Trim() + "%'";
  4111. }
  4112. else if ( LYFZ.Command.Command_Validate.IsOrderNumber(StrText) )
  4113. {
  4114. StrWhere = " And Ord_SinceOrderNumber like '" + StrText.Trim() + "%'";
  4115. }
  4116. }
  4117. return StrWhere;
  4118. }
  4119. /// <summary>
  4120. /// 获取菜单树所选择的节点及下级所有节点
  4121. /// </summary>
  4122. /// <param name="treev"></param>
  4123. /// <returns></returns>
  4124. public static void GetTreeViewQueryCondition( ref string StrWhere, LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, string StrFieldName, string ConnectWord = "And" )
  4125. {
  4126. if ( treev.Nodes.Count > 0 )
  4127. {
  4128. if ( treev.SelectedNode != null )
  4129. {
  4130. string classString = "'" + treev.SelectedNode.Tag.ToString().Trim() + "'";
  4131. for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
  4132. {
  4133. if ( treev.SelectedNode.Nodes[i].Nodes.Count > 0 )
  4134. {
  4135. GrtTreeViewNodesCondition(treev.Nodes[i], ref classString);
  4136. }
  4137. else
  4138. {
  4139. classString += ",'" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "'";
  4140. }
  4141. }
  4142. if ( classString.Trim().Length > 0 )
  4143. {
  4144. StrWhere += " " + ConnectWord + " " + StrFieldName + " in(" + classString + ")";
  4145. }
  4146. }
  4147. }
  4148. }
  4149. /// <summary>
  4150. ///
  4151. /// </summary>
  4152. /// <param name="root"></param>
  4153. /// <param name="StrWhere"></param>
  4154. static void GrtTreeViewNodesCondition( TreeNode root, ref string StrWhere )
  4155. {
  4156. for ( int i = 0; i < root.Nodes.Count; i++ )
  4157. {
  4158. if ( root.Nodes[i].Nodes.Count > 0 )
  4159. {
  4160. GrtTreeViewNodesCondition(root.Nodes[i], ref StrWhere);
  4161. }
  4162. else
  4163. {
  4164. StrWhere += ",'" + root.Nodes[i].Tag.ToString().Trim() + "'";
  4165. }
  4166. }
  4167. }
  4168. /// <summary>
  4169. /// 获取选中的下拉员工树员工,以模糊查询做为条件
  4170. /// </summary>
  4171. /// <param name="treev"></param>
  4172. /// <param name="StrWhere"></param>
  4173. /// <param name="StrFieldName"></param>
  4174. /// <param name="ConnectWord"></param>
  4175. public static void GetTreeViewSelectPersonTagQueryConditionLike( LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, ref string StrWhere, string StrFieldName, string ConnectWord = "And" )
  4176. {
  4177. if ( treev.Tag != null )
  4178. {
  4179. if ( treev.StrGetName.Trim() == "User" )
  4180. {
  4181. StrWhere = ConnectWord + " (" + StrFieldName + " like '%" + treev.Tag.ToString().Trim() + "%')";
  4182. }
  4183. else if ( treev.StrGetName.Trim() == "Department" )
  4184. {
  4185. for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
  4186. {
  4187. StrWhere += " " + StrFieldName + " like '%" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "%' or";
  4188. }
  4189. if ( !string.IsNullOrEmpty(StrWhere) )
  4190. {
  4191. StrWhere = ConnectWord + " (" + StrWhere.TrimEnd('r').TrimEnd('o') + ")";
  4192. }
  4193. }
  4194. else if ( treev.StrGetName.Trim() == "StoreName" )
  4195. {
  4196. for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
  4197. {
  4198. if ( treev.SelectedNode.Nodes[i].Name.Trim() == "Department" && treev.SelectedNode.Nodes[i].Nodes.Count > 0 )
  4199. {
  4200. for ( int j = 0; j < treev.SelectedNode.Nodes[i].Nodes.Count; j++ )
  4201. {
  4202. StrWhere += " " + StrFieldName + " like '%" + treev.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "%' or";
  4203. }
  4204. }
  4205. }
  4206. if ( !string.IsNullOrEmpty(StrWhere) )
  4207. {
  4208. StrWhere = ConnectWord + " (" + StrWhere.TrimEnd('r').TrimEnd('o') + ")";
  4209. }
  4210. }
  4211. }
  4212. }
  4213. /// <summary>
  4214. /// 获取选中的下拉员工树员工,以in ('','')查询做为条件
  4215. /// </summary>
  4216. /// <param name="treev"></param>
  4217. /// <param name="StrWhere"></param>
  4218. /// <param name="StrFieldName"></param>
  4219. /// <param name="ConnectWord"></param>
  4220. public static void GetTreeViewSelectPersonTagQueryConditionEqual( LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, ref string StrWhere, string StrFieldName, string ConnectWord = "And" )
  4221. {
  4222. string StrOrdersPerson = "";
  4223. if ( treev.Tag != null )
  4224. {
  4225. if ( treev.StrGetName.Trim() == "User" )
  4226. {
  4227. StrWhere = ConnectWord + " " + StrFieldName + " = '" + treev.Tag.ToString().Trim() + "'";
  4228. }
  4229. else if ( treev.StrGetName.Trim() == "Department" )
  4230. {
  4231. for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
  4232. {
  4233. StrOrdersPerson += "'" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "',";
  4234. }
  4235. if ( !string.IsNullOrEmpty(StrOrdersPerson) )
  4236. {
  4237. StrWhere = ConnectWord + " " + StrFieldName + " in (" + StrOrdersPerson.TrimEnd(',') + ")";
  4238. }
  4239. }
  4240. else if ( treev.StrGetName.Trim() == "StoreName" )
  4241. {
  4242. for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ )
  4243. {
  4244. if ( treev.SelectedNode.Nodes[i].Name.Trim() == "Department" && treev.SelectedNode.Nodes[i].Nodes.Count > 0 )
  4245. {
  4246. for ( int j = 0; j < treev.SelectedNode.Nodes[i].Nodes.Count; j++ )
  4247. {
  4248. StrOrdersPerson += "'" + treev.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "',";
  4249. }
  4250. }
  4251. }
  4252. if ( !string.IsNullOrEmpty(StrOrdersPerson) )
  4253. {
  4254. StrWhere = ConnectWord + " " + StrFieldName + " in (" + StrOrdersPerson.TrimEnd(',') + ")";
  4255. }
  4256. }
  4257. }
  4258. }
  4259. #endregion
  4260. #region 根据数据库的User_EmployeeID 获取User_Name
  4261. /// <summary>
  4262. /// 根据数据库的User_EmployeeID 获取User_Name
  4263. /// </summary>
  4264. /// <param name="User_EmployeeID">员工编号</param>
  4265. /// <returns></returns>
  4266. public static string GetUserName( object User_EmployeeID )
  4267. {
  4268. try
  4269. {
  4270. if ( !string.IsNullOrEmpty(User_EmployeeID.ToString()) )
  4271. {
  4272. DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(User_EmployeeID);
  4273. if ( dtRow != null )
  4274. {
  4275. return dtRow["User_Name"].ToString().Trim();
  4276. }
  4277. }
  4278. }
  4279. catch { }
  4280. return "";
  4281. }
  4282. #endregion
  4283. #region ModelLog
  4284. /// <summary>
  4285. /// 获取写日志对象
  4286. /// </summary>
  4287. /// <param name="type">日志类类</param>
  4288. /// <param name="contents">日志内容</param>
  4289. /// <param name="userID">用户ID</param>
  4290. /// <param name="userName">用户名</param>
  4291. /// <param name="ip">ip 可以为空</param>
  4292. /// <returns></returns>
  4293. public static LYFZ.Model.Model_ErpACVBSYS GetModelLog( string SysType, string StrContent, string StrContentDetails = "", object strTime = null )
  4294. {
  4295. if ( strTime == null )
  4296. {
  4297. strTime = SDateTime.Now.ToString();
  4298. }
  4299. LYFZ.Model.Model_ErpACVBSYS modelsys = new Model.Model_ErpACVBSYS();
  4300. modelsys.ACVBSYS002 = EncryptDES(SysType.ToString());
  4301. modelsys.ACVBSYS003 = EncryptDES(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name);
  4302. modelsys.ACVBSYS004 = EncryptDES(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID);
  4303. modelsys.ACVBSYS005 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP;// EncryptDES(GetCurrentHostIP());
  4304. modelsys.ACVBSYS006 = EncryptDES(StrContent);
  4305. modelsys.ACVBSYS007 = EncryptDES(LYFZ.Command.Command_Validate.DateTimeToString(strTime, "yyyy-MM-dd HH:mm:ss"));
  4306. modelsys.ACVBSYS008 = EncryptDES(StrContentDetails);
  4307. return modelsys;
  4308. }
  4309. static string GetCurrentHostIP()
  4310. {
  4311. System.Net.IPHostEntry ipe = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
  4312. return ipe.HostName.ToString().Trim() + " " + ipe.AddressList[3].ToString().Trim();
  4313. }
  4314. private static byte[] DesKeys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };//默认密钥向量
  4315. /// <summary>
  4316. /// 给外部调用的DES算法加密。
  4317. /// </summary>
  4318. public static string EncryptDES( string decryptString )
  4319. {
  4320. return EncryptDES(decryptString, "cust-stu");
  4321. }
  4322. /// <summary>
  4323. /// DES加密字符串
  4324. /// </summary>
  4325. /// <param name="encryptString">待加密的字符串</param>
  4326. /// <param name="encryptKey">加密密钥,要求为8位</param>
  4327. /// <returns>加密成功返回加密后的字符串,失败返回源串</returns>
  4328. private static string EncryptDES( string encryptString, string encryptKey )
  4329. {
  4330. try
  4331. {
  4332. byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8));
  4333. byte[] rgbIV = DesKeys;
  4334. byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
  4335. System.Security.Cryptography.DESCryptoServiceProvider dCSP = new System.Security.Cryptography.DESCryptoServiceProvider();
  4336. MemoryStream mStream = new MemoryStream();
  4337. System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), System.Security.Cryptography.CryptoStreamMode.Write);
  4338. cStream.Write(inputByteArray, 0, inputByteArray.Length);
  4339. cStream.FlushFinalBlock();
  4340. return Convert.ToBase64String(mStream.ToArray());
  4341. }
  4342. catch
  4343. {
  4344. return encryptString;
  4345. }
  4346. }
  4347. #endregion
  4348. #region 集团
  4349. /// <summary>
  4350. /// 绑定集团名称(像用于门市流程)
  4351. /// </summary>
  4352. /// <param name="cmbtreev">控件</param>
  4353. /// <param name="StrGroupKeyCode">菜单组编号</param>
  4354. /// <param name="StrKeyCode">当前窗体编号</param>
  4355. /// <param name="StrDefaultStoreText">默认值</param>
  4356. /// <param name="IsShowAllText">是否显示'全部'</param>
  4357. public static void BindStoreNameALL( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrDefaultStoreText = "", bool IsShowAllText = true )
  4358. {
  4359. cmbtreev.Nodes.Clear();
  4360. DataTable dt = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
  4361. TreeNode node;
  4362. if ( IsShowAllText )
  4363. {
  4364. if ( dt.Rows.Count > 1 )
  4365. {
  4366. node = new TreeNode();
  4367. node.Text = "全部";
  4368. node.Tag = "";
  4369. node.Name = "0";
  4370. cmbtreev.Nodes.Add(node);
  4371. }
  4372. }
  4373. for ( int i = 0; i < dt.Rows.Count; i++ )
  4374. {
  4375. node = new TreeNode();
  4376. node.Text = dt.Rows[i]["Company_Name"].ToString().Trim();
  4377. node.Tag = dt.Rows[i]["Company_DividedShop"].ToString().Trim();
  4378. node.Name = dt.Rows[i]["ID"].ToString().Trim();
  4379. cmbtreev.Nodes.Add(node);
  4380. }
  4381. if ( !string.IsNullOrEmpty(StrDefaultStoreText) )
  4382. {
  4383. if ( cmbtreev.GetNodeItem_TextToTag(StrDefaultStoreText) != null )
  4384. {
  4385. cmbtreev.TextFindTag(StrDefaultStoreText);
  4386. }
  4387. }
  4388. if ( string.IsNullOrEmpty(cmbtreev.Text.Trim()) )
  4389. {
  4390. DataRow[] dtRow = dt.Select("Company_DividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'");
  4391. if ( dtRow.Length > 0 )
  4392. {
  4393. cmbtreev.TagFindText(dtRow[0]["Company_DividedShop"]);
  4394. }
  4395. else
  4396. {
  4397. cmbtreev.TagFindText(dt.Rows[0]["Company_DividedShop"]);
  4398. }
  4399. }
  4400. }
  4401. /// <summary>
  4402. /// 绑定集团名称(像用于门市流程)
  4403. /// </summary>
  4404. /// <param name="cmbtreev">控件</param>
  4405. /// <param name="StrGroupKeyCode">菜单组编号</param>
  4406. /// <param name="StrKeyCode">当前窗体编号</param>
  4407. /// <param name="StrDefaultStoreText">默认值</param>
  4408. /// <param name="IsShowAllText">是否显示'全部'</param>
  4409. public static void BindGroupStoreName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrGroupKeyCode = "", string StrKeyCode = "", string StrDefaultStoreText = "",
  4410. bool IsShowAllText = true,bool bhidelocalData=false,bool bHideMainOpenForm=true )
  4411. {
  4412. cmbtreev.Nodes.Clear();
  4413. if ( string.IsNullOrEmpty(StrGroupKeyCode) )
  4414. {
  4415. StrGroupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet();
  4416. }
  4417. List<string> mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(StrGroupKeyCode, StrKeyCode);
  4418. string StrWhere = "";
  4419. for ( int i = 0; i < mlist.Count; i++ )
  4420. {
  4421. StrWhere += "'" + mlist[i].Trim() + "',";
  4422. }
  4423. if ( !string.IsNullOrEmpty(StrWhere) )
  4424. {
  4425. StrWhere = "Company_DividedShop in (" + StrWhere.TrimEnd(',') + ")";
  4426. }
  4427. DataTable dt = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
  4428. TreeNode node;
  4429. if ( IsShowAllText )
  4430. {
  4431. if ( dt.Rows.Count > 1 )
  4432. {
  4433. node = new TreeNode();
  4434. node.Text = "全部";
  4435. node.Tag = "";
  4436. node.Name = "0";
  4437. cmbtreev.Nodes.Add(node);
  4438. }
  4439. }
  4440. for ( int i = 0; i < dt.Rows.Count; i++ )
  4441. {
  4442. node = new TreeNode();
  4443. node.Text = dt.Rows[i]["Company_Name"].ToString().Trim();
  4444. node.Tag = dt.Rows[i]["Company_DividedShop"].ToString().Trim();
  4445. node.Name = dt.Rows[i]["ID"].ToString().Trim();
  4446. cmbtreev.Nodes.Add(node);
  4447. }
  4448. if ( !string.IsNullOrEmpty(StrDefaultStoreText) )
  4449. {
  4450. if ( cmbtreev.GetNodeItem_TextToTag(StrDefaultStoreText) != null )
  4451. {
  4452. cmbtreev.TextFindTag(StrDefaultStoreText);
  4453. }
  4454. }
  4455. if ( string.IsNullOrEmpty(cmbtreev.Text.Trim()) )
  4456. {
  4457. DataRow[] dtRow = dt.Select("Company_DividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'");
  4458. if ( dtRow.Length > 0 )
  4459. {
  4460. cmbtreev.TagFindText(dtRow[0]["Company_DividedShop"]);
  4461. }
  4462. else
  4463. {
  4464. cmbtreev.TagFindText(dt.Rows[0]["Company_DividedShop"]);
  4465. }
  4466. }
  4467. if (bHideMainOpenForm)
  4468. {
  4469. if (dt.Rows.Count <= 1)
  4470. {
  4471. if (!bhidelocalData)
  4472. {
  4473. cmbtreev.Parent.Visible = false;
  4474. }
  4475. else
  4476. {
  4477. cmbtreev.Visible = false;
  4478. }
  4479. }
  4480. }
  4481. }
  4482. /// <summary>
  4483. ///
  4484. /// </summary>
  4485. /// <param name="StrGroupKeyCode"></param>
  4486. /// <param name="StrKeyCode"></param>
  4487. /// <returns></returns>
  4488. public static DataTable BindGroupStoreName( string StrKeyCode, string StrGroupKeyCode = "" )
  4489. {
  4490. if ( string.IsNullOrEmpty(StrGroupKeyCode) )
  4491. {
  4492. StrGroupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet();
  4493. }
  4494. List<string> mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(StrGroupKeyCode, StrKeyCode);
  4495. string StrWhere = "";
  4496. for ( int i = 0; i < mlist.Count; i++ )
  4497. {
  4498. StrWhere += "'" + mlist[i].Trim() + "',";
  4499. }
  4500. if ( !string.IsNullOrEmpty(StrWhere) )
  4501. {
  4502. StrWhere = "Company_DividedShop in (" + StrWhere.TrimEnd(',') + ")";
  4503. }
  4504. return orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0];
  4505. }
  4506. /// <summary>
  4507. /// 集团店面权限
  4508. /// </summary>
  4509. /// <param name="cmbtreev">集团控件</param>
  4510. /// <param name="moduleBlock">权限模块名</param>
  4511. /// <param name="operatingAuthority">权限名</param>
  4512. /// <returns></returns>
  4513. public static bool GetGroupStoreRights( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string moduleBlock, LYFZ.CustomAttributes.OperatingAuthority operatingAuthority )
  4514. {
  4515. bool IsRights = false;
  4516. if ( !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) )
  4517. {
  4518. IsRights = LYFZ.BLL.BLL_ErpUser.GetGroupRights(moduleBlock, operatingAuthority, cmbtreev.Tag.ToString().Trim());
  4519. }
  4520. else
  4521. {
  4522. for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
  4523. {
  4524. if ( !string.IsNullOrEmpty(cmbtreev.Nodes[i].Tag.ToString().Trim()) )
  4525. {
  4526. IsRights = LYFZ.BLL.BLL_ErpUser.GetGroupRights(moduleBlock, operatingAuthority, cmbtreev.Nodes[i].Tag.ToString().Trim());
  4527. if ( !IsRights )
  4528. {
  4529. break;
  4530. }
  4531. }
  4532. }
  4533. }
  4534. return IsRights;
  4535. }
  4536. /// <summary>
  4537. /// 集团查询获取条件信息
  4538. /// </summary>
  4539. /// <param name="cmbtreev">集团控件</param>
  4540. /// <param name="StrFieldName"></param>
  4541. /// <param name="ConnectWord"></param>
  4542. /// <returns></returns>
  4543. public static string GetGroupQueryWhere( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, string ConnectWord = "And" )
  4544. {
  4545. string StrWhere = "";
  4546. if ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition )
  4547. {
  4548. if ( cmbtreev.Text.Trim() == "全部" )
  4549. {
  4550. string StrSQL = "";
  4551. for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
  4552. {
  4553. if ( cmbtreev.Nodes[i].Text.Trim() != "全部" )
  4554. {
  4555. StrSQL += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',";
  4556. }
  4557. }
  4558. if ( !string.IsNullOrEmpty(StrSQL) )
  4559. {
  4560. StrWhere = StrFieldName + " in (" + StrSQL.TrimEnd(',') + ")";
  4561. }
  4562. }
  4563. else
  4564. {
  4565. StrWhere = StrFieldName + " = '" + cmbtreev.Tag.ToString().Trim() + "'";
  4566. }
  4567. if ( !string.IsNullOrEmpty(ConnectWord) )
  4568. {
  4569. StrWhere = " " + ConnectWord + " " + StrWhere;
  4570. }
  4571. }
  4572. else
  4573. {
  4574. StrWhere = " " + ConnectWord + " 1 = 1";
  4575. }
  4576. return StrWhere;
  4577. }
  4578. /// <summary>
  4579. /// 订单点击查看的分店
  4580. /// </summary>
  4581. /// <param name="cmbtreev"></param>
  4582. /// <param name="StrFieldName"></param>
  4583. /// <param name="ConnectWord"></param>
  4584. /// <returns></returns>
  4585. public static string GetGroupQueryOrderClickWhere( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, string ConnectWord = "And" )
  4586. {
  4587. string StrWhere = "";
  4588. for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
  4589. {
  4590. if ( !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) )
  4591. {
  4592. StrWhere += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',";
  4593. }
  4594. }
  4595. StrWhere = StrFieldName + " in (" + StrWhere.TrimEnd(',') + ")";
  4596. if ( !string.IsNullOrEmpty(ConnectWord) )
  4597. {
  4598. StrWhere = " " + ConnectWord + " " + StrWhere;
  4599. }
  4600. return StrWhere;
  4601. }
  4602. public static Dictionary<string, string> GetGroupQueryOrderClickWhereByDataList( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, ref Dictionary<string, string> dicWhere )
  4603. {
  4604. string StrWhere = "";
  4605. TreeNode treeNode = new TreeNode()
  4606. {
  4607. Tag = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID
  4608. };
  4609. if ( cmbtreev.Tag != null )
  4610. {
  4611. if ( cmbtreev.Tag.ToString().Trim() == "" )
  4612. {
  4613. for ( int i = 0; i < cmbtreev.Nodes.Count; i++ )
  4614. {
  4615. StrWhere += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',";
  4616. }
  4617. dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")");
  4618. }
  4619. else
  4620. {
  4621. if ( cmbtreev.Tag != null && !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) )
  4622. {
  4623. StrWhere += "'" + cmbtreev.Tag.ToString().Trim() + "',";
  4624. dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")");
  4625. }
  4626. }
  4627. }
  4628. else
  4629. {
  4630. StrWhere += "'" + treeNode.Tag.ToString().Trim() + "',";
  4631. dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")");
  4632. }
  4633. //StrWhere = StrFieldName + " in (" + StrWhere.TrimEnd(',') + ")";
  4634. //if (!string.IsNullOrEmpty(ConnectWord))
  4635. //{ StrWhere = " " + ConnectWord + " " + StrWhere; }
  4636. return dicWhere;
  4637. }
  4638. #endregion
  4639. #region 礼服相片
  4640. /// <summary>
  4641. /// 获取礼服缩略图
  4642. /// </summary>
  4643. /// <param name="StrPhoto"></param>
  4644. /// <returns></returns>
  4645. public static Image GetDressImage_Small( string StrPhoto, bool IsShowDefaultPhoto = true )
  4646. {
  4647. Bitmap img = null;
  4648. if ( !string.IsNullOrEmpty(StrPhoto) )
  4649. {
  4650. try
  4651. {
  4652. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg";
  4653. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
  4654. //loadMessage = "加载成功";
  4655. }
  4656. catch ( Exception e )
  4657. {
  4658. //loadMessage = e.Message;
  4659. }
  4660. }
  4661. if ( img == null && IsShowDefaultPhoto )
  4662. {
  4663. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  4664. //loadMessage = "未找到图片路径,使用系统默认图片";
  4665. }
  4666. return img;
  4667. }
  4668. /// <summary>
  4669. /// 获取礼服缩略图
  4670. /// </summary>
  4671. /// <param name="StrPhoto"></param>
  4672. /// <returns></returns>
  4673. public static Image GetDressImage_Small( string StrPhoto, ref string loadMessage, bool IsShowDefaultPhoto = true )
  4674. {
  4675. Bitmap img = null;
  4676. loadMessage = "图片数据为Null";
  4677. if ( !string.IsNullOrEmpty(StrPhoto) )
  4678. {
  4679. try
  4680. {
  4681. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg";
  4682. string tempFlePath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + strImgPath.Substring(1);
  4683. if ( File.Exists(tempFlePath) )
  4684. {
  4685. img = new Bitmap(Image.FromFile(tempFlePath));
  4686. }
  4687. else
  4688. {
  4689. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
  4690. }
  4691. loadMessage = "加载成功";
  4692. }
  4693. catch ( Exception e )
  4694. {
  4695. loadMessage = e.Message;
  4696. }
  4697. }
  4698. if ( img == null && IsShowDefaultPhoto )
  4699. {
  4700. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  4701. loadMessage = "未找到图片路径,使用系统默认图片";
  4702. }
  4703. return img;
  4704. }
  4705. /// <summary>
  4706. /// 获取礼服原图
  4707. /// </summary>
  4708. /// <param name="StrPhoto"></param>
  4709. /// <returns></returns>
  4710. public static Image GetDressImage_Original( string StrPhoto, bool IsShowDefaultPhoto = true )
  4711. {
  4712. Bitmap img = null;
  4713. if ( !string.IsNullOrEmpty(StrPhoto) )
  4714. {
  4715. try
  4716. {
  4717. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\" + StrPhoto;
  4718. if ( string.IsNullOrEmpty(System.IO.Path.GetExtension(StrPhoto)) )
  4719. {
  4720. strImgPath += ".jpg";
  4721. }
  4722. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
  4723. }
  4724. catch
  4725. {
  4726. }
  4727. }
  4728. if ( img == null && IsShowDefaultPhoto )
  4729. {
  4730. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  4731. }
  4732. return img;
  4733. }
  4734. /// <summary>
  4735. /// 上传礼服相片
  4736. /// </summary>
  4737. /// <param name="StrSelectPath">选择的相片路径</param>
  4738. /// <param name="StrDressNumber">礼服的编号</param>
  4739. /// <param name="IsRecursion">是否递归上传失败的相片</param>
  4740. /// <param name="UpdateDressType">上传类型 0:上传缩略图 1:上传原图</param>
  4741. /// <returns></returns>
  4742. public static bool UpdateDressPhoto( string StrSelectPath, string StrDressNumber, bool IsRecursion = false, int UpdateDressType = 0 )
  4743. {
  4744. string[] StrArray = StrSelectPath.Trim().Split('|');
  4745. string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto();
  4746. if ( UpdateDressType == 0 )
  4747. {
  4748. string StrPhotoName = StrDressNumber + "_" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg";
  4749. Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100);
  4750. StrParentPath += @"\Small\" + StrPhotoName;
  4751. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null);
  4752. if ( ret.IndexOf("成功") == -1 )
  4753. {
  4754. if ( !IsRecursion )
  4755. {
  4756. return UpdateDressPhoto(StrSelectPath, StrDressNumber, IsRecursion);
  4757. }
  4758. else
  4759. {
  4760. return false;
  4761. }
  4762. }
  4763. else
  4764. {
  4765. return true;
  4766. }
  4767. }
  4768. else
  4769. {
  4770. string StrPhotoName = StrDressNumber + "_" + System.IO.Path.GetFileName(StrArray[0].Trim());
  4771. Bitmap OriginalMap = null;
  4772. if ( System.IO.Path.GetExtension(StrArray[0].Trim()) == ".gif" )
  4773. {
  4774. OriginalMap = new Bitmap(Image.FromStream(new MemoryStream(System.IO.File.ReadAllBytes(StrArray[0].Trim()))));
  4775. }
  4776. else
  4777. {
  4778. OriginalMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 1080, 720);
  4779. }
  4780. StrParentPath += @"\" + StrPhotoName;
  4781. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(OriginalMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null);
  4782. if ( ret.IndexOf("成功") == -1 )
  4783. {
  4784. if ( !IsRecursion )
  4785. {
  4786. return UpdateDressPhoto(StrSelectPath, StrDressNumber, IsRecursion);
  4787. }
  4788. else
  4789. {
  4790. return false;
  4791. }
  4792. }
  4793. else
  4794. {
  4795. return true;
  4796. }
  4797. }
  4798. }
  4799. /// <summary>
  4800. /// 删除礼服相片
  4801. /// </summary>
  4802. /// <param name="StrSelectPath"></param>
  4803. /// <param name="IsRecursion"></param>
  4804. /// <returns></returns>
  4805. public static bool DeleteDressPhoto( string StrSelectPath, bool IsRecursion = false, int DeleteDressType = 0 )
  4806. {
  4807. string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto();
  4808. if ( DeleteDressType == 0 )
  4809. {
  4810. StrParentPath += @"\Small\" + StrSelectPath;
  4811. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
  4812. if ( ret.IndexOf("成功") == -1 )
  4813. {
  4814. if ( !IsRecursion )
  4815. {
  4816. return DeleteDressPhoto(StrSelectPath, IsRecursion, DeleteDressType: 0);
  4817. }
  4818. else
  4819. {
  4820. return false;
  4821. }
  4822. }
  4823. else
  4824. {
  4825. return true;
  4826. }
  4827. }
  4828. else
  4829. {
  4830. StrParentPath += @"\" + StrSelectPath;
  4831. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
  4832. if ( ret.IndexOf("成功") == -1 )
  4833. {
  4834. if ( !IsRecursion )
  4835. {
  4836. return DeleteDressPhoto(StrSelectPath, IsRecursion, DeleteDressType: 1);
  4837. }
  4838. else
  4839. {
  4840. return false;
  4841. }
  4842. }
  4843. else
  4844. {
  4845. return true;
  4846. }
  4847. }
  4848. }
  4849. #endregion
  4850. #region 其他消费相片
  4851. /// <summary>
  4852. /// 获取其他消费缩略图
  4853. /// </summary>
  4854. /// <param name="StrPhoto"></param>
  4855. /// <returns></returns>
  4856. public static Image GetOtherConsumeImage_Small( string StrPhoto, bool IsShowDefaultPhoto = true )
  4857. {
  4858. Bitmap img = null;
  4859. if ( !string.IsNullOrEmpty(StrPhoto) )
  4860. {
  4861. try
  4862. {
  4863. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg";
  4864. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
  4865. }
  4866. catch
  4867. {
  4868. }
  4869. }
  4870. if ( img == null && IsShowDefaultPhoto )
  4871. {
  4872. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  4873. }
  4874. return img;
  4875. }
  4876. /// <summary>
  4877. /// 获取其他消费原图
  4878. /// </summary>
  4879. /// <param name="StrPhoto"></param>
  4880. /// <returns></returns>
  4881. public static Image GetOtherConsumeImage_Original( string StrPhoto, bool IsShowDefaultPhoto = true )
  4882. {
  4883. Bitmap img = null;
  4884. if ( !string.IsNullOrEmpty(StrPhoto) )
  4885. {
  4886. try
  4887. {
  4888. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + @"\" + StrPhoto;
  4889. if ( string.IsNullOrEmpty(System.IO.Path.GetExtension(StrPhoto)) )
  4890. {
  4891. strImgPath += ".jpg";
  4892. }
  4893. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
  4894. }
  4895. catch
  4896. {
  4897. }
  4898. }
  4899. if ( img == null && IsShowDefaultPhoto )
  4900. {
  4901. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  4902. }
  4903. return img;
  4904. }
  4905. /// <summary>
  4906. /// 上传其他消费相片
  4907. /// </summary>
  4908. /// <param name="StrSelectPath">选择的相片路径</param>
  4909. /// <param name="StrOtherOrderNumber">其他消费的编号</param>
  4910. /// <param name="IsRecursion">是否递归上传失败的相片</param>
  4911. /// <param name="UpdateDressType">上传类型 0:上传缩略图 1:上传原图</param>
  4912. /// <returns></returns>
  4913. public static bool UpdateOtherConsumePhoto( string StrSelectPath, string StrOtherOrderNumber, bool IsRecursion = false, int UpdateDressType = 0 )
  4914. {
  4915. string[] StrArray = StrSelectPath.Trim().Split('|');
  4916. string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto();
  4917. if ( UpdateDressType == 0 )
  4918. {
  4919. string StrPhotoName = StrOtherOrderNumber + "_" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg";
  4920. Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100);
  4921. StrParentPath += @"\Small\" + StrPhotoName;
  4922. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null);
  4923. if ( ret.IndexOf("成功") == -1 )
  4924. {
  4925. if ( !IsRecursion )
  4926. {
  4927. return UpdateOtherConsumePhoto(StrSelectPath, StrOtherOrderNumber, IsRecursion);
  4928. }
  4929. else
  4930. {
  4931. return false;
  4932. }
  4933. }
  4934. else
  4935. {
  4936. return true;
  4937. }
  4938. }
  4939. else
  4940. {
  4941. string StrPhotoName = StrOtherOrderNumber + "_" + System.IO.Path.GetFileName(StrArray[0].Trim());
  4942. StrParentPath += @"\" + StrPhotoName;
  4943. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(StrArray[0].Trim(), StrParentPath, backgroundWorker: null);
  4944. if ( ret.IndexOf("成功") == -1 )
  4945. {
  4946. if ( !IsRecursion )
  4947. {
  4948. return UpdateOtherConsumePhoto(StrSelectPath, StrOtherOrderNumber, IsRecursion);
  4949. }
  4950. else
  4951. {
  4952. return false;
  4953. }
  4954. }
  4955. else
  4956. {
  4957. return true;
  4958. }
  4959. }
  4960. }
  4961. /// <summary>
  4962. /// 删除其他消费相片
  4963. /// </summary>
  4964. /// <param name="StrSelectPath"></param>
  4965. /// <param name="IsRecursion"></param>
  4966. /// <returns></returns>
  4967. public static bool DeleteOtherConsumePhoto( string StrSelectPath, bool IsRecursion = false, int DeleteDressType = 0 )
  4968. {
  4969. string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto();
  4970. if ( DeleteDressType == 0 )
  4971. {
  4972. StrParentPath += @"\Small\" + StrSelectPath;
  4973. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
  4974. if ( ret.IndexOf("成功") == -1 )
  4975. {
  4976. if ( !IsRecursion )
  4977. {
  4978. return DeleteOtherConsumePhoto(StrSelectPath, IsRecursion, DeleteDressType: 0);
  4979. }
  4980. else
  4981. {
  4982. return false;
  4983. }
  4984. }
  4985. else
  4986. {
  4987. return true;
  4988. }
  4989. }
  4990. else
  4991. {
  4992. StrParentPath += @"\" + StrSelectPath;
  4993. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
  4994. if ( ret.IndexOf("成功") == -1 )
  4995. {
  4996. if ( !IsRecursion )
  4997. {
  4998. return DeleteOtherConsumePhoto(StrSelectPath, IsRecursion, DeleteDressType: 1);
  4999. }
  5000. else
  5001. {
  5002. return false;
  5003. }
  5004. }
  5005. else
  5006. {
  5007. return true;
  5008. }
  5009. }
  5010. }
  5011. #endregion
  5012. #region 医院跟踪
  5013. static string StrReminderSettingsArray = "预产期:1,客户生日:2,婚庆日期:3,结婚纪念日:4";
  5014. /// <summary>
  5015. /// 系统自动提醒设置
  5016. /// </summary>
  5017. /// <param name="objValue"></param>
  5018. /// <returns></returns>
  5019. public static string ReminderSettings( string objValue )
  5020. {
  5021. string StrReturn = "满";
  5022. string[] StrArray = StrReminderSettingsArray.Split(',');
  5023. for ( int i = 0; i < StrArray.Length; i++ )
  5024. {
  5025. string[] StrArray2 = StrArray[i].Trim().Split(':');
  5026. if ( objValue.Trim() == StrArray2[0].Trim() )
  5027. {
  5028. StrReturn = "前";
  5029. break;
  5030. }
  5031. if ( objValue.Trim().IndexOf(StrArray2[0].Trim()) != -1 )
  5032. {
  5033. StrReturn = "前";
  5034. break;
  5035. }
  5036. }
  5037. return StrReturn;
  5038. }
  5039. /// <summary>
  5040. /// 系统自动提醒设置
  5041. /// </summary>
  5042. /// <param name="objValue"></param>
  5043. /// <returns></returns>
  5044. public static string ReminderSettings( int objValue )
  5045. {
  5046. string StrReturn = "满";
  5047. string[] StrArray = StrReminderSettingsArray.Split(',');
  5048. for ( int i = 0; i < StrArray.Length; i++ )
  5049. {
  5050. string[] StrArray2 = StrArray[i].Trim().Split(':');
  5051. if ( objValue == Convert.ToInt32(StrArray2[1].Trim()) )
  5052. {
  5053. StrReturn = "前";
  5054. break;
  5055. }
  5056. }
  5057. return StrReturn;
  5058. }
  5059. /// <summary>
  5060. /// 获取医院跟踪缩略图
  5061. /// </summary>
  5062. /// <param name="StrPhoto"></param>
  5063. /// <returns></returns>
  5064. public static Image GetHospitalImage_Small( string StrOrdNumber, string StrPhotoPath, bool IsShowDefaultPhoto = true )
  5065. {
  5066. Bitmap img = null;
  5067. if ( !string.IsNullOrEmpty(StrPhotoPath) )
  5068. {
  5069. try
  5070. {
  5071. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + "\\" + StrOrdNumber + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhotoPath) + ".jpg";
  5072. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, StrPhotoPath);
  5073. }
  5074. catch
  5075. {
  5076. }
  5077. }
  5078. if ( img == null && IsShowDefaultPhoto )
  5079. {
  5080. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  5081. }
  5082. return img;
  5083. }
  5084. /// <summary>
  5085. /// 获取医院跟踪缩略图
  5086. /// </summary>
  5087. /// <param name="StrPhoto"></param>
  5088. /// <returns></returns>
  5089. public static void GetHospitalImage_Small( LYFZ.ComponentLibrary.ListViewEx listViewData, ImageList mlistImagePhoto, string StrOrdNumber, bool IsShowDefaultPhoto = true )
  5090. {
  5091. listViewData.Items.Clear();
  5092. if ( !string.IsNullOrEmpty(StrOrdNumber) )
  5093. {
  5094. try
  5095. {
  5096. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + @"\" + StrOrdNumber + @"\Small\";
  5097. List<string> StrList = new List<string>();
  5098. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.GetDirectoryFileList(out StrList, strImgPath);
  5099. for ( int i = 0; i < StrList.Count; i++ )
  5100. {
  5101. Bitmap img = null;
  5102. retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, StrList[i].Trim());
  5103. if ( img == null && IsShowDefaultPhoto )
  5104. {
  5105. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  5106. }
  5107. ListViewItem lvi = new ListViewItem();
  5108. lvi.ImageKey = StrList[i].Trim();
  5109. lvi.Text = System.IO.Path.GetFileNameWithoutExtension(StrList[i].Trim());
  5110. lvi.Tag = StrList[i].Trim();
  5111. lvi.ToolTipText = lvi.Text;
  5112. if ( !mlistImagePhoto.Images.Keys.Contains(StrList[i].Trim()) )
  5113. {
  5114. mlistImagePhoto.Images.Add(StrList[i].Trim(), img);
  5115. }
  5116. listViewData.Items.Add(lvi);
  5117. }
  5118. }
  5119. catch
  5120. {
  5121. }
  5122. }
  5123. }
  5124. /// <summary>
  5125. /// 获取医院跟踪原图
  5126. /// </summary>
  5127. /// <param name="StrPhoto"></param>
  5128. /// <returns></returns>
  5129. public static Image GetHospitalImage_Original( string StrOrdNumber, string StrPhoto, bool IsShowDefaultPhoto = true )
  5130. {
  5131. Bitmap img = null;
  5132. if ( !string.IsNullOrEmpty(StrPhoto) )
  5133. {
  5134. try
  5135. {
  5136. string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + "\\" + StrOrdNumber + @"\" + StrPhoto;
  5137. string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath);
  5138. }
  5139. catch
  5140. {
  5141. }
  5142. }
  5143. if ( img == null && IsShowDefaultPhoto )
  5144. {
  5145. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  5146. }
  5147. return img;
  5148. }
  5149. /// <summary>
  5150. /// 上传医院跟踪相片
  5151. /// </summary>
  5152. /// <param name="StrSelectPath">选择的相片路径</param>
  5153. /// <param name="StrOrderNumber">其他消费的编号</param>
  5154. /// <param name="IsRecursion">是否递归上传失败的相片</param>
  5155. /// <param name="UpdateDressType">上传类型 0:上传缩略图 1:上传原图</param>
  5156. /// <returns></returns>
  5157. public static bool UpdateHospitalPhoto( string StrSelectPath, string StrOrderNumber, bool IsRecursion = false, int UpdateDressType = 0 )
  5158. {
  5159. string[] StrArray = StrSelectPath.Trim().Split('|');
  5160. string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + @"\" + StrOrderNumber;
  5161. if ( UpdateDressType == 0 )
  5162. {
  5163. string StrParentPath_Small = StrParentPath + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg";
  5164. Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100);
  5165. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath_Small, backgroundWorker: null);
  5166. if ( ret.IndexOf("成功") == -1 )
  5167. {
  5168. if ( !IsRecursion )
  5169. {
  5170. return UpdateHospitalPhoto(StrSelectPath, StrOrderNumber, IsRecursion);
  5171. }
  5172. else
  5173. {
  5174. return false;
  5175. }
  5176. }
  5177. else
  5178. {
  5179. return true;
  5180. }
  5181. }
  5182. else
  5183. {
  5184. string StrParentPath_Original = StrParentPath + @"\" + System.IO.Path.GetFileName(StrArray[0].Trim());
  5185. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(StrArray[0].Trim(), StrParentPath_Original, backgroundWorker: null);
  5186. if ( ret.IndexOf("成功") == -1 )
  5187. {
  5188. if ( !IsRecursion )
  5189. {
  5190. return UpdateHospitalPhoto(StrSelectPath, StrOrderNumber, IsRecursion);
  5191. }
  5192. else
  5193. {
  5194. return false;
  5195. }
  5196. }
  5197. else
  5198. {
  5199. return true;
  5200. }
  5201. }
  5202. }
  5203. /// <summary>
  5204. /// 删除其他消费相片
  5205. /// </summary>
  5206. /// <param name="StrSelectPath"></param>
  5207. /// <param name="IsRecursion"></param>
  5208. /// <returns></returns>
  5209. public static bool DeleteHospitalPhoto( string StrSelectPath, string StrOrdNumber, bool IsRecursion = false, int DeleteDressType = 0 )
  5210. {
  5211. string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto();
  5212. if ( DeleteDressType == 0 )
  5213. {
  5214. StrParentPath += "\\" + StrOrdNumber + @"\Small\" + StrSelectPath;
  5215. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
  5216. if ( ret.IndexOf("成功") == -1 )
  5217. {
  5218. if ( !IsRecursion )
  5219. {
  5220. return DeleteHospitalPhoto(StrSelectPath, StrOrdNumber, IsRecursion, DeleteDressType: 0);
  5221. }
  5222. else
  5223. {
  5224. return false;
  5225. }
  5226. }
  5227. else
  5228. {
  5229. return true;
  5230. }
  5231. }
  5232. else
  5233. {
  5234. StrParentPath += "\\" + StrOrdNumber + @"\" + StrSelectPath;
  5235. string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null);
  5236. if ( ret.IndexOf("成功") == -1 )
  5237. {
  5238. if ( !IsRecursion )
  5239. {
  5240. return DeleteHospitalPhoto(StrSelectPath, StrOrdNumber, IsRecursion, DeleteDressType: 1);
  5241. }
  5242. else
  5243. {
  5244. return false;
  5245. }
  5246. }
  5247. else
  5248. {
  5249. return true;
  5250. }
  5251. }
  5252. }
  5253. #endregion
  5254. #region 图片处理
  5255. /// <summary>
  5256. /// 获取产品图片
  5257. /// </summary>
  5258. /// <param name="StrPhoto"></param>
  5259. /// <returns></returns>
  5260. public static Image GetProductImage( string StrPhoto )
  5261. {
  5262. Bitmap img = null;
  5263. if ( !string.IsNullOrEmpty(StrPhoto) )
  5264. {
  5265. try
  5266. {
  5267. img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(StrPhoto));
  5268. }
  5269. catch
  5270. {
  5271. }
  5272. }
  5273. if ( img == null )
  5274. {
  5275. img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2;
  5276. }
  5277. return img;
  5278. }
  5279. /// <summary>
  5280. /// 下载图片
  5281. /// </summary>
  5282. /// <param name="pict">控件</param>
  5283. /// <param name="StrName">要保存的名字</param>
  5284. public static void DownloadLog( LYFZ.ComponentLibrary.PictureBoxEx pict, string StrName )
  5285. {
  5286. if ( pict.Image != null )
  5287. {
  5288. DownloadLog(pict.Image, StrName + ".jpg");
  5289. //string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  5290. //Bitmap bmp = new Bitmap(pict.Image);
  5291. //bmp.Save(dir + "\\" + StrName + ".jpg");
  5292. //MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面");
  5293. }
  5294. else
  5295. {
  5296. MessageBoxCustom.Show("图片未上传!");
  5297. }
  5298. }
  5299. /// <summary>
  5300. /// 下载图片
  5301. /// </summary>
  5302. /// <param name="Img">图片</param>
  5303. /// <param name="StrName">图片名</param>
  5304. public static void DownloadLog( Image Img, string StrName, bool IsShowPromptOK = true )
  5305. {
  5306. if ( Img != null )
  5307. {
  5308. string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  5309. Bitmap bmp = new Bitmap(Img);
  5310. LYFZ.ImageFunction.ThumbImgae.SaveIamge(Img, 90, dir + "\\" + StrName);
  5311. if ( IsShowPromptOK )
  5312. {
  5313. MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面");
  5314. }
  5315. }
  5316. else
  5317. {
  5318. MessageBoxCustom.Show("图片不存在!");
  5319. }
  5320. }
  5321. /// <summary>
  5322. /// 下载图片
  5323. /// </summary>
  5324. /// <param name="Img">图片</param>
  5325. /// <param name="StrName">图片名</param>
  5326. public static void DownloadToDirectory( Image Img, string StrPath, bool IsShowPromptOK = true )
  5327. {
  5328. if ( Img != null )
  5329. {
  5330. LYFZ.ImageFunction.ThumbImgae.SaveIamge(Img, 90, StrPath);
  5331. if ( IsShowPromptOK )
  5332. {
  5333. MessageBoxCustom.Show("下载成功!下载储存于:\r\n" + System.IO.Path.GetDirectoryName(StrPath));
  5334. }
  5335. }
  5336. else
  5337. {
  5338. MessageBoxCustom.Show("图片不存在!");
  5339. }
  5340. }
  5341. /// <summary>
  5342. /// 图片另存为
  5343. /// </summary>
  5344. public static void DownloadSaveAs( Image Img, string StrFilleName = "", bool IsShowPromptOK = true )
  5345. {
  5346. if ( Img != null )
  5347. {
  5348. SaveFileDialog saveFileDialog1 = new SaveFileDialog();
  5349. saveFileDialog1.InitialDirectory = @"C:\Users\e_teng\Desktop\";
  5350. saveFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";
  5351. saveFileDialog1.Title = "保存图像";
  5352. saveFileDialog1.FileName = StrFilleName;
  5353. if ( saveFileDialog1.ShowDialog() == DialogResult.OK )
  5354. {
  5355. string StrPath = saveFileDialog1.FileName;
  5356. string QStrPath = StrPath.Substring(0, StrPath.IndexOf('.'));//后缀
  5357. string HstrPath = StrPath.Substring(StrPath.IndexOf('.'), StrPath.Length - (StrPath.IndexOf('.')));
  5358. string StrPathNow = QStrPath;
  5359. Img.Save(StrPathNow + HstrPath);
  5360. if ( IsShowPromptOK )
  5361. {
  5362. MessageBoxCustom.Show("保存为完毕");
  5363. }
  5364. }
  5365. }
  5366. }
  5367. #endregion
  5368. #region 礼服处理
  5369. /// <summary>
  5370. /// 礼服是否撞期
  5371. /// </summary>
  5372. public static string IsDressClashDateTime( LYFZ.ComponentLibrary.ListViewEx listViewData, DateTime TakeDressTime )
  5373. {
  5374. Hashtable htData = new Hashtable();
  5375. for ( int i = 0; i < listViewData.Items.Count; i++ )
  5376. {
  5377. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)listViewData.Items[i].Tag;
  5378. htData[columnModel] = listViewData.Items[i].SubItems["礼服名称"].Text.Trim();
  5379. }
  5380. return IsDressClashDateTime(htData, TakeDressTime);
  5381. }
  5382. /// <summary>
  5383. /// 礼服是否撞期
  5384. /// </summary>
  5385. /// <param name="htData"></param>
  5386. /// <param name="TakeDressTime"></param>
  5387. /// <returns></returns>
  5388. public static string IsDressClashDateTime( Hashtable htData, DateTime TakeDressTime )
  5389. {
  5390. string StrDressClash = "";
  5391. 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];
  5392. foreach ( DictionaryEntry item in htData )
  5393. {
  5394. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)item.Key;
  5395. bool IsFind = true;
  5396. if ( columnModel.ID > 0 )
  5397. {
  5398. DataTable dt = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail", StrWhere: "ID = '" + columnModel.ID + "'", ShowColumnName: "Dsrd_TakeDressTime").Tables[0];
  5399. if ( dt.Rows.Count > 0 )
  5400. {
  5401. if ( !string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[0]["Dsrd_TakeDressTime"].ToString().Trim())) )
  5402. {
  5403. IsFind = false;
  5404. }
  5405. }
  5406. }
  5407. if ( IsFind )
  5408. {
  5409. DataRow[] row_DSRD = dtSaleRental.Select("Dsrd_DressNumber = '" + columnModel.StrDressNumber.Trim() + "' ");
  5410. if ( row_DSRD.Length > 0 )
  5411. {
  5412. bool isFind = false;
  5413. for ( int t = 0; t < row_DSRD.Length; t++ )
  5414. {
  5415. if ( TakeDressTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeDressTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]) )
  5416. {
  5417. isFind = true;
  5418. }
  5419. }
  5420. if ( isFind )
  5421. {
  5422. StrDressClash += "礼服编号:" + columnModel.StrDressNumber.Trim() + " " + " 礼服名称:" + item.Value.ToString().Trim() + "\r\n";
  5423. }
  5424. }
  5425. }
  5426. }
  5427. if ( string.IsNullOrEmpty(StrDressClash) )
  5428. {
  5429. 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];
  5430. foreach ( DictionaryEntry item in htData )
  5431. {
  5432. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)item.Key;
  5433. DataRow[] row_DSRD = dtSendWash.Select("Dswd_DressNumber = '" + columnModel.StrDressNumber.Trim() + "' ");
  5434. if ( row_DSRD.Length > 0 )
  5435. {
  5436. bool isFind = false;
  5437. for ( int t = 0; t < row_DSRD.Length; t++ )
  5438. {
  5439. if ( TakeDressTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeDressTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]) )
  5440. {
  5441. isFind = true;
  5442. }
  5443. }
  5444. if ( isFind )
  5445. {
  5446. StrDressClash += "礼服编号:" + columnModel.StrDressNumber.Trim() + " " + " 礼服名称:" + item.Value.ToString().Trim() + "\r\n";
  5447. }
  5448. }
  5449. }
  5450. }
  5451. if ( !string.IsNullOrEmpty(StrDressClash) )
  5452. {
  5453. StrDressClash += "已经撞期,无法租售!";
  5454. }
  5455. return StrDressClash;
  5456. }
  5457. #endregion
  5458. #region 客服任务
  5459. /// <summary>
  5460. /// 获取任务事项
  5461. /// </summary>
  5462. /// <returns></returns>
  5463. public static string GetTaskItem()
  5464. {
  5465. string[] StrEnumArray = Enum.GetNames(typeof(LYFZ.EnumPublic.ClientServiceTaskType));
  5466. return string.Join(",", StrEnumArray).Replace(LYFZ.EnumPublic.ClientServiceTaskType.无分类.ToString(), "").Trim(',');
  5467. }
  5468. /// <summary>
  5469. /// 获取任务事项的具体事项
  5470. /// </summary>
  5471. /// <param name="StrItem">任务事项</param>
  5472. /// <returns></returns>
  5473. public static string GetTaskItemSelect( string StrItem )
  5474. {
  5475. List<string> StrList = new List<string>();
  5476. switch ( (LYFZ.EnumPublic.ClientServiceTaskType)Enum.Parse(typeof(LYFZ.EnumPublic.ClientServiceTaskType), StrItem.Trim()) )
  5477. {
  5478. case EnumPublic.ClientServiceTaskType.摄控确认:
  5479. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣服客人.ToString());
  5480. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照客人.ToString());
  5481. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片客人.ToString());
  5482. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版客人.ToString());
  5483. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件客人.ToString());
  5484. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务客人.ToString());
  5485. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.摄控医院客人.ToString());
  5486. break;
  5487. case EnumPublic.ClientServiceTaskType.流程通知:
  5488. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已定未拍.ToString());
  5489. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已拍未拍完.ToString());
  5490. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已拍未选.ToString());
  5491. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已修未选.ToString());
  5492. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已设计未看.ToString());
  5493. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.部分回件未取.ToString());
  5494. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.全部回件未取.ToString());
  5495. break;
  5496. case EnumPublic.ClientServiceTaskType.沟通助手:
  5497. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.结婚客人.ToString());
  5498. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.结婚纪念日.ToString());
  5499. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.客户生日.ToString());
  5500. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.宝贝生日.ToString());
  5501. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.转介绍客户.ToString());
  5502. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.会员积分.ToString());
  5503. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.孕妇周期.ToString());
  5504. break;
  5505. case EnumPublic.ClientServiceTaskType.意向跟踪:
  5506. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.意向客户.ToString());
  5507. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.订单意向.ToString());
  5508. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.医院意向.ToString());
  5509. break;
  5510. case EnumPublic.ClientServiceTaskType.满意度回访:
  5511. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.接单回访.ToString());
  5512. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣回访.ToString());
  5513. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照回访.ToString());
  5514. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片回访.ToString());
  5515. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版回访.ToString());
  5516. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件回访.ToString());
  5517. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务回访.ToString());
  5518. StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.其它回访.ToString());
  5519. break;
  5520. }
  5521. if ( StrList.Count > 0 )
  5522. {
  5523. return string.Join(",", StrList).Trim(',');
  5524. }
  5525. else
  5526. {
  5527. return "";
  5528. }
  5529. }
  5530. /// <summary>
  5531. /// 安排客服
  5532. /// </summary>
  5533. /// <param name="dgvData"></param>
  5534. /// <param name="modelClientServiceTask"></param>
  5535. /// <param name="ClientServiceTaskType"></param>
  5536. public static void ClientServiceAnPai(LYFZ.ComponentLibrary.DataGridViewEc dgvData, LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceTaskType )
  5537. {
  5538. string StrWhere = "";
  5539. DateTime StrTime = SDateTime.Now;
  5540. List<LYFZ.Helper.CommandInfo> clist = new List<CommandInfo>();
  5541. LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask();
  5542. LYFZ.Model.Model_ErpClientServiceTask modelCst = null;
  5543. DataTable dtprompt = new DataTable();
  5544. 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];
  5545. #region 获取查询条件
  5546. switch ( ClientServiceTaskType )
  5547. {
  5548. case EnumPublic.ClientServiceTaskItem.接单回访:
  5549. case EnumPublic.ClientServiceTaskItem.其它回访:
  5550. case EnumPublic.ClientServiceTaskItem.订单意向:
  5551. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5552. {
  5553. StrWhere += "'" + dgvData.SelectedRows[i].Cells["Ord_Number"].Value.ToString().Trim() + "',";
  5554. }
  5555. if ( StrWhere.Trim().Length > 0 )
  5556. {
  5557. StrWhere = "GP_OrderNumber in (" + StrWhere.TrimEnd(',') + ")";
  5558. }
  5559. break;
  5560. case EnumPublic.ClientServiceTaskItem.选衣回访:
  5561. case EnumPublic.ClientServiceTaskItem.拍照回访:
  5562. case EnumPublic.ClientServiceTaskItem.选片回访:
  5563. case EnumPublic.ClientServiceTaskItem.看版回访:
  5564. case EnumPublic.ClientServiceTaskItem.取件回访:
  5565. case EnumPublic.ClientServiceTaskItem.服务回访:
  5566. case EnumPublic.ClientServiceTaskItem.已拍未选:
  5567. case EnumPublic.ClientServiceTaskItem.已修未选:
  5568. case EnumPublic.ClientServiceTaskItem.已设计未看:
  5569. case EnumPublic.ClientServiceTaskItem.部分回件未取:
  5570. case EnumPublic.ClientServiceTaskItem.全部回件未取:
  5571. case EnumPublic.ClientServiceTaskItem.已定未拍:
  5572. case EnumPublic.ClientServiceTaskItem.已拍未拍完:
  5573. case EnumPublic.ClientServiceTaskItem.选衣服客人:
  5574. case EnumPublic.ClientServiceTaskItem.选片客人:
  5575. case EnumPublic.ClientServiceTaskItem.看版客人:
  5576. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5577. {
  5578. StrWhere += "'" + dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim() + "',";
  5579. }
  5580. if ( StrWhere.Trim().Length > 0 )
  5581. {
  5582. StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")";
  5583. }
  5584. break;
  5585. case EnumPublic.ClientServiceTaskItem.拍照客人:
  5586. case EnumPublic.ClientServiceTaskItem.取件客人:
  5587. case EnumPublic.ClientServiceTaskItem.服务客人:
  5588. Hashtable htData = new Hashtable();
  5589. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5590. {
  5591. htData[dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim()] = dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim();
  5592. }
  5593. foreach ( string item in htData.Keys )
  5594. {
  5595. StrWhere += "'" + item + "',";
  5596. }
  5597. if ( StrWhere.Trim().Length > 0 )
  5598. {
  5599. StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")";
  5600. }
  5601. break;
  5602. case EnumPublic.ClientServiceTaskItem.摄控医院客人:
  5603. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5604. {
  5605. StrWhere += "'" + dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() + "',";
  5606. }
  5607. if ( StrWhere.Trim().Length > 0 )
  5608. {
  5609. StrWhere = "tb_ErpHospitalDispatchDoor.ID in (" + StrWhere.TrimEnd(',') + ")";
  5610. }
  5611. break;
  5612. case EnumPublic.ClientServiceTaskItem.意向客户:
  5613. string StrClientNumber = "";
  5614. string StrClientGroupNumber = "";
  5615. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5616. {
  5617. StrClientNumber += "'" + dgvData.SelectedRows[i].Cells["客户编号"].Value.ToString().Trim() + "',";
  5618. StrClientGroupNumber += "'" + dgvData.SelectedRows[i].Cells["客户组编号"].Value.ToString().Trim() + "',";
  5619. }
  5620. if ( StrClientNumber.Trim().Length > 0 && StrClientGroupNumber.Trim().Length > 0 )
  5621. {
  5622. StrWhere = "GP_CustomerGroupID in (" + StrClientGroupNumber.TrimEnd(',') + ") And GM_CustomerID in (" + StrClientNumber.TrimEnd(',') + ")";
  5623. }
  5624. break;
  5625. case EnumPublic.ClientServiceTaskItem.医院意向:
  5626. case EnumPublic.ClientServiceTaskItem.孕妇周期:
  5627. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5628. {
  5629. StrWhere += "'" + dgvData.SelectedRows[i].Cells["来单批号"].Value.ToString().Trim() + "',";
  5630. }
  5631. if ( StrWhere.Trim().Length > 0 )
  5632. {
  5633. StrWhere = "Hct_Oddnumber in (" + StrWhere.TrimEnd(',') + ")";
  5634. }
  5635. break;
  5636. case EnumPublic.ClientServiceTaskItem.结婚客人:
  5637. case EnumPublic.ClientServiceTaskItem.结婚纪念日:
  5638. case EnumPublic.ClientServiceTaskItem.客户生日:
  5639. case EnumPublic.ClientServiceTaskItem.宝贝生日:
  5640. case EnumPublic.ClientServiceTaskItem.转介绍客户:
  5641. case EnumPublic.ClientServiceTaskItem.会员积分:
  5642. for ( int i = 0; i < dgvData.SelectedRows.Count; i++ )
  5643. {
  5644. StrWhere += "'" + dgvData.SelectedRows[i].Cells["客户编号"].Value.ToString().Trim() + "',";
  5645. }
  5646. if ( StrWhere.Trim().Length > 0 )
  5647. {
  5648. StrWhere = "Cus_CustomerNumber in (" + StrWhere.TrimEnd(',') + ")";
  5649. }
  5650. break;
  5651. }
  5652. #endregion
  5653. #region 获取保存数据
  5654. switch ( ClientServiceTaskType )
  5655. {
  5656. case EnumPublic.ClientServiceTaskItem.接单回访:
  5657. case EnumPublic.ClientServiceTaskItem.其它回访:
  5658. case EnumPublic.ClientServiceTaskItem.订单意向:
  5659. #region 按订单分
  5660. if ( StrWhere.Trim().Length > 0 )
  5661. {
  5662. 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];
  5663. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5664. {
  5665. DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "'");
  5666. if ( dtRows.Length > 0 )
  5667. {
  5668. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5669. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5670. {
  5671. continue;
  5672. }
  5673. if ( StrUserName.Trim().Length > 0 )
  5674. {
  5675. 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 )
  5676. {
  5677. continue;
  5678. }
  5679. }
  5680. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5681. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5682. }
  5683. else
  5684. {
  5685. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5686. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
  5687. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
  5688. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
  5689. modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim();
  5690. modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
  5691. modelCst.Cst_CreateDatetime = StrTime;
  5692. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5693. }
  5694. }
  5695. }
  5696. #endregion
  5697. break;
  5698. case EnumPublic.ClientServiceTaskItem.选衣回访:
  5699. case EnumPublic.ClientServiceTaskItem.拍照回访:
  5700. case EnumPublic.ClientServiceTaskItem.选片回访:
  5701. case EnumPublic.ClientServiceTaskItem.看版回访:
  5702. case EnumPublic.ClientServiceTaskItem.取件回访:
  5703. case EnumPublic.ClientServiceTaskItem.服务回访:
  5704. case EnumPublic.ClientServiceTaskItem.已拍未选:
  5705. case EnumPublic.ClientServiceTaskItem.已修未选:
  5706. case EnumPublic.ClientServiceTaskItem.已设计未看:
  5707. case EnumPublic.ClientServiceTaskItem.部分回件未取:
  5708. case EnumPublic.ClientServiceTaskItem.全部回件未取:
  5709. case EnumPublic.ClientServiceTaskItem.已定未拍:
  5710. case EnumPublic.ClientServiceTaskItem.已拍未拍完:
  5711. case EnumPublic.ClientServiceTaskItem.选衣服客人:
  5712. case EnumPublic.ClientServiceTaskItem.拍照客人:
  5713. case EnumPublic.ClientServiceTaskItem.选片客人:
  5714. case EnumPublic.ClientServiceTaskItem.看版客人:
  5715. case EnumPublic.ClientServiceTaskItem.取件客人:
  5716. case EnumPublic.ClientServiceTaskItem.服务客人:
  5717. #region 按数码分
  5718. if ( StrWhere.Trim().Length > 0 )
  5719. {
  5720. 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];
  5721. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5722. {
  5723. DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim() + "'");
  5724. if ( dtRows.Length > 0 )
  5725. {
  5726. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5727. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5728. {
  5729. continue;
  5730. }
  5731. if ( StrUserName.Trim().Length > 0 )
  5732. {
  5733. 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 )
  5734. {
  5735. continue;
  5736. }
  5737. }
  5738. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5739. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5740. }
  5741. else
  5742. {
  5743. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5744. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
  5745. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
  5746. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim();
  5747. modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim();
  5748. modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
  5749. modelCst.Cst_CreateDatetime = StrTime;
  5750. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5751. }
  5752. }
  5753. }
  5754. #endregion
  5755. break;
  5756. case EnumPublic.ClientServiceTaskItem.摄控医院客人:
  5757. #region 摄控医院客人
  5758. if ( StrWhere.Trim().Length > 0 )
  5759. {
  5760. 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];
  5761. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5762. {
  5763. DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["ID"].ToString().Trim() + "'");
  5764. if ( dtRows.Length > 0 )
  5765. {
  5766. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5767. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5768. {
  5769. continue;
  5770. }
  5771. if ( StrUserName.Trim().Length > 0 )
  5772. {
  5773. 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 )
  5774. {
  5775. continue;
  5776. }
  5777. }
  5778. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5779. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5780. }
  5781. else
  5782. {
  5783. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5784. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5785. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5786. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["ID"].ToString().Trim();
  5787. modelCst.Cst_SightsName = "派单上门";
  5788. modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5789. modelCst.Cst_CreateDatetime = StrTime;
  5790. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5791. }
  5792. }
  5793. }
  5794. #endregion
  5795. break;
  5796. case EnumPublic.ClientServiceTaskItem.意向客户:
  5797. #region 意向客户
  5798. if ( StrWhere.Trim().Length > 0 )
  5799. {
  5800. 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];
  5801. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5802. {
  5803. DataRow[] dtRows = dt.Select("Cst_ClientGroupNumber = '" + dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["GM_CustomerID"].ToString().Trim() + "'");
  5804. if ( dtRows.Length > 0 )
  5805. {
  5806. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5807. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5808. {
  5809. continue;
  5810. }
  5811. if ( StrUserName.Trim().Length > 0 )
  5812. {
  5813. 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 )
  5814. {
  5815. continue;
  5816. }
  5817. }
  5818. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5819. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5820. }
  5821. else
  5822. {
  5823. string StrSightsName = "";
  5824. string StrShowOrdNumber = "";
  5825. if ( dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim().Length > 0 )
  5826. {
  5827. 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];
  5828. if ( dtOrder.Rows.Count > 0 )
  5829. {
  5830. StrShowOrdNumber = dtOrder.Rows[0]["Ord_SinceOrderNumber"].ToString().Trim();
  5831. for ( int j = 0; j < dtOrder.Rows.Count; j++ )
  5832. {
  5833. StrSightsName += dtOrder.Rows[0]["Ords_SightsName"].ToString().Trim() + ",";
  5834. }
  5835. }
  5836. }
  5837. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5838. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
  5839. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
  5840. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["GM_CustomerID"].ToString().Trim();
  5841. modelCst.Cst_SightsName = StrSightsName.TrimEnd(',');
  5842. modelCst.Cst_ShowOrderNumber = StrShowOrdNumber;
  5843. modelCst.Cst_CreateDatetime = StrTime;
  5844. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5845. }
  5846. }
  5847. }
  5848. #endregion
  5849. break;
  5850. case EnumPublic.ClientServiceTaskItem.医院意向:
  5851. case EnumPublic.ClientServiceTaskItem.孕妇周期:
  5852. #region 医院意向
  5853. if ( StrWhere.Trim().Length > 0 )
  5854. {
  5855. DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpHospitalClient", StrWhere: StrWhere, ShowColumnName: "Hct_Oddnumber,Hct_CustomerName,Hct_MyselfMobile").Tables[0];
  5856. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5857. {
  5858. DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "'");
  5859. if ( dtRows.Length > 0 )
  5860. {
  5861. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5862. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5863. {
  5864. continue;
  5865. }
  5866. if ( StrUserName.Trim().Length > 0 )
  5867. {
  5868. 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 )
  5869. {
  5870. continue;
  5871. }
  5872. }
  5873. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5874. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5875. }
  5876. else
  5877. {
  5878. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5879. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5880. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5881. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5882. modelCst.Cst_SightsName = "";
  5883. modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
  5884. modelCst.Cst_CreateDatetime = StrTime;
  5885. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5886. }
  5887. }
  5888. }
  5889. #endregion
  5890. break;
  5891. case EnumPublic.ClientServiceTaskItem.结婚客人:
  5892. case EnumPublic.ClientServiceTaskItem.结婚纪念日:
  5893. case EnumPublic.ClientServiceTaskItem.客户生日:
  5894. case EnumPublic.ClientServiceTaskItem.宝贝生日:
  5895. case EnumPublic.ClientServiceTaskItem.转介绍客户:
  5896. #region 结婚客人
  5897. if ( StrWhere.Trim().Length > 0 )
  5898. {
  5899. DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: StrWhere, ShowColumnName: "Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0];
  5900. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5901. {
  5902. DataRow[] dtRows = dt.Select("Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim() + "'");
  5903. if ( dtRows.Length > 0 )
  5904. {
  5905. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5906. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5907. {
  5908. continue;
  5909. }
  5910. if ( StrUserName.Trim().Length > 0 )
  5911. {
  5912. 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 )
  5913. {
  5914. continue;
  5915. }
  5916. }
  5917. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5918. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5919. }
  5920. else
  5921. {
  5922. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5923. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
  5924. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
  5925. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
  5926. modelCst.Cst_SightsName = "";
  5927. modelCst.Cst_ShowOrderNumber = "";
  5928. modelCst.Cst_CreateDatetime = StrTime;
  5929. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5930. }
  5931. }
  5932. }
  5933. #endregion
  5934. break;
  5935. case EnumPublic.ClientServiceTaskItem.会员积分:
  5936. #region 会员积分
  5937. if ( StrWhere.Trim().Length > 0 )
  5938. {
  5939. 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];
  5940. for ( int i = 0; i < dtClientGroup.Rows.Count; i++ )
  5941. {
  5942. DataRow[] dtRows = dt.Select("Cst_ClientGroupNumber = '" + dtClientGroup.Rows[i]["Mc_Number"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim() + "'");
  5943. if ( dtRows.Length > 0 )
  5944. {
  5945. string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
  5946. if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) )
  5947. {
  5948. continue;
  5949. }
  5950. if ( StrUserName.Trim().Length > 0 )
  5951. {
  5952. 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 )
  5953. {
  5954. continue;
  5955. }
  5956. }
  5957. modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
  5958. clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
  5959. }
  5960. else
  5961. {
  5962. modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
  5963. modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Mc_Number"].ToString().Trim();
  5964. modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
  5965. modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim();
  5966. modelCst.Cst_SightsName = "";
  5967. modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Mc_CradNumber"].ToString().Trim();
  5968. modelCst.Cst_CreateDatetime = StrTime;
  5969. clist.Add(cstbll.GetAddCommandInfo(modelCst));
  5970. }
  5971. }
  5972. }
  5973. #endregion
  5974. break;
  5975. }
  5976. #endregion
  5977. if ( clist.Count > 0 )
  5978. {
  5979. if ( MessageBoxCustom.Show("您确定要安排吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No )
  5980. {
  5981. return;
  5982. }
  5983. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0 )
  5984. {
  5985. MessageBoxCustom.Show("安排成功!");
  5986. }
  5987. else
  5988. {
  5989. MessageBoxCustom.Show("安排失败!");
  5990. }
  5991. }
  5992. else
  5993. {
  5994. MessageBoxCustom.Show("没有可以安排的数据!");
  5995. }
  5996. }
  5997. /// <summary>
  5998. /// 重新安排客户服务任务
  5999. /// </summary>
  6000. /// <param name="dtRow"></param>
  6001. /// <param name="StrTime"></param>
  6002. /// <param name="modelClientServiceTask"></param>
  6003. /// <returns></returns>
  6004. public static LYFZ.Model.Model_ErpClientServiceTask GetClientServiceUpdateModel( DataRow dtRow, DateTime StrTime, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask )
  6005. {
  6006. LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask();
  6007. LYFZ.Model.Model_ErpClientServiceTask modelCst = cstbll.DataRowToModel(dtRow);
  6008. modelCst.Cst_TaskTermTime = Convert.ToDateTime(modelClientServiceTask.StrDateTime);
  6009. modelCst.Cst_ServicePerson = modelClientServiceTask.StrUserID;
  6010. modelCst.Cst_TaskRemark = modelClientServiceTask.StrRemark;
  6011. modelCst.Cst_UpdateDateTime = StrTime;
  6012. modelCst.Cst_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  6013. return modelCst;
  6014. }
  6015. /// <summary>
  6016. /// 添加客户服务任务
  6017. /// </summary>
  6018. /// <param name="StrTime"></param>
  6019. /// <param name="StrMainNumber"></param>
  6020. /// <param name="StrViceNumber"></param>
  6021. /// <param name="StrThreeNumber"></param>
  6022. /// <param name="EnumTaskModule"></param>
  6023. /// <param name="modelClientServiceTask"></param>
  6024. /// <param name="ClientServiceAnPaiType"></param>
  6025. /// <returns></returns>
  6026. public static LYFZ.Model.Model_ErpClientServiceTask GetClientServiceAddModel( LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceAnPaiType )
  6027. {
  6028. LYFZ.Model.Model_ErpClientServiceTask modelCst = new Model.Model_ErpClientServiceTask();
  6029. modelCst.Cst_Number = "CST" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  6030. modelCst.Cst_TaskModule = EnumTaskModule.ToString().Trim();
  6031. modelCst.Cst_TaskItem = ClientServiceAnPaiType.ToString().Trim();
  6032. modelCst.Cst_TaskTermTime = Convert.ToDateTime(modelClientServiceTask.StrDateTime);
  6033. modelCst.Cst_ServicePerson = modelClientServiceTask.StrUserID;
  6034. modelCst.Cst_TaskRemark = modelClientServiceTask.StrRemark;
  6035. modelCst.Cst_CompletionIntStatus = 0;
  6036. modelCst.Cst_CompletionStatus = "未完成";
  6037. modelCst.Cst_CompletionRemark = "";
  6038. modelCst.Cst_CompletionPerson = "";
  6039. modelCst.Cst_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  6040. return modelCst;
  6041. }
  6042. #endregion
  6043. #region 相片查看输入密码认证
  6044. /// <summary>
  6045. ///
  6046. /// </summary>
  6047. /// <param name="StrViceNumber"></param>
  6048. /// <returns></returns>
  6049. public static bool IsEnterPassword( string StrViceNumber )
  6050. {
  6051. DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigital", StrWhere: "Ordv_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "Ordv_PhotoPassword").Tables[0];
  6052. if ( dt.Rows.Count > 0 )
  6053. {
  6054. if ( dt.Rows[0]["Ordv_PhotoPassword"].ToString().Trim().Length > 0 )
  6055. {
  6056. LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm frm = new MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm();
  6057. frm.StrWindowText = "请输入相片查看密码";
  6058. frm.ShowDialog();
  6059. if ( frm.IsSaveed )
  6060. {
  6061. if ( LYFZ.Command.Command_MD5.md5(frm.Pwd) == dt.Rows[0]["Ordv_PhotoPassword"].ToString().Trim() )
  6062. {
  6063. return true;
  6064. }
  6065. MessageBoxCustom.Show("密码输入错误!");
  6066. }
  6067. }
  6068. else
  6069. {
  6070. return true;
  6071. }
  6072. }
  6073. return false;
  6074. }
  6075. #endregion
  6076. /// <summary>
  6077. /// 财务(日、月、年)订单类型
  6078. /// </summary>
  6079. /// <param name="cmbtreev"></param>
  6080. public static void BindFinanceOrderType( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev )
  6081. {
  6082. Hashtable htData = new Hashtable();
  6083. htData["0"] = LYFZ.EnumPublic.OrderNumberPrefixType.婚纱订单.ToString().Trim();
  6084. htData["1"] = LYFZ.EnumPublic.OrderNumberPrefixType.儿童订单.ToString().Trim();
  6085. htData["2"] = LYFZ.EnumPublic.OrderNumberPrefixType.写真订单.ToString().Trim();
  6086. htData["3"] = LYFZ.EnumPublic.OrderNumberPrefixType.服务订单.ToString().Trim();
  6087. htData["4"] = LYFZ.EnumPublic.OrderNumberPrefixType.婚庆订单.ToString().Trim();
  6088. switch ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() )
  6089. {
  6090. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
  6091. htData.Remove("1");
  6092. break;
  6093. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
  6094. htData.Remove("0");
  6095. break;
  6096. }
  6097. if ( !LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition )
  6098. {
  6099. htData.Remove("2");
  6100. }
  6101. cmbtreev.SetTextAndTag_ValueNull();
  6102. cmbtreev.Nodes.Clear();
  6103. TreeNode root = null;
  6104. if ( htData.Count > 0 )
  6105. {
  6106. root = new TreeNode();
  6107. root.Text = " ";
  6108. root.Tag = "";
  6109. root.Name = "";
  6110. cmbtreev.Nodes.Add(root);
  6111. }
  6112. for ( int i = 0; i < 5; i++ )
  6113. {
  6114. if ( htData.ContainsKey("" + i + "") )
  6115. {
  6116. string StrValue = htData["" + i + ""].ToString().Trim();
  6117. root = new TreeNode();
  6118. root.Text = StrValue.Trim();
  6119. root.Tag = StrValue.Trim();
  6120. root.Name = StrValue.Trim();
  6121. cmbtreev.Nodes.Add(root);
  6122. }
  6123. }
  6124. cmbtreev.TagFindText("");
  6125. }
  6126. /// <summary>
  6127. /// 日财务报表双击查看详情
  6128. /// </summary>
  6129. /// <param name="StrID"></param>
  6130. /// <param name="StrType"></param>
  6131. public static void FinanceDayRowsDoubleClick( string StrID, string StrType )
  6132. {
  6133. switch ( StrType )
  6134. {
  6135. case "0":
  6136. case "1":
  6137. case "2":
  6138. case "3":
  6139. case "4":
  6140. LYFZ.Software.MainBusiness.StatisticalInquiry.MonthFinance.FinanceDayDetails frm = new StatisticalInquiry.MonthFinance.FinanceDayDetails();
  6141. frm.StrID = StrID;
  6142. frm.ShowDialog();
  6143. break;
  6144. default:
  6145. break;
  6146. }
  6147. }
  6148. /// <summary>
  6149. /// ListView控件绘制列表单双行
  6150. /// </summary>
  6151. /// <param name="ProcessType"></param>
  6152. public static void ListViewDrawSingleOrDoubleRows( ListViewEx ltView )
  6153. {
  6154. int IntCount = 0;
  6155. if ( ltView.Groups.Count > 0 && ltView.ShowGroups )
  6156. {
  6157. for ( int i = 0; i < ltView.Groups.Count; i++ )
  6158. {
  6159. for ( int j = 0; j < ltView.Groups[i].Items.Count; j++ )
  6160. {
  6161. if ( (IntCount % 2) > 0 )
  6162. {
  6163. ltView.Groups[i].Items[j].BackColor = System.Drawing.Color.PapayaWhip;
  6164. }
  6165. else
  6166. {
  6167. ltView.Groups[i].Items[j].BackColor = System.Drawing.Color.PowderBlue;
  6168. }
  6169. IntCount++;
  6170. }
  6171. }
  6172. }
  6173. else
  6174. {
  6175. for ( int j = 0; j < ltView.Items.Count; j++ )
  6176. {
  6177. if ( (IntCount % 2) > 0 )
  6178. {
  6179. ltView.Items[j].BackColor = System.Drawing.Color.PapayaWhip;
  6180. }
  6181. else
  6182. {
  6183. ltView.Items[j].BackColor = System.Drawing.Color.PowderBlue;
  6184. }
  6185. IntCount++;
  6186. }
  6187. }
  6188. }
  6189. /// <summary>
  6190. /// DataGridView设置列标题显示隐藏字段
  6191. /// </summary>
  6192. /// <param name="sender"></param>
  6193. /// <param name="StrEnabled"></param>
  6194. /// <returns></returns>
  6195. public static bool ShowDataGridViewSetColumn( object sender, string StrEnabled = "" )
  6196. {
  6197. DataGridViewEc dgvNewData = (DataGridViewEc)sender;
  6198. if ( !string.IsNullOrEmpty(dgvNewData.dgvGuidName) && dgvNewData.AllowUserToOrderColumns )
  6199. {
  6200. LYFZ.ComponentLibrary.DataGridViewSetColumn frm = new DataGridViewSetColumn();
  6201. frm.dgvNewData = dgvNewData;
  6202. frm.listEnabled = new List<string>(StrEnabled.Trim().Split(','));
  6203. frm.ShowDialog();
  6204. return frm.IsSaveed;
  6205. }
  6206. return false;
  6207. }
  6208. /// <summary>
  6209. /// 获取订单的人员所相关的数据
  6210. /// </summary>
  6211. /// <param name="StrOrdNumber"></param>
  6212. /// <param name="StrType"></param>
  6213. /// <returns></returns>
  6214. public static Hashtable GetOrderExtractIntoItemHashtable( string StrOrdNumber, string StrOrdViceNumber, string StrType )
  6215. {
  6216. Hashtable htData = new Hashtable();
  6217. htData["StrOrdNumber"] = StrOrdNumber;
  6218. htData["StrOrdViceNumber"] = StrOrdViceNumber;
  6219. htData["StrType"] = StrType;
  6220. htData["tblDepartment"] = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_Department;
  6221. htData["tblUser"] = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: true, IsShowAdmin: false);// LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_User;
  6222. htData["StrUsrID"] = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  6223. return htData;
  6224. }
  6225. 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 )
  6226. {
  6227. if ( tbl == null )
  6228. {
  6229. tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0];
  6230. }
  6231. if ( IsClearNodes )
  6232. {
  6233. cmbtreev.Nodes.Clear();
  6234. }
  6235. DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'");
  6236. if ( dtRow.Length > 0 )
  6237. {
  6238. TreeNode root = null;
  6239. if ( IsBindParent )
  6240. {
  6241. root = new TreeNode();
  6242. root.Text = dtRow[0]["Sc_ClassName"].ToString();
  6243. root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
  6244. root.Name = dtRow[0]["ID"].ToString().Trim();
  6245. CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
  6246. cmbtreev.Nodes.Add(root);
  6247. }
  6248. else
  6249. {
  6250. DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'");
  6251. if ( dtRow2.Length > 0 )
  6252. {
  6253. for ( int i = 0; i < dtRow2.Length; i++ )
  6254. {
  6255. if ( i == 0 )
  6256. {
  6257. if ( IsFirstNodeNull )
  6258. {
  6259. root = new TreeNode();
  6260. root.Text = IsFirstNodeName;
  6261. root.Tag = "";
  6262. root.Name = "";
  6263. cmbtreev.Nodes.Add(root);
  6264. }
  6265. }
  6266. root = new TreeNode();
  6267. root.Text = dtRow2[i]["Sc_ClassName"].ToString();
  6268. root.Tag = dtRow2[i]["Sc_ClassCode"].ToString();
  6269. root.Name = dtRow2[i]["ID"].ToString();
  6270. CreateTreeViewSystemCategory(root, dtRow2[i]["ID"].ToString(), tbl);
  6271. cmbtreev.Nodes.Add(root);
  6272. }
  6273. }
  6274. else
  6275. {
  6276. root = new TreeNode();
  6277. root.Text = dtRow[0]["Sc_ClassName"].ToString();
  6278. root.Tag = dtRow[0]["Sc_ClassCode"].ToString();
  6279. root.Name = dtRow[0]["ID"].ToString().Trim();
  6280. CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl);
  6281. cmbtreev.Nodes.Add(root);
  6282. }
  6283. }
  6284. }
  6285. }
  6286. }
  6287. /// <summary>
  6288. /// DatatTable处理
  6289. /// </summary>
  6290. public class PublicGetVersionDataTable
  6291. {
  6292. static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  6293. /// <summary>
  6294. /// 获取用户数据
  6295. /// </summary>
  6296. /// <param name="IsShowResign">是否显示离职人员</param>
  6297. /// <param name="IsShowAdmin">是否显示Admin帐号</param>
  6298. /// <returns></returns>
  6299. public static DataTable GetUserTable( bool IsShowResign = true, bool IsShowAdmin = false )
  6300. {
  6301. string StrWhere = "";
  6302. if ( !IsShowResign )
  6303. {
  6304. StrWhere = "User_Status != '离职'";
  6305. }
  6306. if ( !IsShowAdmin )
  6307. {
  6308. if ( StrWhere != "" )
  6309. {
  6310. StrWhere += " And ";
  6311. }
  6312. StrWhere += "User_Account != 'admin'";
  6313. }
  6314. return orbll.GetView_Custom("tb_ErpUser", StrWhere: StrWhere, ShowColumnName: "User_Account,User_Name,User_EmployeeID,User_Department,User_Status,User_DividedShop").Tables[0];
  6315. }
  6316. }
  6317. /// <summary>
  6318. /// 处理数据库数据
  6319. /// </summary>
  6320. public static class PublicGetTableName
  6321. {
  6322. /// <summary>
  6323. /// 获取客户数据
  6324. /// </summary>
  6325. /// <param name="tbl_Client"></param>
  6326. /// <param name="ArrayClient"></param>
  6327. /// <param name="StrOrdType"></param>
  6328. /// <returns></returns>
  6329. public static Hashtable GetClientData( DataTable tbl_Client, string[] ArrayClient, string StrOrdType )
  6330. {
  6331. Hashtable htData = new Hashtable();
  6332. htData["strManName"] = "";
  6333. htData["strManPhone"] = "";
  6334. htData["strManSex"] = "";
  6335. htData["strWoManName"] = "";
  6336. htData["strWoManPhone"] = "";
  6337. htData["strWoManSex"] = "";
  6338. for ( int i = 0; i < ArrayClient.Length; i++ )
  6339. {
  6340. if ( !string.IsNullOrEmpty(ArrayClient[i].Trim()) )
  6341. {
  6342. DataRow dtRow = tbl_Client.Rows.Find(ArrayClient[i]);
  6343. if ( StrOrdType == "1" )
  6344. {
  6345. if ( i > 1 )
  6346. {
  6347. break;
  6348. }
  6349. if ( i == 0 )
  6350. {
  6351. htData["strManName"] = dtRow["Cus_Name"].ToString().Trim();
  6352. htData["strManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
  6353. htData["strManSex"] = Convert.ToBoolean(dtRow["Cus_Sex"]) ? "女" : "男";
  6354. }
  6355. else
  6356. {
  6357. htData["strWoManName"] = dtRow["Cus_Name"].ToString().Trim();
  6358. htData["strWoManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
  6359. htData["strWoManSex"] = Convert.ToBoolean(dtRow["Cus_Sex"]) ? "女" : "男";
  6360. }
  6361. }
  6362. else
  6363. {
  6364. if ( StrOrdType == "2" || StrOrdType == "3" )
  6365. {
  6366. if ( i > 0 )
  6367. {
  6368. break;
  6369. }
  6370. }
  6371. if ( !Convert.ToBoolean(dtRow["Cus_Sex"]) )
  6372. {
  6373. htData["strManName"] = dtRow["Cus_Name"].ToString().Trim();
  6374. htData["strManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
  6375. htData["strManSex"] = "男";
  6376. }
  6377. else
  6378. {
  6379. htData["strWoManName"] = dtRow["Cus_Name"].ToString().Trim();
  6380. htData["strWoManPhone"] = dtRow["Cus_Telephone"].ToString().Trim();
  6381. htData["strWoManSex"] = "女";
  6382. }
  6383. }
  6384. }
  6385. }
  6386. return htData;
  6387. }
  6388. /// <summary>
  6389. /// 获取景点数据
  6390. /// </summary>
  6391. /// <param name="tbl_Sights"></param>
  6392. /// <param name="StrViceNumber"></param>
  6393. /// <param name="StrOrdType"></param>
  6394. /// <returns></returns>
  6395. public static Hashtable GetSightsData( DataTable tbl_Sights, string StrViceNumber, string StrOrdType )
  6396. {
  6397. Hashtable htData = new Hashtable();
  6398. int NotCount = 0;
  6399. int OkCount = 0;
  6400. int InCount = 0;
  6401. htData["Ordpg_Sights"] = "";
  6402. htData["Ordpg_Photographer"] = "";
  6403. htData["Ordpg_MakeupArtist"] = "";
  6404. htData["Ordpg_PhotographyTimeStart"] = "";
  6405. htData["Ordpg_PhotographyTimeEnd"] = "";
  6406. htData["Ordpg_PhotographyStatus"] = "";
  6407. for ( int i = 0; i < tbl_Sights.Rows.Count; i++ )
  6408. {
  6409. if ( tbl_Sights.Rows[i]["Ordpg_ViceNumber"].ToString().Trim() == StrViceNumber )
  6410. {
  6411. try
  6412. {
  6413. if ( tbl_Sights.Rows[i]["Ordpg_Sights"].ToString().Trim() != "" )
  6414. {
  6415. if ( StrOrdType == "1" )
  6416. {
  6417. htData["Ordpg_Sights"] = tbl_Sights.Rows[i]["Ordpg_Sights"].ToString().Trim();
  6418. }
  6419. }
  6420. }
  6421. catch { }
  6422. try
  6423. {
  6424. if ( tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim() != "" )
  6425. {
  6426. if ( htData["Ordpg_Photographer"].ToString().Trim() == "" )
  6427. {
  6428. htData["Ordpg_Photographer"] += tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim();
  6429. }
  6430. else
  6431. {
  6432. htData["Ordpg_Photographer"] += "," + tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim();
  6433. }
  6434. }
  6435. }
  6436. catch { }
  6437. try
  6438. {
  6439. if ( tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim() != "" )
  6440. {
  6441. if ( htData["Ordpg_MakeupArtist"].ToString().Trim() == "" )
  6442. {
  6443. htData["Ordpg_MakeupArtist"] += tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim();
  6444. }
  6445. else
  6446. {
  6447. htData[".Ordpg_MakeupArtist"] += "," + tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim();
  6448. }
  6449. }
  6450. //开始拍摄日期
  6451. if ( tbl_Sights.Rows[i]["Ordpg_PhotographyTime"].ToString().Trim() != "" )
  6452. {
  6453. if ( htData["Ordpg_PhotographyTimeStart"].ToString().Trim() == "" )
  6454. {
  6455. htData["Ordpg_PhotographyTimeStart"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
  6456. }
  6457. else
  6458. {
  6459. if ( Convert.ToDateTime(htData["Ordpg_PhotographyTimeStart"]) > Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]) )
  6460. {
  6461. htData["Ordpg_PhotographyTimeStart"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
  6462. }
  6463. }
  6464. }
  6465. }
  6466. catch { }
  6467. try
  6468. {
  6469. //最后拍摄日期
  6470. if ( tbl_Sights.Rows[i]["Ordpg_PhotographyTime"].ToString().Trim() != "" )
  6471. {
  6472. if ( htData["Ordpg_PhotographyTimeEnd"].ToString().Trim() == "" )
  6473. {
  6474. htData["Ordpg_PhotographyTimeEnd"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
  6475. }
  6476. else
  6477. {
  6478. if ( Convert.ToDateTime(htData["Ordpg_PhotographyTimeEnd"]) < Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]) )
  6479. {
  6480. htData["Ordpg_PhotographyTimeEnd"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd");
  6481. }
  6482. }
  6483. }
  6484. }
  6485. catch { }
  6486. try
  6487. {
  6488. if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "0" )
  6489. {
  6490. NotCount++;
  6491. }
  6492. if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "1" )
  6493. {
  6494. OkCount++;
  6495. }
  6496. if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "2" )
  6497. {
  6498. InCount++;
  6499. }
  6500. }
  6501. catch { }
  6502. }
  6503. }
  6504. if ( NotCount > 0 && OkCount == 0 )
  6505. {
  6506. htData["Ordpg_PhotographyStatus"] = "未拍";
  6507. }
  6508. else if ( NotCount > 0 && OkCount > 0 )
  6509. {
  6510. htData["Ordpg_PhotographyStatus"] = "拍摄中";
  6511. }
  6512. else if ( NotCount == 0 && OkCount > 0 )
  6513. {
  6514. htData["Ordpg_PhotographyStatus"] = "OK";
  6515. }
  6516. if ( InCount > 0 )
  6517. {
  6518. htData["Ordpg_PhotographyStatus"] = "拍摄中";
  6519. }
  6520. return htData;
  6521. }
  6522. }
  6523. /// <summary>
  6524. /// 项
  6525. /// </summary>
  6526. public class ListItem
  6527. {
  6528. /// <summary>
  6529. /// 显示的文本
  6530. /// </summary>
  6531. public string StrText
  6532. {
  6533. get; set;
  6534. }
  6535. /// <summary>
  6536. /// 隐藏的值
  6537. /// </summary>
  6538. public object StrValue
  6539. {
  6540. get; set;
  6541. }
  6542. /// <summary>
  6543. ///
  6544. /// </summary>
  6545. /// <param name="strKey">要显示在页面的值</param>
  6546. /// <param name="strValue">隐藏的值</param>
  6547. public ListItem( string strText, object strValue )
  6548. {
  6549. this.StrText = strText;
  6550. this.StrValue = strValue;
  6551. }
  6552. public override string ToString()
  6553. {
  6554. return this.StrText;
  6555. }
  6556. /// <summary>
  6557. /// 根据ListItem中的Value找到特定的ListItem(仅在ComboBox的Item都为ListItem时有效)
  6558. /// </summary>
  6559. /// <param name="cmb">要查找的ComboBox</param>
  6560. /// <param name="strValue">要查找ListItem的Value</param>
  6561. /// <returns>返回传入的ComboBox中符合条件的第一个ListItem,如果没有找到则返回null.</returns>
  6562. public static ListItem ValueFindByText( ComboBoxEx cmb, string strValue )
  6563. {
  6564. foreach ( ListItem li in cmb.Items )
  6565. {
  6566. if ( li.StrValue.ToString().Trim() == strValue )
  6567. {
  6568. return li;
  6569. }
  6570. }
  6571. return null;
  6572. }
  6573. /// <summary>
  6574. /// 根据ListItem中的Key找到特定的ListItem(仅在ComboBox的Item都为ListItem时有效)
  6575. /// </summary>
  6576. /// <param name="cmb">要查找的ComboBox</param>
  6577. /// <param name="strValue">要查找ListItem的Key</param>
  6578. /// <returns>返回传入的ComboBox中符合条件的第一个ListItem,如果没有找到则返回null.</returns>
  6579. public static ListItem TextFindByValue( ComboBoxEx cmb, string strText )
  6580. {
  6581. foreach ( ListItem li in cmb.Items )
  6582. {
  6583. if ( li.StrText.ToString().Trim() == strText )
  6584. {
  6585. return li;
  6586. }
  6587. }
  6588. return null;
  6589. }
  6590. }
  6591. }