123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721 |
- // BeautifySkinFrom2.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "BeautifySkinFrom2.h"
- #include "MyMdi.H"
- #include "ModifyDinDan.h"
- #include "ImportPhoto.h"
- #include "ShowPic.h"
- #include "SelectPhotoDlg.h"
- #include "./helper/ffsco.h"
- #include "ShowCut.h"
- #include "CompressOption.h"
- #include "NetShareInfo.h"
- #include "DlgChuXiuInfo.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- IMPLEMENT_DYNCREATE(BeautifySkinFrom2, MyFormView)
- BeautifySkinFrom2::BeautifySkinFrom2(): MyFormView(BeautifySkinFrom2::IDD)
- {
- m_filter = _T("");
- m_nAdd = 0;
- if (g_bAllBranch)
- {
- m_nAdd = 1;
- }
- }
- BeautifySkinFrom2::~BeautifySkinFrom2()
- {
- }
- void BeautifySkinFrom2::DoDataExchange(CDataExchange* pDX)
- {
- MyFormView::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_COMBO1, m_combo1);
- DDX_Control(pDX, IDC_LIST2, m_FurtherList);
- DDX_Control(pDX, IDC_STATIC1, m_static1);
- DDX_CBString(pDX, IDC_COMBO1, m_filter);
- }
- BEGIN_MESSAGE_MAP(BeautifySkinFrom2, MyFormView)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
- ON_WM_TIMER()
- ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
- ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
- ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
- ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
- ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
- ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
- ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
- END_MESSAGE_MAP()
- #ifdef _DEBUG
- void BeautifySkinFrom2::AssertValid() const
- {
- MyFormView::AssertValid();
- }
- void BeautifySkinFrom2::Dump(CDumpContext& dc) const
- {
- MyFormView::Dump(dc);
- }
- #endif
- void BeautifySkinFrom2::OnInitialUpdate()
- {
- MyFormView::OnInitialUpdate();
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
- EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
- int idarray[] = { IDC_BUTprint3, IDC_BUTexportphoto, IDC_BUTimportphoto, IDC_BUTshowphoto, IDC_BUTexportphoto2, IDC_BUTclose };
- int idcount = 6;
- int btnwid;
- CRect prerc;
- for (int a = idcount - 2; a >= 0; a--)
- {
- GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
- ScreenToClient(prerc);
- GetDlgItem(idarray[a])->GetWindowRect(rc2);
- ScreenToClient(rc2);
- btnwid = rc2.Width();
- rc2.right = prerc.left;
- rc2.left = rc2.right - btnwid;
- GetDlgItem(idarray[a])->MoveWindow(rc2);
- }
- m_static1.SetFont(&g_titlefont);
- if (g_bAllBranch == 0)
- {
- #ifdef CHILD_VERSION
- m_FurtherList.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
- #else
- m_FurtherList.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
- #endif
- m_FurtherList.LoadColumnInfo(122);
- }
- else
- {
- #ifdef CHILD_VERSION
- m_FurtherList.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
- #else
- m_FurtherList.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
- #endif
- m_FurtherList.LoadColumnInfo(198);
- GetDlgItem(IDC_BUTprint3)->ShowWindow(1);
- }
- GetData();
- m_combo1.AddString(g_user.name);
- m_combo1.GetWindowRect(rc2);
- ScreenToClient(rc2);
- rc2.bottom += 200;
- m_combo1.MoveWindow(rc2);
- GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
- SetComboHei(&m_combo1, rc2.Height());
- GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(10));
- GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(11));
- }
- void BeautifySkinFrom2::FillGrid(BOOL bStatus)
- {
- if (g_bSearchFilter)
- {
- m_FurtherList.DeleteAllItems2();
- int ii = 0;
- m_FurtherList.m_arLabels.SetSize(m_List1array.GetSize(), 1);
- int count = 0;
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 条件查询==精修日期
- if (g_filterdate1 != "")
- {
- if (m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) > g_filterdate2)
- continue;
- }
- if (g_waiter1 != "")
- {
- // 条件查询==精修人;
- if (m_List1array.ElementAt(ii).ElementAt(13 + m_nAdd) != g_waiter1)
- continue;
- }
- if (g_bAllBranch && g_filterbranch != "")
- {
- if (m_List1array.ElementAt(ii).ElementAt(0) != g_filterbranch)
- continue;
- }
- if (1)
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- m_FurtherList.m_arLabels.SetSize(count, 1);
- ii = count;
- m_FurtherList.m_LabelCount = ii;
- m_FurtherList.SetItemCountEx(ii);
- CString str;
- str.Format("单数:%d", ii);
- SetDlgItemText(IDC_STATIC2, str);
- }
- else
- {
- m_FurtherList.DeleteAllItems2();
- int ii = 0;
- m_FurtherList.m_arLabels.SetSize(m_List1array.GetSize(), 1);
- int count = 0;
- if (m_filter.IsEmpty())
- {
- if (bStatus)
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 条件查询==选片状态&&精修状态;
- if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" && m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK")
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- else
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else
- {
- if (bStatus)
- {
- int type = GetType(m_filter);
- if (type == 1)//电话
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 查询条件==选片状态&&精修状态&&(手机1||手机2)
- if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
- m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
- (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).Find(m_filter) != -1))
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else if (type == 2)//拼音
- {
- m_filter.MakeUpper();
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 查询条件==选片状态&&精修状态&&(拼音1||拼音2)
- if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
- m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
- (m_List1array.ElementAt(ii).ElementAt(19 + m_nAdd).Find(m_filter) != -1 ||m_List1array.ElementAt(ii).ElementAt(20 + m_nAdd).Find(m_filter) != -1))
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 查询条件==选片状态&&精修状态&&(……)
- if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
- m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
- (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(19).Find(m_filter) != -1))
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- }
- else
- {
- int type = GetType(m_filter);
- if (type == 1)//电话
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 查询条件==手机1||手机2
- if (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 ||
- m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).Find(m_filter) != -1)
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else if (type == 2)//拼音
- {
- m_filter.MakeUpper();
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- // 查询条件==拼音1||拼音2
- if (m_List1array.ElementAt(ii).ElementAt(19 + m_nAdd).Find(m_filter) != -1 ||
- m_List1array.ElementAt(ii).ElementAt(20 + m_nAdd).Find(m_filter) != -1)
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else
- {
- for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
- {
- if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(20).Find(m_filter) != -1)
- {
- m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- }
- }
- m_FurtherList.m_arLabels.SetSize(count, 1);
- ii = count;
- m_FurtherList.m_LabelCount = ii;
- m_FurtherList.SetItemCountEx(ii);
- CString str;
- str.Format("单数:%d", ii);
- SetDlgItemText(IDC_STATIC2, str);
- }
- if (!g_id.IsEmpty())
- {
- for (int i = 0; i < m_FurtherList.GetItemCount(); i++)
- {
- if (g_id == m_FurtherList.GetItemText(i, 0 + m_nAdd))
- {
- m_FurtherList.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
- m_FurtherList.EnsureVisible(i, FALSE);
- break;
- }
- }
- }
- }
- void BeautifySkinFrom2::OnBUTclose()
- {
- GetParent()->SendMessage(WM_CLOSE);
- }
- void BeautifySkinFrom2::OnSelchangeCombo1()
- {
- SetTimer(1, 100, NULL);
- }
- void BeautifySkinFrom2::OnTimer(UINT nIDEvent)
- {
- KillTimer(nIDEvent);
- OnButton1();
- }
- BOOL BeautifySkinFrom2::PreTranslateMessage(MSG* pMsg)
- {
- try
- {
- if (pMsg->message == WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_RETURN:
- OnButton1();
- return 1;
- case 0x43: // copy
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- return MyFormView::PreTranslateMessage(pMsg);
- }
- catch (...)
- {
- }
- return true;
- }
- void BeautifySkinFrom2::OnBUTimportphoto() // 导入精修片 按钮;
- {
- #ifdef USE_KERNEL_DLL
- POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
- if ( pos == NULL )
- {
- AfxMessageBox(_T("请选中您要导入精修片的订单!"),MB_ICONINFORMATION);
- return;
- }
- INT nItemCount = m_FurtherList.GetItemCount();
- INT nSelectedItem = m_FurtherList.GetNextSelectedItem(pos);
- // 获取列表信息:域名、订单号、顾客信息、景点名(成长套系名)、精修人、精修状态、精修日期;
- CString strBranchName = _T("");
- CString strBranchId = _T("");
- CString strOrderNum = _T("");
- CString strScenery = _T("");
- CString strCustomerInfo = _T("");
- CString strJingxiuRen = _T("");
- CString strJingxiuState = _T("");
- CString strJingxiuDate = _T("");
- // 获取域名;
- if ( g_bAllBranch )
- {// 多店汇总时;
- strBranchName = m_FurtherList.GetItemText(nSelectedItem, 0);
- strBranchId = GetDomainFromBranch( strBranchName );
- }
- else
- {
- if ( g_branchname.IsEmpty() )
- {// 连接本店时;
- strBranchId = g_domain;
- }
- else
- {// 连接分店时;
- strBranchName = g_branchname;
- strBranchId = GetDomainFromBranch( g_branchname );
- }
- }
- // 获取订单号;
- strOrderNum = m_FurtherList.GetItemText(nSelectedItem, 0 + m_nAdd);
- // 获取精修师;
- strJingxiuRen = m_FurtherList.GetItemText(nSelectedItem, 13 + m_nAdd); // 11
- // 获取精修状态;
- strJingxiuState = m_FurtherList.GetItemText(nSelectedItem, 6 + m_nAdd);
- // 获取精修日期;
- strJingxiuDate = m_FurtherList.GetItemText(nSelectedItem, 7 + m_nAdd);
- // 获取顾客信息;
- strCustomerInfo = m_FurtherList.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_FurtherList.GetItemText(nSelectedItem, 2 + m_nAdd);
- CDlgChuXiuInfo xpdlg;
- xpdlg.m_strOrderNumber = strOrderNum;
- xpdlg.m_strXiupianRen = strJingxiuRen;
- if ( strJingxiuState == _T("OK") )
- xpdlg.m_nXiupianStatus = 0;
- else if ( strJingxiuState == _T("修片中"))
- xpdlg.m_nXiupianStatus = 1;
- else if ( strJingxiuState == _T("未修"))
- xpdlg.m_nXiupianStatus = 2;
- CString strSQL = _T("");
- if ( xpdlg.DoModal() == IDOK )
- {
- if ( xpdlg.m_bGrowthTx )
- strScenery = xpdlg.m_strScenery;
- if ( xpdlg.m_nXiupianStatus == 0 )
- strJingxiuState = _T("OK");
- else if ( xpdlg.m_nXiupianStatus == 1)
- strJingxiuState = _T("修片中");
- else if ( xpdlg.m_nXiupianStatus == 2 )
- strJingxiuState = _T("未修");
- strJingxiuRen = xpdlg.m_strXiupianRen;
- if (strJingxiuDate.IsEmpty())
- strSQL.Format(_T("update dindan set waiter7 = '%s', status6 = '%s', time9 = '%s' where id = '%s' "), strJingxiuRen, strJingxiuState, g_date, strOrderNum);
- else
- strSQL.Format(_T("update dindan set waiter7 = '%s', status6 = '%s' where id = '%s'"), strJingxiuRen, strJingxiuState, strOrderNum);
- // 构建更新包,发送到服务端更新数据;
- g_sendhead.bsql = TRUE;
- if ( g_bAllBranch )
- { // 多店汇总时;
- g_branchip = GetBranchIPbyId(strBranchId);
- g_pMainWnd->OnDisconnect();
- g_branchname = strBranchName;
- g_bBranchModify = TRUE;
- g_pMainWnd->ProcessChatMessageRequest2(strSQL);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = FALSE;
- g_branchip = g_branchname = "";
- }
- else
- {// 连接本店或分店时;
- g_pMainWnd->ProcessChatMessageRequest2(strSQL);
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // 接收服务器返回的数据,并刷新界面;
- if (g_bSendOK == 0)
- {
- OutputDebugString(_T("接收服务信息失败\n"));
- return;
- }
- if ( g_bAllBranch == 0)
- {// 连接本店或分店时;
- GetData();
- }
- else
- {// 多店汇总时;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if ( strOrderNum == m_List1array.ElementAt(i).ElementAt(1) && strBranchName == m_List1array.ElementAt(i).ElementAt(0))
- {
- m_List1array.ElementAt(i).SetAt(6 + m_nAdd, strJingxiuState);
- if ( strJingxiuDate.IsEmpty() )
- m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
- m_List1array.ElementAt(i).SetAt(13 + m_nAdd, strJingxiuRen);
- FillGrid();
- break;
- }
- }
- }
- }
- else
- {
- // 开始导入初修片;
- if ( MessageBox(_T("是否现在开始导入精修片!"), _T("导片提示:导入精修片"), MB_TOPMOST|MB_YESNO|MB_ICONWARNING ) != IDYES )
- {// 是否马上导入相片;
- return;
- }
- if ( xpdlg.m_bGrowthTx )
- strScenery = xpdlg.m_strScenery;
- if ( xpdlg.m_bGrowthTx && strScenery.IsEmpty() )
- {
- AfxMessageBox(_T("儿童成长套系导片必须选择套系名!"));
- return;
- }
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- if ( g_pIMGProcess == NULL )
- {
- return;
- }
- ImgImportInterface *pImport = NULL;
- g_pIMGProcess->QueryInterface(IID_ImgImportInterface, (void**)&pImport);
- if ( pImport )
- {
- pImport->ImportFurtherImg(
- FALSE, // 文件夹形式打开源或多选文件形式;
- strBranchId, // 分店域名;
- strOrderNum, // 订单号;
- strCustomerInfo, // 顾客信息,可任意组合;
- !strScenery.IsEmpty(), // 导入时,是否生成景点名文件夹;
- strScenery, // 导入时,景点名;
- _T("*.jpg|*.jpeg"), // 导入时,主扩展名相片;
- INVALID_COPY_PIX, // 导入时,主扩展名相片的压缩像素;
- _T("*.nef|*.cr2"), // 导入时,附加的扩展名相片;
- TRUE, // 导入时,是否生成缩略图;
- SET_PIX(100,100), // 导入时,生成的缩略图像素大小;
- FALSE // 导入时,文件存在时是否覆盖;
- );
- g_pIMGProcess->Release();
- WriteOptLog(_T("导入精修,订单号:%s"),strOrderNum);
- }
- // 结束;
- #else
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- CString branch;
- CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
- if (g_bAllBranch)
- branch = m_FurtherList.GetItemText(iItem, 0);
- CString oldstatus = m_FurtherList.GetItemText(iItem, 6 + m_nAdd);
- CString time9 = m_FurtherList.GetItemText(iItem, 7 + m_nAdd);
- CString name = m_FurtherList.GetItemText(iItem, 1 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
- name.TrimLeft(",");
- name.TrimRight(",");
- name = "客人:" + name;
- CString phone = m_FurtherList.GetItemText(iItem, 15 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 16 + m_nAdd);
- phone.TrimLeft(",");
- phone.TrimRight(",");
- phone = "电话:" + phone;
- CString strDomain = _T("");
- CString savepath = _T("");
- if (g_bAllBranch)
- strDomain = GetDomainFromBranch(branch);
- else
- {
- if(g_branchname != _T(""))
- strDomain = GetDomainFromBranch(g_branchname);
- }
- //////////////////////////////////////////////////////////////////////////
- // 获取可用的共享目录;
- #if USE_SHARE_FLORD // 2015.04.13
- TCHAR szSharePath[MAX_PATH];
- //if( GetEnableShareDirectory(3,id,branch,szSharePath) )
- if (CNetShareInfo::GetInstance()->GetEnableShareDirectory(3, id, strDomain, szSharePath))
- {
- savepath.Format("%s\\",szSharePath);
- }
- else
- {
- AfxMessageBox(_T("没有可用的共享目录!"));
- return;
- }
- #else
- savepath += id + "\\";
- #endif
- //////////////////////////////////////////////////////////////////////////
- if (::CheckFolderFileExist(savepath) == 0)
- {
- if ( !CreateDirectory(savepath, NULL) )
- {
- DWORD dwError = GetLastError();
- AfxMessageBox(_T("创建精修订单目录失败"));
- return;
- }
- }
- CString srcdir; CString str;
- GetSavePath(srcdir);
- if (srcdir.IsEmpty())
- {
- CString status6;
- if (AfxMessageBox("客照是否全部精修完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
- status6 = "OK";
- else
- status6 = "修片中";
- CString sql;
- if (time9.IsEmpty())
- sql = "update dindan set status6='" + status6 + "',time9='" + g_date + "' where id='" + id + "'";
- else
- sql = "update dindan set status6='" + status6 + "' where id='" + id + "'";
- g_sendhead.bsql = 1;
- if (g_bAllBranch)
- {
- g_branchip = GetIP(branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- else
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- if (g_bAllBranch == 0)
- {
- GetData();
- }
- else
- {
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
- {
- m_List1array.ElementAt(i).SetAt(6 + m_nAdd, status6);
- if (time9.IsEmpty())
- m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
- FillGrid();
- break;
- }
- }
- }
- return;
- }
- if (srcdir.GetLength() < 4)
- {
- AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
- return;
- }
- if (oldstatus != "未修")
- {
- str.Format("%s\r\n%s\r\n此单已导入过修片,确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)
- return;
- }
- else
- {
- str.Format("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
- return;
- }
- CStringArray array;
- CStringArray desarray;
- CStringArray dirarray;
- if (1)
- {
- // 1.获取源目录下的所有文件,包含子目录;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(srcdir), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (FindArray(&dirarray, str) == -1)
- {
- dirarray.Add(str);
- if (str != dirarray.ElementAt(0))
- {
- str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
- if (::CheckFolderFileExist(str) == 0)
- ::CreateDirectory(str, NULL);
- }
- }
- }
- }
- if (1)
- {
- // 2.从每个子目录下查找所有的相片;
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();coo.end() != it;it++)
- {
- str = (*it).c_str();
- array.Add(str);
- desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
- }
- }
- }
- if (array.GetSize() == 0)return;
- ImportPhoto dlg;
- #if USE_SHARE_FLORD
- dlg.m_id = id; // add by 2015-07-06 Jeff;
- #endif
- dlg.m_branch = branch;
- dlg.m_nphototype = 2;
- dlg.m_bOverWrite = 1;
- dlg.m_pArray = &array;
- dlg.m_pDesArray = &desarray;
- dlg.m_savepath = savepath;
- #ifdef ENTERPRISE_VERSION
- // if(!g_branchname.IsEmpty ())
- {
- dlg.m_bSaveUploadTask = g_bSaveUploadTask3;
- dlg.m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(80);
- dlg.m_uploadtaskarray.Add(id + ";" + name);
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- }
- #endif
- dlg.DoModal();
- CString status6;
- if (AfxMessageBox("客照是否全部精修完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
- status6 = "OK";
- else
- status6 = "修片中";
- CString sql;
- if (time9.IsEmpty())
- sql = "update dindan set status6='" + status6 + "',waiter7='" + g_user.name + "',time9='" + g_date + "' where id='" + id + "'";
- else
- sql = "update dindan set status6='" + status6 + "',waiter7='" + g_user.name + "' where id='" + id + "'";
- g_sendhead.bsql = 1;
- if (g_bAllBranch)
- {
- g_branchip = GetIP(branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- else
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- savepath += "ok";
- ::DeleteFile(savepath); // 删除ok文件;
- AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
- if (g_bAllBranch == 0)
- {
- GetData();
- }
- else
- {
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
- {
- m_List1array.ElementAt(i).SetAt(6 + m_nAdd, status6);
- if (time9.IsEmpty())
- m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
- m_List1array.ElementAt(i).SetAt(11 + m_nAdd, g_user.name);
- FillGrid();
- break;
- }
- }
- }
- #endif
- }
- void BeautifySkinFrom2::OnBUTshowphoto() // 查看精修片;
- {
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- CString branch;
- CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
- if (g_bAllBranch)
- branch = m_FurtherList.GetItemText(iItem, 0);
- CString name = m_FurtherList.GetItemText(iItem, 1 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
- name.TrimLeft(",");
- name.TrimRight(",");
- name = "客人:" + name;
- ShowPic dlg;
- dlg.m_id = id;
- dlg.m_name = name;
- dlg.m_mode = 3;
- if(g_branchname == _T(""))
- dlg.m_path = g_path1 + "\\";
- else
- {
- dlg.m_branch = GetDomainFromBranch(g_branchname);
- CString branchpath = GetBranchPhotoPath(g_branchname);
- dlg.m_path = g_path1 + branchpath + "\\";
- }
- #ifndef USE_KERNEL_DLL
- #if USE_SHARE_FLORD
- // 根据域名,相片类型,订单号查找相片;
- dlg.m_aryOfShareDirectory.RemoveAll();
- CNetShareInfo::GetInstance()->LoadOrderImages(dlg.m_mode, dlg.m_id, g_domain, dlg.m_patharray1, &dlg.m_aryOfShareDirectory);
- #endif
- #endif
- dlg.m_path += id;
- dlg.m_path += "\\";
- dlg.DoModal();
- }
- //-----------------------------------------------------------------
- // remark by Jeff 2014-12-12
- // 函数:GetNo
- // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
- // 参数:
- // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
- // array:空的数组,用来存放解析后的相片名;
- // 返回:
- // 注意:更换分隔符造成的问题,在该函数已解决;
- //-----------------------------------------------------------------
- void BeautifySkinFrom2::GetNo(CString str, CStringArray &array)
- {
- if (!str.IsEmpty())
- {
- #ifdef USE_SEP_VEB
- int pos = str.Find(SEPS_VEB);
- #else
- int pos = str.Find(",");
- #endif
- while (pos != -1)
- {
- if (FindArray(&array, str.Left(pos)) == -1)
- array.Add(str.Left(pos));
- str = str.Right(str.GetLength() - pos - 1);
- #ifdef USE_SEP_VEB
- pos = str.Find(SEPS_VEB);
- #else
- pos = str.Find(",");
- #endif
- }
- if (FindArray(&array, str) == -1)
- array.Add(str);
- }
- }
- //-----------------------------------------------------------------
- // remark by Jeff 2014-12-12
- // 函数:GetSelName
- // 描述:
- // 参数:
- // name:由GetNo解析出来后的单个相片名,如:"001"
- // spnamearray:订单下的商品数组,case 50所得;
- // 返回:
- // 注意:更换分隔符造成的问题,在该函数已解决;
- //-----------------------------------------------------------------
- CString BeautifySkinFrom2::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
- {
- CString ret;
- #ifdef USE_SEP_VEB
- name = SEPS_VEB + name + SEPS_VEB;
- #else
- name = "," + name + ",";
- #endif
- CString str;
- for (int i = 0; i < spnamearray.GetSize(); i++)
- {
- #ifdef USE_SEP_VEB
- str = SEPS_VEB + spnamearray.ElementAt(i).ElementAt(6) + SEPS_VEB;
- #else
- str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
- #endif
- if (str.Find(name) != -1)
- {
- ret += spnamearray.ElementAt(i).ElementAt(5);
- ret += ";";
- }
- }
- ret.TrimRight(";");
- ret.Replace("*", "x");
- return ret;
- }
- CString GetPathFromNo2(CString dir, CString no)
- {
- CString sRet;
- dir.TrimRight('\\');
- dir += "\\";
- CStringArray dirarray;
- CString temp;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(dir), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it++)
- {
- temp = (*it).c_str();
- if (::FindArray(&dirarray, temp) == -1 && temp != dir)
- {
- dirarray.Add(temp);
- }
- }
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- temp = dirarray.ElementAt(i);
- sRet.Format("%s%s.jpg", temp, no);
- if (::PathFileExists(sRet))return sRet;
- sRet.Replace(".jpg", ".raw");
- if (::PathFileExists(sRet))return sRet;
- sRet.Replace(".raw", ".nef");
- if (::PathFileExists(sRet))return sRet;
- sRet.Replace(".nef", ".cr2");
- if (::PathFileExists(sRet))return sRet;
- sRet.Replace(".cr2", ".jpg");
- if (::PathFileExists(sRet))return sRet;
- }
- return dir + no + ".jpg";
- }
- CString GetPathFromNo3(CString dir, CString no)
- {
- CString sRet;
- dir.TrimRight('\\');
- dir += "\\";
- CStringArray dirarray;
- CString temp;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(dir), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it++)
- {
- temp = (*it).c_str();
- if (::FindArray(&dirarray, temp) == -1 && temp != dir)
- {
- dirarray.Add(temp);
- }
- }
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- temp = dirarray.ElementAt(i);
- sRet.Format("%s%s.jpg", temp, no);
- if (::PathFileExists(sRet))return sRet;
- }
- return dir + no + ".jpg";
- }
- // 导出裁剪后的效果图;
- void BeautifySkinFrom2::OnBUTexportphoto() // 导出选好的片 按钮;
- {
- #ifdef USE_KERNEL_DLL
- // 判断用户是否有权限导出选好的片;
- if ( !IsHasRights2new(10) )
- {
- AfxMessageBox(_T("您没有权限导出选好的片!"));
- return;
- }
- // 获取列表信息;
- POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
- if ( pos == NULL )
- {
- AfxMessageBox(__T("请选中您要导片的订单!"));
- return;
- }
- INT nItemCount = m_FurtherList.GetItemCount();
- INT nSelectedItem = m_FurtherList.GetNextSelectedItem(pos);
- // 获取域名、订单号、景点名、顾客信息、选片人、选片状态、选片日期;
- CString strBranchName = _T("");
- CString strBranchId = _T("");
- CString strOrderNum = _T("");
- CString strScenery = _T("");
- CString strCustomerInfo = _T("");
- CString strXuanpianRen = _T("");
- CString strXuanpianState = _T("");
- CString strXuanpianDate = _T("");
- // 获取订单号;
- strOrderNum = m_FurtherList.GetItemText(nSelectedItem, 0 + m_nAdd);
- // 获取顾客信息;
- strCustomerInfo = m_FurtherList.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_FurtherList.GetItemText(nSelectedItem, 2 + m_nAdd);
- // 获取选片状态;
- strXuanpianState = m_FurtherList.GetItemText(nSelectedItem, 4 + m_nAdd);
- // 获取选片日期;
- strXuanpianRen = m_FurtherList.GetItemText(nSelectedItem, 5 + m_nAdd);
- if ( strXuanpianState == _T("未选") )
- {
- MessageBox(_T("此单未选片!"), _T("影楼管理"), MB_OK | MB_TOPMOST | MB_ICONINFORMATION );
- return;
- }
- // 获取域名;
- if ( g_bAllBranch )
- {// 多店汇总;
- strBranchName = m_FurtherList.GetItemText(nSelectedItem, 0);
- strBranchId = GetDomainFromBranch(strBranchName);
- }
- else
- {
- if ( g_branchname.IsEmpty() )
- {// 连接本店时;
- strBranchId = g_domain;
- }
- else
- {//连接分店时;
- strBranchName = g_branchname;
- strBranchId = GetDomainFromBranch( g_branchname );
- }
- }
- // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
- IsGrowthTx IsGrowthtxdlg;
- IsGrowthtxdlg.m_mode = 1;
- IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
- IsGrowthtxdlg.DoModal();
- if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
- {
- return;
- }
- if ( IsGrowthtxdlg.m_bGrowthTx )
- {
- // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
- strScenery = IsGrowthtxdlg.m_seltxname;
- if ( strScenery == _T("全部") )
- {
- strScenery.Empty();
- }
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // 与服务器通信获取指定条件的订单商品信息;
- CString strSQL = _T("");
- #ifdef CHILD_VERSION
- if ( IsGrowthtxdlg.m_bGrowthTx && !strScenery.IsEmpty() )
- strSQL.Format(_T("id='%s' and growthtxname = '%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strScenery, strOrderNum, strOrderNum);
- else
- strSQL.Format(_T("id='%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
- #else
- strSQL.Format(_T("id='%s'; id='%s'; id='%s' and kind <> '2' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
- #endif//CHILD_VERSION
- g_sendhead.bsql = FALSE;
- g_sendhead.code[0] = 50; // dindansp;
- g_sendhead.code[1] = 11; // dindan;
- g_sendhead.code[2] = 56; // dindansp;
- g_sendhead.tabcount = 3;
- if( g_bAllBranch )
- {//多店汇总时;
- g_branchip = GetBranchIPbyId(strBranchId);
- g_pMainWnd->OnDisconnect();
- g_branchname = strBranchName;
- g_bBranchModify = TRUE;
- g_pMainWnd->ProcessChatMessageRequest2(strSQL);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = FALSE;
- g_branchip = g_branchname = _T("");
- }
- else
- {// 连接本店或分店时;
- g_pMainWnd->ProcessChatMessageRequest2(strSQL);
- }
- if( !g_bSendOK )
- return ;
- CArray<CStringArray, CStringArray> Arydindan;
- CArray<CStringArray, CStringArray> Arydindansp;
- CArray<CStringArray, CStringArray> Arydindansp2;
- DataToArray( &Arydindansp, &Arydindan, &Arydindansp2 );
- CString strTemp = _T("");
- CStringArray AryImgNums;
- CStringArray AryPerImgGoods;
- // 获取所有dindansp记录no字段中的相片编号;
- int i = 0;
- int nSize = Arydindansp.GetSize();
- for ( i = 0; i < nSize; i++)
- {
- strTemp = Arydindansp.ElementAt(i).ElementAt(6); // dindansp表中的no字段;
- GetNo(strTemp, AryImgNums);
- }
- // 获取每张相片编号对应的商品,每个商品间用分号隔开;
- nSize = AryImgNums.GetSize();
- AryPerImgGoods.SetSize(nSize);
- for ( i = 0; i < nSize; i++ )
- {
- strTemp = AryImgNums.ElementAt(i);
- AryPerImgGoods.SetAt(i, GetSelName(strTemp, Arydindansp));
- }
- // 由于VC6.0传CStringArray给VC9.0DLL 时,会产生无法避免的兼容性问题,故使用CString传;
- CString strImgNums = _T("");
- for ( i = 0; i < AryImgNums.GetSize(); i++ )
- {
- strImgNums += AryImgNums.ElementAt(i);
- strImgNums += _T("?|?");
- }
- CString strPerImgGoods = _T("");
- for ( i = 0; i < AryPerImgGoods.GetSize(); i++ )
- {// 商品名称,应该禁止包含非法字符;
- strPerImgGoods += AryPerImgGoods.ElementAt(i);
- strPerImgGoods += _T("?|?");
- }
- // 再选择导出的是初修片、原片、初修+原片,并且是否按产品生成文件夹分类相片或者相片名后带产品名;
- SelectPhotoDlg selectdlg;
- selectdlg.DoModal();
- BOOL bExportWithName = selectdlg.m_check1;
- INT bExportMode = selectdlg.m_mode; // 0 原片+初修, 1 原片, 2 初修;
- // 保存导出相片的路径;
- CString strSaveDirectory = _T("");
- if ( g_pIMGProcess == NULL )
- {
- return ;
- }
- ImgExportInterface *pExport = NULL;
- g_pIMGProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
- if ( pExport )
- {// 导出选好的片;
- HGLOBAL hMemery = pExport->ExportSelectedBeautifyImg(
- strBranchId,
- strOrderNum,
- strCustomerInfo,
- !strScenery.IsEmpty(),
- strScenery,
- _T("*.jpg|*.jpeg"),
- INVALID_COPY_PIX,
- _T("*.nef|*.cr2|*.raw|"),
- FALSE,
- bExportWithName,
- IsGrowthtxdlg.m_bGrowthTx,
- bExportMode,
- strImgNums,
- strPerImgGoods,
- Arydindan.ElementAt(0).ElementAt(60)
- );
- WriteOptLog(_T("导出选好的片,订单号:%s"),strOrderNum);
- if ( hMemery )
- {
- CString strDir = _T("");
- TCHAR* pszSaveDirectory = (TCHAR*)GlobalLock(hMemery);
- GlobalUnlock(hMemery);
- // 输出输出要求内容;
- strDir.Format(_T("%s\\客户要求.txt"), pszSaveDirectory);
- if ( Arydindan.GetSize() )
- {
- CStdioFile fp;
- fp.Open(strDir, CFile::modeCreate | CFile::modeWrite);
- fp.WriteString(_T("选片要求:\n"));
- fp.WriteString(Arydindan.ElementAt(0).ElementAt(39) + _T(" ") + Arydindan.ElementAt(0).ElementAt(75));
- fp.WriteString(_T("\n"));
- fp.WriteString(_T("\n"));
- fp.WriteString(_T("订单要求:\n"));
- fp.WriteString(Arydindan.ElementAt(0).ElementAt(38));
- fp.WriteString(_T("\n"));
- fp.WriteString(_T("\n"));
- fp.WriteString(_T("客人产品:\n"));
- CString str;
- str = _T("产品名称");
- FillLength(str, 30);
- str += _T("数量");
- FillLength(str, 40);
- #ifdef LKAY_VERSION
- str += _T("P数");
- FillLength(str, 50);
- str += _T("加急");
- FillLength(str, 60);
- str += _T("取件日期");
- FillLength(str, 70);
- #else
- str += _T("加急");
- FillLength(str, 50);
- str += _T("取件日期");
- FillLength(str, 60);
- #endif
- fp.WriteString(str);
- fp.WriteString(_T("\n"));
- for (int i = 0; i < Arydindansp2.GetSize(); i++)
- {
- str.Empty();
- str = Arydindansp2.ElementAt(i).ElementAt(0);
- FillLength(str, 30);
- str += Arydindansp2.ElementAt(i).ElementAt(1);
- FillLength(str, 40);
- #ifdef LKAY_VERSION
- str += Arydindansp2.ElementAt(i).ElementAt(29); //p数
- FillLength(str, 50);
- str += Arydindansp2.ElementAt(i).ElementAt(18);
- FillLength(str, 60);
- str += Arydindansp2.ElementAt(i).ElementAt(19);
- FillLength(str, 70);
- #else
- str += Arydindansp2.ElementAt(i).ElementAt(18);
- FillLength(str, 50);
- str += Arydindansp2.ElementAt(i).ElementAt(19);
- FillLength(str, 60);
- #endif
- fp.WriteString(str);
- fp.WriteString(_T("\n"));
- }
- fp.Close();
- }
- // 导出条形码位图;
- if ( g_bExportBarCode )
- {
- for ( int j = Arydindansp.GetSize() - 1; j >= 0; j-- )
- {
- if ( Arydindansp.ElementAt(j).ElementAt(6).IsEmpty() )
- Arydindansp.RemoveAt(j);
- }
- if ( !bExportWithName )
- {
- for ( int i = 0; i < Arydindansp.GetSize(); i++ )
- {
- strDir.Format(_T("%s\\%s"), pszSaveDirectory, Arydindansp.ElementAt(i).ElementAt(5));
- if ( PathFileExists(strDir) )
- {
- // 商品目录存在才导出;
- pExport->ExportBarCodeImg(0, g_screenwid, g_screenhei, 1, 40, Arydindansp.ElementAt(i).ElementAt(7), Arydindansp.ElementAt(i).ElementAt(0), Arydindansp.ElementAt(i).ElementAt(5), strDir);
- }
- }
- }
- pExport->ExportOrderBarCodeImg(0, g_screenwid, g_screenhei*3, 1, 40, Arydindansp, pszSaveDirectory);
- }
- }
- OutputDebugString(_T("导出选好的片!\n"));
- }
- pExport->Release();
- // 结束;
- #else
- // 1.判断权限;
- if (IsHasRights2new(10) == 0)return;
- #if USE_SHARE_FLORD
- BOOL bOfmat = FALSE;
- BOOL bGrowth = FALSE;
- BOOL bExportWithName = FALSE;
- CString name1,name2,branch,strdomain,strOrderNumber,strGrowhTx = _T("");
- CStringArray array,spnamearray2;
- OUT CArray<CStringArray, CStringArray> sparray2;
- GetCurSelRecord(name1,name2,strOrderNumber,branch,strdomain);
- int nResult = GetImageWithGoods(branch,strdomain,strOrderNumber,bGrowth,strGrowhTx,bExportWithName,array,spnamearray2,sparray2);
- if ( nResult == -1 )
- {
- // 没有任务相片存在于共享目录中;
- return;
- }
- CString strSaveDiretory;
- GetSavePath(strSaveDiretory);
- if(strSaveDiretory.IsEmpty())return;
- strSaveDiretory.TrimRight ('\\');
- strSaveDiretory+="\\";
- strSaveDiretory+=strOrderNumber;
- strSaveDiretory+=g_branchname;
- if(g_bAllBranch)
- {
- if(GetBranchPhotoPath(branch)!="")
- strSaveDiretory+=branch;
- }
- strSaveDiretory+=name1;
- strSaveDiretory+=name2;
- strSaveDiretory+="选片";
- strSaveDiretory+="\\";
- if ( nResult == 3 )
- {
- // 选择导出的是初修,但初修无片,导出原片;
- strSaveDiretory.Delete(strSaveDiretory.GetLength()-1, 1);
- strSaveDiretory += _T("(未修)\\");
- bOfmat = TRUE;
- }
- ::CreateDirectory (strSaveDiretory, NULL);
- #else
- // 2.获取选中列的信息,如订单号;
- UpdateData();
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
- return;
- }
- // 2.1.获取订单的选片状态;
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- CString status2 = m_FurtherList.GetItemText(iItem, 4 + m_nAdd);
- if (status2 != "OK")
- {
- AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
- return;
- }
- // 2.2.获取订单号;
- BOOL bOfmat = 0;
- CString strOrderNumber = m_FurtherList.GetItemText(iItem, 0 + m_nAdd); // 订单号;
- CString branch;
- if (g_bAllBranch)
- branch = m_FurtherList.GetItemText(iItem, 0);
- CString name1 = m_FurtherList.GetItemText(iItem, 1 + m_nAdd);
- CString name2 = m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
- // 3.1.选片成长套系对话框;
- IsGrowthTx growthtxdlg;
- growthtxdlg.m_mode = 1;
- growthtxdlg.m_strOrderNumber = strOrderNumber;
- growthtxdlg.DoModal(); // 非成长套系的,直接退出;
- BOOL m_bGrowthTX = growthtxdlg.m_bGrowthTx;
- CString m_seltxname = growthtxdlg.m_seltxname;
- #ifdef CHILD_VERSION
- CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底'";
- if (m_seltxname != "" && m_seltxname != "全部")
- {
- filter = "id='" + strOrderNumber + "' and growthtxname='" + m_seltxname + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底'";
- }
- #else
- CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"' and kind<>'2' and name<>'入册' and name<>'入底'";
- #endif //#ifdef CHILD_VERSION
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 50; // dindansp
- g_sendhead.code[1] = 11; // dindan
- g_sendhead.code[2] = 56; // dindansp
- g_sendhead.tabcount = 3;
- if (g_bAllBranch)
- {
- g_branchip = GetIP(branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- else
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- CArray<CStringArray, CStringArray>sparray;
- CArray<CStringArray, CStringArray>sparray2;
- DataToArray(&sparray, &g_List1array, &sparray2);
- CString strSrcDiretory; // 相片源目录;
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- strSrcDiretory = g_path2 + branchpath + "\\";
- }
- else
- strSrcDiretory = g_path2 + "\\";
- // 4.照片类型选择对话框;(客户原片、初修片)
- SelectPhotoDlg selectdlg;
- selectdlg.DoModal();
- strSrcDiretory += strOrderNumber;
- strSrcDiretory += "\\";
- if (m_seltxname != "" && m_seltxname != "全部")
- {
- strSrcDiretory += m_seltxname;
- strSrcDiretory += "\\";
- }
- ////////////////////////////////////////
- CString str, spname;
- CStringArray noarray;
- CStringArray spnamearray;
- for (int i = 0; i < sparray.GetSize(); i++)
- {
- str = sparray.ElementAt(i).ElementAt(6); // 选好的片的相片名串;
- spname = sparray.ElementAt(i).ElementAt(5); // 选好的片对应的商品名;
- GetNo(str, noarray);
- }
- /*
- for(int k=0; k<noarray; k++)
- printf("no str=%s\n", noarray.ElementAt(k));
- */
- if (noarray.GetSize() == 0)
- {
- AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
- return;
- }
- spnamearray.SetSize(noarray.GetSize());
- for (i = 0; i < noarray.GetSize(); i++)
- {
- str = noarray.ElementAt(i);
- spnamearray.SetAt(i, GetSelName(str, sparray));//+"-"+str );
- }
- CString strSaveDiretory; // 导出选好片的目录;
- GetSavePath(strSaveDiretory);
- if (strSaveDiretory.IsEmpty())return;
- strSaveDiretory.TrimRight('\\');
- strSaveDiretory += "\\";
- strSaveDiretory += strOrderNumber;
- strSaveDiretory += g_branchname;
- if (g_bAllBranch)
- {
- if (GetBranchPhotoPath(branch) != "")
- strSaveDiretory += branch;
- }
- strSaveDiretory += name1;
- strSaveDiretory += name2;
- strSaveDiretory += "选片";
- strSaveDiretory += "\\";
- CStringArray array;
- CStringArray spnamearray2;
- CString src, des;
- // printf("m_mode = %d, m_seltxname = %s, m_bGrowthTX = %d, SrcDir = %s\n", selectdlg.m_mode, m_seltxname, m_bGrowthTX, strSrcDiretory);
- if (selectdlg.m_mode == 0)
- {
- for (i = 0; i < noarray.GetSize(); i++)
- {
- if ((m_seltxname != "" && m_seltxname != "全部") || m_bGrowthTX == 0)
- src.Format("%s%s.jpg", strSrcDiretory, noarray.ElementAt(i));
- else
- src = GetPathFromNo3(strSrcDiretory, noarray.ElementAt(i));
- // printf("src1 = %s\n", src);
- if (PathFileExists(src))
- {
- // printf("exists src = %s\n", src);
- array.Add(src);
- if (1)//selectdlg.m_check1)
- spnamearray2.Add(spnamearray.ElementAt(i));
- else
- spnamearray2.Add(noarray.ElementAt(i));
- }
- else
- AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
- }
- }
- // printf("arraySize1 = %d\n", array.GetSize());
- if (array.GetSize() == 0)
- {
- if (selectdlg.m_mode == 0)
- AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- strSrcDiretory = g_path1 + branchpath + "\\";
- }
- else
- strSrcDiretory = g_path1 + "\\";
- strSrcDiretory += strOrderNumber;
- strSrcDiretory += "\\";
- strSaveDiretory.Delete(strSaveDiretory.GetLength() - 1, 1);
- strSaveDiretory += "(未修)\\";
- bOfmat = 1;
- for (i = 0; i < noarray.GetSize(); i++)
- {
- // src.Format ("%s%s.jpg", strSrcDiretory, noarray.ElementAt (i));
- src = GetPathFromNo2(strSrcDiretory, noarray.ElementAt(i));
- // printf("src2 = %s\n", src);
- if (PathFileExists(src))
- {
- // printf("exists src = %s\n", src);
- array.Add(src);
- if (1)//selectdlg.m_check1)
- spnamearray2.Add(spnamearray.ElementAt(i));
- else
- spnamearray2.Add(noarray.ElementAt(i));
- }
- else
- AfxMessageBox("未找到原片文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
- }
- }
- // printf("arraySize2 = %d\n", array.GetSize());
- if (array.GetSize() == 0)
- {
- AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
- return;
- }
- ::CreateDirectory(strSaveDiretory, NULL);
- #endif //#if USE_SHARE_FLORD
- // 3.导出相片处理对象;
- ImportPhoto dlg;
- dlg.m_name = name1 + name2;
- #if USE_SHARE_FLORD
- dlg.m_bAddname = bExportWithName;
- #else
- dlg.m_bAddname = selectdlg.m_check1;
- #endif
- dlg.m_bOfmat = bOfmat;
- dlg.m_mode = 1;
- dlg.m_bOrigin = 1;
- dlg.m_pArray = &array;
- dlg.m_pArray2 = &spnamearray2;
- dlg.m_savepath = strSaveDiretory;
- dlg.DoModal();
- //////////////
- if (g_List1array.GetSize())
- {
- CStdioFile fp;
- fp.Open(strSaveDiretory + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
- fp.WriteString("选片要求:\n");
- fp.WriteString(g_List1array.ElementAt(0).ElementAt(39) + " " + g_List1array.ElementAt(0).ElementAt(75));
- fp.WriteString("\n");
- fp.WriteString("\n");
- fp.WriteString("订单要求:\n");
- fp.WriteString(g_List1array.ElementAt(0).ElementAt(38));
- fp.WriteString("\n");
- fp.WriteString("\n");
- fp.WriteString("客人产品:\n");
- CString str;
- str = "产品名称";
- FillLength(str, 30);
- str += "数量";
- FillLength(str, 40);
- #ifdef LKAY_VERSION
- str += "P数";
- FillLength(str, 50);
- str += "加急";
- FillLength(str, 60);
- str += "取件日期";
- FillLength(str, 70);
- #else
- str += "加急";
- FillLength(str, 50);
- str += "取件日期";
- FillLength(str, 60);
- #endif
- fp.WriteString(str);
- fp.WriteString("\n");
- for (int i = 0; i < sparray2.GetSize(); i++)
- {
- str.Empty();
- str = sparray2.ElementAt(i).ElementAt(0);
- FillLength(str, 30);
- str += sparray2.ElementAt(i).ElementAt(1);
- FillLength(str, 40);
- #ifdef LKAY_VERSION
- str += sparray2.ElementAt(i).ElementAt(29);//p数
- FillLength(str, 50);
- str += sparray2.ElementAt(i).ElementAt(18);
- FillLength(str, 60);
- str += sparray2.ElementAt(i).ElementAt(19);
- FillLength(str, 70);
- #else
- str += sparray2.ElementAt(i).ElementAt(18);
- FillLength(str, 50);
- str += sparray2.ElementAt(i).ElementAt(19);
- FillLength(str, 60);
- #endif
- fp.WriteString(str);
- fp.WriteString("\n");
- }
- fp.Close();
- }
- //////////////
- AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- #if JEFF_TEST_ON // 导出裁剪效果图;
- //strSrcDiretory; // 源相片目录;
- //strSaveDiretory;// 导出选好片的目录;
- if (FALSE == g_List1array.ElementAt(0).ElementAt(60).IsEmpty())
- #if USE_SHARE_FLORD
- ;
- #else
- // 使用多级共享目录,需要重写该函数;
- ExportCutImageToFile(g_List1array.ElementAt(0).ElementAt(60), strSrcDiretory, strSaveDiretory+_T("裁剪效果\\"));
- #endif
- #else
- {
- ShowCut dlg;
- dlg.m_branch = branch;
- dlg.m_mode = 1;
- dlg.m_id = strOrderNumber;
- dlg.DoModal();
- }
- #endif
- CString strlog;
- strlog = " 导出选片 ";
- strlog += "客人:";
- strlog += name1 + name2 + strOrderNumber;
- WriteLog(_T("精修导出选好的片"), strlog);
- #endif
- }
- void BeautifySkinFrom2::OnBUTexportphoto2() // 导出精修的片 按钮;
- {
- #ifdef USE_KERNEL_DLL
- // 判断登陆用户是否有导出原片的权限;
- if ( !IsHasRights2new(11) )
- {
- AfxMessageBox(_T("您无权限导出原片!"),MB_ICONINFORMATION);
- return;
- }
- // 获取列表信息:域名、订单号、景点名、顾客信息;
- POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
- if ( pos == NULL )
- {
- AfxMessageBox(_T("请选中您要导出原片的订单!"), MB_ICONINFORMATION);
- return;
- }
- INT nItemCount = m_FurtherList.GetItemCount();
- INT nSelectedItem = m_FurtherList.GetNextSelectedItem(pos);
- CString strBranchId = _T("");
- CString strOrderNum = _T("");
- // 初修列表不支持景点名,需要从其他地方获取;
- CString strScenery = _T("");
- CString strCustomerInfo = _T("");
- // 获取域名;
- if ( g_bAllBranch )
- {// 多店汇总时;
- strBranchId = GetDomainFromBranch( m_FurtherList.GetItemText(nSelectedItem, 0) );
- }
- else
- {
- if ( g_branchname.IsEmpty() )
- {// 连接本店时;
- strBranchId = g_domain;
- }
- else
- {// 连接分店时;
- strBranchId = GetDomainFromBranch( g_branchname );
- }
- }
- // 获取订单号;
- strOrderNum = m_FurtherList.GetItemText(nSelectedItem, 0 + m_nAdd);
- // 获取顾客信息;
- strCustomerInfo = m_FurtherList.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_FurtherList.GetItemText(nSelectedItem, 2 + m_nAdd);
- // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
- IsGrowthTx IsGrowthtxdlg;
- IsGrowthtxdlg.m_mode = 1;
- IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
- IsGrowthtxdlg.DoModal();
- if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
- {
- return;
- }
- if ( IsGrowthtxdlg.m_bGrowthTx )
- {
- // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
- strScenery = IsGrowthtxdlg.m_seltxname;
- if ( strScenery == _T("全部") )
- {
- strScenery.Empty();
- }
- }
- // 导出原片时,是否压缩导出;
- DWORD dwExportPix = INVALID_COPY_PIX; // 通过其他对话框,选择导出时压缩的像素;
- /////////////////////////////////////////////////////////////////////////////////////////////////
- if ( g_pIMGProcess == NULL )
- {
- return ;
- }
- // 获取完信息,开始导出原片;
- ImgExportInterface *pExport = NULL;
- g_pIMGProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
- if ( pExport )
- {
- pExport->ExportFurtherImg(
- TRUE,
- strBranchId,
- strOrderNum,
- strCustomerInfo,
- !strScenery.IsEmpty(),
- strScenery,
- _T("*.jpg|*.jpeg"),
- dwExportPix,
- _T("*.nef|*.cr2|*.raw|*.ra2"),
- FALSE,
- FALSE
- );
- }
- g_pIMGProcess->Release();
- WriteOptLog(_T("导出精修,订单号:%s"),strOrderNum);
- // 结束;
- #else
- if (IsHasRights2new(11) == 0)return;
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
- #if USE_SHARE_FLORD
- CString branch;
- if(g_bAllBranch)
- branch=m_FurtherList.GetItemText (iItem, 0);
- CString strDomain = _T("");
- CString savepath = _T("");
- if (g_bAllBranch)
- {
- if(branch != _T(""))
- strDomain = GetDomainFromBranch(branch);
- }
- else
- {
- if(g_branchname != _T(""))
- strDomain = GetDomainFromBranch(g_branchname);
- }
- // 导出原片时,可以选择只导出单独的景点相片;(如果是儿童版的成长套系,可以导出某个套系的相片)
- // 得到源相片;
- CStringArray array;
- CNetShareInfo::GetInstance()->LoadOrderImages(3, id, strDomain,array);
- // printf("size=%d\n", array.GetSize());
- if(array.GetSize ()==0)
- {
- AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
- return;
- }
- // 获取保存的路径;
- CString dir;
- GetSavePath(dir);
- if(dir.IsEmpty())
- {
- return;
- }
- CString name1=m_FurtherList.GetItemText (iItem, 1+m_nAdd);
- CString name2=m_FurtherList.GetItemText (iItem, 2+m_nAdd);
- dir.TrimRight ('\\');
- dir+="\\";
- dir+=id;
- dir+=g_branchname;
- if(g_bAllBranch)
- {
- if(GetBranchPhotoPath(branch)!="")
- dir+=branch;
- }
- dir+=name1;
- dir+=name2;
- dir+="精修好的片";
- dir+="\\";
- ::CreateDirectory (dir, NULL);
- // 新的相片路径;
- int nIndex = 0;
- CString strTemp;
- CStringArray desarray;
- for ( int i = 0; i < array.GetSize(); i++ )
- {
- // 获取到订单号以后的路径字符;
- strTemp = array.ElementAt(i).Mid(array.ElementAt(i).Find(id) + id.GetLength() + 1 );
- desarray.Add(dir + strTemp);
- if ( (nIndex = strTemp.Find("\\")) != -1 )
- {
- strTemp = strTemp.Left( nIndex + 1 );
- CreateDirectory(dir + strTemp, NULL);
- }
- }
- #else
- CString branch;
- if (g_bAllBranch)
- branch = m_FurtherList.GetItemText(iItem, 0);
- CString path;
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- path = g_path4 + branchpath + "\\";
- }
- else
- path = g_path4 + "\\";
- path += id;
- path += "\\";
- CStringArray array;
- CString dir;
- GetSavePath(dir);
- if (dir.IsEmpty())
- {
- return;
- }
- CString name1 = m_FurtherList.GetItemText(iItem, 1 + m_nAdd);
- CString name2 = m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
- dir.TrimRight('\\');
- dir += "\\";
- dir += id;
- dir += g_branchname;
- if (g_bAllBranch)
- {
- if (GetBranchPhotoPath(branch) != "")
- dir += branch;
- }
- dir += name1;
- dir += name2;
- dir += "精修好的片";
- dir += "\\";
- ::CreateDirectory(dir, NULL);
- CStringArray desarray;
- CStringArray dirarray;
- CString savepath = dir;
- CString str;
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(path), LPCSTR("*.*"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_dir();
- for (it = coo.begin();coo.end() != it;it++)
- {
- str = (*it).c_str();
- if (FindArray(&dirarray, str) == -1)
- {
- dirarray.Add(str);
- if (str != dirarray.ElementAt(0))
- {
- str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
- if (::CheckFolderFileExist(str) == 0)
- ::CreateDirectory(str, NULL);
- }
- }
- }
- }
- if (1)
- {
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin();coo.end() != it;it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- array.Add(str);
- desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
- }
- }
- }
- if (array.GetSize() == 0)
- {
- AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
- return;
- }
- #endif
- CCompressOption comoptdlg;
- comoptdlg.DoModal();
- ImportPhoto dlg;
- dlg.m_nOutputSize = comoptdlg.m_nsize;
- dlg.m_mode = 1;
- dlg.m_pArray = &array;
- dlg.m_pDesArray = &desarray;
- dlg.m_savepath = dir;
- dlg.DoModal(); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- CString str;
- str = " 导出精修片 ";
- str += "客人:";
- str += name1 + name2 + id;
- WriteLog(_T("导出精修片"), str);
- #endif
- }
- void BeautifySkinFrom2::OnButton1()
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid();
- }
- void BeautifySkinFrom2::OnButton2() // 已选未修 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(1);
- }
- void BeautifySkinFrom2::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- if (IsHasRights2new(6) || IsHasRights2new(49))
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
- }
- else
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
- /* if(waiter7.IsEmpty () && IsHasRights2new(6) || IsHasRights2new(49))
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
- }
- else if(waiter7==g_user.name && IsHasRights2new(6) )
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
- }
- else
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);*/
- *pResult = 0;
- }
- void BeautifySkinFrom2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)return;
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- g_id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
- *pResult = 0;
- }
- void BeautifySkinFrom2::HidePrice()
- {
- #ifdef LKAY_VERSION
- return;
-
- #else
- return;
-
- #endif
- }
- void BeautifySkinFrom2::OnBtnsearchfilter()
- {
- SearchFilter dlg;
- dlg.m_mode = 3;
- if (dlg.DoModal() == IDOK)FillGrid();
- g_bSearchFilter = 0;
- }
- void BeautifySkinFrom2::GetData()
- {
- if (g_bAllBranch == 0)
- {
- if (g_bShowOK == 0)
- {
- #ifdef LKAY_VERSION
- CString filter = "status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
- #else
- CString filter = "status3='未取'";
- #endif
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 35;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 35;
- g_sendhead.tabcount = 1;
- #ifdef LKAY_VERSION
- CString filter = "dindantype<>'意向客户' or dindantype is null";
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- #else
- g_pMainWnd->ProcessChatMessageRequest2(1);
- #endif
- if (g_bSendOK == 0)return;
- }
- DataToArray(&m_List1array);
- }
- else
- {
- //////////////数据汇总
- m_List1array.RemoveAll();
- CString branch;
- for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
- {
- if (i != -1)
- {
- branch = g_brancharray.ElementAt(i).ElementAt(0);
- g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- }
- else
- branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
- if (g_bShowOK == 0)
- {
- CString filter = "status3='未取'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 35;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)continue;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 35;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- if (g_bSendOK == 0)continue;
- }
- CArray<CStringArray, CStringArray>List1array;
- DataToArray(&List1array);
- int size = m_List1array.GetSize();
- for (int j = 0; j < List1array.GetSize(); j++)
- {
- size++;
- m_List1array.SetSize(size, 1);
- size--;
- m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
- m_List1array.ElementAt(size).InsertAt(0, branch);
- size++;
- }
- }
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0; g_branchip = g_branchname = "";
- }
- HidePrice();
- FillGrid();
- }
- void BeautifySkinFrom2::OnBUTprint3()
- {
- GetData();
- }
- // Jeff.没看到调用的地方,也没有关联任何按钮控件.
- // 应该是废弃的函数;
- void BeautifySkinFrom2::OnBUTexportphotoAddName()
- {
- if (IsHasRights2new(10) == 0)return;
- UpdateData();
- POSITION pos;
- pos = m_FurtherList.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_FurtherList.GetNextSelectedItem(pos);
- CString status2 = m_FurtherList.GetItemText(iItem, 4);
- if (status2 != "OK")
- {
- AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
- return;
- }
- CString id = m_FurtherList.GetItemText(iItem, 0);
- CString name1 = m_FurtherList.GetItemText(iItem, 1);
- CString name2 = m_FurtherList.GetItemText(iItem, 2);
- CString filter = "id='" + id + "';id='" + id + "'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 50;
- g_sendhead.code[1] = 11;
- g_sendhead.tabcount = 2;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- CArray<CStringArray, CStringArray>sparray;
- DataToArray(&sparray, &g_List1array);
- CString path = g_path2 + "\\";
- SelectPhotoDlg selectdlg;
- selectdlg.DoModal();
- path += id;
- path += "\\";
- ////////////////////////////////////////
- CString str, spname;
- CStringArray noarray;
- CStringArray spnamearray;
- int i = 0;
- for ( i = 0; i < sparray.GetSize(); i++)
- {
- str = sparray.ElementAt(i).ElementAt(6);
- spname = sparray.ElementAt(i).ElementAt(5);
- GetNo(str, noarray);
- }
- if (noarray.GetSize() == 0)
- {
- AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
- return;
- }
- spnamearray.SetSize(noarray.GetSize());
- for (i = 0; i < noarray.GetSize(); i++)
- {
- str = noarray.ElementAt(i);
- spnamearray.SetAt(i, GetSelName(str, sparray) + "-" + str);
- }
- CString dir;
- GetSavePath(dir);
- if (dir.IsEmpty())return;
- dir.TrimRight('\\');
- dir += "\\";
- dir += id;
- dir += name1;
- dir += name2;
- dir += "选片";
- dir += "\\";
- CStringArray array;
- CStringArray spnamearray2;
- CString src, des;
- //selectdlg.m_mode: 1=原片 2=初修 0=初修+原片
- if (selectdlg.m_mode == 2)
- {
- for (i = 0; i < noarray.GetSize(); i++)
- {
- src.Format("%s%s.jpg", path, noarray.ElementAt(i));
- if (::CheckFolderFileExist(src))
- {
- array.Add(src);
- if (selectdlg.m_check1)
- spnamearray2.Add(spnamearray.ElementAt(i));
- else
- spnamearray2.Add(noarray.ElementAt(i));
- }
- else
- AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
- }
- }
- if (array.GetSize() == 0)
- {
- if (selectdlg.m_mode == 2)
- AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
- path = g_path1 + "\\";
- path += id;
- path += "\\";
- dir.Delete(dir.GetLength() - 1, 1);
- dir += "(未修)\\";
- for (i = 0; i < noarray.GetSize(); i++)
- {
- src = GetPathFromNo2(path, noarray.ElementAt(i));
- if (PathFileExists(src))
- {
- array.Add(src);
- if (selectdlg.m_check1)
- spnamearray2.Add(spnamearray.ElementAt(i));
- else
- spnamearray2.Add(noarray.ElementAt(i));
- }
- }
- }
- if (array.GetSize() == 0)
- {
- AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
- return;
- }
- ::CreateDirectory(dir, NULL);
- ImportPhoto dlg;
- dlg.m_mode = 1;
- dlg.m_pArray = &array;
- dlg.m_pArray2 = &spnamearray2;
- dlg.m_savepath = dir;
- dlg.DoModal();
- //////////////
- if (g_List1array.GetSize())
- {
- CStdioFile fp;
- fp.Open(dir + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
- fp.WriteString(g_List1array.ElementAt(0).ElementAt(39));
- fp.Close();
- }
- //////////////
- AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- }
- #if USE_SHARE_FLORD
- /************************************************************************/
- /*
- 函数:GetCurSelRecord
- 描述:获取当前List列表选中的项记录;
- 参数:
- OUT:strName1 选中项的顾客1姓名;
- OUT:strName2 选中项的顾客2姓名;
- OUT:strOrderNum 选中项的订单号;
- OUT:strDomain 选中项的所在分店域名,本店为空;
- 返回:
- 调用约定:
- 注意:
- */
- /************************************************************************/
- void BeautifySkinFrom2::GetCurSelRecord(
- OUT CString &strName1,
- OUT CString &strName2,
- OUT CString &strOrderNum,
- OUT CString &strBranch,
- OUT CString &strDomain)
- {
- UpdateData();
- // 获取所中行;
- POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
- if ( pos == NULL)
- {
- AfxMessageBox(_T("请先选中您要导片的定单!"), MB_ICONINFORMATION);
- return;
- }
- int nItem = m_FurtherList.GetNextSelectedItem(pos);
-
- // 获取选片状态, m_nAdd作用?;
- CString strStatus = m_FurtherList.GetItemText(nItem,4 + m_nAdd);
- if ( strStatus != _T("OK") )
- {
- AfxMessageBox(_T("此单未选片!"), MB_ICONINFORMATION);
- return;
- }
- strOrderNum = m_FurtherList.GetItemText(nItem, 0 + m_nAdd);
- strName1 = m_FurtherList.GetItemText(nItem, 1 + m_nAdd);
- strName2 = m_FurtherList.GetItemText(nItem, 2 + m_nAdd);
- if ( g_bAllBranch )
- {
- // 多店汇总时;
- strBranch = m_FurtherList.GetItemText(nItem, 0);
- strDomain = GetDomainFromBranch(strBranch);
- }
- else
- {
- if(g_branchname != _T(""))
- {
- strBranch = g_branchname;
- strDomain = GetDomainFromBranch(g_branchname);
- }
- }
- }
- /************************************************************************/
- /*
- 函数:GetImageWithGoods
- 描述:获取每张相片对应的商品串;
- 参数:
- IN: strBranch 分店名(多店汇总时)
- IN: strDomain 分店域名(多店汇总或分店连接时);
- IN: strOrderNum 订单号;
- OUT: bGrowth 是否是儿童套系;
- OUT: strSelGrowth 若bGrowth为TRUE,则这里为选中的成长套系名称;
- OUT: bExportWithName 导出选好的片是否带商品名;
- OUT: strAryOfImagePath 选中的相片路径;
- OUT: strEachImageOfGoods与strAryOfImagePath元素位置对应,每一个元素都是strAryOfImagePath元素的商品表(用分号隔开);
- 返回:返回导出的相片类型,== -1 无相片, 1 == 原片,0 == 初修片, 3 == 无初修,使用原片, //== 4 选择的是原片,但原片空....
- 调用约定:
- 注意:
- */
- /************************************************************************/
- int BeautifySkinFrom2::GetImageWithGoods(
- IN CString &strBranch,
- IN CString &strDomain,
- IN CString &strOrderNum,
- OUT BOOL &bGrowth,
- OUT CString &strSelGrowth,
- OUT BOOL &bExportWithName,
- OUT CStringArray &strAryOfImagePath,
- OUT CStringArray &strAryOfEachImageOfGoods,
- OUT CArray<CStringArray, CStringArray> &sparray2)
- {
- // 若是儿童成长套系,则弹出选项框;
- CStringArray strAryOfScenery;
- IsGrowthTx growthtxdlg;
- growthtxdlg.m_mode = 1;
- growthtxdlg.m_pAryOfScenery = &strAryOfScenery;
- growthtxdlg.m_strOrderNumber = strOrderNum;
- growthtxdlg.DoModal();
- bGrowth = growthtxdlg.m_bGrowthTx;
- strSelGrowth = growthtxdlg.m_seltxname;
- // 与服务器通信获取指定条件的订单商品信息;
- CString strFilter = _T("");
- #ifdef CHILD_VERSION
- if ( !strSelGrowth.IsEmpty() && strSelGrowth != _T("全部") )
- {
- strFilter.Format(_T("id='%s' and growthtxname = '%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strSelGrowth, strOrderNum, strOrderNum);
- }
- else
- {
- strFilter.Format(_T("id='%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
- }
- #else
- strFilter.Format(_T("id='%s'; id='%s'; id='%s' and kind <> '2' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
- #endif
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 50;
- g_sendhead.code[1] = 11;
- g_sendhead.code[2] = 56;
- g_sendhead.tabcount = 3;
- if( !g_bAllBranch )
- {
- g_pMainWnd->ProcessChatMessageRequest2(strFilter);
- }
- else
- {
- g_branchip = GetIP(strBranch);
- g_pMainWnd->OnDisconnect();
- g_branchname = strBranch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(strFilter);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = _T("");
- }
- if( !g_bSendOK )
- return -1;
- CArray<CStringArray, CStringArray> sparray;
- //CArray<CStringArray, CStringArray> sparray2;
- DataToArray( &sparray, &g_List1array, &sparray2 );
-
- CString strTemp;
- CStringArray strAryOfImageNum; // 所有相片的数字编号;
- // 获取所有dindansp记录no字段中的相片编号;
- int i = 0;
- int nSize = sparray.GetSize();
- for ( i = 0; i < nSize; i++)
- {
- strTemp = sparray.ElementAt(i).ElementAt(6); // dindansp表中的no字段;
- // WriteTextLog(_T("no:") + strTemp);
- GetNo(strTemp, strAryOfImageNum);
- }
- if ( strAryOfImageNum.GetSize() == 0 )
- {
- AfxMessageBox(_T("此单未选片!"),MB_ICONINFORMATION);
- return -1;
- }
- // 获取每个相片编号关联的商品集合,用分号隔开;
- strAryOfEachImageOfGoods.SetSize(strAryOfImageNum.GetSize());
- nSize = strAryOfImageNum.GetSize();
- for( int n = 0; n < nSize; n++)
- {
- strTemp = strAryOfImageNum.ElementAt(n);
- // WriteTextLog(_T("关联的号码:") + strTemp);
- CString strspnames = GetSelName(strTemp, sparray);
- // WriteTextLog(_T("关联的商品:") + strspnames);
- strAryOfEachImageOfGoods.SetAt(n, strspnames);
- }
- CStringArray strTempImageGoods;
- strTempImageGoods.Copy(strAryOfEachImageOfGoods);
- SelectPhotoDlg selectdlg;
- selectdlg.DoModal();
- bExportWithName = selectdlg.m_check1;
- int nPhotoType = selectdlg.m_mode; //mode模式:2.初修 1.原片 0.初修+原片 //相片类型1=原片 2=初修 3=精修 4=设计
- // 遍历所有共享目录,查找相片路径;
- CStringArray imagePathArr;
- CStringArray imageNumArr;
- imageNumArr.Copy(strAryOfImageNum);
- if(nPhotoType == 0)
- {
- // printf(_T("原片+初修\n"));
- for(i=2; i>0; --i)
- {
- imagePathArr.RemoveAll();
-
- LoadExistsImagesEx(i, strDomain, strOrderNum, bGrowth, strSelGrowth, strAryOfScenery, imageNumArr, imagePathArr, strAryOfEachImageOfGoods);
- if(strAryOfImagePath.GetSize() == 0)
- strAryOfImagePath.Append(imagePathArr);
- else
- {
- int nSize = strAryOfImagePath.GetSize();
- for(int j=0; j<nSize; j++)
- {
- //去掉相同的相片
- CString strName1 = strAryOfImagePath.ElementAt(j);
- strName1 = strName1.Right(strName1.GetLength() - strName1.ReverseFind('\\') - 1);
- for(int k=0; k<imagePathArr.GetSize(); k++)
- {
- CString strName2 = imagePathArr.ElementAt(k);
- strName2 = strName2.Right(strName2.GetLength() - strName2.ReverseFind('\\') - 1);
- if(strName1 == strName2)
- {
- imagePathArr.RemoveAt(k);
- break;
- }
- }
- }
- if(imagePathArr.GetSize() > 0)
- strAryOfImagePath.Append(imagePathArr);
- }
- }
- }
- else
- {
- LoadExistsImagesEx(nPhotoType, strDomain, strOrderNum, bGrowth, strSelGrowth, strAryOfScenery, imageNumArr, imagePathArr, strAryOfEachImageOfGoods);
- if(imagePathArr.GetSize() > 0)
- strAryOfImagePath.Copy(imagePathArr);
- }
- if ( strAryOfImagePath.GetSize() == 0 && nPhotoType == 2)
- {
- AfxMessageBox(_T("注意:此单未修片, 导出的是原片!"), MB_ICONINFORMATION);
- nPhotoType = 1;
- strAryOfImagePath.RemoveAll();
- strAryOfEachImageOfGoods.RemoveAll();
- strAryOfEachImageOfGoods.Copy(strTempImageGoods);
- LoadExistsImagesEx(nPhotoType,strDomain,strOrderNum,bGrowth,strSelGrowth,strAryOfScenery,imageNumArr,imagePathArr,strAryOfEachImageOfGoods);
-
- if(imagePathArr.GetSize() > 0)
- strAryOfImagePath.Append(imagePathArr);
- return strAryOfImagePath.GetSize() ? 3 : -1;
- }
- //按编号排序
- CStringArray tempPathArr;
- tempPathArr.Copy(strAryOfImagePath);
- strAryOfImagePath.RemoveAll();
- for(int j=0; j<imageNumArr.GetSize(); j++)
- {
- BOOL bExists = FALSE;
- CString strNum = imageNumArr.ElementAt(j);
- for(i=0; i<tempPathArr.GetSize(); i++)
- {
- CString strFile = tempPathArr.ElementAt(i);
- strFile = strFile.Mid(strFile.ReverseFind('\\')+1);
- int nPos = strFile.Find(_T("."));
- if(nPos == -1)
- continue;
-
- strFile = strFile.Left(nPos);
- if(strNum.CompareNoCase(strFile) == 0)
- {
- strAryOfImagePath.Add(tempPathArr.ElementAt(i));
- bExists = TRUE;
- break;
- }
- }
- if(!bExists)
- strAryOfImagePath.Add(_T(""));
- }
- return strAryOfImagePath.GetSize() ? selectdlg.m_mode : -1;
- }
- /************************************************************************/
- /*
- 函数:LoadExistsImagesEx
- 描述:加载存在的相片编号文件;
- 参数:
- IN:nPhotoType 导出的相片类型;
- IN:lpDomain 域名;
- IN:lpOrderNum 订单号;
- IN:bGrowTh 是否儿童成长套系;
- IN:lpSelectName 选中的成长套系名;
- IN:strAryOfScenery 订单下的景点名或儿童成长套系名数组;
- IN:strAryOfImageNum 订单选好商品的相片编号数组;
- OUT:strAryOfImagePath 存在于共享目录的相片编号文件路径数组;
- OUT:strAryOfImageGoods 存在于共享目录的相片关联的商品数组;
- 返回:
- 调用约定:
- 注意:
- */
- /************************************************************************/
- void BeautifySkinFrom2::LoadExistsImagesEx(IN const int &nPhotoType,
- IN LPCTSTR lpDomain,
- IN LPCTSTR lpOrderNum,
- IN BOOL bGrowTh,
- IN LPCTSTR lpSelectName,
- IN CStringArray &strAryOfScenery,
- IN CStringArray &strAryOfImageNum,
- OUT CStringArray &strAryOfImagePath,
- OUT CStringArray &strAryOfImageGoods)
- {
- CStringArray strTempNum; //临时相片编号如:001,002
- strTempNum.Copy(strAryOfImageNum);
- CStringArray strTempImagePath; //临时相片路径集
- //根据选好的相片编号查找
- CNetShareInfo::GetInstance()->LoadOrderBySelectedImages(nPhotoType, lpOrderNum, lpDomain, strTempNum, strTempImagePath);
- CString strScenery(lpSelectName);
- /*
- printf("-----bGrowTh = %d---------------strScenery = %s--------------------\n", bGrowTh, lpSelectName);
- */
- if ( bGrowTh && ( !strScenery.IsEmpty() && strScenery != _T("全部")) )
- {
- // 保留套系名下的相片;
- CString str;
- if ( nPhotoType == 1 )
- {
- // 原片;
- for ( int i = 0; i < strTempImagePath.GetSize(); i++)
- {
- str = strTempImagePath.ElementAt(i);
- str = str.Mid(str.Find(lpOrderNum) + strlen(lpOrderNum) + 1);
- str = str.Left(str.Find('\\'));
- if ( str.CompareNoCase(strScenery) == 0 )
- {
- strAryOfImagePath.Add(strTempImagePath.ElementAt(i));
- }
- }
- }
- else
- {
- // 初修;
- for ( int i = 0; i < strTempImagePath.GetSize(); i++)
- {
- str = strTempImagePath.ElementAt(i);
- int nIndex = str.Find(lpOrderNum);
- str.Insert(nIndex + strlen(lpOrderNum) + 1, strScenery + _T("\\"));
- if ( PathFileExists(str) )
- strAryOfImagePath.Add(strTempImagePath.ElementAt(i));
- }
- }
- }
- else
- {
- /*
- for(int i=0; i<strTempImagePath.GetSize(); )
- {
- CString strPath = strTempImagePath.ElementAt(i);
- strPath = strPath.Right(strPath.GetLength() - strPath.ReverseFind('\\') - 1);
- strPath = strPath.Left(strPath.Find('.'));
- printf("strPath = %s\n", strPath);
- if(FindArray(&strTempNum, strPath) == -1)
- {
- printf("remove = %s\n", strTempImagePath.ElementAt(i));
- strTempImagePath.RemoveAt(i);
- }
- else
- i++;
- }
- */
- strAryOfImagePath.Copy(strTempImagePath);
- }
- /*test
- for(int i=0; i<strAryOfImagePath.GetSize(); i++)
- printf("path10 = %s\n", strAryOfImagePath.ElementAt(i));
- */
- }
- #endif
|