ChoosePhotoSkin2.cpp 125 KB

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