ChoosePhotoSkin2.cpp 129 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220
  1. // ChoosePhotoSkin2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ChoosePhotoSkin2.h"
  5. #include "YLGL.h"
  6. #include "./helper/ffsco.h"
  7. #include ".\MenuBarXP\MenuXP.h"
  8. #include "ChoosePhotoSkin3.h"
  9. #include "ShowPic22.h"
  10. #include "ClientRequirement.h"
  11. #include "MyLock.h"
  12. #include "Time5.h"
  13. #include "ComparePhoto.h"
  14. #include "ReplaceDesignNo.h"
  15. #include "Login2.h"
  16. #include "TimeOutDlg.h"
  17. #include "ShowEffect.h"
  18. #include "SelBrunDevice.h"
  19. #include "ProductChooseFilter.h"
  20. #define THUMBNAIL_WIDTH 100
  21. #define THUMBNAIL_HEIGHT 90
  22. extern HCURSOR g_cursorhand;
  23. //mode
  24. //0 全部
  25. //1 选中
  26. //2 未选
  27. //3 删除
  28. //4 入册
  29. //5 入底
  30. /////////////////////////////////////////////////////////////////////////////
  31. // ChoosePhotoSkin2 dialog IDC_EDITzs
  32. ChoosePhotoSkin2::ChoosePhotoSkin2(CWnd* pParent /*=NULL*/) : CDialog(ChoosePhotoSkin2::IDD, pParent)
  33. {
  34. m_pBk = NULL;
  35. m_pParent = NULL;
  36. m_name1 = _T("");
  37. m_name2 = _T("");
  38. m_time4 = g_date;
  39. m_waiter3 = _T("");
  40. m_takezs = _T("");
  41. m_taoxizs = _T("");
  42. m_choosezs = _T("");
  43. m_strOrderNumber = _T("");
  44. m_money3 = _T("");
  45. m_bz3 = _T("");
  46. //}}AFX_DATA_INIT
  47. m_bTerminate = false;
  48. m_bRunning = false;
  49. m_hThread = NULL;
  50. m_bSave = 0;
  51. m_bModify = 0;
  52. m_mode = 0;
  53. m_showpichwd = NULL;
  54. m_mode2 = 0;
  55. g_pMainWnd->GetSkin();
  56. m_bSort = 0;
  57. m_bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(59));
  58. m_pArray = NULL;
  59. m_bShowTimeOut = 1;
  60. m_bCanSave = 1;
  61. m_bGrowthTX = 0;
  62. m_nChoosePhotoType = 0;
  63. m_bChooseBig = 0;
  64. m_bFromLocal = 0;
  65. m_strStatusOfChoosePhoto = "未选";
  66. }
  67. ChoosePhotoSkin2::ChoosePhotoSkin2(DWORD id, CWnd* pParent) : CDialog(id, pParent)
  68. {
  69. m_pBk = NULL;
  70. m_pParent = NULL;
  71. }
  72. void ChoosePhotoSkin2::DoDataExchange(CDataExchange* pDX)
  73. {
  74. CDialog::DoDataExchange(pDX);
  75. //{{AFX_DATA_MAP(ChoosePhotoSkin2)
  76. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  77. DDX_Control(pDX, IDC_EDITzs3, m_editnum4);
  78. DDX_Control(pDX, IDC_EDITzs2, m_editnum3);
  79. DDX_Control(pDX, IDC_EDITzs, m_editnum2);
  80. DDX_Control(pDX, IDC_EDITmoney3, m_editnum1);
  81. DDX_Control(pDX, IDC_LIST3, m_List3);
  82. DDX_Control(pDX, IDC_LIST2, m_List2);
  83. DDX_Control(pDX, IDC_LIST1, m_List1);
  84. DDX_Text(pDX, IDC_EDITname1, m_name1);
  85. DDX_Text(pDX, IDC_EDITname2, m_name2);
  86. DDX_Text(pDX, IDC_EDITtime4, m_time4);
  87. DDX_Text(pDX, IDC_EDITwaiter3, m_waiter3);
  88. DDX_Text(pDX, IDC_EDITzs, m_takezs);
  89. DDX_Text(pDX, IDC_EDITzs2, m_taoxizs);
  90. DDX_Text(pDX, IDC_EDITzs3, m_choosezs);
  91. DDX_Text(pDX, IDC_EDITmoney3, m_money3);
  92. DDX_Text(pDX, IDC_EDITid, m_strOrderNumber);
  93. DDX_Text(pDX, IDC_EDITbz3, m_bz3);
  94. //}}AFX_DATA_MAP}
  95. }
  96. BEGIN_MESSAGE_MAP(ChoosePhotoSkin2, CDialog)
  97. //{{AFX_MSG_MAP(ChoosePhotoSkin2)
  98. ON_WM_PAINT()
  99. ON_WM_DESTROY()
  100. ON_WM_ERASEBKGND()
  101. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  102. ON_WM_CLOSE()
  103. ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
  104. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  105. ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
  106. ON_WM_TIMER()
  107. //}}AFX_MSG_MAP
  108. ON_MESSAGE(WM_USER + 1101, OnBtnClick)
  109. ON_COMMAND_RANGE(IDM_MENUsp1 - 1, IDM_MENUsp1 + 200, OnCommandMenu)
  110. ON_MESSAGE(WM_USER + 200, UpdateTakeZS)
  111. END_MESSAGE_MAP()
  112. /////////////////////////////////////////////////////////////////////////////
  113. // ChoosePhotoSkin2 message handlers
  114. extern void SizeToContent(HWND hwnd, Image *img);
  115. #ifdef VC_60
  116. void ChoosePhotoSkin2::OnBtnClick(WPARAM wParam, LPARAM lParam)
  117. {
  118. // WM_USER + 1101
  119. // F5按键,显示删除相片
  120. int id = lParam;
  121. id -= 99;
  122. switch (id)
  123. {
  124. case 1: // 查看全部相片按钮事件;
  125. case 2: // 查看选中的相片按钮事件;
  126. case 4: // F5查看删除的相片;
  127. if (m_mode == id - 1 && m_mode != 1)return;
  128. m_mode = id - 1;
  129. LoadPhotos();
  130. break;
  131. case 3://查看未选按钮事件;
  132. if (m_mode == id - 1)return;
  133. m_sChooseFilter = "";
  134. UpdateChooseZS();
  135. GetNoSelPhoto();
  136. m_mode = id - 1;
  137. LoadPhotos();
  138. break;
  139. case 13: // 查看入册相片按钮事件;
  140. GetAlbumPhoto();
  141. break;
  142. case 14: // 查看入底相片按钮事件;
  143. GetDiskPhoto();
  144. break;
  145. case 15: // 效果图按钮事件;
  146. {
  147. ShowEffectDlg dlg;
  148. dlg.m_pPhotopatharray = this->GetCurArray();
  149. dlg.DoModal();
  150. }
  151. break;
  152. case 5: // 保存按钮事件;
  153. OnButton4();
  154. break;
  155. case 9:
  156. {
  157. if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  158. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
  159. else
  160. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
  161. ReLoadPhoto();
  162. /* if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return ;
  163. CString sql;
  164. sql="update dindansp set [no2]='' where [id]='"+m_strOrderNumber+"'";
  165. g_sendhead.bsql=1;
  166. g_pMainWnd->ProcessChatMessageRequest2(sql);
  167. if(g_bSendOK==0)return;
  168. CString path=m_path;
  169. path.TrimRight ('\\');
  170. DeleteDirectory(path);
  171. GetPhotos();
  172. LoadPhotos();*/
  173. }
  174. break;
  175. case 10:
  176. {
  177. POSITION pos;
  178. pos = m_List1.GetFirstSelectedItemPosition();
  179. if (pos == NULL)
  180. {
  181. AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
  182. return;
  183. }
  184. if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
  185. while (pos)
  186. {
  187. int iItem = m_List1.GetNextSelectedItem(pos);
  188. CString title = m_List1.GetItemText(iItem, 0);
  189. int pos = title.Find("\r\n");
  190. if (pos != -1)title = title.Left(pos);
  191. if (m_mode2 == 1)//看设计
  192. {
  193. if (title.Find("Flash") != -1)
  194. {
  195. title.Replace("Flash", "delgabook");
  196. CString str = m_path + title;
  197. DeleteDirectory(str);
  198. GetPhotos();
  199. LoadPhotos();
  200. return;
  201. }
  202. }
  203. ::DeleteFile(m_path + title + ".jpg");
  204. ::DeleteFile(m_path + "s" + title + ".jpg");
  205. ////////////////
  206. CStringArray *pArray = GetCurArray();
  207. CString path = pArray->ElementAt(iItem);
  208. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  209. path = path.Left(path.ReverseFind('.'));
  210. if (CheckName(path))
  211. {
  212. path = "," + path + ",";
  213. for (int i = 0; i < m_List2.GetItemCount(); i++)
  214. {
  215. CString no = m_noarray.ElementAt(i);
  216. if (no.Find(path) != -1)
  217. {
  218. path.TrimRight(",");
  219. no.Delete(no.Find(path), path.GetLength());
  220. no.TrimLeft(","); no.TrimRight(",");
  221. m_List2.SetItemText(i, 4, no);
  222. no = "," + no + ",";
  223. m_noarray.SetAt(i, no);
  224. }
  225. }
  226. }
  227. }
  228. GetPhotos();
  229. LoadPhotos();
  230. }
  231. break;
  232. case 6: // 关闭按钮事件 ;
  233. if (m_bModify && m_bCanSave)
  234. {
  235. if (AfxMessageBox("提醒, 选片修改未保存, 是否保存后再退出?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  236. {
  237. OnButton4();
  238. if (m_bSaveFail)
  239. {
  240. AfxMessageBox("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!");
  241. CDialog::OnCancel(); return;
  242. }
  243. return;
  244. }
  245. else
  246. {
  247. CString savepath;
  248. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  249. if (m_mode2)savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  250. ::DeleteFile(savepath);
  251. }
  252. }
  253. CDialog::OnCancel();
  254. break;
  255. case 11:
  256. if (m_selphotownd.GetSafeHwnd() == NULL)
  257. {
  258. m_selphotownd.m_id = m_strOrderNumber;
  259. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  260. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  261. }
  262. m_selphotownd.ShowWindow(1);
  263. break;
  264. case 12:
  265. if (m_mode2)
  266. {
  267. ReplaceDesignNo dlg;
  268. dlg.m_id = this->m_strOrderNumber;
  269. dlg.DoModal();
  270. }
  271. /* if(m_selphotownd2.GetSafeHwnd ()==NULL)
  272. {
  273. m_selphotownd2.m_id=m_id;
  274. m_selphotownd2.m_rc=m_rcarray.ElementAt (6);
  275. m_selphotownd2.Create (IDD_DLGShowSelPhoto2, this);
  276. }
  277. m_selphotownd2.ShowWindow (1);*/
  278. break;
  279. }
  280. }
  281. #else
  282. LRESULT ChoosePhotoSkin2::OnBtnClick(WPARAM wParam, LPARAM lParam)
  283. {
  284. // WM_USER + 1101
  285. // F5按键,显示删除相片
  286. int id = lParam;
  287. id -= 99;
  288. switch (id)
  289. {
  290. case 1: // 查看全部相片按钮事件;
  291. case 2: // 查看选中的相片按钮事件;
  292. case 4: // F5查看删除的相片;
  293. if (m_mode == id - 1 && m_mode != 1)
  294. return 0;
  295. m_mode = id - 1;
  296. LoadPhotos();
  297. break;
  298. case 3://查看未选按钮事件;
  299. if (m_mode == id - 1)
  300. return 0;
  301. m_sChooseFilter = "";
  302. UpdateChooseZS();
  303. GetNoSelPhoto();
  304. m_mode = id - 1;
  305. LoadPhotos();
  306. break;
  307. case 13: // 查看入册相片按钮事件;
  308. GetAlbumPhoto();
  309. break;
  310. case 14: // 查看入底相片按钮事件;
  311. GetDiskPhoto();
  312. break;
  313. case 15: // 效果图按钮事件;
  314. {
  315. ShowEffectDlg dlg;
  316. dlg.m_pPhotopatharray = this->GetCurArray();
  317. dlg.DoModal();
  318. }
  319. break;
  320. case 5: // 保存按钮事件;
  321. OnButton4();
  322. break;
  323. case 9:
  324. {
  325. if (((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  326. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(0);
  327. else
  328. ((MyBmpButton2*)m_picarray.ElementAt(8))->SetPushDown(1);
  329. ReLoadPhoto();
  330. /* if(AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return ;
  331. CString sql;
  332. sql="update dindansp set [no2]='' where [id]='"+m_strOrderNumber+"'";
  333. g_sendhead.bsql=1;
  334. g_pMainWnd->ProcessChatMessageRequest2(sql);
  335. if(g_bSendOK==0)return;
  336. CString path=m_path;
  337. path.TrimRight ('\\');
  338. DeleteDirectory(path);
  339. GetPhotos();
  340. LoadPhotos();*/
  341. }
  342. break;
  343. case 10:
  344. {
  345. POSITION pos;
  346. pos = m_List1.GetFirstSelectedItemPosition();
  347. if (pos == NULL)
  348. {
  349. AfxMessageBox("请先选中您要删除的照片!", MB_ICONINFORMATION);
  350. return 0;
  351. }
  352. if (AfxMessageBox("删除后将无法恢复, 确认删除吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return 0;
  353. while (pos)
  354. {
  355. int iItem = m_List1.GetNextSelectedItem(pos);
  356. CString title = m_List1.GetItemText(iItem, 0);
  357. int pos = title.Find("\r\n");
  358. if (pos != -1)title = title.Left(pos);
  359. if (m_mode2 == 1)//看设计
  360. {
  361. if (title.Find("Flash") != -1)
  362. {
  363. title.Replace("Flash", "delgabook");
  364. CString str = m_path + title;
  365. DeleteDirectory(str);
  366. GetPhotos();
  367. LoadPhotos();
  368. return 0;
  369. }
  370. }
  371. ::DeleteFile(m_path + title + ".jpg");
  372. ::DeleteFile(m_path + "s" + title + ".jpg");
  373. ////////////////
  374. CStringArray *pArray = GetCurArray();
  375. CString path = pArray->ElementAt(iItem);
  376. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  377. path = path.Left(path.ReverseFind('.'));
  378. if (CheckName(path))
  379. {
  380. path = "," + path + ",";
  381. for (int i = 0; i < m_List2.GetItemCount(); i++)
  382. {
  383. CString no = m_noarray.ElementAt(i);
  384. if (no.Find(path) != -1)
  385. {
  386. path.TrimRight(",");
  387. no.Delete(no.Find(path), path.GetLength());
  388. no.TrimLeft(","); no.TrimRight(",");
  389. m_List2.SetItemText(i, 4, no);
  390. no = "," + no + ",";
  391. m_noarray.SetAt(i, no);
  392. }
  393. }
  394. }
  395. }
  396. GetPhotos();
  397. LoadPhotos();
  398. }
  399. break;
  400. case 6: // 关闭按钮事件 ;
  401. if (m_bModify && m_bCanSave)
  402. {
  403. if (AfxMessageBox("提醒, 选片修改未保存, 是否保存后再退出?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  404. {
  405. OnButton4();
  406. if (m_bSaveFail)
  407. {
  408. AfxMessageBox("连接服务器失败, 保存失败, 您可以在本机上重新进入选片恢复到选中状态!");
  409. CDialog::OnCancel(); return 0;
  410. }
  411. return 0;
  412. }
  413. else
  414. {
  415. CString savepath;
  416. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  417. if (m_mode2)savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  418. ::DeleteFile(savepath);
  419. }
  420. }
  421. CDialog::OnCancel();
  422. break;
  423. case 11:
  424. if (m_selphotownd.GetSafeHwnd() == NULL)
  425. {
  426. m_selphotownd.m_id = m_strOrderNumber;
  427. m_selphotownd.m_rc = m_rcarray.ElementAt(6);
  428. m_selphotownd.Create(IDD_DLGShowSelPhoto, this);
  429. }
  430. m_selphotownd.ShowWindow(1);
  431. break;
  432. case 12:
  433. if (m_mode2)
  434. {
  435. ReplaceDesignNo dlg;
  436. dlg.m_id = this->m_strOrderNumber;
  437. dlg.DoModal();
  438. }
  439. /* if(m_selphotownd2.GetSafeHwnd ()==NULL)
  440. {
  441. m_selphotownd2.m_id=m_id;
  442. m_selphotownd2.m_rc=m_rcarray.ElementAt (6);
  443. m_selphotownd2.Create (IDD_DLGShowSelPhoto2, this);
  444. }
  445. m_selphotownd2.ShowWindow (1);*/
  446. break;
  447. }
  448. return 0;
  449. }
  450. #endif
  451. BOOL ChoosePhotoSkin2::OnInitDialog() //初始化选片*看设计
  452. {
  453. CDialog::OnInitDialog();
  454. #if 1
  455. g_bInSkin = 1;
  456. m_ticks = ::GetTickCount();
  457. if (g_cursorhand == NULL)
  458. g_cursorhand = AfxGetApp()->LoadCursor(IDC_CURSORHAND);
  459. BYTE *pData = NULL;
  460. BYTE *pDataBegin;
  461. //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
  462. if (!LoadLia(g_mainpath + "\\skin\\" + m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
  463. {
  464. EndDialog(0);
  465. return false;
  466. }
  467. //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
  468. for (int i = 0; i < g_resdata2.nPicCount; i++)
  469. {
  470. g_resdata2.rect[i].left *= g_fscalex;
  471. g_resdata2.rect[i].right *= g_fscalex;
  472. g_resdata2.rect[i].top *= g_fscaley;
  473. g_resdata2.rect[i].bottom *= g_fscaley;
  474. if (i == 8)
  475. g_resdata2.rect[i] = g_resdata2.rect[2];
  476. else if (i == 9)
  477. g_resdata2.rect[i] = g_resdata2.rect[3];
  478. else if (i == 10)
  479. g_resdata2.rect[i] = g_resdata2.rect[1];
  480. if (g_resdata2.nPicBmpCount[i])
  481. {
  482. MyBmpButton2 *pic = new MyBmpButton2;
  483. m_picarray.Add((DWORD)pic);
  484. CRect rc = g_resdata2.rect[i];
  485. CString str;
  486. str.Format(_T("%d"), i + 1);
  487. pic->Create(str, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rc, this, i + 100);
  488. pic->m_bmpcount = g_resdata2.nPicBmpCount[i];
  489. pic->ReadBmp(&pData, NULL, this);
  490. #ifdef SZWNS_VERSION
  491. if(i==3 && m_mode2==0)
  492. {
  493. Image *img=NULL;
  494. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG") );
  495. delete pic->m_bmp;
  496. pic->m_bmp=img->Clone();
  497. delete img;
  498. img=NULL;
  499. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG") );
  500. delete pic->m_bmpfocus;
  501. pic->m_bmpfocus=img->Clone();
  502. delete img;
  503. img=NULL;
  504. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG") );
  505. delete pic->m_bmpfocused;
  506. pic->m_bmpfocused=img->Clone();
  507. delete img;
  508. }
  509. #endif
  510. }
  511. else
  512. m_picarray.Add(NULL);
  513. m_rcarray.Add(g_resdata2.rect[i]);
  514. }
  515. delete[]pDataBegin;
  516. if (m_mode2)//看设计
  517. {
  518. m_bHide = 0;
  519. // printf("Jeff:g_cominfoarray.ElementAt(0).ElementAt(86)=%s\n\n",g_cominfoarray.ElementAt(0).ElementAt(86)); // Jeff Printf;
  520. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  521. {
  522. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  523. CRect rc, rc2;
  524. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  525. ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
  526. int dtx = rc.right - rc2.right;
  527. ScreenToClient(rc2);
  528. rc2.left += dtx;
  529. rc2.right += dtx;
  530. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  531. ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
  532. ScreenToClient(rc2);
  533. rc2.left += dtx;
  534. rc2.right += dtx;
  535. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  536. }
  537. CRect rc, rc2;
  538. ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
  539. ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
  540. int dtx = rc.right - rc2.right;
  541. rc2 = rc;
  542. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
  543. {
  544. float scale = 0.9;
  545. dtx *= scale;
  546. int wid = rc2.Width()*scale;
  547. int hei = rc2.Height()*scale;
  548. int dty = rc2.Height() - hei;
  549. dty /= 2;
  550. rc2.left = rc2.right - wid;
  551. rc2.top += dty;
  552. rc2.bottom = rc2.top + hei;
  553. }
  554. ScreenToClient(rc2);
  555. ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
  556. rc2.left -= dtx;
  557. rc2.right -= dtx;
  558. ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
  559. rc2.left -= dtx;
  560. rc2.right -= dtx;
  561. ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
  562. rc2.left -= dtx;
  563. rc2.right -= dtx;
  564. ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
  565. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
  566. {
  567. rc2.left -= dtx;
  568. rc2.right -= dtx;
  569. ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
  570. }
  571. rc2.left -= dtx;
  572. rc2.right -= dtx;
  573. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  574. rc2.left -= dtx;
  575. rc2.right -= dtx;
  576. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  577. rc2.left -= dtx;
  578. rc2.right -= dtx;
  579. ((MyBmpButton2*)m_picarray.ElementAt(8))->MoveWindow(rc2);
  580. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  581. }
  582. else
  583. {
  584. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  585. {
  586. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  587. CRect rc, rc2;
  588. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  589. ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
  590. int dtx = rc.right - rc2.right;
  591. ScreenToClient(rc2);
  592. rc2.left += dtx;
  593. rc2.right += dtx;
  594. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  595. ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
  596. ScreenToClient(rc2);
  597. rc2.left += dtx;
  598. rc2.right += dtx;
  599. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  600. }
  601. }
  602. if (1)//m_mode2==0)
  603. {
  604. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  605. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  606. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  607. ((MyBmpButton2*)m_picarray.ElementAt(10))->ShowWindow(SW_HIDE);
  608. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  609. }
  610. else
  611. {
  612. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  613. ((MyBmpButton2*)m_picarray.ElementAt(0))->ShowWindow(SW_HIDE);
  614. ((MyBmpButton2*)m_picarray.ElementAt(1))->ShowWindow(SW_HIDE);
  615. ((MyBmpButton2*)m_picarray.ElementAt(2))->ShowWindow(SW_HIDE);
  616. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  617. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  618. if (IsHasRights2new(37) == 0)
  619. {
  620. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  621. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  622. }
  623. }
  624. if (m_mode2)
  625. {
  626. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_SHOW);
  627. // ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
  628. ((MyBmpButton2*)m_picarray.ElementAt(12))->ShowWindow(SW_HIDE);
  629. ((MyBmpButton2*)m_picarray.ElementAt(13))->ShowWindow(SW_HIDE);
  630. }
  631. else//移按钮位置
  632. {
  633. CRect rc, rc2;
  634. ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
  635. ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
  636. int dtx = rc.right - rc2.right;
  637. rc2 = rc;
  638. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
  639. {
  640. float scale = 0.9;
  641. dtx *= scale;
  642. int wid = rc2.Width()*scale;
  643. int hei = rc2.Height()*scale;
  644. int dty = rc2.Height() - hei;
  645. dty /= 2;
  646. rc2.left = rc2.right - wid;
  647. rc2.top += dty;
  648. rc2.bottom = rc2.top + hei;
  649. }
  650. ScreenToClient(rc2);
  651. ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
  652. rc2.left -= dtx;
  653. rc2.right -= dtx;
  654. ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
  655. rc2.left -= dtx;
  656. rc2.right -= dtx;
  657. ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
  658. rc2.left -= dtx;
  659. rc2.right -= dtx;
  660. ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
  661. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
  662. {
  663. rc2.left -= dtx;
  664. rc2.right -= dtx;
  665. ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
  666. }
  667. rc2.left -= dtx;
  668. rc2.right -= dtx;
  669. ((MyBmpButton2*)m_picarray.ElementAt(12))->MoveWindow(rc2);
  670. rc2.left -= dtx;
  671. rc2.right -= dtx;
  672. ((MyBmpButton2*)m_picarray.ElementAt(13))->MoveWindow(rc2);
  673. rc2.left -= dtx;
  674. rc2.right -= dtx;
  675. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  676. rc2.left -= dtx;
  677. rc2.right -= dtx;
  678. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  679. }
  680. #ifndef MNLS_VERSION
  681. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  682. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  683. Graphics graph(m_pBk);
  684. Image *img = NULL;
  685. if (m_mode2 == 0)
  686. ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\标题-选片.jpg");
  687. else
  688. ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\标题-看设计.jpg");
  689. if (img)
  690. {
  691. if (img->GetWidth() == 2000)
  692. {
  693. graph.SetSmoothingMode(SmoothingModeHighQuality);
  694. graph.DrawImage(img, 0, 0);
  695. }
  696. delete img;
  697. }
  698. #endif
  699. CRect listrc = m_rcarray.ElementAt(6);
  700. CRect rc;
  701. GetClientRect(rc);
  702. rc.top = listrc.top;
  703. m_List1.MoveWindow(rc);
  704. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  705. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  706. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  707. // Jeff以上均为界面布局,过于混乱;
  708. // 下面的代码才是数据处理;
  709. //----------------------------------------------------------------------------------------------------------------------------------------
  710. //----------------------------------------------------------------------------------------------------------------------------------------
  711. //----------------------------------------------------------------------------------------------------------------------------------------
  712. CString path, str;
  713. if (m_mode2)
  714. {
  715. m_path = g_path3 + "\\";
  716. m_path += m_strOrderNumber;
  717. m_path += "\\";
  718. // printf("Jeff:m_path=%s\n\n",m_path); // Jeff Printf;
  719. }
  720. if (m_mode2)//看设计
  721. {
  722. GetPhotos();
  723. }
  724. else // 开始选片
  725. {
  726. IsGrowthTx growthtxdlg;
  727. growthtxdlg.m_mode = 1;
  728. growthtxdlg.m_strOrderNumber = m_strOrderNumber;
  729. growthtxdlg.DoModal();
  730. m_bGrowthTX = growthtxdlg.m_bGrowthTx;
  731. m_seltxname = growthtxdlg.m_seltxname;
  732. /*if(!growthtxdlg.m_seltxname.IsEmpty ())
  733. {
  734. if(growthtxdlg.m_seltxname!="全部")
  735. {
  736. path+=growthtxdlg.m_seltxname;
  737. path+="\\";
  738. }
  739. }*/
  740. // HC:缓存,checkHC检查在本机是否存在缓存的相片;
  741. if (CheckHC()) // (一般返回0)这一步是查看C:\WINDOWS\System32\有没有lyfz的文件夹,以及该文件夹下是否有订单号文件夹和相片;
  742. {
  743. m_bFromLocal = 1;
  744. char path[MAX_PATH];
  745. ::GetSystemDirectory(path, MAX_PATH);
  746. CString sysdir = path;
  747. sysdir += "\\lyfz";
  748. ::CreateDirectory(sysdir, NULL);
  749. sysdir += "\\";
  750. sysdir += m_strOrderNumber;
  751. using namespace helper_coffs;
  752. ffsco o;
  753. o.dirs(1);
  754. o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
  755. ffsco::typeT coo;
  756. ffsco::typeT::iterator it;
  757. coo = o.co_file();
  758. for (it = coo.begin(); coo.end() != it; it++)
  759. {
  760. str = (*it).c_str();
  761. //printf("Jeff:str=%s\n\n",str);// Jeff Printf
  762. if (str.GetAt(str.ReverseFind('\\') + 1) != 's' && str.GetAt(str.ReverseFind('\\') + 1) != 'm')
  763. {
  764. m_patharray1.Add(str);
  765. }
  766. }
  767. }
  768. //printf("Jeff:m_patharray1.GetSize()=%d\n\n",m_patharray1.GetSize());// Jeff Printf;
  769. if (m_patharray1.GetSize() == 0) // m_patharray1:查看全部相片.
  770. {
  771. if (IsPhoto2Exist())//如果订单文件夹存在;
  772. {
  773. SelBrunDevice dlg;
  774. dlg.m_mode = 1;
  775. if (dlg.DoModal() == IDOK) // m_nChoosePhotoType=0:原片+修片; =1:修片; =2:原片
  776. m_nChoosePhotoType = dlg.m_sel;
  777. else
  778. m_nChoosePhotoType = 0;
  779. }
  780. else AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  781. CString path2;
  782. m_path = g_path1 + "\\";
  783. m_path += m_strOrderNumber;
  784. m_path += "\\";
  785. if (m_seltxname != "" && m_seltxname != "全部")
  786. {
  787. m_path += m_seltxname;
  788. m_path += "\\";
  789. //printf("Jeff:m_path1=%s\n\n",m_path);// Jeff Printf;
  790. }
  791. if (m_nChoosePhotoType == 1) // 选片:选择修片文件夹;
  792. {
  793. m_path = g_path2 + "\\";
  794. m_path += m_strOrderNumber;
  795. m_path += "\\";
  796. //printf("Jeff:m_path2=%s\n\n",m_path);// Jeff Printf;
  797. }
  798. // 查找m_path下所有文件o.find(...);
  799. CString filename;
  800. using namespace helper_coffs;
  801. ffsco o;
  802. o.dirs(1);
  803. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  804. ffsco::typeT coo;
  805. ffsco::typeT::iterator it;
  806. coo = o.co_file();
  807. for (it = coo.begin(); coo.end() != it; it++) // 遍历文件夹;
  808. {
  809. path = (*it).c_str();
  810. //printf("Jeff:path=%s\n\n",path);//Jeff Printf;
  811. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  812. {
  813. path.MakeLower();
  814. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  815. if (filename.Find(".") != -1)
  816. filename = filename.Left(filename.Find("."));
  817. if (!myisdigit(filename))continue;
  818. if (m_nChoosePhotoType == 1) // m_patharray1只添加修片文件夹;
  819. {
  820. #if JEFF_TEST_ON
  821. if(PathFileExists(path))
  822. m_patharray1.Add(path);
  823. #else
  824. m_patharray1.Add(path);
  825. #endif
  826. //printf("Jeff:修片:m_patharray1.Add(%s)=%s\n\n",path);//Jeff Printf;
  827. }
  828. else // m_nChoosePhotoType=0,2
  829. {
  830. path2 = path;
  831. if (m_nChoosePhotoType == 0) // 原片+修片;
  832. {
  833. path2.Replace("客户原片", "修好的片");
  834. //printf("Jeff:原片+修片 path2=%s\n\n",path2); // Jeff Printf;
  835. }
  836. if (m_bGrowthTX == 0)
  837. {
  838. int pos = path2.Find(m_strOrderNumber);
  839. pos += m_strOrderNumber.GetLength();
  840. int pos2 = path2.ReverseFind('\\');
  841. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  842. }
  843. if (m_nChoosePhotoType == 0 && PathFileExists(path2)) // 原片+修片;
  844. {
  845. m_patharray1.Add(path2);
  846. //printf("Jeff:原片+修片:m_patharray1.Add(%s)=%s\n\n",path2);//Jeff Printf;
  847. }
  848. else //if( m_nChoosePhotoType == 2 ) // 只有原片;
  849. {
  850. path2.Replace(".raw", ".jpg");
  851. if (PathFileExists(path2))
  852. {
  853. m_patharray1.Add(path2);
  854. continue;
  855. }
  856. path2.Replace(".nef", ".jpg");
  857. if (PathFileExists(path2))
  858. {
  859. m_patharray1.Add(path2);
  860. continue;
  861. }
  862. path2.Replace(".cr2", ".jpg");
  863. if (PathFileExists(path2))
  864. {
  865. m_patharray1.Add(path2);
  866. continue;
  867. }
  868. else
  869. {
  870. if (path.Right(3) != "jpg")
  871. continue;
  872. #if JEFF_TEST_ON
  873. if (PathFileExists(path))
  874. m_patharray1.Add(path);
  875. #else
  876. m_patharray1.Add(path);
  877. #endif
  878. }
  879. }
  880. }
  881. }
  882. }
  883. if (m_nChoosePhotoType != 2) // Jeff:如果不是只查看原片;
  884. {//多种修好的效果
  885. CString path2;
  886. path2 = g_path2 + "\\";
  887. path2 += m_strOrderNumber;
  888. path2 += "\\"; //printf("Jeff:****paht2=%s\n\n",path2);//Jeff Printf;path2="修好的片"
  889. using namespace helper_coffs;
  890. ffsco o;
  891. o.dirs(0);
  892. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  893. ffsco::typeT coo;
  894. ffsco::typeT::iterator it;
  895. coo = o.co_file();
  896. for (it = coo.begin(); coo.end() != it; it++)
  897. {
  898. path = (*it).c_str();
  899. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  900. {
  901. path.MakeLower();
  902. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  903. if (path2.Find("-") != -1)
  904. {
  905. #if JEFF_TEST_ON
  906. if(PathFileExists(path))
  907. m_patharray1.Add(path);
  908. #else
  909. m_patharray1.Add(path);
  910. #endif
  911. }
  912. }
  913. }
  914. }
  915. }
  916. if (m_patharray1.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
  917. {
  918. int size = m_patharray1.GetSize() - 1;
  919. CString sTemp;
  920. int nPos;
  921. for (int i = 0; i < size; i++)
  922. {
  923. nPos = rand() % (size - i);
  924. sTemp = m_patharray1.ElementAt(size - i);
  925. m_patharray1.SetAt(size - i, m_patharray1.ElementAt(nPos));
  926. m_patharray1.SetAt(nPos, sTemp);
  927. }
  928. }
  929. }
  930. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  931. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  932. m_List2.InitStyle();
  933. m_List2.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
  934. m_List2.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 150);
  935. m_List2.InsertColumn(2, _T("数量"), LVCFMT_LEFT, 45);
  936. m_List3.InitStyle();
  937. m_List3.InsertColumn(0, _T("autoid"), LVCFMT_LEFT, 0);
  938. m_List3.InsertColumn(1, _T("编号"), LVCFMT_LEFT, 45);
  939. m_List3.InsertColumn(2, _T("商品名称"), LVCFMT_LEFT, 150);
  940. m_List3.InsertColumn(3, _T("价格"), LVCFMT_LEFT, 45);
  941. m_List3.InsertColumn(4, _T("数量"), LVCFMT_LEFT, 45);
  942. #ifdef LKAY_VERSION
  943. m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
  944. m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
  945. m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
  946. #else
  947. m_List3.InsertColumn(5, _T("照片编号"), LVCFMT_LEFT, 365);
  948. #endif
  949. #else
  950. if( FALSE==InitializeUI() ) return FALSE;
  951. #endif
  952. if (m_mode2 == 0)
  953. {
  954. GetData();
  955. if (m_checkstatus == "OK")
  956. {
  957. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20) == 0)
  958. {
  959. Login2 dlg;
  960. if (dlg.DoModal() != IDOK)
  961. {
  962. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  963. btn->m_bmpdisable = btn->m_bmp->Clone();
  964. Graphics graph(btn->m_bmpdisable);
  965. CPoint pt1, pt2, pt3;
  966. pt1.x = 0;
  967. pt1.y = 0;
  968. pt2.x = btn->m_bmp->GetWidth();
  969. pt2.y = 0;
  970. pt3.x = 0;
  971. pt3.y = btn->m_bmp->GetHeight();
  972. Point destinationPoints[] = {
  973. Point(pt1.x, pt1.y), // destination for upper-left point of original
  974. Point(pt2.x, pt2.y), // destination for upper-right point of original
  975. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  976. ColorMatrix colorMatrix = \
  977. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  978. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  979. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  980. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  981. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  982. ImageAttributes imageAtt;
  983. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  984. graph.DrawImage(btn->m_bmp,
  985. destinationPoints,
  986. 3,
  987. 0,
  988. 0,
  989. btn->m_bmp->GetWidth(),
  990. btn->m_bmp->GetHeight(),
  991. UnitPixel,
  992. &imageAtt);
  993. btn->EnableWindow(0);
  994. m_bCanSave = 0;
  995. // CDialog::OnCancel ();
  996. // return 1;
  997. }
  998. else if (IsHasRightsnew2(20, dlg.m_rights) == 0)
  999. {
  1000. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  1001. btn->m_bmpdisable = btn->m_bmp->Clone();
  1002. Graphics graph(btn->m_bmpdisable);
  1003. CPoint pt1, pt2, pt3;
  1004. pt1.x = 0;
  1005. pt1.y = 0;
  1006. pt2.x = btn->m_bmp->GetWidth();
  1007. pt2.y = 0;
  1008. pt3.x = 0;
  1009. pt3.y = btn->m_bmp->GetHeight();
  1010. Point destinationPoints[] = {
  1011. Point(pt1.x, pt1.y), // destination for upper-left point of original
  1012. Point(pt2.x, pt2.y), // destination for upper-right point of original
  1013. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  1014. ColorMatrix colorMatrix = \
  1015. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1016. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1017. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1018. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  1019. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  1020. ImageAttributes imageAtt;
  1021. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  1022. graph.DrawImage(btn->m_bmp,
  1023. destinationPoints,
  1024. 3,
  1025. 0,
  1026. 0,
  1027. btn->m_bmp->GetWidth(),
  1028. btn->m_bmp->GetHeight(),
  1029. UnitPixel,
  1030. &imageAtt);
  1031. btn->EnableWindow(0); m_bCanSave = 0;
  1032. // CDialog::OnCancel ();
  1033. // return 1;
  1034. }
  1035. }
  1036. }
  1037. if (!m_delphotos.IsEmpty())
  1038. {
  1039. m_delphotos.TrimLeft(";");
  1040. m_delphotos.TrimRight(";");
  1041. m_delphotos = ";" + m_delphotos;
  1042. m_delphotos += ";";
  1043. for (int i = m_patharray1.GetSize() - 1; i >= 0; i--)
  1044. {
  1045. CString no;
  1046. no = m_patharray1.ElementAt(i);
  1047. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  1048. no = no.Left(no.Find('.'));
  1049. no = ";" + no;
  1050. no += ";";
  1051. if (m_delphotos.Find(no) != -1)
  1052. {
  1053. no = m_patharray1.ElementAt(i);
  1054. m_patharray1.RemoveAt(i);
  1055. #if JEFF_TEST_ON
  1056. if(PathFileExists(no))
  1057. m_patharray4.Add(no);
  1058. #else
  1059. m_patharray4.Add(no);
  1060. #endif
  1061. }
  1062. }
  1063. }
  1064. if (m_pArray)
  1065. {
  1066. for (int i = 0; i < m_pArray->GetSize(); i += 2)
  1067. {
  1068. int j = 0;
  1069. for ( j = 0; j < m_List2.GetItemCount(); j++)
  1070. {
  1071. if (m_pArray->ElementAt(i) == m_List2.GetItemText(j, 0))
  1072. {
  1073. CString name = m_pArray->ElementAt(i + 1);
  1074. int pos = name.Find("$");
  1075. if (pos != 0)continue;
  1076. name.Delete(0, 1);
  1077. pos = name.Find(".");
  1078. while (pos != -1)
  1079. {
  1080. if (CheckOK(name.Left(pos)))
  1081. {
  1082. CString str = m_noarray.ElementAt(j);
  1083. CString temp = name.Left(pos);
  1084. temp = "," + temp + ",";
  1085. if (str.Find(temp) == -1)
  1086. {
  1087. str += name.Left(pos);
  1088. str.TrimLeft(","); str = "," + str + ",";
  1089. m_noarray.SetAt(j, str);
  1090. str.TrimLeft(",");
  1091. str.TrimRight(",");
  1092. m_List2.SetItemText(j, 4, str);
  1093. }
  1094. }
  1095. name = name.Right(name.GetLength() - pos - 1);
  1096. pos = name.Find(".");
  1097. }
  1098. if (CheckOK(name))
  1099. {
  1100. CString str = m_noarray.ElementAt(j);
  1101. CString temp = name;
  1102. temp = "," + temp + ",";
  1103. if (str.Find(temp) == -1)
  1104. {
  1105. str += name;
  1106. str.TrimLeft(","); str = "," + str + ",";
  1107. m_noarray.SetAt(j, str);
  1108. str.TrimLeft(",");
  1109. str.TrimRight(",");
  1110. m_List2.SetItemText(j, 4, str);
  1111. }
  1112. }
  1113. }
  1114. }
  1115. for (j = 0; j < m_List3.GetItemCount(); j++)
  1116. {
  1117. if (m_pArray->ElementAt(i) == m_List3.GetItemText(j, 0))
  1118. {
  1119. CString name = m_pArray->ElementAt(i + 1);
  1120. int pos = name.Find("$");
  1121. if (pos != 0)continue;
  1122. name.Delete(0, 1);
  1123. pos = name.Find(".");
  1124. while (pos != -1)
  1125. {
  1126. if (CheckOK(name.Left(pos)))
  1127. {
  1128. CString str = m_no2array.ElementAt(j);
  1129. CString temp = name.Left(pos);
  1130. temp = "," + temp + ",";
  1131. if (str.Find(temp) == -1)
  1132. {
  1133. str += name.Left(pos);
  1134. str.TrimLeft(","); str = "," + str + ",";
  1135. m_no2array.SetAt(j, str);
  1136. str.TrimLeft(",");
  1137. str.TrimRight(",");
  1138. #ifdef LKAY_VERSION
  1139. m_List3.SetItemText (j, 7, str);
  1140. #else
  1141. m_List3.SetItemText(j, 5, str);
  1142. #endif
  1143. }
  1144. }
  1145. name = name.Right(name.GetLength() - pos - 1);
  1146. pos = name.Find(".");
  1147. }
  1148. if (CheckOK(name))
  1149. {
  1150. CString str = m_no2array.ElementAt(j);
  1151. CString temp = name;
  1152. temp = "," + temp + ",";
  1153. if (str.Find(temp) == -1)
  1154. {
  1155. str += name;
  1156. str.TrimLeft(","); str = "," + str + ",";
  1157. m_no2array.SetAt(j, str);
  1158. str.TrimLeft(",");
  1159. str.TrimRight(",");
  1160. #ifdef LKAY_VERSION
  1161. m_List3.SetItemText (j, 7, str);
  1162. #else
  1163. m_List3.SetItemText(j, 5, str);
  1164. #endif
  1165. }
  1166. }
  1167. }
  1168. }
  1169. }
  1170. }
  1171. }
  1172. else
  1173. {
  1174. GetData2();
  1175. if (m_checkstatus != "未看")
  1176. {
  1177. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(85)) && IsHasRights2new(20) == 0)
  1178. {
  1179. Login2 dlg;
  1180. if (dlg.DoModal() != IDOK)
  1181. {
  1182. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  1183. btn->m_bmpdisable = btn->m_bmp->Clone();
  1184. Graphics graph(btn->m_bmpdisable);
  1185. CPoint pt1, pt2, pt3;
  1186. pt1.x = 0;
  1187. pt1.y = 0;
  1188. pt2.x = btn->m_bmp->GetWidth();
  1189. pt2.y = 0;
  1190. pt3.x = 0;
  1191. pt3.y = btn->m_bmp->GetHeight();
  1192. Point destinationPoints[] = {
  1193. Point(pt1.x, pt1.y), // destination for upper-left point of original
  1194. Point(pt2.x, pt2.y), // destination for upper-right point of original
  1195. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  1196. ColorMatrix colorMatrix = \
  1197. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1198. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1199. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1200. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  1201. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  1202. ImageAttributes imageAtt;
  1203. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  1204. graph.DrawImage(btn->m_bmp,
  1205. destinationPoints,
  1206. 3,
  1207. 0,
  1208. 0,
  1209. btn->m_bmp->GetWidth(),
  1210. btn->m_bmp->GetHeight(),
  1211. UnitPixel,
  1212. &imageAtt);
  1213. btn->EnableWindow(0);
  1214. m_bCanSave = 0;
  1215. // CDialog::OnCancel ();
  1216. // return 1;
  1217. }
  1218. else if (IsHasRightsnew2(20, dlg.m_rights) == 0)
  1219. {
  1220. MyBmpButton2 *btn = ((MyBmpButton2*)m_picarray.ElementAt(4));
  1221. btn->m_bmpdisable = btn->m_bmp->Clone();
  1222. Graphics graph(btn->m_bmpdisable);
  1223. CPoint pt1, pt2, pt3;
  1224. pt1.x = 0;
  1225. pt1.y = 0;
  1226. pt2.x = btn->m_bmp->GetWidth();
  1227. pt2.y = 0;
  1228. pt3.x = 0;
  1229. pt3.y = btn->m_bmp->GetHeight();
  1230. Point destinationPoints[] = {
  1231. Point(pt1.x, pt1.y), // destination for upper-left point of original
  1232. Point(pt2.x, pt2.y), // destination for upper-right point of original
  1233. Point(pt3.x, pt3.y) }; // destination for lower-left point of original
  1234. ColorMatrix colorMatrix = \
  1235. {0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1236. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1237. 0.33f, 0.33f, 0.33f, 0.0f, 0.0f,
  1238. 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
  1239. 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
  1240. ImageAttributes imageAtt;
  1241. imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
  1242. graph.DrawImage(btn->m_bmp,
  1243. destinationPoints,
  1244. 3,
  1245. 0,
  1246. 0,
  1247. btn->m_bmp->GetWidth(),
  1248. btn->m_bmp->GetHeight(),
  1249. UnitPixel,
  1250. &imageAtt);
  1251. btn->EnableWindow(0); m_bCanSave = 0;
  1252. // CDialog::OnCancel ();
  1253. // return 1;
  1254. }
  1255. }
  1256. }
  1257. if (!m_delphotos.IsEmpty()) // add by Jeff:在加载时,先将已删除的相片从欲查看的相片中删除;
  1258. {
  1259. m_delphotos.TrimLeft(";");
  1260. m_delphotos.TrimRight(";");
  1261. m_delphotos = ";" + m_delphotos;
  1262. m_delphotos += ";";
  1263. for (int i = m_patharray1.GetSize() - 1; i >= 0; i--)
  1264. {
  1265. CString no;
  1266. no = m_patharray1.ElementAt(i);
  1267. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  1268. no = no.Left(no.Find('.'));
  1269. no = ";" + no;
  1270. no += ";";
  1271. if (m_delphotos.Find(no) != -1)
  1272. {
  1273. no = m_patharray1.ElementAt(i);
  1274. m_patharray1.RemoveAt(i);
  1275. #if JEFF_TEST_ON
  1276. if (PathFileExists(no))
  1277. m_patharray4.Add(no);
  1278. #else
  1279. m_patharray4.Add(no);
  1280. #endif
  1281. }
  1282. }
  1283. }
  1284. }
  1285. LoadPhotos();//在界面上显示图片;
  1286. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(95)) || g_cominfoarray.ElementAt(0).ElementAt(95) == "")
  1287. {
  1288. int timer1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(96));
  1289. m_timer = atoi(g_cominfoarray.ElementAt(0).ElementAt(97));
  1290. if (timer1 == 0)timer1 = 60;
  1291. if (m_timer == 0)m_timer = 20;
  1292. SetTimer(1, timer1 * 60000, NULL);
  1293. }
  1294. return false;
  1295. }
  1296. BOOL ChoosePhotoSkin2::InitializeUI()
  1297. {
  1298. g_bInSkin = 1;
  1299. m_ticks = ::GetTickCount();
  1300. if (g_cursorhand == NULL)
  1301. g_cursorhand = AfxGetApp()->LoadCursor(IDC_CURSORHAND);
  1302. BYTE *pData = NULL;
  1303. BYTE *pDataBegin;
  1304. //printf("Jeff:loadLia路径:%s\n\n",g_mainpath+"\\skin\\"+m_liapath);//Jeff Printf;
  1305. if (!LoadLia(g_mainpath + "\\skin\\" + m_liapath, &pData, &pDataBegin, &m_pBk, m_hWnd))
  1306. {
  1307. EndDialog(0);
  1308. return false;
  1309. }
  1310. //printf("Jeff:g_resdata2.nPicCount=%d\n\n",g_resdata2.nPicCount); // Jeff Printf,这个nPicCount好像一直是15;
  1311. for (int i = 0; i < g_resdata2.nPicCount; i++)
  1312. {
  1313. g_resdata2.rect[i].left *= g_fscalex;
  1314. g_resdata2.rect[i].right *= g_fscalex;
  1315. g_resdata2.rect[i].top *= g_fscaley;
  1316. g_resdata2.rect[i].bottom *= g_fscaley;
  1317. if (i == 8)
  1318. g_resdata2.rect[i] = g_resdata2.rect[2];
  1319. else if (i == 9)
  1320. g_resdata2.rect[i] = g_resdata2.rect[3];
  1321. else if (i == 10)
  1322. g_resdata2.rect[i] = g_resdata2.rect[1];
  1323. if (g_resdata2.nPicBmpCount[i])
  1324. {
  1325. MyBmpButton2 *pic = new MyBmpButton2;
  1326. m_picarray.Add((DWORD)pic);
  1327. CRect rc = g_resdata2.rect[i];
  1328. CString str;
  1329. str.Format(_T("%d"), i + 1);
  1330. pic->Create(str, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, rc, this, i + 100);
  1331. pic->m_bmpcount = g_resdata2.nPicBmpCount[i];
  1332. pic->ReadBmp(&pData, NULL, this);
  1333. #ifdef SZWNS_VERSION
  1334. if(i==3 && m_mode2==0)
  1335. {
  1336. Image *img=NULL;
  1337. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG6), _T("JPG") );
  1338. delete pic->m_bmp;
  1339. pic->m_bmp=img->Clone();
  1340. delete img;
  1341. img=NULL;
  1342. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG7), _T("JPG") );
  1343. delete pic->m_bmpfocus;
  1344. pic->m_bmpfocus=img->Clone();
  1345. delete img;
  1346. img=NULL;
  1347. LoadImageFromRes(&img, MAKEINTRESOURCE(IDR_JPG8), _T("JPG") );
  1348. delete pic->m_bmpfocused;
  1349. pic->m_bmpfocused=img->Clone();
  1350. delete img;
  1351. }
  1352. #endif
  1353. }
  1354. else
  1355. m_picarray.Add(NULL);
  1356. m_rcarray.Add(g_resdata2.rect[i]);
  1357. }
  1358. delete[]pDataBegin;
  1359. if (m_mode2)//看设计
  1360. {
  1361. m_bHide = 0;
  1362. // printf("Jeff:g_cominfoarray.ElementAt(0).ElementAt(86)=%s\n\n",g_cominfoarray.ElementAt(0).ElementAt(86)); // Jeff Printf;
  1363. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  1364. {
  1365. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  1366. CRect rc, rc2;
  1367. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  1368. ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
  1369. int dtx = rc.right - rc2.right;
  1370. ScreenToClient(rc2);
  1371. rc2.left += dtx;
  1372. rc2.right += dtx;
  1373. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  1374. ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
  1375. ScreenToClient(rc2);
  1376. rc2.left += dtx;
  1377. rc2.right += dtx;
  1378. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  1379. }
  1380. CRect rc, rc2;
  1381. ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
  1382. ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
  1383. int dtx = rc.right - rc2.right;
  1384. rc2 = rc;
  1385. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
  1386. {
  1387. float scale = 0.9;
  1388. dtx *= scale;
  1389. int wid = rc2.Width()*scale;
  1390. int hei = rc2.Height()*scale;
  1391. int dty = rc2.Height() - hei;
  1392. dty /= 2;
  1393. rc2.left = rc2.right - wid;
  1394. rc2.top += dty;
  1395. rc2.bottom = rc2.top + hei;
  1396. }
  1397. ScreenToClient(rc2);
  1398. ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
  1399. rc2.left -= dtx;
  1400. rc2.right -= dtx;
  1401. ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
  1402. rc2.left -= dtx;
  1403. rc2.right -= dtx;
  1404. ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
  1405. rc2.left -= dtx;
  1406. rc2.right -= dtx;
  1407. ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
  1408. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
  1409. {
  1410. rc2.left -= dtx;
  1411. rc2.right -= dtx;
  1412. ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
  1413. }
  1414. rc2.left -= dtx;
  1415. rc2.right -= dtx;
  1416. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  1417. rc2.left -= dtx;
  1418. rc2.right -= dtx;
  1419. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  1420. rc2.left -= dtx;
  1421. rc2.right -= dtx;
  1422. ((MyBmpButton2*)m_picarray.ElementAt(8))->MoveWindow(rc2);
  1423. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  1424. }
  1425. else
  1426. {
  1427. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  1428. {
  1429. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  1430. CRect rc, rc2;
  1431. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  1432. ((MyBmpButton2*)m_picarray.ElementAt(1))->GetWindowRect(rc2);
  1433. int dtx = rc.right - rc2.right;
  1434. ScreenToClient(rc2);
  1435. rc2.left += dtx;
  1436. rc2.right += dtx;
  1437. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  1438. ((MyBmpButton2*)m_picarray.ElementAt(0))->GetWindowRect(rc2);
  1439. ScreenToClient(rc2);
  1440. rc2.left += dtx;
  1441. rc2.right += dtx;
  1442. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  1443. }
  1444. }
  1445. if (1)//m_mode2==0)
  1446. {
  1447. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  1448. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  1449. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  1450. ((MyBmpButton2*)m_picarray.ElementAt(10))->ShowWindow(SW_HIDE);
  1451. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  1452. }
  1453. else
  1454. {
  1455. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  1456. ((MyBmpButton2*)m_picarray.ElementAt(0))->ShowWindow(SW_HIDE);
  1457. ((MyBmpButton2*)m_picarray.ElementAt(1))->ShowWindow(SW_HIDE);
  1458. ((MyBmpButton2*)m_picarray.ElementAt(2))->ShowWindow(SW_HIDE);
  1459. ((MyBmpButton2*)m_picarray.ElementAt(3))->ShowWindow(SW_HIDE);
  1460. ((MyBmpButton2*)m_picarray.ElementAt(11))->ShowWindow(SW_HIDE);
  1461. if (IsHasRights2new(37) == 0)
  1462. {
  1463. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_HIDE);
  1464. ((MyBmpButton2*)m_picarray.ElementAt(9))->ShowWindow(SW_HIDE);
  1465. }
  1466. }
  1467. if (m_mode2)
  1468. {
  1469. ((MyBmpButton2*)m_picarray.ElementAt(8))->ShowWindow(SW_SHOW);
  1470. // ((MyBmpButton2*)m_picarray.ElementAt (8))->SetPushDown (1);
  1471. ((MyBmpButton2*)m_picarray.ElementAt(12))->ShowWindow(SW_HIDE);
  1472. ((MyBmpButton2*)m_picarray.ElementAt(13))->ShowWindow(SW_HIDE);
  1473. }
  1474. else//移按钮位置
  1475. {
  1476. CRect rc, rc2;
  1477. ((MyBmpButton2*)m_picarray.ElementAt(5))->GetWindowRect(rc);
  1478. ((MyBmpButton2*)m_picarray.ElementAt(4))->GetWindowRect(rc2);
  1479. int dtx = rc.right - rc2.right;
  1480. rc2 = rc;
  1481. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(86))==0)
  1482. {
  1483. float scale = 0.9;
  1484. dtx *= scale;
  1485. int wid = rc2.Width()*scale;
  1486. int hei = rc2.Height()*scale;
  1487. int dty = rc2.Height() - hei;
  1488. dty /= 2;
  1489. rc2.left = rc2.right - wid;
  1490. rc2.top += dty;
  1491. rc2.bottom = rc2.top + hei;
  1492. }
  1493. ScreenToClient(rc2);
  1494. ((MyBmpButton2*)m_picarray.ElementAt(5))->MoveWindow(rc2);
  1495. rc2.left -= dtx;
  1496. rc2.right -= dtx;
  1497. ((MyBmpButton2*)m_picarray.ElementAt(4))->MoveWindow(rc2);
  1498. rc2.left -= dtx;
  1499. rc2.right -= dtx;
  1500. ((MyBmpButton2*)m_picarray.ElementAt(14))->MoveWindow(rc2);
  1501. rc2.left -= dtx;
  1502. rc2.right -= dtx;
  1503. ((MyBmpButton2*)m_picarray.ElementAt(2))->MoveWindow(rc2);
  1504. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)) == 0)
  1505. {
  1506. rc2.left -= dtx;
  1507. rc2.right -= dtx;
  1508. ((MyBmpButton2*)m_picarray.ElementAt(3))->MoveWindow(rc2);
  1509. }
  1510. rc2.left -= dtx;
  1511. rc2.right -= dtx;
  1512. ((MyBmpButton2*)m_picarray.ElementAt(12))->MoveWindow(rc2);
  1513. rc2.left -= dtx;
  1514. rc2.right -= dtx;
  1515. ((MyBmpButton2*)m_picarray.ElementAt(13))->MoveWindow(rc2);
  1516. rc2.left -= dtx;
  1517. rc2.right -= dtx;
  1518. ((MyBmpButton2*)m_picarray.ElementAt(1))->MoveWindow(rc2);
  1519. rc2.left -= dtx;
  1520. rc2.right -= dtx;
  1521. ((MyBmpButton2*)m_picarray.ElementAt(0))->MoveWindow(rc2);
  1522. }
  1523. #ifndef MNLS_VERSION
  1524. ((MyBmpButton2*)m_picarray.ElementAt(7))->ShowWindow(SW_HIDE);
  1525. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  1526. Graphics graph(m_pBk);
  1527. Image *img = NULL;
  1528. if (m_mode2 == 0)
  1529. ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\标题-选片.jpg");
  1530. else
  1531. ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\标题-看设计.jpg");
  1532. if (img)
  1533. {
  1534. if (img->GetWidth() == 2000)
  1535. {
  1536. graph.SetSmoothingMode(SmoothingModeHighQuality);
  1537. graph.DrawImage(img, 0, 0);
  1538. }
  1539. delete img;
  1540. }
  1541. #endif
  1542. CRect listrc = m_rcarray.ElementAt(6);
  1543. CRect rc;
  1544. GetClientRect(rc);
  1545. rc.top = listrc.top;
  1546. m_List1.MoveWindow(rc);
  1547. CString path, str;
  1548. if (m_mode2)
  1549. {
  1550. m_path = g_path3 + "\\";
  1551. m_path += m_strOrderNumber;
  1552. m_path += "\\";
  1553. // printf("Jeff:m_path=%s\n\n",m_path); // Jeff Printf;
  1554. }
  1555. if (m_mode2)//看设计
  1556. {
  1557. GetPhotos();
  1558. }
  1559. else
  1560. {
  1561. IsGrowthTx growthtxdlg;
  1562. growthtxdlg.m_mode = 1;
  1563. growthtxdlg.m_strOrderNumber = m_strOrderNumber;
  1564. growthtxdlg.DoModal();
  1565. m_bGrowthTX = growthtxdlg.m_bGrowthTx;
  1566. m_seltxname = growthtxdlg.m_seltxname;
  1567. /*if(!growthtxdlg.m_seltxname.IsEmpty ())
  1568. {
  1569. if(growthtxdlg.m_seltxname!="全部")
  1570. {
  1571. path+=growthtxdlg.m_seltxname;
  1572. path+="\\";
  1573. }
  1574. }*/
  1575. if (CheckHC())
  1576. {
  1577. m_bFromLocal = 1;
  1578. char path[MAX_PATH];
  1579. ::GetSystemDirectory(path, MAX_PATH);
  1580. CString sysdir = path;
  1581. sysdir += "\\lyfz";
  1582. ::CreateDirectory(sysdir, NULL);
  1583. sysdir += "\\";
  1584. sysdir += m_strOrderNumber;
  1585. using namespace helper_coffs;
  1586. ffsco o;
  1587. o.dirs(1);
  1588. o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
  1589. ffsco::typeT coo;
  1590. ffsco::typeT::iterator it;
  1591. coo = o.co_file();
  1592. for (it = coo.begin(); coo.end() != it; it++)
  1593. {
  1594. str = (*it).c_str();
  1595. // printf("Jeff:str=%s\n\n",str);// Jeff Printf
  1596. if (str.GetAt(str.ReverseFind('\\') + 1) != 's' && str.GetAt(str.ReverseFind('\\') + 1) != 'm')
  1597. {
  1598. m_patharray1.Add(str);
  1599. }
  1600. }
  1601. }
  1602. if (m_patharray1.GetSize() == 0)
  1603. {
  1604. if (IsPhoto2Exist())
  1605. {
  1606. SelBrunDevice dlg;
  1607. dlg.m_mode = 1;
  1608. if (dlg.DoModal() == IDOK)
  1609. m_nChoosePhotoType = dlg.m_sel;
  1610. else
  1611. m_nChoosePhotoType = 0;
  1612. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  1613. }
  1614. else
  1615. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  1616. {
  1617. CString path2;
  1618. m_path = g_path1 + "\\";
  1619. m_path += m_strOrderNumber;
  1620. m_path += "\\";
  1621. if (m_seltxname != "" && m_seltxname != "全部")
  1622. {
  1623. m_path += m_seltxname; m_path += "\\";
  1624. }
  1625. if (m_nChoosePhotoType == 1)
  1626. {
  1627. m_path = g_path2 + "\\";
  1628. m_path += m_strOrderNumber;
  1629. m_path += "\\";
  1630. }
  1631. CString filename;
  1632. using namespace helper_coffs;
  1633. ffsco o;
  1634. o.dirs(1);
  1635. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  1636. ffsco::typeT coo;
  1637. ffsco::typeT::iterator it;
  1638. coo = o.co_file();
  1639. for (it = coo.begin(); coo.end() != it; it++)
  1640. {
  1641. path = (*it).c_str();
  1642. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  1643. {
  1644. path.MakeLower();
  1645. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1646. if (filename.Find(".") != -1)
  1647. filename = filename.Left(filename.Find("."));
  1648. if (!myisdigit(filename))continue;
  1649. if (m_nChoosePhotoType == 1)
  1650. {
  1651. #if JEFF_TEST_ON
  1652. if (PathFileExists(path))
  1653. m_patharray1.Add(path);
  1654. #else
  1655. m_patharray1.Add(path);
  1656. #endif
  1657. }
  1658. else
  1659. {
  1660. path2 = path;
  1661. if (m_nChoosePhotoType == 0)
  1662. path2.Replace("客户原片", "修好的片");
  1663. if (m_bGrowthTX == 0)
  1664. {
  1665. int pos = path2.Find(m_strOrderNumber);
  1666. pos += m_strOrderNumber.GetLength();
  1667. int pos2 = path2.ReverseFind('\\');
  1668. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  1669. }
  1670. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  1671. {
  1672. m_patharray1.Add(path2);
  1673. }
  1674. else
  1675. {
  1676. path2.Replace(".raw", ".jpg");
  1677. if (::PathFileExists(path2))
  1678. {
  1679. m_patharray1.Add(path2); continue;
  1680. }
  1681. path2.Replace(".nef", ".jpg");
  1682. if (PathFileExists(path2))
  1683. {
  1684. m_patharray1.Add(path2); continue;
  1685. }
  1686. path2.Replace(".cr2", ".jpg");
  1687. if (PathFileExists(path2))
  1688. {
  1689. m_patharray1.Add(path2);
  1690. continue;
  1691. }
  1692. else
  1693. {
  1694. if (path.Right(3) != "jpg")
  1695. continue;
  1696. #if JEFF_TEST_ON
  1697. if (PathFileExists(path))
  1698. m_patharray1.Add(path);
  1699. #else
  1700. m_patharray1.Add(path);
  1701. #endif
  1702. }
  1703. }
  1704. }
  1705. }
  1706. }
  1707. }
  1708. // if(0)
  1709. {//多种修好的效果
  1710. CString path2;
  1711. path2 = g_path2 + "\\";
  1712. path2 += m_strOrderNumber;
  1713. path2 += "\\";
  1714. using namespace helper_coffs;
  1715. ffsco o;
  1716. o.dirs(0);
  1717. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  1718. ffsco::typeT coo;
  1719. ffsco::typeT::iterator it;
  1720. coo = o.co_file();
  1721. for (it = coo.begin();
  1722. coo.end() != it;
  1723. it++)
  1724. {
  1725. path = (*it).c_str();
  1726. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  1727. {
  1728. path.MakeLower();
  1729. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  1730. if (path2.Find("-") != -1)
  1731. {
  1732. #if JEFF_TEST_ON
  1733. if (PathFileExists(path))
  1734. m_patharray1.Add(path);
  1735. #else
  1736. m_patharray1.Add(path);
  1737. #endif
  1738. }
  1739. }
  1740. }
  1741. }
  1742. }
  1743. if (m_patharray1.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
  1744. {
  1745. int size = m_patharray1.GetSize() - 1;
  1746. CString sTemp;
  1747. int nPos;
  1748. for (int i = 0; i < size; i++)
  1749. {
  1750. nPos = rand() % (size - i);
  1751. sTemp = m_patharray1.ElementAt(size - i);
  1752. m_patharray1.SetAt(size - i, m_patharray1.ElementAt(nPos));
  1753. m_patharray1.SetAt(nPos, sTemp);
  1754. }
  1755. }
  1756. }
  1757. m_ImageListThumb.Create(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, ILC_COLOR24, 0, 1);
  1758. m_List1.SetImageList(&m_ImageListThumb, LVSIL_NORMAL);
  1759. m_List2.InitStyle();
  1760. m_List2.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
  1761. m_List2.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 150);
  1762. m_List2.InsertColumn(2, _T("数量"), LVCFMT_LEFT, 45);
  1763. m_List3.InitStyle();
  1764. m_List3.InsertColumn(0, _T("autoid"), LVCFMT_LEFT, 0);
  1765. m_List3.InsertColumn(1, _T("编号"), LVCFMT_LEFT, 45);
  1766. m_List3.InsertColumn(2, _T("商品名称"), LVCFMT_LEFT, 150);
  1767. m_List3.InsertColumn(3, _T("价格"), LVCFMT_LEFT, 45);
  1768. m_List3.InsertColumn(4, _T("数量"), LVCFMT_LEFT, 45);
  1769. #ifdef LKAY_VERSION
  1770. m_List3.InsertColumn(5,_T("P数"),LVCFMT_LEFT,55);
  1771. m_List3.InsertColumn(6,_T("张数"),LVCFMT_LEFT,55);
  1772. m_List3.InsertColumn(7,_T("照片编号"),LVCFMT_LEFT,365);
  1773. #else
  1774. m_List3.InsertColumn(5, _T("照片编号"), LVCFMT_LEFT, 365);
  1775. #endif
  1776. }
  1777. void ChoosePhotoSkin2::OnPaint()
  1778. {
  1779. try
  1780. {
  1781. CPaintDC dc(this); // device context for painting
  1782. // TODO: Add your message handler code here
  1783. if (m_pBk == NULL)
  1784. {
  1785. return;
  1786. }
  1787. CRect rc;
  1788. GetClientRect(rc);
  1789. Graphics graph(dc.GetSafeHdc());
  1790. Rect destinationRect(0, 0, rc.Width(), rc.Height());
  1791. int width = m_pBk->GetWidth();
  1792. int height = m_pBk->GetHeight();
  1793. graph.SetSmoothingMode(SmoothingModeHighQuality);
  1794. graph.DrawImage(m_pBk, destinationRect, 0, 0, width, height, UnitPixel);
  1795. // Do not call CDialog::OnPaint() for painting messages
  1796. }
  1797. catch (...)
  1798. {
  1799. }
  1800. }
  1801. void ChoosePhotoSkin2::OnPaint2(CWnd *pWnd)
  1802. {
  1803. try
  1804. {
  1805. CPaintDC dc(pWnd); // device context for painting
  1806. // TODO: Add your message handler code here
  1807. CRect rc;
  1808. GetClientRect(rc);
  1809. if (m_pBk == NULL)
  1810. {
  1811. return;
  1812. }
  1813. int width = m_pBk->GetWidth();
  1814. int height = m_pBk->GetHeight();
  1815. Graphics graph(dc.GetSafeHdc());
  1816. Rect destinationRect(0, 0, rc.Width(), rc.Height());
  1817. graph.SetSmoothingMode(SmoothingModeHighQuality);
  1818. graph.DrawImage(m_pBk, destinationRect, 0, 0, width, height, UnitPixel);
  1819. }
  1820. catch (...)
  1821. {
  1822. }
  1823. }
  1824. void ChoosePhotoSkin2::OnDestroy()
  1825. {
  1826. try
  1827. {
  1828. TerminateThread();
  1829. if (m_pBk)delete m_pBk;
  1830. MyBmpButton2 *pic = NULL;
  1831. for (int i = 0; i < m_picarray.GetSize(); i++)
  1832. {
  1833. pic = (MyBmpButton2*)m_picarray.ElementAt(i);
  1834. if (pic)
  1835. {
  1836. pic->DestroyWindow();
  1837. delete pic;
  1838. }
  1839. }
  1840. m_picarray.RemoveAll();
  1841. if (m_selphotownd.GetSafeHwnd())
  1842. {
  1843. m_selphotownd.DestroyWindow();
  1844. }
  1845. if (m_selphotownd2.GetSafeHwnd())
  1846. {
  1847. m_selphotownd2.DestroyWindow();
  1848. }
  1849. /* char path[MAX_PATH];
  1850. ::GetSystemDirectory (path, MAX_PATH);
  1851. CString sysdir=path;
  1852. sysdir+="\\lyfz";
  1853. ::DeleteDirectory (sysdir);*/
  1854. CDialog::OnDestroy();
  1855. }
  1856. catch (...)
  1857. {
  1858. }
  1859. }
  1860. BOOL ChoosePhotoSkin2::OnEraseBkgnd(CDC* pDC)
  1861. {
  1862. return 1;
  1863. }
  1864. void ChoosePhotoSkin2::SetLiaPath(CString path)
  1865. {
  1866. m_liapath = path;
  1867. }
  1868. BEGIN_EVENTSINK_MAP(ChoosePhotoSkin2, CDialog)
  1869. ON_EVENT(ChoosePhotoSkin2, 100, 150 /* FSCommand */, OnFSCommandShockwaveflash1, VTS_BSTR VTS_BSTR)
  1870. END_EVENTSINK_MAP()
  1871. void ChoosePhotoSkin2::OnFSCommandShockwaveflash1(LPCTSTR command, LPCTSTR args)
  1872. {
  1873. }
  1874. //extern void LoadImageFromFile(Image **img, CString path);
  1875. unsigned __stdcall LoadThumbNail3(LPVOID lpParam)
  1876. {
  1877. ChoosePhotoSkin2 *pDlg = (ChoosePhotoSkin2*)lpParam;
  1878. CListCtrl *ListCtrl = &pDlg->m_List1;
  1879. try
  1880. {
  1881. CImageList* pImgList = &pDlg->m_ImageListThumb;
  1882. // reset our image list
  1883. for (int i = 0; i < pImgList->GetImageCount(); i++)
  1884. pImgList->Remove(i);
  1885. // remove all items from list view
  1886. ListCtrl->DeleteAllItems();
  1887. pImgList->SetImageCount(pDlg->m_vFileName.size());
  1888. // TCHAR path[MAX_PATH];
  1889. vector<CString>::iterator iter;
  1890. // Set redraw to FALSE to avoid flickering during adding new items
  1891. ListCtrl->SetRedraw(FALSE);
  1892. int nIndex = 0;
  1893. CString str, spath;
  1894. if (pDlg->m_mode2 == 0) // 选片;
  1895. {
  1896. for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
  1897. {
  1898. str = *iter;
  1899. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  1900. str = str.Left(str.Find('.'));
  1901. str += pDlg->GetSelName(str);
  1902. ListCtrl->InsertItem(nIndex, str, nIndex);
  1903. }
  1904. }
  1905. else // 看设计;
  1906. {
  1907. for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
  1908. {
  1909. str = *iter;
  1910. spath.Empty();
  1911. if (str.Left(str.ReverseFind('\\') + 1) != pDlg->m_path)
  1912. {
  1913. spath = str.Left(str.ReverseFind('\\') + 1);
  1914. spath = spath.Right(spath.GetLength() - pDlg->m_path.GetLength());
  1915. }
  1916. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  1917. if (str.Find("delgabook") != -1)
  1918. {
  1919. str.TrimRight("\\");
  1920. str = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  1921. str.Replace("delgabook", "Flash");
  1922. ListCtrl->InsertItem(nIndex, str, nIndex);
  1923. }
  1924. else
  1925. {
  1926. str = spath + str.Left(str.GetLength() - 4);
  1927. CString temp = pDlg->GetSelName(str);
  1928. ListCtrl->InsertItem(nIndex, str + temp, nIndex);
  1929. }
  1930. }
  1931. }
  1932. ListCtrl->SetRedraw(TRUE);
  1933. ListCtrl->Invalidate();
  1934. const float fRatio = (float)THUMBNAIL_HEIGHT / THUMBNAIL_WIDTH;
  1935. int XDest, YDest, nDestWidth, nDestHeight;
  1936. nIndex = 0;
  1937. SolidBrush whitebrush(Color(255, 255, 255, 255));
  1938. Image *pHideImg = NULL;
  1939. Bitmap *pNULLBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
  1940. Graphics graph2(pNULLBmp);
  1941. graph2.Clear(Color(255, 0, 0, 0));
  1942. for (iter = pDlg->m_vFileName.begin(); iter != pDlg->m_vFileName.end() && pDlg->m_bTerminate != true; iter++, nIndex++)
  1943. {
  1944. // Load Image File
  1945. Image *image = NULL;
  1946. Bitmap *pBmp = NULL;
  1947. str = *iter;
  1948. spath = str.Left(str.ReverseFind('\\') + 1);
  1949. spath += "s";
  1950. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  1951. // if(pDlg->m_mode2==0 && pDlg->m_bHide && pHideImg==NULL)
  1952. if (pDlg->m_bHide && pHideImg == NULL)
  1953. {
  1954. LoadImageFromRes(&pHideImg, MAKEINTRESOURCE(IDR_JPG5), _T("JPG"));
  1955. }
  1956. BOOL bNullimg = 0;
  1957. if (pHideImg == NULL)
  1958. {
  1959. // if(atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0 && pDlg->m_mode2==0)
  1960. if (0)//pDlg->m_bFromLocal && pDlg->m_mode2==0)
  1961. {
  1962. spath = spath.Right(spath.GetLength() - spath.ReverseFind('\\'));
  1963. CString stemp;
  1964. stemp = g_path2 + "\\";
  1965. stemp += pDlg->m_strOrderNumber;
  1966. stemp += "\\";
  1967. stemp += spath;
  1968. if (PathFileExists(stemp))
  1969. spath = stemp;
  1970. else
  1971. {
  1972. stemp = g_path1 + "\\";
  1973. stemp += pDlg->m_strOrderNumber;
  1974. stemp += "\\";
  1975. stemp += spath;
  1976. spath = stemp;
  1977. }
  1978. }
  1979. if (PathFileExists(spath))
  1980. {
  1981. ::LoadImageFromBuf(&image, spath);
  1982. }
  1983. else if (PathFileExists(str))
  1984. ::LoadImageFromBuf(&image, str);
  1985. else
  1986. {
  1987. bNullimg = 1;
  1988. image = pNULLBmp;
  1989. }
  1990. if (image == NULL)continue;
  1991. if (image->GetWidth() == 0)
  1992. continue;
  1993. int orientation = GetOrientation(image);
  1994. if (orientation == 8)
  1995. image->RotateFlip(Rotate270FlipNone);
  1996. else if (orientation == 6)
  1997. image->RotateFlip(Rotate90FlipNone);
  1998. }
  1999. else
  2000. image = pHideImg;
  2001. // Calculate Rect to fit to canvas
  2002. const float fImgRatio = (float)image->GetHeight() / image->GetWidth();
  2003. if (fImgRatio > fRatio)
  2004. {
  2005. nDestWidth = THUMBNAIL_HEIGHT / fImgRatio;
  2006. XDest = (THUMBNAIL_WIDTH - nDestWidth) / 2;
  2007. YDest = 0;
  2008. nDestHeight = THUMBNAIL_HEIGHT;
  2009. }
  2010. else
  2011. {
  2012. XDest = 0;
  2013. nDestWidth = THUMBNAIL_WIDTH;
  2014. nDestHeight = THUMBNAIL_WIDTH*fImgRatio;
  2015. YDest = (THUMBNAIL_HEIGHT - nDestHeight) / 2;
  2016. }
  2017. pBmp = new Bitmap(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, PixelFormat24bppRGB);
  2018. Graphics graph2(pBmp);
  2019. graph2.Clear(Color(255, 192, 192, 192));
  2020. graph2.FillRectangle(&whitebrush, 1, 1, THUMBNAIL_WIDTH - 2, THUMBNAIL_HEIGHT - 2);
  2021. Graphics graph(pBmp);
  2022. Rect desRect(XDest, YDest, nDestWidth, nDestHeight);
  2023. // Draw Image
  2024. graph.DrawImage(image, desRect, 0, 0, image->GetWidth(), image->GetHeight(), UnitPixel);
  2025. if (pHideImg == NULL && bNullimg == 0)
  2026. delete image;
  2027. // Attach to Bitmap and Replace image in CImageList
  2028. CBitmap bitmap;
  2029. HBITMAP hbmp;
  2030. pBmp->GetHBITMAP(Color(255, 255, 255, 255), &hbmp);
  2031. bitmap.Attach(hbmp);
  2032. pImgList->Replace(nIndex, &bitmap, NULL);
  2033. delete pBmp;
  2034. // Redraw only a current item for removing flickering and fast speed.
  2035. ListCtrl->RedrawItems(nIndex, nIndex);
  2036. // Release used DC and Object
  2037. }
  2038. delete pNULLBmp;
  2039. if (pHideImg)delete pHideImg;
  2040. ListCtrl->Invalidate();
  2041. pDlg->m_bRunning = false;
  2042. pDlg->m_bTerminate = false;
  2043. pDlg->PostMessage(WM_USER + 200, 0, 0);
  2044. _endthreadex(0);
  2045. return 0;
  2046. }
  2047. catch (...)
  2048. {
  2049. ListCtrl->Invalidate();
  2050. pDlg->m_bRunning = false;
  2051. pDlg->m_bTerminate = false;
  2052. pDlg->PostMessage(WM_USER + 200, 0, 0);
  2053. _endthreadex(0);
  2054. }
  2055. }
  2056. void ChoosePhotoSkin2::LoadThumbImages()
  2057. {
  2058. TerminateThread();
  2059. m_hThread = (HANDLE)_beginthreadex(NULL, 0, LoadThumbNail3, (LPVOID)this, 0/* CREATE_SUSPENDED*/, &m_dwThreadID);
  2060. m_bRunning = true;
  2061. }
  2062. BOOL ChoosePhotoSkin2::TerminateThread()
  2063. {
  2064. if (!m_bRunning)
  2065. return TRUE;
  2066. m_bTerminate = true;
  2067. for (;;)
  2068. {
  2069. if (::WaitForSingleObject(m_hThread, 0) == WAIT_OBJECT_0)
  2070. break;
  2071. MSG msg;
  2072. while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
  2073. {
  2074. if (!AfxGetApp()->PumpMessage())
  2075. break;
  2076. }
  2077. }
  2078. ::CloseHandle(m_hThread);
  2079. return TRUE;
  2080. }
  2081. //------------------------------------------------------------------
  2082. // Remark by Jeff 2014.11.03
  2083. // 函数:OnDblclkList1
  2084. // 描述:处理双击和回车时的图片显示效果;与函数名本身的表达意义不一致,导致歧义!
  2085. // 参数:
  2086. // 返回:
  2087. //------------------------------------------------------------------
  2088. void ChoosePhotoSkin2::OnDblclkList1()
  2089. {
  2090. // 1.从双击中的列表项中获取相片名;
  2091. POSITION pos;
  2092. pos = m_List1.GetFirstSelectedItemPosition();
  2093. if (pos == NULL)
  2094. {
  2095. return;
  2096. }
  2097. int iItem = m_List1.GetNextSelectedItem(pos);
  2098. #if JEFF_TEST_OFF
  2099. // 双击列表根本就不做不到多选多击,双击只会选中一个,故GetNextSelectedItem(pos)后,pos=NULL
  2100. // 但是这个函数的作用并不是跟函数名一致,有其他地方用到。
  2101. #else // 这一块代码是用于处理回车键;
  2102. CArray<int, int>posarray;
  2103. posarray.Add(iItem);
  2104. // 获取剩下的图片位置;
  2105. while (pos)
  2106. {
  2107. int iItem = m_List1.GetNextSelectedItem(pos);
  2108. posarray.Add(iItem);
  2109. if (posarray.GetSize() > 3)break;
  2110. }
  2111. if (posarray.GetSize() >= 2)
  2112. {
  2113. CStringArray *m_pPtahArray = GetCurArray();
  2114. CComparePhoto dlg;
  2115. dlg.m_path1 = m_pPtahArray->ElementAt(posarray.ElementAt(0));
  2116. dlg.m_path2 = m_pPtahArray->ElementAt(posarray.ElementAt(1));
  2117. if (posarray.GetSize() > 2)
  2118. dlg.m_path3 = m_pPtahArray->ElementAt(posarray.ElementAt(2));
  2119. if (posarray.GetSize() > 3)
  2120. dlg.m_path4 = m_pPtahArray->ElementAt(posarray.ElementAt(3));
  2121. dlg.DoModal();
  2122. return;
  2123. }
  2124. #endif
  2125. if (m_mode2 == 1)//看设计
  2126. {
  2127. CString title = m_List1.GetItemText(iItem, 0);
  2128. if (title.Find("Flash") != -1)
  2129. {
  2130. title.Replace("Flash", "delgabook");
  2131. CString str = m_path + title + "\\delgaBook.exe";
  2132. ShellExecute(NULL, _T("open"), str, NULL, NULL, SW_SHOWNORMAL);
  2133. return;
  2134. }
  2135. }
  2136. m_showpichwd = NULL;
  2137. // 双击小图查看大图;
  2138. ShowPic22 dlg;
  2139. if (m_mode2 == 1) // ==1 看设计;
  2140. dlg.m_bShowName = 1;
  2141. dlg.m_pParent = this;
  2142. dlg.m_pos = iItem;
  2143. if (m_mode2 == 0 && atoi(g_cominfoarray.ElementAt(0).ElementAt(100)))
  2144. {
  2145. CStringArray saCurrentImagePath; // 当前列表相片;
  2146. CStringArray arraymsize; // 对应的"m"相片路径;
  2147. CStringArray *pArray = GetCurArray();
  2148. saCurrentImagePath.Copy(*pArray);
  2149. for (int i = 0; i < saCurrentImagePath.GetSize(); i++)
  2150. {
  2151. CString str = saCurrentImagePath.ElementAt(i);
  2152. CString spath = str.Left(str.ReverseFind('\\') + 1);
  2153. spath += "m";
  2154. spath += str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  2155. if (::PathFileExists(spath))
  2156. arraymsize.Add(spath);
  2157. else
  2158. arraymsize.Add(str);
  2159. }
  2160. dlg.m_pPathArray = &arraymsize;
  2161. dlg.m_pPathArrayBigsize = &saCurrentImagePath;
  2162. dlg.DoModal();
  2163. }
  2164. else
  2165. {
  2166. dlg.m_pPathArray = GetCurArray();
  2167. dlg.DoModal();
  2168. }
  2169. m_showpichwd = NULL;
  2170. }
  2171. void ChoosePhotoSkin2::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) // 双击图片列表!
  2172. {
  2173. OnDblclkList1();
  2174. *pResult = 0;
  2175. }
  2176. CString GetModifyTime2(CString path)
  2177. {
  2178. HANDLE hFile;
  2179. WIN32_FIND_DATA wfd;
  2180. SYSTEMTIME systime;
  2181. FILETIME localtime;
  2182. CString stime; //输出时间
  2183. memset(&wfd, 0, sizeof(wfd));
  2184. if ((hFile = FindFirstFile(path, &wfd)) == INVALID_HANDLE_VALUE)
  2185. return "";
  2186. //ok,转换时间
  2187. FileTimeToLocalFileTime(&wfd.ftLastWriteTime, &localtime);
  2188. FileTimeToSystemTime(&localtime, &systime);
  2189. stime.Format("%4d%02d%02d",
  2190. systime.wYear, systime.wMonth, systime.wDay);
  2191. return stime;
  2192. }
  2193. BOOL ChoosePhotoSkin2::GetData()//选片模式;
  2194. {
  2195. m_List2.DeleteAllItems();
  2196. m_List3.DeleteAllItems();
  2197. m_noarray.RemoveAll();
  2198. m_no2array.RemoveAll();
  2199. #ifdef CHILD_VERSION
  2200. CString filter = "id='" + m_strOrderNumber + "';id='" + m_strOrderNumber + "';;id='" + m_strOrderNumber + "'";
  2201. if (m_seltxname != "" && m_seltxname != "全部")
  2202. {
  2203. filter = "id='" + m_strOrderNumber + "' and growthtxname='" + m_seltxname + "';id='" + m_strOrderNumber + "';;id='" + m_strOrderNumber + "'";
  2204. }
  2205. #else
  2206. CString filter = "id='" + m_strOrderNumber + "' and kind<>'2';id='" + m_strOrderNumber + "';;id='" + m_strOrderNumber + "'";
  2207. #endif
  2208. g_sendhead.code[0] = 50; // dindansp;
  2209. g_sendhead.code[1] = 11; // dindan
  2210. g_sendhead.code[2] = 4; // shangpin
  2211. g_sendhead.code[3] = 182; // dindansp3
  2212. g_sendhead.tabcount = 4;
  2213. g_sendhead.bsql = 0;
  2214. g_pMainWnd->ProcessChatMessageRequest2(filter);
  2215. if (g_bSendOK == 0)return 0;
  2216. CArray<CStringArray, CStringArray>sparray;
  2217. DataToArray(&sparray, &g_List1array, &m_sparray, &oldsparray);
  2218. m_patharray2.RemoveAll();
  2219. CString str, kind;
  2220. int nchoosezs = 0;
  2221. int list2pos = 0;
  2222. int list3pos = 0;
  2223. CString savepath;
  2224. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  2225. CString stm1 = GetModifyTime2(savepath);
  2226. CTime tm1 = CTime::GetCurrentTime();
  2227. tm1 -= CTimeSpan(2, 0, 0, 0);
  2228. CString stm2 = tm1.Format("%Y%m%d");
  2229. BOOL bLoadHistory = 0;
  2230. if (PathFileExists(savepath) && stm1 > stm2)
  2231. {
  2232. if (AfxMessageBox("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  2233. bLoadHistory = 1;
  2234. }
  2235. if (bLoadHistory)
  2236. {
  2237. CArray<CStringArray, CStringArray>List1array;
  2238. CFile fp;
  2239. fp.Open(savepath, CFile::modeRead);
  2240. DWORD nMessageLen = fp.GetLength();
  2241. BYTE *szChatMessage = new BYTE[nMessageLen];
  2242. fp.Read(szChatMessage, nMessageLen);
  2243. fp.Close();
  2244. int count;
  2245. memcpy(&count, szChatMessage + (nMessageLen - sizeof(int)), sizeof(int));
  2246. CMemFile memfile;
  2247. memfile.Attach(szChatMessage, nMessageLen);
  2248. CArchive ar(&memfile, CArchive::load);
  2249. List1array.SetSize(count);
  2250. int i = 0;
  2251. for ( i = 0; i < List1array.GetSize(); i++)
  2252. {
  2253. List1array.ElementAt(i).Serialize(ar);
  2254. }
  2255. ar.Close();
  2256. memfile.Detach();
  2257. delete[]szChatMessage;
  2258. list2pos = 0;
  2259. list3pos = 0;
  2260. for (i = 0; i < List1array.GetSize(); i++)
  2261. {
  2262. if (0)//List1array.ElementAt (i).GetSize ()==6)
  2263. {
  2264. kind = "0";
  2265. m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
  2266. m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
  2267. m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
  2268. m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
  2269. m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
  2270. str = List1array.ElementAt(i).ElementAt(5);
  2271. list2pos++;
  2272. }
  2273. else
  2274. {
  2275. kind = "4";
  2276. m_List3.InsertItem(list3pos, List1array.ElementAt(i).ElementAt(1));
  2277. m_List3.SetItemText(list3pos, 1, List1array.ElementAt(i).ElementAt(2));
  2278. m_List3.SetItemText(list3pos, 2, List1array.ElementAt(i).ElementAt(3));
  2279. m_List3.SetItemText(list3pos, 3, List1array.ElementAt(i).ElementAt(4));
  2280. m_List3.SetItemText(list3pos, 4, List1array.ElementAt(i).ElementAt(5));
  2281. m_List3.SetItemText(list3pos, 5, List1array.ElementAt(i).ElementAt(6));
  2282. #ifdef LKAY_VERSION
  2283. m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
  2284. m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
  2285. str=List1array.ElementAt (i).ElementAt (8);
  2286. #else
  2287. str = List1array.ElementAt(i).ElementAt(6);
  2288. #endif
  2289. list3pos++;
  2290. }
  2291. nchoosezs += GetZS(str);
  2292. GetPath(str);
  2293. if (!str.IsEmpty())
  2294. str = "," + str + ",";
  2295. str.MakeLower();
  2296. if (kind == "4")
  2297. m_no2array.Add(str);
  2298. else
  2299. m_noarray.Add(str);
  2300. }
  2301. }
  2302. else
  2303. {
  2304. for (int i = 0; i < sparray.GetSize(); i++)
  2305. {
  2306. kind = "4";//sparray.ElementAt (i).ElementAt (4);
  2307. if (kind == "4")
  2308. {
  2309. m_List3.InsertItem(list3pos, sparray.ElementAt(i).ElementAt(7));
  2310. m_List3.SetItemText(list3pos, 1, sparray.ElementAt(i).ElementAt(1));
  2311. m_List3.SetItemText(list3pos, 2, sparray.ElementAt(i).ElementAt(5));
  2312. m_List3.SetItemText(list3pos, 3, sparray.ElementAt(i).ElementAt(2));
  2313. m_List3.SetItemText(list3pos, 4, sparray.ElementAt(i).ElementAt(3));
  2314. #ifdef LKAY_VERSION
  2315. m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9));
  2316. m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
  2317. m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (6));
  2318. #else
  2319. m_List3.SetItemText(list3pos, 5, sparray.ElementAt(i).ElementAt(6));
  2320. #endif
  2321. list3pos++;
  2322. }
  2323. else
  2324. {
  2325. m_List2.InsertItem(list2pos, sparray.ElementAt(i).ElementAt(7));
  2326. m_List2.SetItemText(list2pos, 1, sparray.ElementAt(i).ElementAt(1));
  2327. m_List2.SetItemText(list2pos, 2, sparray.ElementAt(i).ElementAt(5));
  2328. m_List2.SetItemText(list2pos, 3, sparray.ElementAt(i).ElementAt(3));
  2329. m_List2.SetItemText(list2pos, 4, sparray.ElementAt(i).ElementAt(6));
  2330. list2pos++;
  2331. }
  2332. str = sparray.ElementAt(i).ElementAt(6);
  2333. str.MakeLower();
  2334. nchoosezs += GetZS(str);
  2335. GetPath(str);
  2336. if (!str.IsEmpty())
  2337. str = "," + str + ",";
  2338. if (kind == "4")
  2339. m_no2array.Add(str);
  2340. else
  2341. m_noarray.Add(str);
  2342. }
  2343. CheckForAlbum();
  2344. CheckForDisk();
  2345. }
  2346. if (g_List1array.GetSize())
  2347. {
  2348. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  2349. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  2350. m_phone1 = g_List1array.ElementAt(0).ElementAt(61);
  2351. m_phone2 = g_List1array.ElementAt(0).ElementAt(62);
  2352. if (!m_name1.IsEmpty())
  2353. m_name = m_name1 + ",";
  2354. m_name += m_name2;
  2355. m_name.TrimRight(",");
  2356. m_waiter3 = g_user.name;
  2357. m_taoxizs = g_List1array.ElementAt(0).ElementAt(9);
  2358. m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  2359. m_takezs = g_List1array.ElementAt(0).ElementAt(23);
  2360. m_choosezs = g_List1array.ElementAt(0).ElementAt(24);
  2361. m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  2362. m_oldmoney3 = m_money3;
  2363. m_bz3 = g_List1array.ElementAt(0).ElementAt(39);
  2364. m_bz4 = g_List1array.ElementAt(0).ElementAt(75);
  2365. m_urgent = g_List1array.ElementAt(0).ElementAt(40);
  2366. m_delphotos = g_List1array.ElementAt(0).ElementAt(53); // Jeff开始选片时,获取dindan表的字段delphotos.读取正常。
  2367. m_time6 = g_List1array.ElementAt(0).ElementAt(48);
  2368. m_time5old = m_time5;
  2369. m_time6old = m_time6;
  2370. taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  2371. m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  2372. m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  2373. m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  2374. m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  2375. ren = g_List1array.ElementAt(0).ElementAt(14);
  2376. m_size = g_List1array.ElementAt(0).ElementAt(60);
  2377. m_checkstatus = g_List1array.ElementAt(0).ElementAt(32);
  2378. UpdateData(false);
  2379. }
  2380. else
  2381. {
  2382. m_name1 = "";
  2383. m_name2 = "";
  2384. m_waiter3 = "";
  2385. m_taoxizs = "";
  2386. m_time5 = "";
  2387. m_takezs = "";
  2388. m_choosezs = "";
  2389. m_money3 = "";
  2390. m_bz3 = "";
  2391. m_bz4 = "";
  2392. m_urgent = "";
  2393. UpdateData(false);
  2394. }
  2395. return 1;
  2396. }
  2397. void ChoosePhotoSkin2::OnOK()
  2398. {
  2399. }
  2400. void ChoosePhotoSkin2::OnCancel()
  2401. {
  2402. }
  2403. void ChoosePhotoSkin2::OnClose()
  2404. {
  2405. if (m_bModify)
  2406. {
  2407. if (AfxMessageBox("提醒, 选片修改未保存, 是否保存后再退出?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  2408. {
  2409. OnButton4();
  2410. }
  2411. }
  2412. CDialog::OnCancel();
  2413. }
  2414. BOOL ChoosePhotoSkin2::PreTranslateMessage(MSG* pMsg)
  2415. {
  2416. if (pMsg->message == WM_LBUTTONDOWN)
  2417. {
  2418. g_bNeedDrawParent = 2;
  2419. if (0)
  2420. {//list3
  2421. CPoint pt;
  2422. CRect rc, rc2;
  2423. ::GetCursorPos(&pt);
  2424. m_List3.GetWindowRect(rc2);
  2425. if (rc2.PtInRect(pt) == 0) return CDialog::PreTranslateMessage(pMsg);
  2426. SetTimer(3, 300, NULL);
  2427. }
  2428. }
  2429. /* else if(pMsg->message==WM_PAINT && pMsg->hwnd ==this->m_hWnd )
  2430. {
  2431. SetTimer(1, 100, NULL);
  2432. }
  2433. else if(pMsg->message==WM_TIMER&& pMsg->hwnd ==this->m_hWnd)
  2434. {
  2435. KillTimer(1);
  2436. DrawLogin();
  2437. }*/
  2438. else if (0)//pMsg->message==WM_LBUTTONDBLCLK)
  2439. {
  2440. {//list1
  2441. CPoint pt;
  2442. CRect rc, rc2;
  2443. ::GetCursorPos(&pt);
  2444. m_List2.GetWindowRect(rc2);
  2445. if (rc2.PtInRect(pt))
  2446. return 1;
  2447. }
  2448. {//list3
  2449. CPoint pt;
  2450. CRect rc, rc2;
  2451. ::GetCursorPos(&pt);
  2452. m_List3.GetWindowRect(rc2);
  2453. if (rc2.PtInRect(pt) == 0)return CDialog::PreTranslateMessage(pMsg);
  2454. pt.x -= rc2.left;
  2455. pt.y -= rc2.top;
  2456. int iItem = m_List3.GetItemCount() - 1;
  2457. if (iItem < 0)
  2458. {
  2459. m_List3.GetHeaderCtrl()->GetItemRect(0, rc);
  2460. int hei = rc.Height();
  2461. rc.top += hei;
  2462. rc.bottom += hei;
  2463. if (rc.PtInRect(pt))
  2464. {
  2465. m_List3.InsertItem(m_List3.GetItemCount(), "");
  2466. }
  2467. }
  2468. else
  2469. {
  2470. m_List3.GetSubItemRect(iItem, 0, LVIR_BOUNDS, rc);
  2471. int hei = rc.Height();
  2472. rc.top += hei;
  2473. rc.bottom += hei;
  2474. if (rc.PtInRect(pt))
  2475. {
  2476. if (m_List3.GetItemText(iItem, 1).IsEmpty() && m_List3.GetItemText(iItem, 2).IsEmpty())
  2477. return CDialog::PreTranslateMessage(pMsg);
  2478. m_List3.InsertItem(m_List3.GetItemCount(), "");
  2479. }
  2480. POSITION pos;
  2481. pos = m_List3.GetFirstSelectedItemPosition();
  2482. if (pos)
  2483. {
  2484. iItem = m_List3.GetNextSelectedItem(pos);
  2485. m_List3.GetSubItemRect(iItem, 4, LVIR_BOUNDS, rc);
  2486. if (rc.PtInRect(pt))return 1;
  2487. }
  2488. }
  2489. }
  2490. }
  2491. else if (pMsg->message == WM_KEYDOWN)
  2492. {
  2493. if (m_showpichwd)return 1;
  2494. switch (pMsg->wParam)
  2495. {
  2496. case VK_DELETE:
  2497. OnDel();
  2498. return 1;
  2499. case VK_RETURN:
  2500. OnDblclkList1();
  2501. return 1;
  2502. case VK_F4:
  2503. if (m_mode2 && m_bChooseBig == 0)return 1;
  2504. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(62)))
  2505. {
  2506. if (m_mode == 1)UpdateChooseZS();
  2507. SortArray();
  2508. }
  2509. return 1;
  2510. case VK_F5:
  2511. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(86)))
  2512. {
  2513. OnBtnClick(0, 99 + 4);
  2514. }
  2515. /* if(m_mode2==0)return 1;
  2516. {
  2517. ReplaceDesignNo dlg;
  2518. dlg.m_id=this->m_id ;
  2519. dlg.DoModal ();
  2520. }*/
  2521. return 1;
  2522. case VK_F1:
  2523. {
  2524. if (m_selphotownd2.GetSafeHwnd() == NULL)
  2525. {
  2526. m_selphotownd2.m_id = m_strOrderNumber;
  2527. m_selphotownd2.m_rc = m_rcarray.ElementAt(6);
  2528. m_selphotownd2.Create(IDD_DLGShowSelPhoto2, this);
  2529. }
  2530. m_selphotownd2.ShowWindow(1);
  2531. }
  2532. return 1;
  2533. case VK_F2:
  2534. if (m_mode2 && m_bChooseBig == 0)return 1;
  2535. if (0)
  2536. {
  2537. return 1;
  2538. CStringArray array;
  2539. for (int i = 0; i < m_List2.GetItemCount(); i++)
  2540. {
  2541. if (m_List2.GetItemText(i, 4).IsEmpty() == 0)
  2542. {
  2543. array.Add(m_List2.GetItemText(i, 0));
  2544. array.Add(m_List2.GetItemText(i, 4));
  2545. }
  2546. }
  2547. if (array.GetSize() == 0)return 1;
  2548. ChoosePhotoSkin2 dlg;
  2549. dlg.SetLiaPath("3.lia");
  2550. dlg.m_strOrderNumber = m_strOrderNumber;
  2551. dlg.m_pArray = &array;
  2552. dlg.m_path = g_path2 + "\\";
  2553. dlg.m_path += dlg.m_strOrderNumber;
  2554. dlg.m_path += "\\";
  2555. dlg.DoModal();
  2556. return 1;
  2557. }
  2558. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(60)))
  2559. {
  2560. m_bHide = !m_bHide;
  2561. LoadPhotos();
  2562. }
  2563. return 1;
  2564. case VK_F6:
  2565. {
  2566. if (m_mode2)
  2567. {
  2568. ReplaceDesignNo dlg;
  2569. dlg.m_id = this->m_strOrderNumber;
  2570. dlg.DoModal();
  2571. }
  2572. }
  2573. return 1;
  2574. }
  2575. }
  2576. return CDialog::PreTranslateMessage(pMsg);
  2577. }
  2578. void ChoosePhotoSkin2::OnRclickList1()// 右键选片模式;
  2579. {
  2580. // 1.Jeff:看设计模式;
  2581. if (m_mode2)
  2582. {
  2583. OnRclickList2();
  2584. return;
  2585. }
  2586. // 2.Jeff:开始选片模式;
  2587. if (m_bRunning)return;
  2588. POSITION pos;
  2589. pos = m_List1.GetFirstSelectedItemPosition();
  2590. if (pos == NULL)
  2591. {
  2592. return;
  2593. }
  2594. int iItem = m_List1.GetNextSelectedItem(pos);
  2595. CString scount;
  2596. // .获取当前查看的相片;
  2597. CStringArray *pArray = GetCurArray();
  2598. CString path = pArray->ElementAt(iItem);
  2599. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2600. path = path.Left(path.ReverseFind('.'));
  2601. if (m_mode2)// Jeff:第1步时就退出了,这里判断有意义????? 这一段代码永远不会执行;
  2602. {
  2603. if (!CheckName(path))
  2604. {
  2605. CMenuXP *pPopup;
  2606. pPopup = new CMenuXP;
  2607. pPopup->CYBUTTONMARGIN = 3;
  2608. pPopup->CreatePopupMenu();
  2609. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);
  2610. pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
  2611. CPoint pt;
  2612. ::GetCursorPos(&pt);
  2613. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  2614. delete pPopup;
  2615. return;
  2616. }
  2617. }
  2618. path = "," + path + ",";
  2619. CMenuXP *pPopup;
  2620. pPopup = new CMenuXP;
  2621. pPopup->CYBUTTONMARGIN = 3;
  2622. pPopup->CreatePopupMenu();
  2623. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);
  2624. int i = 0;
  2625. int maxleng = 1;
  2626. {
  2627. CString name, no;
  2628. int count = 0;
  2629. for ( i = 0; i < m_List2.GetItemCount(); i++)
  2630. {
  2631. name = m_List2.GetItemText(i, 2);
  2632. // Jeff,no里为商品名称选中的相片
  2633. no = m_noarray.ElementAt(i);
  2634. maxleng = max(maxleng, name.GetLength());
  2635. }
  2636. count = i;
  2637. for (; i < count + m_no2array.GetSize(); i++)
  2638. {
  2639. name = m_List3.GetItemText(i - count, 2);
  2640. maxleng = max(maxleng, name.GetLength());
  2641. }
  2642. }
  2643. maxleng += 3;
  2644. CString name, no;
  2645. int count = 0;
  2646. for ( i = 0; i < m_List2.GetItemCount(); i++)
  2647. {
  2648. name = m_List2.GetItemText(i, 2);
  2649. ::FillLength(name, maxleng);
  2650. // Jeff,no里为商品名称选中的相片
  2651. no = m_noarray.ElementAt(i);
  2652. GetSelCountFromName(no, scount);
  2653. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
  2654. if (no.Find(path) != -1)
  2655. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  2656. }
  2657. count = i;
  2658. for (; i < count + m_no2array.GetSize(); i++)
  2659. {
  2660. name = m_List3.GetItemText(i - count, 2);
  2661. ::FillLength(name, maxleng);
  2662. no = m_no2array.ElementAt(i - count);
  2663. GetSelCountFromName(no, scount);
  2664. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
  2665. if (no.Find(path) != -1)
  2666. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  2667. }
  2668. pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
  2669. CPoint pt;
  2670. ::GetCursorPos(&pt);
  2671. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);
  2672. delete pPopup;
  2673. }
  2674. void ChoosePhotoSkin2::OnRclickList2()// 右键看设计模式;
  2675. {
  2676. if (m_bRunning)return;
  2677. POSITION pos;
  2678. pos = m_List1.GetFirstSelectedItemPosition();
  2679. if (pos == NULL)
  2680. {
  2681. return;
  2682. }
  2683. int iItem = m_List1.GetNextSelectedItem(pos);
  2684. CString scount;
  2685. CStringArray *pArray = GetCurArray(); //获取当前查看的内容;
  2686. CString path = pArray->ElementAt(iItem); //path//打印出相片完整路径名;
  2687. if (m_bChooseBig)//选放大
  2688. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2689. else//选设计
  2690. path = path.Right(path.GetLength() - m_path.GetLength());
  2691. path = path.Left(path.ReverseFind('.'));
  2692. path = "," + path + ","; //
  2693. // TODO: Add your control notification handler code here
  2694. // 1.创建菜单对象;
  2695. CMenuXP *pPopup;
  2696. pPopup = new CMenuXP;
  2697. pPopup->CYBUTTONMARGIN = 3; // 1.0.按钮范围0~3; 4个菜单;
  2698. pPopup->CreatePopupMenu(); // 1.1.弹出式菜单;
  2699. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);// 1.2.弹出菜单样式;
  2700. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  2701. int i = 0;
  2702. int maxleng = 1;
  2703. {
  2704. CString name, no;
  2705. int count = 0;
  2706. for ( i = 0; i < m_List2.GetItemCount(); i++)
  2707. {
  2708. // name商品名称
  2709. name = m_List2.GetItemText(i, 2);
  2710. no = m_noarray.ElementAt(i);
  2711. maxleng = max(maxleng, name.GetLength());
  2712. }
  2713. count = i;
  2714. for (; i < count + m_no2array.GetSize(); i++)
  2715. {
  2716. name = m_List3.GetItemText(i - count, 2);
  2717. maxleng = max(maxleng, name.GetLength());
  2718. }
  2719. }
  2720. maxleng += 3;
  2721. // Jeff:m_List2有三列头:编号、商品名称、商品数量;
  2722. CString name, no;
  2723. int count = 0;
  2724. for ( i = 0; i < m_List2.GetItemCount(); i++)
  2725. {
  2726. name = m_List2.GetItemText(i, 2);
  2727. ::FillLength(name, maxleng);// Jeff:有这样的API函数么???怎么查也查不到
  2728. no = m_noarray.ElementAt(i);
  2729. GetSelCountFromName(no, scount);
  2730. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));// 2.使用AppendODMenu2添加子菜单项;
  2731. if (no.Find(path) != -1)
  2732. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  2733. }
  2734. count = i;
  2735. for (; i < count + m_no2array.GetSize(); i++)
  2736. {
  2737. name = m_List3.GetItemText(i - count, 2);
  2738. ::FillLength(name, maxleng);
  2739. no = m_no2array.ElementAt(i - count);
  2740. GetSelCountFromName(no, scount);
  2741. pPopup->AppendODMenu2(0, new CMenuXPText(IDM_MENUsp1 + i, name + scount, NULL));
  2742. if (no.Find(path) != -1)
  2743. pPopup->CheckMenuItem(IDM_MENUsp1 + i, MF_BYCOMMAND | MF_CHECKED);
  2744. }
  2745. pPopup->AppendODMenu2(0, new CMenuXPText(32794, "修改要求", NULL));
  2746. CPoint pt;
  2747. ::GetCursorPos(&pt);
  2748. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this, 0);// 3.使用TrackPopupMenu,正常弹出菜单;
  2749. delete pPopup;
  2750. }
  2751. void ChoosePhotoSkin2::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
  2752. {
  2753. if (m_showpichwd)return;
  2754. OnRclickList1();
  2755. *pResult = 0;
  2756. }
  2757. void SortArray2(CArray<int, int>&datearray)
  2758. {
  2759. int strtemp;
  2760. int last = datearray.GetSize() - 1;
  2761. bool sorted = true;
  2762. do {
  2763. sorted = true;
  2764. for (int i = 0; i < last; i++)
  2765. {
  2766. if (datearray[i] < datearray[i + 1])
  2767. {
  2768. strtemp = datearray[i];
  2769. datearray[i] = datearray[i + 1];
  2770. datearray[i + 1] = strtemp;
  2771. sorted = false;
  2772. }
  2773. }
  2774. last--;
  2775. } while (!sorted);
  2776. }
  2777. void ChoosePhotoSkin2::OnCommandMenu(UINT nID)//弹出菜单处理;
  2778. {
  2779. if (m_mode2)//看设计;
  2780. {
  2781. OnCommandMenu2(nID);
  2782. return;
  2783. }
  2784. if (32794 == nID)
  2785. {
  2786. if (m_mode2)//Jeff不会执行的代码;
  2787. {
  2788. OnButton4();
  2789. }
  2790. else
  2791. {
  2792. POSITION pos;
  2793. pos = m_List1.GetFirstSelectedItemPosition();
  2794. if (pos == NULL)
  2795. {
  2796. return;
  2797. }
  2798. int iItem = m_List1.GetNextSelectedItem(pos);
  2799. CStringArray *pArray = GetCurArray();
  2800. CString path = pArray->ElementAt(iItem);
  2801. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2802. path = path.Left(path.Find('.'));
  2803. if (m_bz4.GetLength() > 4080)
  2804. {
  2805. AfxMessageBox("备注太长,可在保存界面选中备注内容,按Delete键清除");
  2806. return;
  2807. }
  2808. UpdateData();
  2809. CClientRequirement dlg;
  2810. dlg.m_no = "当前照片:" + path;
  2811. // dlg.m_bz2=m_bz3;
  2812. CString header, left, right, cur;
  2813. header = path + ":";
  2814. int pos2 = m_bz4.Find(header);
  2815. if (pos2 != -1)
  2816. {
  2817. left = m_bz4.Left(pos2);
  2818. m_bz4 = m_bz4.Right(m_bz4.GetLength() - pos2);
  2819. pos2 = m_bz4.Find(" ");
  2820. if (pos2 != -1)
  2821. {
  2822. cur = m_bz4.Left(pos2);
  2823. int pos3 = cur.Find(":");
  2824. if (pos3 != -1)
  2825. cur = cur.Right(cur.GetLength() - pos3 - 1);
  2826. right = m_bz4.Right(m_bz4.GetLength() - pos2 - 2);
  2827. }
  2828. }
  2829. else
  2830. left = m_bz4;
  2831. dlg.m_bz2 = cur;
  2832. dlg.m_bSave = 0;
  2833. dlg.m_nMode = 2;
  2834. if (dlg.DoModal() == IDOK)
  2835. {
  2836. // m_bz3=dlg.m_bz2 ;
  2837. dlg.m_bz2.TrimLeft();
  2838. dlg.m_bz2.TrimRight();
  2839. if (dlg.m_bz2 != "")
  2840. cur = header + dlg.m_bz2 + " ";
  2841. else
  2842. cur = "";
  2843. m_bz4 = left + cur + right;
  2844. UpdateData(false);
  2845. }
  2846. else
  2847. {
  2848. if (cur != "")
  2849. m_bz4 = left + header + cur + " " + right;
  2850. else
  2851. m_bz4 = left + right;
  2852. }
  2853. }
  2854. return;
  2855. }
  2856. POSITION pos;
  2857. pos = m_List1.GetFirstSelectedItemPosition();
  2858. if (pos == NULL)
  2859. {
  2860. return;
  2861. }
  2862. CString temp;
  2863. m_combo1.ResetContent();
  2864. int aa = 0;
  2865. while (pos)
  2866. {
  2867. // if(aa && m_mode==1)break;//m_mode=1查看选中
  2868. // if(aa && m_mode==2)break;
  2869. aa++;
  2870. int iItem = m_List1.GetNextSelectedItem(pos);
  2871. CStringArray *pArray = GetCurArray();
  2872. CString path = pArray->ElementAt(iItem);
  2873. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  2874. path = path.Left(path.ReverseFind('.'));
  2875. path = "," + path + ",";
  2876. int idpos = nID - IDM_MENUsp1;
  2877. BOOL bSel = 0;//选中还是取消
  2878. if (idpos < m_noarray.GetSize())
  2879. {
  2880. CString no = m_noarray.ElementAt(idpos);
  2881. if (no.Find(path) != -1)
  2882. {
  2883. int pos = no.Find(path);
  2884. no.Delete(pos, path.GetLength() - 1);
  2885. }
  2886. else if (no.GetLength() > 4000)
  2887. {
  2888. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  2889. }
  2890. else
  2891. {
  2892. bSel = 1;
  2893. no.TrimRight(",");
  2894. no += path;
  2895. }
  2896. no.TrimLeft(",");
  2897. no.TrimRight(",");
  2898. m_List2.SetItemText(idpos, 4, no);
  2899. if (no.IsEmpty())
  2900. m_noarray.SetAt(idpos, no);
  2901. else
  2902. m_noarray.SetAt(idpos, "," + no + ",");
  2903. }
  2904. else
  2905. {
  2906. idpos -= m_noarray.GetSize();
  2907. CString no = m_no2array.ElementAt(idpos);
  2908. if (no.Find(path) != -1)
  2909. {
  2910. int pos = no.Find(path);
  2911. no.Delete(pos, path.GetLength() - 1);
  2912. }
  2913. else if (no.GetLength() > 4000)
  2914. {
  2915. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  2916. }
  2917. else
  2918. {
  2919. bSel = 1;
  2920. no.TrimRight(",");
  2921. no += path;
  2922. }
  2923. no.TrimLeft(",");
  2924. no.TrimRight(",");
  2925. #ifdef LKAY_VERSION
  2926. m_List3.SetItemText (idpos, 7, no);
  2927. #else
  2928. m_List3.SetItemText(idpos, 5, no);
  2929. #endif
  2930. if (no.IsEmpty())
  2931. m_no2array.SetAt(idpos, no);
  2932. else
  2933. m_no2array.SetAt(idpos, "," + no + ",");
  2934. }
  2935. m_bModify = 1;
  2936. if (bSel == 0 && m_mode == 1 && IsSelPhoto(path) == 0)
  2937. {
  2938. temp.Format("%d", iItem);
  2939. m_combo1.AddString(temp);
  2940. continue;
  2941. }
  2942. else if (bSel == 1 && m_mode == 2)
  2943. {
  2944. temp.Format("%d", iItem);
  2945. m_combo1.AddString(temp);
  2946. continue;
  2947. }
  2948. else if (bSel == 1 && m_mode == 3)
  2949. {
  2950. temp.Format("%d", iItem);
  2951. m_combo1.AddString(temp);
  2952. continue;
  2953. }
  2954. else if (bSel == 0 && m_mode == 4 && IsSelAlbumPhoto(path) == 0)
  2955. {
  2956. temp.Format("%d", iItem);
  2957. m_combo1.AddString(temp);
  2958. continue;
  2959. }
  2960. else if (bSel == 0 && m_mode == 5 && IsSelDiskPhoto(path) == 0)
  2961. {
  2962. temp.Format("%d", iItem);
  2963. m_combo1.AddString(temp);
  2964. continue;
  2965. }
  2966. /////////////////////////
  2967. CString no, dir;
  2968. no = pArray->ElementAt(iItem);
  2969. if (m_mode2)
  2970. {
  2971. if (no.Left(no.ReverseFind('\\') + 1) != m_path)
  2972. {
  2973. dir = no.Left(no.ReverseFind('\\') + 1);
  2974. dir = dir.Right(dir.GetLength() - m_path.GetLength());
  2975. }
  2976. }
  2977. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  2978. no = no.Left(no.ReverseFind('.'));
  2979. no += GetSelName(no);
  2980. m_List1.SetItemText(iItem, 0, dir + no);
  2981. }
  2982. CArray<int, int>posarray;
  2983. for (int i = m_combo1.GetCount() - 1; i >= 0; i--)
  2984. {
  2985. m_combo1.GetLBText(i, temp);
  2986. posarray.Add(atoi(temp));
  2987. }
  2988. SortArray2(posarray);
  2989. if (posarray.GetSize())
  2990. {
  2991. if (m_mode == 1)
  2992. {
  2993. for (int i = 0; i < posarray.GetSize(); i++)
  2994. {
  2995. m_List1.DeleteItem(posarray.ElementAt(i));
  2996. m_patharray3.Add(m_patharray2.ElementAt(posarray.ElementAt(i)));
  2997. m_patharray2.RemoveAt(posarray.ElementAt(i));
  2998. }
  2999. if (m_showpichwd)
  3000. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3001. }
  3002. else if (m_mode == 2)
  3003. {
  3004. for (int i = 0; i < posarray.GetSize(); i++)
  3005. {
  3006. m_List1.DeleteItem(posarray.ElementAt(i));
  3007. m_patharray3.RemoveAt(posarray.ElementAt(i));
  3008. }
  3009. if (m_showpichwd)
  3010. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3011. }
  3012. else if (m_mode == 3)
  3013. {
  3014. for (int i = 0; i < posarray.GetSize(); i++)
  3015. {
  3016. m_List1.DeleteItem(posarray.ElementAt(i));
  3017. m_patharray1.Add(m_patharray4.ElementAt(posarray.ElementAt(i)));
  3018. m_patharray4.RemoveAt(posarray.ElementAt(i));
  3019. }
  3020. if (m_showpichwd)
  3021. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3022. }
  3023. else if (m_mode == 4)
  3024. {
  3025. for (int i = 0; i < posarray.GetSize(); i++)
  3026. {
  3027. m_List1.DeleteItem(posarray.ElementAt(i));
  3028. m_patharray5.RemoveAt(posarray.ElementAt(i));
  3029. }
  3030. if (m_showpichwd)
  3031. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3032. }
  3033. else if (m_mode == 5)
  3034. {
  3035. for (int i = 0; i < posarray.GetSize(); i++)
  3036. {
  3037. m_List1.DeleteItem(posarray.ElementAt(i));
  3038. m_patharray6.RemoveAt(posarray.ElementAt(i));
  3039. }
  3040. if (m_showpichwd)
  3041. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3042. }
  3043. }
  3044. if (m_mode2 == 0)
  3045. {
  3046. Save();
  3047. DrawLogin();
  3048. if (m_showpichwd)
  3049. ::SendMessage(m_showpichwd, WM_USER + 200, 0, 0);
  3050. }
  3051. }
  3052. void ChoosePhotoSkin2::OnCommandMenu2(UINT nID)//看设计,弹出菜单处理;
  3053. {
  3054. if (32794 == nID)// 处理菜单荐:修改要求;
  3055. {
  3056. POSITION pos;
  3057. pos = m_List1.GetFirstSelectedItemPosition();
  3058. if (pos == NULL)
  3059. {
  3060. return;
  3061. }
  3062. int iItem = m_List1.GetNextSelectedItem(pos);
  3063. CStringArray *pArray = GetCurArray();
  3064. CString path = pArray->ElementAt(iItem);
  3065. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  3066. path = path.Left(path.Find('.'));
  3067. UpdateData();
  3068. CClientRequirement dlg;
  3069. dlg.m_no = "当前照片:" + path;
  3070. dlg.m_bz2 = m_bz3;
  3071. dlg.m_bSave = 0;
  3072. dlg.m_nMode = 2;
  3073. if (dlg.DoModal() == IDOK)
  3074. {
  3075. m_bz3 = dlg.m_bz2;
  3076. UpdateData(false);
  3077. }
  3078. return;
  3079. }
  3080. POSITION pos;
  3081. pos = m_List1.GetFirstSelectedItemPosition();
  3082. if (pos == NULL)
  3083. {
  3084. return;
  3085. }
  3086. CString temp;
  3087. m_combo1.ResetContent();
  3088. int aa = 0;
  3089. while (pos) // 开始获取相片;
  3090. {
  3091. // if(aa && m_mode==1)break;
  3092. // if(aa && m_mode==2)break;
  3093. aa++;
  3094. int iItem = m_List1.GetNextSelectedItem(pos);
  3095. CStringArray *pArray = GetCurArray();
  3096. // path:
  3097. CString path = pArray->ElementAt(iItem);
  3098. //AfxMessageBox(path);//Jeff box
  3099. if (m_bChooseBig)//选放大
  3100. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  3101. else//选设计
  3102. path = path.Right(path.GetLength() - m_path.GetLength());
  3103. path = path.Left(path.ReverseFind('.'));
  3104. path = "," + path + ",";
  3105. int idpos = nID - IDM_MENUsp1;
  3106. BOOL bSel = 0;//选中还是取消
  3107. if (idpos < m_noarray.GetSize())
  3108. {
  3109. //MessageBox("1");
  3110. CString no = m_noarray.ElementAt(idpos); // no:为dindansp字段no;
  3111. //AfxMessageBox(no);//Jeff box
  3112. if (no.Find(path) != -1)
  3113. {
  3114. int pos = no.Find(path);
  3115. no.Delete(pos, path.GetLength() - 1);
  3116. }
  3117. else if (no.GetLength() > 4000)
  3118. {
  3119. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  3120. }
  3121. else
  3122. {
  3123. bSel = 1;
  3124. no.TrimRight(",");
  3125. no += path;
  3126. }
  3127. no.TrimLeft(",");
  3128. no.TrimRight(",");
  3129. m_List2.SetItemText(idpos, 4, no);
  3130. if (no.IsEmpty())
  3131. m_noarray.SetAt(idpos, no);
  3132. else
  3133. m_noarray.SetAt(idpos, "," + no + ",");
  3134. }
  3135. else
  3136. {
  3137. idpos -= m_noarray.GetSize();
  3138. CString no = m_no2array.ElementAt(idpos);
  3139. if (no.Find(path) != -1)
  3140. {
  3141. int pos = no.Find(path);
  3142. no.Delete(pos, path.GetLength() - 1);
  3143. }
  3144. else if (no.GetLength() > 4000)
  3145. {
  3146. AfxMessageBox("编号太长,选择失败!", MB_ICONSTOP); return;
  3147. }
  3148. else
  3149. {
  3150. bSel = 1;
  3151. no.TrimRight(",");
  3152. no += path;
  3153. }
  3154. no.TrimLeft(",");
  3155. no.TrimRight(",");
  3156. #ifdef LKAY_VERSION
  3157. m_List3.SetItemText (idpos, 7, no);
  3158. #else
  3159. m_List3.SetItemText(idpos, 5, no);
  3160. #endif
  3161. if (no.IsEmpty())
  3162. m_no2array.SetAt(idpos, no);
  3163. else
  3164. m_no2array.SetAt(idpos, "," + no + ",");
  3165. }
  3166. m_bModify = 1;
  3167. if (bSel == 0 && m_mode == 1 && IsSelPhoto(path) == 0)
  3168. {
  3169. temp.Format("%d", iItem);
  3170. m_combo1.AddString(temp);
  3171. continue;
  3172. }
  3173. else if (bSel == 1 && m_mode == 2)
  3174. {
  3175. temp.Format("%d", iItem);
  3176. m_combo1.AddString(temp);
  3177. continue;
  3178. }
  3179. else if (bSel == 1 && m_mode == 3)
  3180. {
  3181. temp.Format("%d", iItem);
  3182. m_combo1.AddString(temp);
  3183. continue;
  3184. }
  3185. /////////////////////////
  3186. CString no, dir;
  3187. no = pArray->ElementAt(iItem);
  3188. if (m_bChooseBig)//选放大
  3189. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  3190. else//选设计
  3191. no = no.Right(no.GetLength() - m_path.GetLength());
  3192. no = no.Left(no.ReverseFind('.'));
  3193. no += GetSelName(no);
  3194. m_List1.SetItemText(iItem, 0, no);
  3195. }
  3196. CArray<int, int>posarray;
  3197. for (int i = m_combo1.GetCount() - 1; i >= 0; i--)
  3198. {
  3199. m_combo1.GetLBText(i, temp);
  3200. posarray.Add(atoi(temp));
  3201. }
  3202. SortArray2(posarray);
  3203. if (posarray.GetSize())
  3204. {
  3205. if (m_mode == 1)
  3206. {
  3207. for (int i = 0; i < posarray.GetSize(); i++)
  3208. {
  3209. m_List1.DeleteItem(posarray.ElementAt(i));
  3210. m_patharray3.Add(m_patharray2.ElementAt(posarray.ElementAt(i)));
  3211. m_patharray2.RemoveAt(posarray.ElementAt(i));
  3212. }
  3213. if (m_showpichwd)
  3214. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3215. }
  3216. else if (m_mode == 2)
  3217. {
  3218. for (int i = 0; i < posarray.GetSize(); i++)
  3219. {
  3220. m_List1.DeleteItem(posarray.ElementAt(i));
  3221. m_patharray3.RemoveAt(posarray.ElementAt(i));
  3222. }
  3223. if (m_showpichwd)
  3224. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3225. }
  3226. else if (m_mode == 3)
  3227. {
  3228. for (int i = 0; i < posarray.GetSize(); i++)
  3229. {
  3230. m_List1.DeleteItem(posarray.ElementAt(i));
  3231. m_patharray1.Add(m_patharray4.ElementAt(posarray.ElementAt(i)));
  3232. m_patharray4.RemoveAt(posarray.ElementAt(i));
  3233. }
  3234. if (m_showpichwd)
  3235. ::SendMessage(m_showpichwd, WM_CLOSE, 0, 0);
  3236. }
  3237. }
  3238. Save();
  3239. DrawLogin();
  3240. if (m_showpichwd)
  3241. ::SendMessage(m_showpichwd, WM_USER + 200, 0, 0);
  3242. }
  3243. int ChoosePhotoSkin2::GetZS(CString str)
  3244. {
  3245. str.TrimLeft(",");
  3246. str.TrimRight(",");
  3247. if (str.IsEmpty())return 0;
  3248. int pos = str.Find(',');
  3249. int count = 1;
  3250. while (pos != -1)
  3251. {
  3252. str.Delete(pos);
  3253. pos = str.Find(',');
  3254. count++;
  3255. }
  3256. return count;
  3257. }
  3258. long ChoosePhotoSkin2::UpdateTakeZS(WPARAM inWParam, LPARAM inLParam)
  3259. {
  3260. if (m_mode == 0 && m_List1.GetItemCount() > atoi(m_takezs))
  3261. {
  3262. UpdateData();
  3263. m_takezs.Format("%d", m_List1.GetItemCount());
  3264. UpdateData(false);
  3265. }
  3266. DrawLogin();
  3267. return 1;
  3268. }
  3269. void ChoosePhotoSkin2::UpdateChooseZS()
  3270. {
  3271. m_patharray2.RemoveAll();
  3272. CString str;
  3273. if (m_sChooseFilter != "" && m_sChooseFilter != "全部")
  3274. {
  3275. for (int i = 0; i < m_List3.GetItemCount(); i++)
  3276. {
  3277. if (m_List3.GetItemText(i, 2) != m_sChooseFilter)continue;
  3278. str = m_no2array.ElementAt(i);
  3279. GetPath(str);
  3280. }
  3281. return;
  3282. }
  3283. int i = 0;
  3284. for ( i = 0; i < m_noarray.GetSize(); i++)
  3285. {
  3286. str = m_noarray.ElementAt(i);
  3287. GetPath(str);
  3288. }
  3289. for (i = 0; i < m_no2array.GetSize(); i++)
  3290. {
  3291. str = m_no2array.ElementAt(i);
  3292. GetPath(str);
  3293. }
  3294. }
  3295. // 保存按钮;
  3296. void ChoosePhotoSkin2::OnButton4() // 保存按钮;
  3297. {
  3298. if (m_mode2 == 0) //选片时的保存;
  3299. {
  3300. UpdateData();
  3301. if (m_mode != 1)
  3302. {
  3303. CalChooseZS();
  3304. }
  3305. CString zs = m_taoxizs;
  3306. int pos = zs.Find("\\");
  3307. if (pos != -1)
  3308. {
  3309. zs = zs.Left(pos);
  3310. }
  3311. m_choosezs.Format("%d", max(0, m_patharray2.GetSize() - atoi(zs)));
  3312. m_bSaveFail = 0;
  3313. ChoosePhotoSkin3 dlg;
  3314. dlg.m_strStatusOfChoosePhoto = m_strStatusOfChoosePhoto; // Jeff 传选片状态;
  3315. dlg.m_pParent = this;
  3316. dlg.DoModal();
  3317. if (dlg.m_bSave)
  3318. m_bModify = 0;
  3319. if (dlg.m_bPushedSave == 0 && dlg.m_bSaveFail == 0)
  3320. {
  3321. CString savepath;
  3322. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  3323. if (m_mode2)savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  3324. ::DeleteFile(savepath);
  3325. }
  3326. m_bSaveFail = dlg.m_bSaveFail;
  3327. if (dlg.m_bExit)
  3328. {
  3329. m_bModify = 0;
  3330. CDialog::OnCancel();
  3331. }
  3332. }
  3333. else if (m_mode2 == 1) // 看设计时的保存,delphotos2的保存需要重新定向;
  3334. {
  3335. UpdateData();
  3336. if (m_mode != 1)
  3337. {
  3338. CalChooseZS();
  3339. }
  3340. CString zs = m_taoxizs;
  3341. int pos = zs.Find("\\");
  3342. if (pos != -1)
  3343. {
  3344. zs = zs.Left(pos);
  3345. }
  3346. m_choosezs.Format("%d", max(0, m_patharray2.GetSize() - atoi(zs)));
  3347. m_bSaveFail = 0;
  3348. ChoosePhotoSkin3 dlg;
  3349. //dlg.m_strStatusOfChoosePhoto = m_strStatusOfChoosePhoto;// Jeff.看设计状态另处理;
  3350. dlg.m_pParent = this;
  3351. dlg.DoModal();
  3352. if (dlg.m_bSave)
  3353. m_bModify = 0;
  3354. if (dlg.m_bPushedSave == 0 && dlg.m_bSaveFail == 0)
  3355. {
  3356. CString savepath;
  3357. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  3358. if (m_mode2)savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  3359. ::DeleteFile(savepath);
  3360. }
  3361. m_bSaveFail = dlg.m_bSaveFail;
  3362. if (dlg.m_bExit)
  3363. {
  3364. m_bModify = 0;
  3365. CDialog::OnCancel();
  3366. }
  3367. }
  3368. }
  3369. // 删除相片;
  3370. BOOL ChoosePhotoSkin2::OnDel() // 删除相片;
  3371. {
  3372. // printf("Jeff:m_mode=%d,m_mode2=%d.\n\n",m_mode,m_mode2);//Jeff Printf
  3373. if (m_mode == 1)
  3374. {
  3375. AfxMessageBox("选中照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
  3376. return 0;
  3377. }
  3378. else if (m_mode == 3)
  3379. {
  3380. return 0;
  3381. }
  3382. POSITION pos;
  3383. pos = m_List1.GetFirstSelectedItemPosition();
  3384. if (pos == NULL)
  3385. {
  3386. return 0;
  3387. }
  3388. if (m_bRunning)
  3389. return 0;
  3390. int iItem = m_List1.GetNextSelectedItem(pos);
  3391. CString no;//=m_List1.GetItemText (iItem, 0);
  3392. CStringArray *pArray = GetCurArray(); // Jeff:按钮选择返回(查看全部、查看选中、查看未选……)
  3393. no = pArray->ElementAt(iItem);
  3394. //printf("Jeff:pos=%d,iItem=%d,no=%s \n\n",pos,iItem,no);// Jeff Printf;
  3395. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  3396. no = no.Left(no.Find('.'));
  3397. if (IsSelPhoto(no)) // Jeff 这里有问题,有些订单删除未选中的相片时,会提示box内容。状态:未处理;
  3398. {
  3399. AfxMessageBox("选中的照片不能删除, 请先取消选中状态!", MB_ICONINFORMATION);
  3400. return 0;
  3401. }
  3402. if (AfxMessageBox("是否删除此照片?", MB_YESNO | MB_ICONINFORMATION) != IDYES)
  3403. return 0;
  3404. m_List1.DeleteItem(iItem);
  3405. CString name = pArray->ElementAt(iItem);
  3406. #if JEFF_TEST_ON
  3407. if (PathFileExists(name))
  3408. m_patharray4.Add(name);
  3409. #else
  3410. m_patharray4.Add(name);
  3411. #endif
  3412. // printf("Jeff:将要删除的相片=%s\n\n",name);// Jeff Printf;
  3413. for (int i = 0; i < pArray->GetSize(); i++)
  3414. {
  3415. if (name.CollateNoCase(pArray->ElementAt(i)) == 0)
  3416. {
  3417. pArray->RemoveAt(i);
  3418. if (m_mode == 2)
  3419. {
  3420. DelNo(no);
  3421. // MessageBox(no);
  3422. // m_patharray1.RemoveAt (i);
  3423. }
  3424. break;
  3425. }
  3426. }
  3427. if (iItem >= pArray->GetSize())
  3428. iItem = 0;
  3429. m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  3430. DrawLogin();
  3431. return 1;
  3432. }
  3433. extern int GetOrientation(Image *image);
  3434. void ChoosePhotoSkin2::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
  3435. {
  3436. *pResult = 0;
  3437. }
  3438. void ChoosePhotoSkin2::OnTimer(UINT nIDEvent)
  3439. {
  3440. if (nIDEvent == 1)
  3441. {
  3442. KillTimer(nIDEvent);
  3443. if (m_showpichwd)
  3444. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  3445. TimeOutDlg dlg;
  3446. dlg.m_ticks = m_ticks;
  3447. dlg.DoModal();
  3448. SetTimer(2, m_timer * 60000, NULL);
  3449. }
  3450. else if (nIDEvent == 2) // 定时器触发超时密码对话框;
  3451. {
  3452. KillTimer(nIDEvent);
  3453. if (m_showpichwd)
  3454. ::SendMessage(m_showpichwd, WM_USER + 200, 1, 0);
  3455. TimeOutDlg dlg;
  3456. dlg.m_ticks = m_ticks;
  3457. dlg.DoModal();
  3458. SetTimer(2, m_timer * 60000, NULL);
  3459. }
  3460. else if (nIDEvent == 3)
  3461. {
  3462. KillTimer(nIDEvent);
  3463. //SetSPName3();
  3464. }
  3465. }
  3466. float ChoosePhotoSkin2::GetSPPriceFromId(CString id)
  3467. {
  3468. for (int i = 0; i < m_sparray.GetSize(); i++)
  3469. {
  3470. if (id == m_sparray.ElementAt(i).ElementAt(0))
  3471. return atof(m_sparray.ElementAt(i).ElementAt(4));
  3472. }
  3473. return 0;
  3474. }
  3475. CString ChoosePhotoSkin2::GetSPNameFromId(CString id)
  3476. {
  3477. int i = 0;
  3478. for ( i = 0; i < m_sparray.GetSize(); i++)
  3479. {
  3480. if (id == m_sparray.ElementAt(i).ElementAt(0))
  3481. return m_sparray.ElementAt(i).ElementAt(1);
  3482. }
  3483. id.TrimLeft("0");
  3484. for (i = 0; i < m_sparray.GetSize(); i++)
  3485. {
  3486. if (id == m_sparray.ElementAt(i).ElementAt(0))
  3487. return m_sparray.ElementAt(i).ElementAt(1);
  3488. }
  3489. return "";
  3490. }
  3491. CString GetPathFromNo(CString dir, CString no, CStringArray *pArray)
  3492. {
  3493. CString sRet;
  3494. dir.TrimRight('\\');
  3495. dir += "\\";
  3496. CStringArray dirarray;
  3497. CString temp;
  3498. if (pArray->GetSize() == 0)
  3499. {
  3500. using namespace helper_coffs;
  3501. ffsco o;
  3502. o.dirs(1);
  3503. o.find(LPCSTR(dir), LPCSTR("*.*"));
  3504. ffsco::typeT coo;
  3505. ffsco::typeT::iterator it;
  3506. coo = o.co_dir();
  3507. for (it = coo.begin(); coo.end() != it; it++)
  3508. {
  3509. temp = (*it).c_str();
  3510. if (::FindArray(&dirarray, temp) == -1 && temp != dir)
  3511. {
  3512. dirarray.Add(temp);
  3513. }
  3514. }
  3515. }
  3516. else
  3517. dirarray.Copy(*pArray);
  3518. for (int i = 0; i < dirarray.GetSize(); i++)
  3519. {
  3520. temp = dirarray.ElementAt(i);
  3521. sRet.Format("%s%s.jpg", temp, no);
  3522. if (::PathFileExists(sRet))return sRet;
  3523. }
  3524. return dir + no + ".jpg";
  3525. }
  3526. CString GetPathFromNo2(CString dir, CString no, CStringArray *pArray)
  3527. {
  3528. CString path;
  3529. for (int i = 0; i < pArray->GetSize(); i++)
  3530. {
  3531. path = pArray->ElementAt(i);
  3532. path = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  3533. if (path.Find(".") != -1)
  3534. path = path.Left(path.Find("."));
  3535. if (no == path)return pArray->ElementAt(i);
  3536. }
  3537. return "";
  3538. }
  3539. void ChoosePhotoSkin2::GetPath(CString str)
  3540. {// if(atoi(g_cominfoarray.ElementAt(0).ElementAt(109))==0 && m_mode2==0)
  3541. if (m_bFromLocal && m_mode2 == 0)
  3542. {
  3543. str.TrimLeft(",");
  3544. str.TrimRight(",");
  3545. if (str.IsEmpty())return;
  3546. int pos = str.Find(',');
  3547. CString path, path2;
  3548. char spath[MAX_PATH];
  3549. ::GetSystemDirectory(spath, MAX_PATH);
  3550. CString sysdir = spath;
  3551. sysdir += "\\lyfz";
  3552. sysdir += "\\";
  3553. sysdir += m_strOrderNumber;
  3554. sysdir += "\\";
  3555. while (pos != -1)
  3556. {
  3557. path = sysdir + str.Left(pos) + ".jpg";
  3558. if (FindArray(&m_patharray2, path) == -1)
  3559. {
  3560. #if JEFF_TEST_ON
  3561. if (PathFileExists(path))
  3562. m_patharray2.Add(path);
  3563. #else
  3564. m_patharray2.Add(path);
  3565. #endif
  3566. }
  3567. str = str.Right(str.GetLength() - pos - 1);
  3568. pos = str.Find(',');
  3569. }
  3570. path = sysdir + str + ".jpg";
  3571. if (FindArray(&m_patharray2, path) == -1)
  3572. {
  3573. #if JEFF_TEST_ON
  3574. if (PathFileExists(path))
  3575. m_patharray2.Add(path);
  3576. #else
  3577. m_patharray2.Add(path);//MessageBox(path);
  3578. #endif
  3579. }
  3580. }
  3581. else if (m_mode2 && m_bChooseBig == 0)//看设计
  3582. {
  3583. str.TrimLeft(",");
  3584. str.TrimRight(",");
  3585. if (str.IsEmpty())return;
  3586. int pos = str.Find(',');
  3587. CString path, path2;
  3588. while (pos != -1)
  3589. {
  3590. path = m_path + str.Left(pos) + ".jpg";
  3591. if (FindArray(&m_patharray2, path) == -1)
  3592. {
  3593. #if JEFF_TEST_ON
  3594. if (PathFileExists(path))
  3595. m_patharray2.Add(path);
  3596. #else
  3597. m_patharray2.Add(path);
  3598. #endif
  3599. }
  3600. str = str.Right(str.GetLength() - pos - 1);
  3601. pos = str.Find(',');
  3602. }
  3603. path = m_path + str + ".jpg";
  3604. if (FindArray(&m_patharray2, path) == -1)
  3605. {
  3606. #if JEFF_TEST_ON
  3607. if (PathFileExists(path))
  3608. m_patharray2.Add(path);
  3609. #else
  3610. m_patharray2.Add(path);
  3611. #endif
  3612. }
  3613. }
  3614. else
  3615. {
  3616. if (m_DirArrayBuf.GetSize() == 0)
  3617. {
  3618. CString dir = m_path;
  3619. dir.TrimRight('\\');
  3620. dir += "\\";
  3621. CString temp;
  3622. using namespace helper_coffs;
  3623. ffsco o;
  3624. o.dirs(1);
  3625. o.find(LPCSTR(dir), LPCSTR("*.*"));
  3626. ffsco::typeT coo;
  3627. ffsco::typeT::iterator it;
  3628. coo = o.co_dir();
  3629. for (it = coo.begin(); coo.end() != it; it++)
  3630. {
  3631. temp = (*it).c_str();
  3632. if (::FindArray(&m_DirArrayBuf, temp) == -1 && temp != dir)
  3633. {
  3634. m_DirArrayBuf.Add(temp);
  3635. }
  3636. }
  3637. }
  3638. str.TrimLeft(",");
  3639. str.TrimRight(",");
  3640. if (str.IsEmpty())return;
  3641. int pos = str.Find(',');
  3642. CString path, path2;
  3643. while (pos != -1)
  3644. {
  3645. path = GetPathFromNo2(m_path, str.Left(pos), &m_patharray1);
  3646. path2 = path;
  3647. if (m_nChoosePhotoType == 0)
  3648. {
  3649. path2.Replace("客户原片", "修好的片");
  3650. int pos1 = path2.Find(m_strOrderNumber);
  3651. pos1 += m_strOrderNumber.GetLength();
  3652. int pos2 = path2.ReverseFind('\\');
  3653. path2 = path2.Left(pos1) + path2.Right(path2.GetLength() - pos2);
  3654. if (::PathFileExists(path2))
  3655. path = path2;
  3656. }
  3657. if (FindArray(&m_patharray2, path) == -1)
  3658. {
  3659. #if JEFF_TEST_ON
  3660. if (PathFileExists(path))
  3661. m_patharray2.Add(path);
  3662. #else
  3663. m_patharray2.Add(path);
  3664. #endif
  3665. }
  3666. str = str.Right(str.GetLength() - pos - 1);
  3667. pos = str.Find(',');
  3668. }
  3669. path = GetPathFromNo2(m_path, str, &m_patharray1);//+".jpg";
  3670. path2 = path;
  3671. if (m_nChoosePhotoType == 0)
  3672. {
  3673. path2.Replace("客户原片", "修好的片");
  3674. int pos1 = path2.Find(m_strOrderNumber);
  3675. pos1 += m_strOrderNumber.GetLength();
  3676. int pos2 = path2.ReverseFind('\\');
  3677. path2 = path2.Left(pos1) + path2.Right(path2.GetLength() - pos2);
  3678. if (PathFileExists(path2))
  3679. path = path2;
  3680. }
  3681. if (FindArray(&m_patharray2, path) == -1)
  3682. {
  3683. #if JEFF_TEST_ON
  3684. if (PathFileExists(path))
  3685. m_patharray2.Add(path);
  3686. #else
  3687. m_patharray2.Add(path);
  3688. #endif
  3689. }
  3690. }
  3691. }
  3692. void ChoosePhotoSkin2::LoadPhotos()//加载图片;
  3693. {
  3694. if (m_mode == 1)
  3695. {
  3696. ProductChooseFilter dlg;
  3697. CString name;
  3698. int i = 0;
  3699. for ( i = 0; i < m_List2.GetItemCount(); i++)
  3700. {
  3701. name = m_List2.GetItemText(i, 2);
  3702. dlg.m_array.Add(name);
  3703. }
  3704. for (i = 0; i < m_List3.GetItemCount(); i++)
  3705. {
  3706. name = m_List3.GetItemText(i, 2);
  3707. dlg.m_array.Add(name);
  3708. }
  3709. dlg.DoModal();
  3710. m_sChooseFilter = dlg.m_sChooseFilter;
  3711. UpdateChooseZS();
  3712. }
  3713. TerminateThread();
  3714. CStringArray *pArray = GetCurArray();
  3715. m_vFileName.clear();
  3716. for (int i = 0; i < pArray->GetSize(); i++)
  3717. {
  3718. CString filePath = pArray->ElementAt(i);
  3719. filePath.MakeLower();
  3720. m_vFileName.push_back(filePath);
  3721. }
  3722. LoadThumbImages();
  3723. }
  3724. void ChoosePhotoSkin2::GetNoSelPhoto()
  3725. {
  3726. m_patharray3.RemoveAll();
  3727. CString str1, str2;
  3728. for (int i = 0; i < m_patharray1.GetSize(); i++)
  3729. {
  3730. BOOL bFind = 0;
  3731. for (int j = 0; j < m_patharray2.GetSize(); j++)
  3732. {
  3733. str1 = m_patharray1.ElementAt(i);
  3734. str2 = m_patharray2.ElementAt(j);
  3735. if (str1.CollateNoCase(str2) == 0)
  3736. {
  3737. bFind = 1;
  3738. break;
  3739. }
  3740. }
  3741. if (bFind == 0)m_patharray3.Add(m_patharray1.ElementAt(i));
  3742. }
  3743. }
  3744. int ChoosePhotoSkin2::GetNoSelPhotoCount()
  3745. {
  3746. int nRet = 0;
  3747. CString str1, str2;
  3748. for (int i = 0; i < m_patharray1.GetSize(); i++)
  3749. {
  3750. BOOL bFind = 0;
  3751. for (int j = 0; j < m_patharray2.GetSize(); j++)
  3752. {
  3753. str1 = m_patharray1.ElementAt(i);
  3754. str2 = m_patharray2.ElementAt(j);
  3755. if (str1.CollateNoCase(str2) == 0)
  3756. {
  3757. bFind = 1;
  3758. break;
  3759. }
  3760. }
  3761. if (bFind == 0)nRet++;
  3762. }
  3763. return nRet;
  3764. }
  3765. CStringArray* ChoosePhotoSkin2::GetCurArray()
  3766. {
  3767. CStringArray *pArray;
  3768. switch (m_mode)
  3769. {
  3770. case 0:
  3771. pArray = &m_patharray1;//全部
  3772. break;
  3773. case 1:
  3774. pArray = &m_patharray2;//选中
  3775. break;
  3776. case 2:
  3777. pArray = &m_patharray3;//未选
  3778. break;
  3779. case 3:
  3780. pArray = &m_patharray4;//删除
  3781. break;
  3782. case 4:
  3783. pArray = &m_patharray5;//入册
  3784. break;
  3785. case 5:
  3786. pArray = &m_patharray6;//入底
  3787. break;
  3788. }
  3789. return pArray;
  3790. }
  3791. BOOL ChoosePhotoSkin2::IsSelPhoto(CString path)
  3792. {
  3793. //path.MakeLower ();
  3794. int i = 0;
  3795. for ( i = 0; i < m_no2array.GetSize(); i++)
  3796. {
  3797. //m_no2array.ElementAt (i).MakeLower ();
  3798. if (m_no2array.ElementAt(i).Find(path) != -1)
  3799. return 1;
  3800. }
  3801. for (i = 0; i < m_noarray.GetSize(); i++)
  3802. {
  3803. //m_noarray.ElementAt (i).MakeLower ();
  3804. if (m_noarray.ElementAt(i).Find(path) != -1)
  3805. return 1;
  3806. }
  3807. return 0;
  3808. }
  3809. BOOL ChoosePhotoSkin2::IsSelAlbumPhoto(CString path)
  3810. {
  3811. CString photosno;
  3812. for (int i = 0; i < m_List3.GetItemCount(); i++)
  3813. {
  3814. if (m_List3.GetItemText(i, 2) != "入册")continue;
  3815. photosno = m_no2array.ElementAt(i); break;
  3816. }
  3817. photosno = "," + photosno + ",";
  3818. if (photosno.Find(path) != -1)
  3819. {
  3820. return 1;
  3821. }
  3822. return 0;
  3823. }
  3824. BOOL ChoosePhotoSkin2::IsSelDiskPhoto(CString path)
  3825. {
  3826. CString photosno;
  3827. for (int i = 0; i < m_List3.GetItemCount(); i++)
  3828. {
  3829. if (m_List3.GetItemText(i, 2) != "入底")continue;
  3830. photosno = m_no2array.ElementAt(i); break;
  3831. }
  3832. photosno = "," + photosno + ",";
  3833. if (photosno.Find(path) != -1)
  3834. {
  3835. return 1;
  3836. }
  3837. return 0;
  3838. }
  3839. CString ChoosePhotoSkin2::GetSelName(CString name)//获取选中相片;
  3840. {
  3841. CString ret;
  3842. name = "," + name + ",";
  3843. int i = 0;
  3844. for ( i = 0; i < m_List2.GetItemCount(); i++)
  3845. {
  3846. if (m_noarray.ElementAt(i).Find(name) != -1)
  3847. {
  3848. ret += m_List2.GetItemText(i, 2);
  3849. ret += "\r\n";
  3850. }
  3851. }
  3852. for (i = 0; i < m_List3.GetItemCount(); i++)
  3853. {
  3854. if (m_no2array.ElementAt(i).Find(name) != -1)
  3855. {
  3856. ret += m_List3.GetItemText(i, 2);
  3857. ret += "\r\n";
  3858. }
  3859. }
  3860. if (!ret.IsEmpty())
  3861. {
  3862. ret = "\r\n" + ret;
  3863. ret.TrimRight("\r\n");
  3864. }
  3865. return ret;
  3866. }
  3867. // Jeff获取选设计的数据;
  3868. BOOL ChoosePhotoSkin2::GetData2()//选设计模式;
  3869. {
  3870. m_List2.DeleteAllItems();
  3871. m_List3.DeleteAllItems();
  3872. m_noarray.RemoveAll();
  3873. m_no2array.RemoveAll();
  3874. #ifdef CHILD_VERSION
  3875. CString filter = "id='" + m_strOrderNumber + "';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
  3876. #else
  3877. CString filter = "id='" + m_strOrderNumber + "' and kind<>'2';id='" + m_strOrderNumber + "';;;id='" + m_strOrderNumber + "'";
  3878. #endif
  3879. g_sendhead.code[0] = 50; // dindansp;
  3880. g_sendhead.code[1] = 11; // dindan.
  3881. g_sendhead.code[2] = 4; // shangpin
  3882. g_sendhead.code[3] = 8; // shangpin
  3883. g_sendhead.code[4] = 182; // dindansp3
  3884. g_sendhead.tabcount = 5;
  3885. g_sendhead.bsql = 0;
  3886. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return 0;
  3887. CArray<CStringArray, CStringArray>sparray;
  3888. DataToArray(&sparray, &g_List1array, &m_sparray, &m_List2array, &oldsparray);
  3889. m_patharray2.RemoveAll();
  3890. CString str, kind;
  3891. int nchoosezs = 0;
  3892. int list2pos = 0;
  3893. int list3pos = 0;
  3894. CString savepath;
  3895. savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  3896. CString stm1 = GetModifyTime2(savepath);
  3897. CTime tm1 = CTime::GetCurrentTime();
  3898. tm1 -= CTimeSpan(60, 0, 0, 0);
  3899. CString stm2 = tm1.Format("%Y%m%d");
  3900. BOOL bLoadHistory = 0;
  3901. if (PathFileExists(savepath) && stm1 > stm2)
  3902. {
  3903. if (AfxMessageBox("提醒:请谨慎操作\r\n上次选片未正常退出, 是否还原到上次选片状态?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  3904. bLoadHistory = 1;
  3905. }
  3906. if (bLoadHistory)
  3907. {
  3908. CArray<CStringArray, CStringArray>List1array;
  3909. CFile fp;
  3910. fp.Open(savepath, CFile::modeRead);
  3911. DWORD nMessageLen = fp.GetLength();
  3912. BYTE *szChatMessage = new BYTE[nMessageLen];
  3913. fp.Read(szChatMessage, nMessageLen);
  3914. fp.Close();
  3915. int count;
  3916. memcpy(&count, szChatMessage + (nMessageLen - sizeof(int)), sizeof(int));
  3917. CMemFile memfile;
  3918. memfile.Attach(szChatMessage, nMessageLen);
  3919. CArchive ar(&memfile, CArchive::load);
  3920. List1array.SetSize(count);
  3921. int i = 0;
  3922. for ( i = 0; i < List1array.GetSize(); i++)
  3923. {
  3924. List1array.ElementAt(i).Serialize(ar);
  3925. }
  3926. ar.Close();
  3927. memfile.Detach();
  3928. delete[]szChatMessage;
  3929. list2pos = 0;
  3930. list3pos = 0;
  3931. for (i = 0; i < List1array.GetSize(); i++)
  3932. {
  3933. if (0)//List1array.ElementAt (i).GetSize ()==6)
  3934. {
  3935. kind = "0";
  3936. m_List2.InsertItem(list2pos, List1array.ElementAt(i).ElementAt(1));
  3937. m_List2.SetItemText(list2pos, 1, List1array.ElementAt(i).ElementAt(2));
  3938. m_List2.SetItemText(list2pos, 2, List1array.ElementAt(i).ElementAt(3));
  3939. m_List2.SetItemText(list2pos, 3, List1array.ElementAt(i).ElementAt(4));
  3940. m_List2.SetItemText(list2pos, 4, List1array.ElementAt(i).ElementAt(5));
  3941. str = List1array.ElementAt(i).ElementAt(5);
  3942. list2pos++;
  3943. }
  3944. else
  3945. {
  3946. kind = "4";
  3947. m_List3.InsertItem(list3pos, List1array.ElementAt(i).ElementAt(1));
  3948. m_List3.SetItemText(list3pos, 1, List1array.ElementAt(i).ElementAt(2));
  3949. m_List3.SetItemText(list3pos, 2, List1array.ElementAt(i).ElementAt(3));
  3950. m_List3.SetItemText(list3pos, 3, List1array.ElementAt(i).ElementAt(4));
  3951. m_List3.SetItemText(list3pos, 4, List1array.ElementAt(i).ElementAt(5));
  3952. m_List3.SetItemText(list3pos, 5, List1array.ElementAt(i).ElementAt(6));
  3953. #ifdef LKAY_VERSION
  3954. m_List3.SetItemText(list3pos, 6, List1array.ElementAt (i).ElementAt (7));
  3955. m_List3.SetItemText(list3pos, 7, List1array.ElementAt (i).ElementAt (8));
  3956. str=List1array.ElementAt (i).ElementAt (8);
  3957. #else
  3958. str = List1array.ElementAt(i).ElementAt(6);
  3959. #endif
  3960. list3pos++;
  3961. }
  3962. nchoosezs += GetZS(str);
  3963. GetPath(str);
  3964. if (!str.IsEmpty())
  3965. str = "," + str + ",";
  3966. str.MakeLower();
  3967. if (kind == "4")
  3968. m_no2array.Add(str);
  3969. else
  3970. m_noarray.Add(str);
  3971. }
  3972. }
  3973. else
  3974. {
  3975. for (int i = 0; i < sparray.GetSize(); i++)
  3976. {
  3977. kind = "4";//sparray.ElementAt (i).ElementAt (4);
  3978. if (kind == "4")
  3979. {
  3980. m_List3.InsertItem(list3pos, sparray.ElementAt(i).ElementAt(7));
  3981. m_List3.SetItemText(list3pos, 1, sparray.ElementAt(i).ElementAt(1));
  3982. m_List3.SetItemText(list3pos, 2, sparray.ElementAt(i).ElementAt(5));
  3983. m_List3.SetItemText(list3pos, 3, sparray.ElementAt(i).ElementAt(2));
  3984. m_List3.SetItemText(list3pos, 4, sparray.ElementAt(i).ElementAt(3));
  3985. #ifdef LKAY_VERSION
  3986. m_List3.SetItemText(list3pos, 5, sparray.ElementAt (i).ElementAt (9));
  3987. m_List3.SetItemText(list3pos, 6, sparray.ElementAt (i).ElementAt (10));
  3988. m_List3.SetItemText(list3pos, 7, sparray.ElementAt (i).ElementAt (8));
  3989. #else
  3990. m_List3.SetItemText(list3pos, 5, sparray.ElementAt(i).ElementAt(8)); // 8 dindansp:no2
  3991. #endif
  3992. list3pos++;
  3993. }
  3994. else
  3995. {
  3996. m_List2.InsertItem(list2pos, sparray.ElementAt(i).ElementAt(7));
  3997. m_List2.SetItemText(list2pos, 1, sparray.ElementAt(i).ElementAt(1));
  3998. m_List2.SetItemText(list2pos, 2, sparray.ElementAt(i).ElementAt(5));
  3999. m_List2.SetItemText(list2pos, 3, sparray.ElementAt(i).ElementAt(3));
  4000. m_List2.SetItemText(list2pos, 4, sparray.ElementAt(i).ElementAt(8)); // 8 dindansp:no2
  4001. list2pos++;
  4002. }
  4003. str = sparray.ElementAt(i).ElementAt(8); // 8 dindansp:no2
  4004. str.MakeLower();
  4005. nchoosezs += GetZS(str);
  4006. GetPath(str);
  4007. if (!str.IsEmpty())
  4008. str = "," + str + ",";
  4009. if (kind == "4")
  4010. m_no2array.Add(str);
  4011. else
  4012. m_noarray.Add(str);
  4013. }
  4014. }
  4015. if (g_List1array.GetSize())
  4016. {
  4017. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  4018. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  4019. m_phone1 = g_List1array.ElementAt(0).ElementAt(61);
  4020. m_phone2 = g_List1array.ElementAt(0).ElementAt(62);
  4021. if (!m_name1.IsEmpty())
  4022. m_name = m_name1 + ",";
  4023. m_name += m_name2;
  4024. m_name.TrimRight(",");
  4025. m_waiter3 = g_user.name;
  4026. m_taoxizs = g_List1array.ElementAt(0).ElementAt(9);
  4027. m_time5 = g_List1array.ElementAt(0).ElementAt(22);
  4028. m_takezs = g_List1array.ElementAt(0).ElementAt(23);
  4029. m_choosezs = g_List1array.ElementAt(0).ElementAt(24);
  4030. m_money3 = g_List1array.ElementAt(0).ElementAt(3);
  4031. m_oldmoney3 = m_money3;
  4032. m_bz3 = g_List1array.ElementAt(0).ElementAt(57);
  4033. m_urgent = g_List1array.ElementAt(0).ElementAt(40);
  4034. m_delphotos = g_List1array.ElementAt(0).ElementAt(56);// Jeff获取选设计时,被删除的相片,选取的字段delphotos2;.读取正常,保存时未能正确保存到delphotos2字段;
  4035. //printf("Jeff:看设计:delphotos2=%s\n\n",m_delphotos);//Jeff Printf
  4036. m_status8 = g_List1array.ElementAt(0).ElementAt(55);
  4037. m_time6 = g_List1array.ElementAt(0).ElementAt(48);
  4038. m_time5old = m_time5;
  4039. m_time6old = m_time6;
  4040. m_checkstatus = g_List1array.ElementAt(0).ElementAt(55);
  4041. UpdateData(false);
  4042. }
  4043. else
  4044. {
  4045. m_name1 = "";
  4046. m_name2 = "";
  4047. m_waiter3 = "";
  4048. m_taoxizs = "";
  4049. m_time5 = "";
  4050. m_takezs = "";
  4051. m_choosezs = "";
  4052. m_money3 = "";
  4053. m_bz3 = "";
  4054. m_urgent = "";
  4055. UpdateData(false);
  4056. }
  4057. return 1;
  4058. }
  4059. void ChoosePhotoSkin2::SortArray()
  4060. {
  4061. // if(m_mode2)return;
  4062. m_bSort = !m_bSort;
  4063. CStringArray *pArray[6] = { &m_patharray1, &m_patharray2, &m_patharray3, &m_patharray4, &m_patharray5, &m_patharray6 };
  4064. if (m_bSort == 0)
  4065. {
  4066. for (int i = 0; i < 6; i++)
  4067. {
  4068. if (pArray[i]->GetSize())
  4069. {
  4070. int size = pArray[i]->GetSize() - 1;
  4071. CString sTemp;
  4072. int nPos;
  4073. for (int ii = 0; ii < size; ii++)
  4074. {
  4075. nPos = rand() % (size - ii);
  4076. sTemp = pArray[i]->ElementAt(size - ii);
  4077. pArray[i]->SetAt(size - ii, pArray[i]->ElementAt(nPos));
  4078. pArray[i]->SetAt(nPos, sTemp);
  4079. }
  4080. }
  4081. }
  4082. }
  4083. else
  4084. {
  4085. for (int i = 0; i < 6; i++)
  4086. {
  4087. m_combo1.ResetContent();
  4088. CString Temp;
  4089. int j = 0;
  4090. for ( j = 0; j < pArray[i]->GetSize(); j++)
  4091. {
  4092. m_combo1.AddString(pArray[i]->ElementAt(j));
  4093. }
  4094. for (j = 0; j < pArray[i]->GetSize(); j++)
  4095. {
  4096. m_combo1.GetLBText(j, Temp);
  4097. pArray[i]->SetAt(j, Temp);
  4098. }
  4099. }
  4100. }
  4101. {
  4102. TerminateThread();
  4103. CStringArray *pArray = GetCurArray();
  4104. m_vFileName.clear();
  4105. for (int i = 0; i < pArray->GetSize(); i++)
  4106. {
  4107. CString filePath = pArray->ElementAt(i);
  4108. filePath.MakeLower();
  4109. m_vFileName.push_back(filePath);
  4110. }
  4111. LoadThumbImages();
  4112. }
  4113. }
  4114. void ChoosePhotoSkin2::CheckForDisk() // 检查入底;
  4115. {
  4116. int i = 0;
  4117. for ( i = 0; i < m_List2.GetItemCount(); i++)
  4118. {
  4119. if ("入底" == m_List2.GetItemText(i, 2))return;
  4120. }
  4121. for (i = 0; i < m_List3.GetItemCount(); i++)
  4122. {
  4123. if ("入底" == m_List3.GetItemText(i, 2))return;
  4124. }
  4125. i = m_List3.GetItemCount();
  4126. m_List3.InsertItem(i, "");
  4127. m_List3.SetItemText(i, 2, "入底");
  4128. m_no2array.Add("");
  4129. }
  4130. void ChoosePhotoSkin2::CheckForAlbum() // 检查入册;
  4131. {
  4132. int i = 0;
  4133. for ( i = 0; i < m_List2.GetItemCount(); i++)
  4134. {
  4135. if ("入册" == m_List2.GetItemText(i, 2))return;
  4136. }
  4137. for (i = 0; i < m_List3.GetItemCount(); i++)
  4138. {
  4139. if ("入册" == m_List3.GetItemText(i, 2))return;
  4140. }
  4141. i = m_List3.GetItemCount();
  4142. m_List3.InsertItem(i, "");
  4143. m_List3.SetItemText(i, 2, "入册");
  4144. m_no2array.Add("");
  4145. }
  4146. void ChoosePhotoSkin2::GetPhotos()//得看设计
  4147. {
  4148. m_patharray1.RemoveAll();
  4149. m_path.MakeLower();
  4150. CStringArray dirarray;
  4151. CString str;
  4152. if (1)
  4153. {
  4154. using namespace helper_coffs;
  4155. ffsco o;
  4156. o.dirs(1);
  4157. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  4158. ffsco::typeT coo;
  4159. ffsco::typeT::iterator it;
  4160. coo = o.co_dir();
  4161. for (it = coo.begin(); coo.end() != it; it++)
  4162. {
  4163. str = (*it).c_str();
  4164. str.TrimRight("\\");
  4165. CString dirname = str.Right(str.GetLength() - str.ReverseFind('\\') - 1);
  4166. if (dirname.Find("DelgaBook") != -1)
  4167. {
  4168. if (FindArray(&m_patharray1, str) == -1)
  4169. {
  4170. m_patharray1.Add(str);
  4171. }
  4172. }
  4173. if (FindArray(&dirarray, str) == -1)
  4174. {
  4175. dirarray.Add(str);
  4176. }
  4177. }
  4178. }
  4179. if (1)
  4180. {
  4181. for (int i = 0; i < dirarray.GetSize(); i++)
  4182. {
  4183. using namespace helper_coffs;
  4184. ffsco o;
  4185. o.dirs(0);
  4186. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  4187. ffsco::typeT coo;
  4188. ffsco::typeT::iterator it;
  4189. coo = o.co_file();
  4190. for (it = coo.begin(); coo.end() != it; it++)
  4191. {
  4192. str = (*it).c_str();
  4193. if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
  4194. if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
  4195. str.MakeLower();
  4196. m_patharray1.Add(str);
  4197. }
  4198. }
  4199. }
  4200. CStringArray *pArray[1] = { &m_patharray1 };
  4201. for (int i = 0; i < 1; i++)
  4202. {
  4203. m_combo1.ResetContent();
  4204. CString Temp;
  4205. int j = 0;
  4206. for ( j = 0; j < pArray[i]->GetSize(); j++)
  4207. {
  4208. m_combo1.AddString(pArray[i]->ElementAt(j));
  4209. }
  4210. for (j = 0; j < pArray[i]->GetSize(); j++)
  4211. {
  4212. m_combo1.GetLBText(j, Temp);
  4213. pArray[i]->SetAt(j, Temp);
  4214. }
  4215. }
  4216. }
  4217. void ChoosePhotoSkin2::Save()
  4218. {
  4219. CString sql;
  4220. CArray<CStringArray, CStringArray>sparray;
  4221. sparray.SetSize(m_List2.GetItemCount() + m_no2array.GetSize());
  4222. int i = 0;
  4223. for ( i = 0; i < m_List2.GetItemCount(); i++)
  4224. {
  4225. sparray.ElementAt(i).Add(m_strOrderNumber);
  4226. sparray.ElementAt(i).Add(m_List2.GetItemText(i, 0));
  4227. sparray.ElementAt(i).Add(m_List2.GetItemText(i, 1));
  4228. sparray.ElementAt(i).Add(m_List2.GetItemText(i, 2));
  4229. sparray.ElementAt(i).Add(m_List2.GetItemText(i, 3));
  4230. sparray.ElementAt(i).Add(m_List2.GetItemText(i, 4));
  4231. }
  4232. for (int j = 0; j < m_no2array.GetSize(); j++)
  4233. {
  4234. sparray.ElementAt(i).Add(m_strOrderNumber);
  4235. sparray.ElementAt(i).Add(m_List3.GetItemText(j, 0));
  4236. sparray.ElementAt(i).Add(m_List3.GetItemText(j, 1));
  4237. sparray.ElementAt(i).Add(m_List3.GetItemText(j, 2));
  4238. sparray.ElementAt(i).Add(m_List3.GetItemText(j, 3));
  4239. sparray.ElementAt(i).Add(m_List3.GetItemText(j, 4));
  4240. sparray.ElementAt(i).Add(m_List3.GetItemText(j, 5));
  4241. #ifdef LKAY_VERSION
  4242. sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 6) );
  4243. sparray.ElementAt (i).Add ( m_List3.GetItemText (j, 7) );
  4244. #endif
  4245. sparray.ElementAt(i).Add("4");
  4246. i++;
  4247. }
  4248. if (sparray.GetSize() == 0)
  4249. {
  4250. sparray.SetSize(1);
  4251. sparray.ElementAt(0).Add(m_strOrderNumber);
  4252. }
  4253. CMemFile memfile;
  4254. CArchive ar(&memfile, CArchive::store);
  4255. for (int ii = 0; ii < sparray.GetSize(); ii++)
  4256. {
  4257. sparray.ElementAt(ii).Serialize(ar);
  4258. }
  4259. ar.Close();
  4260. int length = memfile.GetLength();
  4261. BYTE *pData = memfile.Detach();
  4262. int size = sparray.GetSize();
  4263. BYTE *pData2 = new BYTE[length + sizeof(int)];
  4264. memcpy(pData2, pData, length);
  4265. memcpy(pData2 + length, &size, sizeof(int));
  4266. delete[]pData;
  4267. length += sizeof(int);
  4268. CString savepath;
  4269. savepath.Format("%s\\%s.dat", g_mainpath, m_strOrderNumber);
  4270. if (m_mode2)savepath.Format("%s\\%s-2.dat", g_mainpath, m_strOrderNumber);
  4271. if (1)
  4272. {
  4273. CFile fp;
  4274. fp.Open(savepath, CFile::modeCreate | CFile::modeWrite);
  4275. fp.Write(pData2, length);
  4276. fp.Close();
  4277. }
  4278. delete[]pData2;
  4279. }
  4280. void ChoosePhotoSkin2::DrawLogin()
  4281. {
  4282. CRect rc;
  4283. ((MyBmpButton2*)m_picarray.ElementAt(3))->GetWindowRect(rc);
  4284. ScreenToClient(rc);
  4285. rc.right -= rc.left;
  4286. rc.left = 5;
  4287. rc.right += 5;
  4288. rc.top += 20;
  4289. rc.right -= 15;
  4290. CDC *pDC = GetDC();
  4291. Graphics graph(pDC->GetSafeHdc());
  4292. Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
  4293. RectF layoutRect(rc.left, rc.top, rc.Width(), rc.Height());
  4294. rc.left /= g_fscalex;
  4295. rc.right /= g_fscalex;
  4296. rc.top /= g_fscaley;
  4297. rc.bottom /= g_fscaley;
  4298. // graph.SetSmoothingMode(SmoothingModeHighQuality);
  4299. graph.DrawImage(m_pBk, destinationRect, rc.left, rc.top, rc.Width(), rc.Height(), UnitPixel);
  4300. StringFormat format;
  4301. format.SetAlignment(StringAlignmentNear);
  4302. SolidBrush *Brush = new SolidBrush(Color(255, 255, 255, 255));
  4303. CString str;
  4304. str.Format("张数:%d", m_List1.GetItemCount());
  4305. int leng = GetLengthEx(str);
  4306. BSTR bstr = str.AllocSysString();
  4307. Gdiplus::Font *g_TimerFont = new Gdiplus::Font(L"黑体", 13);
  4308. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  4309. graph.DrawString(
  4310. bstr,
  4311. leng,
  4312. g_TimerFont,
  4313. layoutRect,
  4314. &format,
  4315. Brush);
  4316. delete Brush;
  4317. delete g_TimerFont;
  4318. SysFreeString(bstr);
  4319. ReleaseDC(pDC);
  4320. }
  4321. //--------------------------------------------------
  4322. // remark by Jeff 2014.12.15
  4323. // 函数:CheckOK
  4324. // 描述:判断字符串是否是数字组成;
  4325. // 参数:name 要判断的字符串;
  4326. // 返回:如果是数字组成返回1,否则返回0;
  4327. //--------------------------------------------------
  4328. BOOL ChoosePhotoSkin2::CheckOK(CString name)
  4329. {
  4330. if (name.GetLength() > 4)return 0;
  4331. for (int i = 0; i < name.GetLength(); i++)
  4332. {
  4333. if (name.GetAt(i) < '0' || name.GetAt(i) > '9')return 0;
  4334. }
  4335. return 1;
  4336. }
  4337. //--------------------------------------------------
  4338. // remark by Jeff 2014.12.15
  4339. // 函数:CheckName
  4340. // 描述:类似CheckOK,判断字符串是否是数字组成(除去"$" "."两符号以及后缀名);
  4341. // 参数:name 要判断的字符串;
  4342. // 返回:如果是数字组成返回1,否则返回0;
  4343. //--------------------------------------------------
  4344. BOOL ChoosePhotoSkin2::CheckName(CString name)
  4345. {//$001.002.003
  4346. int pos = name.Find("$");
  4347. if (pos != 0)return 0;
  4348. name.Delete(0, 1);
  4349. pos = name.Find(".");
  4350. while (pos != -1)
  4351. {
  4352. if (CheckOK(name.Left(pos)) == 0)return 0;
  4353. name = name.Right(name.GetLength() - pos - 1);
  4354. pos = name.Find(".");
  4355. }
  4356. return CheckOK(name);
  4357. }
  4358. void ChoosePhotoSkin2::DelNo(CString no)
  4359. {
  4360. CString no2;
  4361. for (int i = 0; i < m_patharray1.GetSize(); i++)
  4362. {
  4363. no2 = m_patharray1.ElementAt(i);
  4364. no2 = no2.Right(no2.GetLength() - no2.ReverseFind('\\') - 1);
  4365. no2 = no2.Left(no2.Find('.'));
  4366. if (no == no2)
  4367. {
  4368. m_patharray1.RemoveAt(i);
  4369. return;
  4370. }
  4371. }
  4372. }
  4373. CString ChoosePhotoSkin2::GetZSInfo(int iItem)
  4374. {
  4375. if (m_mode != 1)
  4376. CalChooseZS();
  4377. CString str;
  4378. // str.Format("%d/%d %d+", m_patharray2.GetSize(), atoi(m_taoxizs), max(0,m_patharray2.GetSize()-atoi(m_taoxizs)));
  4379. CString scount = m_List1.GetItemText(iItem, 0);
  4380. int ncount = 0;
  4381. int npos = scount.Find("\r\n");
  4382. while (npos != -1)
  4383. {
  4384. ncount++;
  4385. scount = scount.Right(scount.GetLength() - npos - 2);
  4386. npos = scount.Find("\r\n");
  4387. }
  4388. /* if(m_mode2)
  4389. str.Format("X:%d", ncount);
  4390. else
  4391. str.Format("X:%d %d/%d %d+ S:%d/%d", ncount, m_patharray2.GetSize(), atoi(m_taoxizs), max(0,m_patharray2.GetSize()-atoi(m_taoxizs)), GetNoSelPhotoCount(), max(0, atoi(m_taoxizs)-m_patharray2.GetSize()));
  4392. */
  4393. CString zs = m_taoxizs;
  4394. int pos = zs.Find("\\");
  4395. if (pos != -1)
  4396. {
  4397. zs = zs.Left(pos);
  4398. }
  4399. if (m_mode2)
  4400. str.Format("X:%d", ncount);
  4401. else
  4402. str.Format("选中次数:%d 已选/应选:%d/%d\r\n加选:%d+ 未选/剩余:%d/%d", ncount, m_patharray2.GetSize(), atoi(zs), max(0, m_patharray2.GetSize() - atoi(zs)), max(0, atoi(zs) - m_patharray2.GetSize()), GetNoSelPhotoCount());
  4403. return str;
  4404. }
  4405. // GetSelCountFromName
  4406. // 描述:返回相片数量;
  4407. // 参数:
  4408. // [IN]name:
  4409. // dindansp表字段no里的内容;(example:001,002,003(陈天,入册),004)
  4410. // [OUT]scount
  4411. //
  4412. //
  4413. void ChoosePhotoSkin2::GetSelCountFromName(CString name, CString &scount)
  4414. {
  4415. name.TrimLeft(",");
  4416. name.TrimRight(",");
  4417. if (name.GetLength() == 0)
  4418. {
  4419. scount = "0";
  4420. return;
  4421. }
  4422. // Jeff:处理有问题,若相片名为:003(陈天,入册),这就会多计数一次;
  4423. // 需要完成的一个处理;
  4424. int ncount = 0;
  4425. int npos = name.Find(",");
  4426. while (npos != -1)
  4427. {
  4428. ncount++;
  4429. name = name.Right(name.GetLength() - npos - 1);
  4430. npos = name.Find(",");
  4431. }
  4432. ncount++;
  4433. scount.Format("%d", ncount);
  4434. }
  4435. void ChoosePhotoSkin2::CalChooseZS()
  4436. {
  4437. m_patharray2.RemoveAll();
  4438. CString str;
  4439. int i = 0;
  4440. for ( i = 0; i < m_noarray.GetSize(); i++)
  4441. {
  4442. str = m_noarray.ElementAt(i);
  4443. GetPath(str);
  4444. }
  4445. for (i = 0; i < m_no2array.GetSize(); i++)
  4446. {
  4447. str = m_no2array.ElementAt(i);
  4448. GetPath(str);
  4449. }
  4450. }
  4451. //入册
  4452. //
  4453. void ChoosePhotoSkin2::GetAlbumPhoto()//查看入册相片;
  4454. {
  4455. if (m_mode == 4)return;
  4456. m_mode = 4;
  4457. m_patharray5.RemoveAll();
  4458. CString photosno;
  4459. int i = 0;
  4460. for ( i = 0; i < m_List3.GetItemCount(); i++)
  4461. {
  4462. if (m_List3.GetItemText(i, 2) != "入册")continue;
  4463. photosno = m_no2array.ElementAt(i); break;
  4464. }
  4465. photosno = "," + photosno + ",";
  4466. for (i = m_patharray1.GetSize() - 1; i >= 0; i--)
  4467. {
  4468. CString no;
  4469. no = m_patharray1.ElementAt(i);
  4470. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  4471. no = no.Left(no.Find('.'));
  4472. no = "," + no;
  4473. no += ",";
  4474. if (photosno.Find(no) != -1)
  4475. {
  4476. no = m_patharray1.ElementAt(i);
  4477. m_patharray5.Add(no);
  4478. }
  4479. }
  4480. LoadPhotos();
  4481. }
  4482. void ChoosePhotoSkin2::GetDiskPhoto()//查看入底相片;
  4483. {
  4484. if (m_mode == 5)return;
  4485. m_mode = 5;
  4486. m_patharray6.RemoveAll();
  4487. CString photosno;
  4488. int i = 0;
  4489. for ( i = 0; i < m_List3.GetItemCount(); i++)
  4490. {
  4491. if (m_List3.GetItemText(i, 2) != "入底")continue;
  4492. photosno = m_no2array.ElementAt(i); break;
  4493. }
  4494. photosno = "," + photosno + ",";
  4495. for (i = m_patharray1.GetSize() - 1; i >= 0; i--)
  4496. {
  4497. CString no;
  4498. no = m_patharray1.ElementAt(i);
  4499. no = no.Right(no.GetLength() - no.ReverseFind('\\') - 1);
  4500. no = no.Left(no.Find('.'));
  4501. no = "," + no;
  4502. no += ",";
  4503. if (photosno.Find(no) != -1)
  4504. {
  4505. no = m_patharray1.ElementAt(i);
  4506. m_patharray6.Add(no);
  4507. }
  4508. }
  4509. LoadPhotos();
  4510. }
  4511. BOOL ChoosePhotoSkin2::ReLoad()
  4512. {
  4513. if (m_mode2 == 0)
  4514. return GetData();
  4515. else
  4516. return GetData2();
  4517. }
  4518. BOOL ChoosePhotoSkin2::IsPhoto2Exist()
  4519. {
  4520. //printf("Jeff:g_path2=%s\n\n",g_path2);
  4521. CString path2;
  4522. CString path = g_path2 + "\\";
  4523. path += m_strOrderNumber;
  4524. path += "\\";
  4525. //printf("Jeff:path=%s\n\n",path);
  4526. #if 0 // 原:这里只是搜索当前文件夹有没有图片文件,并没有对子文件夹进行搜索,将一直返回错误值;
  4527. using namespace helper_coffs;
  4528. ffsco o;
  4529. o.dirs(0);
  4530. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  4531. ffsco::typeT coo;
  4532. coo = o.co_file();
  4533. printf("Jeff:%d\n\n",coo.size());
  4534. return coo.size();
  4535. #else // Jeff.搜索订单文件夹里的相片;2014.09.02
  4536. CStringArray StrSubFoloderArray;
  4537. using namespace helper_coffs;
  4538. ffsco o;
  4539. o.dirs(1); // Jeff.1:查找子目录;
  4540. o.find(LPCSTR(path), LPCSTR("*.*")); // 可能存在m和s开头的缩略图,需要过滤掉;
  4541. if (o.count() == 0)
  4542. return 0;
  4543. // 获取子目录数;
  4544. ffsco::typeT coo;
  4545. ffsco::typeT::iterator it;
  4546. coo = o.co_dir();
  4547. for (it = coo.begin(); it != coo.end(); it++)
  4548. {
  4549. if (::FindArray(&StrSubFoloderArray, (*it).c_str()) == -1)
  4550. StrSubFoloderArray.Add((*it).c_str());
  4551. }
  4552. // 获取子目录下的文件数;
  4553. CStringArray StrPhotoArray;
  4554. for (int n = 0; n < StrSubFoloderArray.GetSize(); n++)
  4555. {
  4556. ffsco op;
  4557. op.dirs(0);
  4558. op.find(LPCSTR(StrSubFoloderArray.ElementAt(n)), LPCSTR("*.*"));
  4559. ffsco::typeT coo;
  4560. ffsco::typeT::iterator itp;
  4561. coo = op.co_file();
  4562. for (itp = coo.begin(); itp != coo.end(); itp++)
  4563. {
  4564. StrPhotoArray.Add((*itp).c_str());
  4565. }
  4566. }
  4567. CString strTempFile;
  4568. int nIndex = 0;
  4569. int nSizeOfFile = 0; // 记录相片文件数;
  4570. int nCount = StrPhotoArray.GetSize();
  4571. for (int i = 0; i < nCount; i++)
  4572. {
  4573. strTempFile = StrPhotoArray.ElementAt(i);
  4574. nIndex = strTempFile.ReverseFind('\\');
  4575. strTempFile = strTempFile.Right(strTempFile.GetLength() - nIndex - 1);
  4576. if (strTempFile.Left(1) == "m" || strTempFile.Left(1) == "s")
  4577. {
  4578. continue;
  4579. }
  4580. strTempFile = strTempFile.Right(4);
  4581. strTempFile.MakeLower();
  4582. if (strTempFile == ".jpg")
  4583. {
  4584. nSizeOfFile++;
  4585. }
  4586. else if (strTempFile == ".raw")
  4587. {
  4588. nSizeOfFile++;
  4589. }
  4590. else if (strTempFile == ".cr2")
  4591. {
  4592. nSizeOfFile++;
  4593. }
  4594. else if (strTempFile == ".nef")
  4595. {
  4596. nSizeOfFile++;
  4597. }
  4598. }
  4599. return nSizeOfFile;
  4600. #endif
  4601. }
  4602. void ChoosePhotoSkin2::ReLoadPhoto()
  4603. {
  4604. if (!((MyBmpButton2*)m_picarray.ElementAt(8))->GetPushDown())
  4605. {
  4606. m_path = g_path3 + "\\";
  4607. m_path += m_strOrderNumber;
  4608. m_path += "\\";
  4609. GetPhotos();
  4610. m_bChooseBig = 0;
  4611. }
  4612. else
  4613. {
  4614. m_bChooseBig = 1;
  4615. IsGrowthTx growthtxdlg;
  4616. growthtxdlg.m_mode = 1;
  4617. growthtxdlg.m_strOrderNumber = m_strOrderNumber;
  4618. growthtxdlg.DoModal();
  4619. m_bGrowthTX = growthtxdlg.m_bGrowthTx;
  4620. m_seltxname = growthtxdlg.m_seltxname;
  4621. m_patharray1.RemoveAll();
  4622. if (CheckHC()) //
  4623. {
  4624. CString str;
  4625. m_bFromLocal = 1;
  4626. char path[MAX_PATH];
  4627. ::GetSystemDirectory(path, MAX_PATH);
  4628. CString sysdir = path;
  4629. sysdir += "\\lyfz";
  4630. ::CreateDirectory(sysdir, NULL);
  4631. sysdir += "\\";
  4632. sysdir += m_strOrderNumber;
  4633. using namespace helper_coffs;
  4634. ffsco o;
  4635. o.dirs(1);
  4636. o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
  4637. ffsco::typeT coo;
  4638. ffsco::typeT::iterator it;
  4639. coo = o.co_file();
  4640. for (it = coo.begin(); coo.end() != it; it++)
  4641. {
  4642. str = (*it).c_str();
  4643. if (str.GetAt(str.ReverseFind('\\') + 1) != 's' && str.GetAt(str.ReverseFind('\\') + 1) != 'm')
  4644. {
  4645. m_patharray1.Add(str);
  4646. }
  4647. }
  4648. }
  4649. if (m_patharray1.GetSize() == 0)
  4650. {
  4651. if (IsPhoto2Exist())
  4652. {
  4653. SelBrunDevice dlg;
  4654. dlg.m_mode = 1;
  4655. if (dlg.DoModal() == IDOK)
  4656. m_nChoosePhotoType = dlg.m_sel;
  4657. else
  4658. m_nChoosePhotoType = 0;
  4659. //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片
  4660. }
  4661. else
  4662. AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION);
  4663. {
  4664. CString path, path2;
  4665. m_path = g_path1 + "\\";
  4666. m_path += m_strOrderNumber;
  4667. m_path += "\\";
  4668. if (m_seltxname != "" && m_seltxname != "全部")
  4669. {
  4670. m_path += m_seltxname;
  4671. m_path += "\\";
  4672. }
  4673. if (m_nChoosePhotoType == 1) // 选片:修片
  4674. {
  4675. m_path = g_path2 + "\\";
  4676. m_path += m_strOrderNumber;
  4677. m_path += "\\";
  4678. }
  4679. CString filename;
  4680. using namespace helper_coffs;
  4681. ffsco o;
  4682. o.dirs(1);
  4683. o.find(LPCSTR(m_path), LPCSTR("*.*"));
  4684. ffsco::typeT coo;
  4685. ffsco::typeT::iterator it;
  4686. coo = o.co_file();
  4687. for (it = coo.begin(); coo.end() != it; it++)
  4688. {
  4689. path = (*it).c_str();
  4690. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  4691. {
  4692. path.MakeLower();
  4693. filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  4694. if (filename.Find(".") != -1)
  4695. filename = filename.Left(filename.Find("."));
  4696. if (!myisdigit(filename))continue;
  4697. if (m_nChoosePhotoType == 1)
  4698. {
  4699. #if JEFF_TEST_ON
  4700. if (PathFileExists(path))
  4701. m_patharray1.Add(path);
  4702. #else
  4703. m_patharray1.Add(path);
  4704. #endif
  4705. }
  4706. else
  4707. {
  4708. path2 = path;
  4709. if (m_nChoosePhotoType == 0)
  4710. path2.Replace("客户原片", "修好的片");
  4711. if (m_bGrowthTX == 0)
  4712. {
  4713. int pos = path2.Find(m_strOrderNumber);
  4714. pos += m_strOrderNumber.GetLength();
  4715. int pos2 = path2.ReverseFind('\\');
  4716. path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2);
  4717. }
  4718. if (m_nChoosePhotoType == 0 && ::PathFileExists(path2))
  4719. {
  4720. m_patharray1.Add(path2);
  4721. }
  4722. else
  4723. {
  4724. path2.Replace(".raw", ".jpg");
  4725. if (PathFileExists(path2))
  4726. {
  4727. m_patharray1.Add(path2);
  4728. continue;
  4729. }
  4730. path2.Replace(".nef", ".jpg");
  4731. if (PathFileExists(path2))
  4732. {
  4733. m_patharray1.Add(path2);
  4734. continue;
  4735. }
  4736. path2.Replace(".cr2", ".jpg");
  4737. if (PathFileExists(path2))
  4738. {
  4739. m_patharray1.Add(path2);
  4740. continue;
  4741. }
  4742. else
  4743. {
  4744. if (path.Right(3) != "jpg")
  4745. continue;
  4746. #if JEFF_TEST_ON
  4747. if (PathFileExists(path))
  4748. m_patharray1.Add(path);
  4749. #else
  4750. m_patharray1.Add(path);
  4751. #endif
  4752. }
  4753. }
  4754. }
  4755. }
  4756. }
  4757. }
  4758. // if(0)
  4759. {//多种修好的效果
  4760. CString path, path2;
  4761. path2 = g_path2 + "\\";
  4762. path2 += m_strOrderNumber;
  4763. path2 += "\\";
  4764. using namespace helper_coffs;
  4765. ffsco o;
  4766. o.dirs(0);
  4767. o.find(LPCSTR(path2), LPCSTR("*.jpg"));
  4768. ffsco::typeT coo;
  4769. ffsco::typeT::iterator it;
  4770. coo = o.co_file();
  4771. for (it = coo.begin(); coo.end() != it; it++)
  4772. {
  4773. path = (*it).c_str();
  4774. if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm')
  4775. {
  4776. path.MakeLower();
  4777. path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1);
  4778. if (path2.Find("-") != -1)
  4779. {
  4780. #if JEFF_TEST_ON
  4781. if (PathFileExists(path))
  4782. m_patharray1.Add(path);
  4783. #else
  4784. m_patharray1.Add(path);
  4785. #endif
  4786. }
  4787. }
  4788. }
  4789. }
  4790. }
  4791. if (m_patharray1.GetSize() && atoi(g_cominfoarray.ElementAt(0).ElementAt(61)))
  4792. {
  4793. int size = m_patharray1.GetSize() - 1;
  4794. CString sTemp;
  4795. int nPos;
  4796. for (int i = 0; i < size; i++)
  4797. {
  4798. nPos = rand() % (size - i);
  4799. sTemp = m_patharray1.ElementAt(size - i);
  4800. m_patharray1.SetAt(size - i, m_patharray1.ElementAt(nPos));
  4801. m_patharray1.SetAt(nPos, sTemp);
  4802. }
  4803. }
  4804. }
  4805. m_mode = 0;
  4806. LoadPhotos();
  4807. }
  4808. BOOL ChoosePhotoSkin2::CheckHC()//检查本机上是否有缓存的相片;
  4809. {
  4810. char path[MAX_PATH];
  4811. ::GetSystemDirectory(path, MAX_PATH); //printf("Jeff:CheckHC::path=%s\n\n",path);//Jeff Printf
  4812. CString sysdir = path;
  4813. sysdir += "\\lyfz";
  4814. ::CreateDirectory(sysdir, NULL); //printf("Jeff:CheckHC::sysdir1=%s\n\n",sysdir);//Jeff Printf
  4815. sysdir += "\\";
  4816. sysdir += m_strOrderNumber; //printf("Jeff:CheckHC::sysdir2=%s\n\n",sysdir);//Jeff Printf
  4817. using namespace helper_coffs;
  4818. ffsco o;
  4819. o.dirs(0);
  4820. o.find(LPCSTR(sysdir), LPCSTR("*.jpg"));
  4821. ffsco::typeT coo;
  4822. coo = o.co_file();
  4823. if (coo.size())
  4824. {
  4825. if (AfxMessageBox("提醒, 此客人有本机缓存片,是否使用缓存片?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  4826. return 1;
  4827. }
  4828. return 0;
  4829. }