ChoosePhotoSkin2.cpp 121 KB

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