ChoosePhotoSkin2.cpp 122 KB

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